:root {
  --ink: #1b1030;
  --space: #140c2a;
  --space-2: #22174a;
  --panel: #2c2163;
  --panel-2: #3a2d7c;
  --steel: #e3eaf7;
  --cyan: #5ff3ff;
  --cyan-d: #1fb7d6;
  --amber: #ffb43a;
  --goo: #9cf04a;
  --goo-d: #5fae22;
  --violet: #8a4fd8;
  --violet-d: #5a2aa6;
  --red: #ff5a4a;
  --gold: #ffe066;
  --cream: #f6f3ff;
  --font-display: "Lilita One", "Arial Rounded MT Bold", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, -apple-system, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --outline: 0 3px 0 var(--ink), 2px 2px 0 var(--ink), -2px 2px 0 var(--ink), 2px -2px 0 var(--ink), -2px -2px 0 var(--ink), 0 -2px 0 var(--ink), 2px 0 0 var(--ink), -2px 0 0 var(--ink);
}

*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--space);
  color: var(--cream);
  font-family: var(--font-body);
  font-weight: 800;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

#bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; }
#app { position: fixed; inset: 0; z-index: 1; }

.screen {
  position: absolute;
  inset: 0;
  display: none;
  padding: calc(10px + var(--safe-t)) calc(10px + var(--safe-r)) calc(10px + var(--safe-b)) calc(10px + var(--safe-l));
}
.screen.on { display: flex; animation: fadein 0.25s ease-out; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Buttons ---------- */
.btn {
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 0.55em 1.3em;
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 5px 0 var(--ink);
  transition: transform 0.08s, box-shadow 0.08s, filter 0.15s;
  text-shadow: 0 2px 0 rgba(27, 16, 48, 0.45);
  background: var(--panel-2);
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.btn:hover { filter: brightness(1.08); }
.btn.big { font-size: clamp(20px, 3.2vmin, 30px); min-width: 12em; }
.btn.mid { font-size: clamp(17px, 2.5vmin, 22px); min-width: 11em; }
.btn.small { font-size: 16px; padding: 0.45em 1em; }
.btn.primary { background: linear-gradient(#7ff8ff, var(--cyan-d)); color: var(--ink); text-shadow: 0 2px 0 rgba(255, 255, 255, 0.5); }
.btn.violet { background: linear-gradient(#b884ff, var(--violet-d)); }
.btn.ghost { background: rgba(58, 45, 124, 0.92); }
.btn.danger { background: linear-gradient(#ff8a7a, #d63a3a); }
.btn.icon { width: 46px; height: 46px; padding: 0; display: grid; place-items: center; }
.btn:disabled { opacity: 0.45; pointer-events: none; }

.ico-sound {
  width: 22px; height: 22px; display: block;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 9h4l5-4v14l-5-4H4z' fill='black'/%3E%3Cpath d='M16 8.5a5 5 0 0 1 0 7M18.5 6a8.5 8.5 0 0 1 0 12' stroke='black' stroke-width='2.2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 9h4l5-4v14l-5-4H4z' fill='black'/%3E%3Cpath d='M16 8.5a5 5 0 0 1 0 7M18.5 6a8.5 8.5 0 0 1 0 12' stroke='black' stroke-width='2.2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.muted .ico-sound {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 9h4l5-4v14l-5-4H4z' fill='black'/%3E%3Cpath d='M16 9l6 6M22 9l-6 6' stroke='black' stroke-width='2.2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 9h4l5-4v14l-5-4H4z' fill='black'/%3E%3Cpath d='M16 9l6 6M22 9l-6 6' stroke='black' stroke-width='2.2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
}

.ico-music {
  width: 22px; height: 22px; display: block;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 17.5V5.5l11-2.5v12' stroke='black' stroke-width='2.2' fill='none' stroke-linejoin='round'/%3E%3Ccircle cx='6.5' cy='17.5' r='3' fill='black'/%3E%3Ccircle cx='17.5' cy='15' r='3' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 17.5V5.5l11-2.5v12' stroke='black' stroke-width='2.2' fill='none' stroke-linejoin='round'/%3E%3Ccircle cx='6.5' cy='17.5' r='3' fill='black'/%3E%3Ccircle cx='17.5' cy='15' r='3' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
}
.muted .ico-music {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 17.5V5.5l11-2.5v12' stroke='black' stroke-width='2.2' fill='none' stroke-linejoin='round'/%3E%3Ccircle cx='6.5' cy='17.5' r='3' fill='black'/%3E%3Ccircle cx='17.5' cy='15' r='3' fill='black'/%3E%3Cpath d='M3 3l18 18' stroke='black' stroke-width='2.6' stroke-linecap='round'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 17.5V5.5l11-2.5v12' stroke='black' stroke-width='2.2' fill='none' stroke-linejoin='round'/%3E%3Ccircle cx='6.5' cy='17.5' r='3' fill='black'/%3E%3Ccircle cx='17.5' cy='15' r='3' fill='black'/%3E%3Cpath d='M3 3l18 18' stroke='black' stroke-width='2.6' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* ---------- Menu ---------- */
#menu { align-items: center; justify-content: center; }
.menu-inner { display: flex; flex-direction: column; align-items: center; gap: clamp(6px, 1.6vmin, 14px); width: 100%; max-width: 720px; }
.logo {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(44px, 10.5vmin, 104px);
  line-height: 0.95;
  text-align: center;
  letter-spacing: 0.01em;
  transform: rotate(-3deg);
}
.logo span { display: inline-block; text-shadow: var(--outline), 0 8px 0 var(--ink); }
.logo .bolts { color: var(--steel); background: linear-gradient(#ffffff, #9fb0c8); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; filter: drop-shadow(0 3px 0 var(--ink)) drop-shadow(2px 0 0 var(--ink)) drop-shadow(-2px 0 0 var(--ink)) drop-shadow(0 -2px 0 var(--ink)) drop-shadow(0 4px 0 var(--ink)); text-shadow: none; animation: bob 2.6s ease-in-out infinite; }
.logo .blobs { color: var(--goo); background: linear-gradient(#d4ff9a, var(--goo-d)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; filter: drop-shadow(0 3px 0 var(--ink)) drop-shadow(2px 0 0 var(--ink)) drop-shadow(-2px 0 0 var(--ink)) drop-shadow(0 -2px 0 var(--ink)) drop-shadow(0 4px 0 var(--ink)); text-shadow: none; animation: wobble 2.2s ease-in-out infinite; }
.logo .vs { color: var(--gold); font-size: 0.55em; vertical-align: middle; transform: rotate(8deg); margin: 0 0.1em; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes wobble { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.04, 0.95) translateY(3px); } }
.tagline { margin: 0; font-size: clamp(15px, 2.4vmin, 22px); color: #cfc6ff; letter-spacing: 0.04em; text-transform: uppercase; }
#hero { width: min(92vw, 560px); height: min(34vh, 250px); }
.menu-buttons { display: flex; flex-direction: column; gap: 14px; align-items: center; }
.menu-row { display: flex; gap: 12px; align-items: center; margin-top: 4px; }

@media (max-height: 520px) and (orientation: landscape) {
  .menu-inner { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "logo buttons" "tag buttons" "hero buttons" "row buttons"; column-gap: 24px; max-width: 900px; align-items: center; }
  .logo { grid-area: logo; font-size: clamp(36px, 12vh, 64px); }
  .tagline { grid-area: tag; }
  #hero { grid-area: hero; height: 42vh; width: min(52vw, 440px); }
  .menu-buttons { grid-area: buttons; }
  .menu-row { grid-area: row; justify-content: center; }
}

/* ---------- Panels ---------- */
.panel {
  position: relative;
  background: linear-gradient(var(--panel-2), var(--panel));
  border: 4px solid var(--ink);
  border-radius: 28px;
  box-shadow: 0 8px 0 var(--ink), inset 0 2px 0 rgba(255, 255, 255, 0.15);
  padding: 22px;
}
.panel h2 { margin: 0 0 10px; font-family: var(--font-display); font-weight: 400; font-size: clamp(22px, 3.4vmin, 32px); text-align: center; text-shadow: var(--outline); letter-spacing: 0.02em; }
.pop { animation: pop 0.32s cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes pop { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.back { position: absolute; left: 14px; top: 14px; z-index: 2; }

/* ---------- Setup ---------- */
#setup { align-items: center; justify-content: center; }
.setup-panel { width: min(100%, 760px); max-height: 100%; overflow-y: auto; display: flex; flex-direction: column; align-items: center; gap: 10px; padding-top: 22px; }
.setup-ai, .setup-2p { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 10px; }
#setup[data-mode="ai"] .setup-2p, #setup[data-mode="2p"] .setup-ai { display: none; }
.teams { display: flex; gap: 14px; justify-content: center; }
.team {
  width: clamp(130px, 22vmin, 190px);
  border: 4px solid var(--ink);
  border-radius: 22px;
  background: rgba(20, 12, 42, 0.55);
  padding: 8px 8px 10px;
  display: flex; flex-direction: column; align-items: center;
  cursor: pointer;
  box-shadow: 0 5px 0 var(--ink);
  transition: transform 0.12s, background 0.2s;
}
.team b { font-family: var(--font-display); font-weight: 400; font-size: 22px; text-shadow: var(--outline); }
.team small { color: #cfc6ff; font-size: 13px; }
.team-art { width: 100%; aspect-ratio: 1.1; }
.team.on[data-team="w"] { background: linear-gradient(rgba(95, 243, 255, 0.45), rgba(31, 183, 214, 0.3)); transform: translateY(-3px); }
.team.on[data-team="b"] { background: linear-gradient(rgba(156, 240, 74, 0.45), rgba(138, 79, 216, 0.4)); transform: translateY(-3px); }
.team.on { outline: 3px solid var(--gold); outline-offset: 2px; }
.levels { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; width: 100%; }
.level {
  border: 3px solid var(--ink);
  border-radius: 18px;
  background: rgba(20, 12, 42, 0.55);
  padding: 6px 4px 8px;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  box-shadow: 0 4px 0 var(--ink);
  transition: transform 0.12s, background 0.2s;
  position: relative;
}
.level canvas { width: 100%; max-width: 92px; aspect-ratio: 1; }
.level b { font-size: 14px; line-height: 1.1; text-align: center; }
.level small { font-size: 12px; color: #cfc6ff; }
.level .pips { display: flex; gap: 2px; }
.level .pips i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, 0.2); border: 1.5px solid var(--ink); }
.level .pips i.on { background: var(--gold); }
.level .star { position: absolute; top: -8px; right: -6px; width: 26px; height: 26px; background: var(--gold); border: 2.5px solid var(--ink); border-radius: 50%; display: grid; place-items: center; font-size: 15px; color: var(--ink); box-shadow: 0 2px 0 var(--ink); }
.level.on { background: linear-gradient(rgba(255, 224, 102, 0.55), rgba(255, 180, 58, 0.35)); transform: translateY(-3px); outline: 3px solid var(--gold); outline-offset: 1px; }
.note { margin: 0; color: #cfc6ff; text-align: center; }
.versus { display: flex; align-items: center; gap: 10px; }
.versus .team-art { width: clamp(120px, 24vmin, 200px); }
.vs-mark { font-family: var(--font-display); font-size: 40px; color: var(--gold); text-shadow: var(--outline); transform: rotate(-8deg); }
.start { margin-top: 6px; }

.toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 16px; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle .track { flex: none; width: 50px; height: 30px; border-radius: 999px; background: #241a52; border: 3px solid var(--ink); position: relative; transition: background 0.2s; }
.toggle .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #cfc6ff; border: 2px solid var(--ink); transition: transform 0.2s, background 0.2s; }
.toggle input:checked + .track { background: var(--cyan-d); }
.toggle input:checked + .track::after { transform: translateX(20px); background: #fff; }
.toggle input:focus-visible + .track { outline: 3px solid var(--gold); }

/* ---------- Guide ---------- */
#guide { align-items: center; justify-content: center; }
.guide-panel { width: min(100%, 820px); max-height: 100%; overflow-y: auto; padding-top: 22px; }
.guide-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; }
.g-card { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; background: rgba(20, 12, 42, 0.5); border: 3px solid var(--ink); border-radius: 18px; padding: 8px 10px; }
.g-pair { display: flex; }
.g-pair canvas { width: 60px; height: 64px; }
.g-card h3 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 19px; letter-spacing: 0.02em; }
.g-card h3 small { font-family: var(--font-body); font-size: 12px; color: #cfc6ff; display: block; letter-spacing: 0; }
.g-card p { margin: 2px 0 0; font-size: 14px; font-weight: 600; line-height: 1.3; color: #e8e3ff; }
.g-card .g-moves { width: 84px; height: 84px; border-radius: 8px; border: 2px solid var(--ink); }
.rules h3 { font-family: var(--font-display); font-weight: 400; font-size: 22px; margin: 16px 0 6px; text-align: center; }
.rules ul { margin: 0; padding-left: 20px; font-weight: 600; line-height: 1.4; color: #e8e3ff; }
.rules li { margin-bottom: 5px; }
.rules b { color: var(--gold); }

/* ---------- Game ---------- */
#game { padding: 0; }
.game-grid {
  position: absolute;
  inset: calc(8px + var(--safe-t)) calc(8px + var(--safe-r)) calc(8px + var(--safe-b)) calc(8px + var(--safe-l));
  display: grid;
  gap: 8px;
}
#game.tall .game-grid {
  grid-template-columns: 1fr;
  grid-template-rows: auto auto auto auto;
  grid-template-areas: "top" "board" "bottom" "tools";
  justify-items: center;
  align-content: center;
}
#game.tall .side { display: none; }
#game.tall .toolbar { max-width: var(--board, 600px); margin-top: 4px; }
#game.wide .game-grid {
  grid-template-columns: auto minmax(220px, 340px);
  grid-template-rows: auto 1fr auto auto;
  grid-template-areas: "board top" "board side" "board bottom" "board tools";
  justify-content: center;
  align-content: center;
  column-gap: 14px;
}
.board-wrap { grid-area: board; display: grid; place-items: center; position: relative; }
#board { display: block; touch-action: none; border-radius: 16px; box-shadow: 0 8px 0 var(--ink); }
.card[data-pos="top"] { grid-area: top; }
.card[data-pos="bottom"] { grid-area: bottom; }
.side { grid-area: side; min-height: 0; display: flex; }
.toolbar { grid-area: tools; display: flex; gap: 8px; justify-content: center; width: 100%; }

.card {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 5px;
  border: 3px solid var(--ink);
  border-radius: 18px;
  background: rgba(34, 23, 74, 0.88);
  box-shadow: 0 4px 0 var(--ink);
  transition: background 0.25s, box-shadow 0.25s;
  min-height: 56px;
}
#game.tall .card { max-width: var(--board, 600px); }
.card.turn[data-side="w"] { background: linear-gradient(90deg, rgba(31, 183, 214, 0.75), rgba(34, 23, 74, 0.9)); box-shadow: 0 4px 0 var(--ink), 0 0 18px rgba(95, 243, 255, 0.45); }
.card.turn[data-side="b"] { background: linear-gradient(90deg, rgba(95, 174, 34, 0.8), rgba(90, 42, 166, 0.85)); box-shadow: 0 4px 0 var(--ink), 0 0 18px rgba(156, 240, 74, 0.45); }
.card .avatar { width: 46px; height: 46px; }
.card .who { min-width: 0; }
.card .name { font-family: var(--font-display); font-weight: 400; font-size: 19px; line-height: 1.05; text-shadow: 0 2px 0 var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .status { font-size: 13px; color: #e0dbff; min-height: 1.2em; white-space: nowrap; }
.card .status .dots i { display: inline-block; width: 5px; height: 5px; margin-left: 3px; border-radius: 50%; background: currentColor; animation: blink 1s infinite; }
.card .status .dots i:nth-child(2) { animation-delay: 0.2s; }
.card .status .dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 100% { opacity: 0.2; } 50% { opacity: 1; } }
.card .caps { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; max-width: 52vw; }
.card .caps canvas { width: 26px; height: 26px; margin-left: -8px; }
.card .caps canvas:first-child { margin-left: 0; }
.card .caps .gap { width: 6px; }
.card .plus { font-family: var(--font-display); font-weight: 400; font-size: 17px; color: var(--gold); margin-left: 6px; text-shadow: 0 2px 0 var(--ink); }

.moves {
  flex: 1;
  margin: 0;
  padding: 8px 10px;
  list-style: none;
  overflow-y: auto;
  background: rgba(20, 12, 42, 0.6);
  border: 3px solid var(--ink);
  border-radius: 16px;
  font-size: 15px;
  display: grid;
  grid-template-columns: 2.4em 1fr 1fr;
  align-content: start;
  row-gap: 2px;
  min-height: 60px;
}
.moves li { display: contents; }
.moves .n { color: #8f86c9; }
.moves .m { padding: 1px 6px; border-radius: 8px; }
.moves .m.w { color: #d9fbff; }
.moves .m.b { color: #e2ffc9; }
.moves .m.last { background: rgba(255, 190, 60, 0.35); }
.moves:empty::before { content: "Moves show here"; grid-column: 1 / -1; color: #8f86c9; font-weight: 600; }

.tool {
  flex: 1;
  max-width: 120px;
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: linear-gradient(#4a3c96, #30246b);
  box-shadow: 0 4px 0 var(--ink);
  padding: 5px 4px 4px;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  cursor: pointer;
  font-size: 13px;
  transition: transform 0.08s, box-shadow 0.08s;
}
.tool:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.tool:disabled { opacity: 0.4; pointer-events: none; }
.tool i { width: 24px; height: 24px; display: block; background: var(--cream); -webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat; }
.tool.busy i { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.i-undo { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 5L3.5 10 9 15' fill='none' stroke='black' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M4 10h9a6.5 6.5 0 0 1 0 13H9' fill='none' stroke='black' stroke-width='2.8' stroke-linecap='round'/%3E%3C/svg%3E"); }
.i-hint { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.5a7 7 0 0 0-4 12.7V18h8v-2.8A7 7 0 0 0 12 2.5z' fill='black'/%3E%3Crect x='8.5' y='19.5' width='7' height='2.6' rx='1.3' fill='black'/%3E%3C/svg%3E"); }
.i-flip { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 9a8 8 0 0 1 14.5-3.5M20 15a8 8 0 0 1-14.5 3.5' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round'/%3E%3Cpath d='M19.5 1.5v5h-5M4.5 22.5v-5h5' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.i-menu { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 6h16M4 12h16M4 18h16' stroke='black' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E"); }

/* ---------- Overlays ---------- */
.overlay { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; background: rgba(10, 5, 25, 0.62); padding: 16px; animation: fadein 0.2s; }
.overlay .panel { width: min(100%, 480px); max-height: 100%; overflow-y: auto; }
.promo-choices { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 8px 0 14px; }
.promo-choices button { border: 3px solid var(--ink); border-radius: 18px; background: rgba(20, 12, 42, 0.55); box-shadow: 0 4px 0 var(--ink); padding: 4px; cursor: pointer; display: flex; flex-direction: column; align-items: center; font-size: 13px; }
.promo-choices button:hover { background: rgba(255, 224, 102, 0.35); }
.promo-choices canvas { width: 100%; aspect-ratio: 1; }
#promo .panel { text-align: center; }
.over-panel { text-align: center; }
.over-art { width: 280px; height: 200px; max-width: 100%; display: block; margin: -6px auto 0; }
.over-title { font-size: clamp(28px, 5vmin, 40px) !important; }
.over-sub { margin: 0 0 14px; color: #e0dbff; font-size: 17px; }
.over-buttons, .pause-buttons, .ask-buttons { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.ask-buttons { flex-direction: row; justify-content: center; }
.ask-buttons .btn { min-width: 7em; }
.ask-panel { text-align: center; }
.ask-text { color: #e0dbff; margin: 0 0 16px; }
.settings { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 18px; background: rgba(20, 12, 42, 0.45); border: 3px solid var(--ink); }

@media (max-width: 560px) {
  .levels { grid-template-columns: repeat(5, 1fr); gap: 5px; }
  .level b { font-size: 11px; }
  .level small { font-size: 10px; }
  .panel { padding: 16px 12px; border-radius: 22px; }
  .guide-list { grid-template-columns: 1fr; }
  .g-card { grid-template-columns: auto 1fr; }
  .g-card .g-moves { display: none; }
  .back { left: 8px; top: 8px; }
  .setup-panel, .guide-panel { padding-top: 50px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .setup-panel { padding: 12px 16px; gap: 6px; }
  .team-art { aspect-ratio: 1.6; }
  .team { width: 150px; padding: 4px; }
  .level canvas { max-width: 56px; }
  .panel h2 { margin-bottom: 4px; font-size: 22px; }
  .back { top: 10px; }
  .overlay .panel { padding: 12px 18px; }
  .over-art { height: 110px; }
  .settings { margin-top: 10px; }
  .overlay .pause-panel { width: min(100%, 720px); display: grid; grid-template-columns: auto 1fr; grid-template-areas: "title title" "buttons settings"; column-gap: 18px; align-items: start; }
  .pause-panel h2 { grid-area: title; }
  .pause-panel .pause-buttons { grid-area: buttons; gap: 10px; }
  .pause-panel .settings { grid-area: settings; margin-top: 0; gap: 8px; padding: 10px 12px; }
  .pause-panel .toggle { font-size: 15px; }
}
