:root {
  --bg-1: #14081f;
  --bg-2: #113450;
  --bg-3: #163d2f;
  --panel: rgba(17, 16, 43, 0.74);
  --panel-strong: rgba(9, 12, 31, 0.88);
  --line: rgba(147, 255, 214, 0.22);
  --text-main: #f6fbff;
  --text-soft: #c5dbef;
  --accent: #9dffdb;
  --accent-2: #ff87bf;
  --accent-3: #ffe27a;
  --shadow: rgba(5, 10, 24, 0.42);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--text-main);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  background:
    radial-gradient(1100px 680px at 12% 14%, rgba(255, 135, 191, 0.18), transparent 60%),
    radial-gradient(920px 580px at 88% 24%, rgba(157, 255, 219, 0.18), transparent 58%),
    linear-gradient(145deg, var(--bg-1), var(--bg-2) 50%, var(--bg-3));
  position: relative;
  overflow-x: hidden;
}

.bubble-layer,
.page-glow {
  pointer-events: none;
  position: fixed;
  inset: 0;
}

.bubble-layer {
  z-index: 0;
  opacity: 0.72;
}

.bubble-layer::before,
.bubble-layer::after {
  content: "";
  position: absolute;
  inset: 0;
  background-repeat: repeat;
  background-size: 320px 320px;
  mix-blend-mode: screen;
}

.bubble-layer-back::before {
  background-image:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.11) 0 20px, transparent 22px),
    radial-gradient(circle at 72% 46%, rgba(157, 255, 219, 0.14) 0 34px, transparent 36px),
    radial-gradient(circle at 42% 74%, rgba(255, 135, 191, 0.12) 0 18px, transparent 20px);
  animation: driftBack 32s linear infinite;
}

.bubble-layer-front::after {
  background-image:
    radial-gradient(circle at 18% 48%, rgba(255, 255, 255, 0.12) 0 12px, transparent 14px),
    radial-gradient(circle at 68% 18%, rgba(255, 226, 122, 0.14) 0 22px, transparent 24px),
    radial-gradient(circle at 82% 72%, rgba(157, 255, 219, 0.11) 0 16px, transparent 18px);
  animation: driftFront 24s linear infinite;
}

.page-glow {
  z-index: 0;
  background:
    radial-gradient(640px 380px at 50% 0%, rgba(255, 255, 255, 0.07), transparent 70%),
    radial-gradient(520px 520px at 50% 100%, rgba(255, 135, 191, 0.08), transparent 72%);
}

main,
section,
footer {
  position: relative;
  z-index: 1;
}

.game-shell {
  width: min(1240px, 95vw);
  margin: 20px auto 0;
}

.topbar {
  padding: 24px;
  border-radius: 26px;
  border: 1px solid var(--line);
  background: linear-gradient(150deg, rgba(15, 15, 40, 0.9), rgba(11, 30, 49, 0.8));
  box-shadow: 0 28px 80px var(--shadow);
  backdrop-filter: blur(14px);
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.9fr);
  gap: 22px;
  align-items: start;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.title-wrap h1 {
  margin: 10px 0 10px;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1;
}

.title-wrap h1 span {
  color: var(--accent-2);
}

.subtitle {
  margin: 0;
  max-width: 780px;
  color: var(--text-soft);
  line-height: 1.7;
}

.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 18px;
}

.quick-links a {
  color: #eef7ff;
  text-decoration: none;
  font-weight: 700;
}

.quick-links a:hover {
  color: var(--accent);
}

.quick-links .mini-link {
  color: #ffd7e8;
}

.hud {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.hud-item {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(157, 255, 219, 0.18);
  background: rgba(7, 15, 36, 0.64);
  min-height: 78px;
}

.hud-item label {
  display: block;
  color: var(--text-soft);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hud-item strong {
  display: block;
  margin-top: 8px;
  font-size: 1.08rem;
  line-height: 1.35;
}

.hud-item-wide {
  grid-column: span 2;
}

.arena-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(300px, 0.78fr);
  gap: 18px;
  margin-top: 18px;
  align-items: start;
}

.view-panel,
.panel-block {
  border-radius: 24px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(12, 15, 36, 0.88), rgba(10, 23, 40, 0.84));
  box-shadow: 0 18px 48px rgba(4, 10, 25, 0.32);
  backdrop-filter: blur(12px);
}

.view-panel {
  padding: 18px;
}

.board-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 16px;
}

.status-card {
  flex: 1;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.section-kicker {
  margin: 0;
  color: var(--accent-3);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.status-line {
  margin: 8px 0 0;
  color: #eef8ff;
  line-height: 1.6;
}

.toolbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.pill-button,
.mini-btn,
.overlay-actions button,
.touch-pad button,
.option-chip {
  font: inherit;
  cursor: pointer;
}

.pill-button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 800;
  color: #08242b;
  background: linear-gradient(135deg, var(--accent), #b7ff8d);
  box-shadow: 0 14px 26px rgba(157, 255, 219, 0.18);
}

.pill-button.secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  box-shadow: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.meta-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.meta-chip {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.meta-chip label {
  display: block;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-soft);
}

.meta-chip strong {
  display: block;
  margin-top: 8px;
  font-size: 1rem;
}

.board-frame {
  margin-top: 14px;
  padding: 16px;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)),
    rgba(6, 12, 28, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.canvas-wrap {
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #071122;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
}

.canvas-tip {
  margin: 12px 0 0;
  color: var(--text-soft);
  line-height: 1.6;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  margin-right: 5px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  font-weight: 700;
}

.touch-controls {
  display: none;
  margin-top: 14px;
  gap: 12px;
}

.touch-pad {
  flex: 1;
  display: grid;
  gap: 10px;
}

.touch-pad button {
  border: 0;
  border-radius: 18px;
  min-height: 62px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.touch-pad .jump-btn {
  background: linear-gradient(135deg, var(--accent-2), #ffbd6f);
  color: #2b1430;
}

.sidebar {
  display: grid;
  gap: 18px;
}

.panel-block {
  padding: 18px;
}

.panel-block h2 {
  margin: 0;
  font-size: 1.18rem;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.section-head span {
  color: var(--accent-3);
  font-weight: 700;
}

.objective-line,
.hint,
.controls-block p,
.progression-block p {
  color: var(--text-soft);
  line-height: 1.65;
}

.objective-line {
  margin: 10px 0 0;
}

.meter + .meter {
  margin-top: 14px;
}

.meter-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.92rem;
}

.meter-track {
  position: relative;
  height: 14px;
  margin-top: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}

.meter-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  transition: width 220ms ease;
}

.life-track .meter-fill {
  background: linear-gradient(135deg, #ff91bf, #ffd278);
}

.inline-controls {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.inline-controls select,
.mini-btn {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(5, 10, 26, 0.72);
  color: var(--text-main);
}

.inline-controls select {
  flex: 1;
  padding: 10px 12px;
  font: inherit;
}

.mini-btn {
  padding: 10px 14px;
  font-weight: 700;
}

.unlock-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.unlock-row {
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.unlock-row strong {
  display: block;
  margin-bottom: 8px;
  color: #fff4d2;
}

.unlock-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.unlock-pill {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(157, 255, 219, 0.14);
  border: 1px solid rgba(157, 255, 219, 0.18);
  font-size: 0.88rem;
}

.custom-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.accordion-card {
  margin-top: 14px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.accordion-summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
}

.accordion-summary::-webkit-details-marker {
  display: none;
}

.accordion-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.accordion-title {
  font-weight: 800;
  color: var(--text-main);
}

.accordion-current {
  color: var(--text-soft);
  font-size: 0.88rem;
}

.accordion-count {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff5ca;
  font-weight: 800;
  white-space: nowrap;
}

.accordion-count::after {
  content: "";
  width: 10px;
  height: 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 180ms ease;
}

.accordion-card[open] .accordion-count::after {
  transform: rotate(225deg) translateY(-1px);
}

.accordion-body {
  padding: 0 16px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.option-chip {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  text-align: left;
  padding: 12px 12px 12px 14px;
  min-height: 64px;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.option-chip:hover,
.option-chip:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(157, 255, 219, 0.38);
  outline: none;
}

.option-chip.selected {
  border-color: transparent;
  background: linear-gradient(135deg, rgba(157, 255, 219, 0.2), rgba(255, 135, 191, 0.18));
  box-shadow: 0 14px 30px rgba(157, 255, 219, 0.12);
}

.option-chip.locked,
.option-chip:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.chip-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.chip-subtitle {
  display: block;
  margin-top: 6px;
  font-size: 0.84rem;
  color: var(--text-soft);
}

.color-dot {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.18);
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(5, 10, 21, 0.6);
  backdrop-filter: blur(14px);
}

.overlay.hidden {
  display: none;
}

.panel {
  width: min(560px, 100%);
  padding: 28px;
  border-radius: 28px;
  background: linear-gradient(160deg, rgba(15, 16, 46, 0.95), rgba(10, 32, 47, 0.92));
  border: 1px solid rgba(157, 255, 219, 0.24);
  box-shadow: 0 34px 80px rgba(4, 10, 24, 0.5);
}

.overlay-tag {
  margin: 0;
  color: var(--accent);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.75rem;
}

.panel h2 {
  margin: 10px 0 12px;
  font-size: clamp(1.7rem, 4vw, 2.2rem);
}

.panel p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.7;
}

.panel p + p {
  margin-top: 8px;
}

.overlay-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.overlay-actions button {
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  font-weight: 800;
}

.overlay-actions .secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.hidden {
  display: none !important;
}

@keyframes driftBack {
  from {
    transform: translate3d(0, 0, 0);
  }

  to {
    transform: translate3d(-120px, 60px, 0);
  }
}

@keyframes driftFront {
  from {
    transform: translate3d(0, 0, 0);
  }

  to {
    transform: translate3d(90px, -80px, 0);
  }
}

@media (max-width: 1100px) {
  .topbar,
  .arena-layout {
    grid-template-columns: 1fr;
  }

  .hud {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .hud-item-wide {
    grid-column: span 1;
  }
}

@media (max-width: 820px) {
  .game-shell {
    width: min(100%, calc(100vw - 12px));
    margin-top: 8px;
  }

  .topbar,
  .view-panel,
  .panel-block {
    border-radius: 20px;
  }

  .topbar {
    padding: 18px;
  }

  .hud {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .board-toolbar,
  .toolbar-actions,
  .inline-controls {
    flex-direction: column;
  }

  .meta-row,
  .custom-grid {
    grid-template-columns: 1fr;
  }

  .accordion-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .accordion-count::after {
    margin-left: 10px;
  }

  .touch-controls {
    display: flex;
  }

  .panel {
    padding: 22px;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 15px;
  }

  .hud {
    grid-template-columns: 1fr;
  }

  .overlay-actions {
    flex-direction: column;
  }
}
