/* Fliptide styles.
   Colours come from tokens that each world redefines, so the same markup
   looks like a sunny garden or a neon city. Every animation uses transform
   and opacity only, and reduced motion swaps flips for quick fades. */

@font-face {
  font-family: 'Fredoka';
  src: url('../fonts/fredoka-latin.woff2') format('woff2');
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: 'Nunito';
  src: url('../fonts/nunito-latin.woff2') format('woff2');
  font-weight: 200 1000;
  font-display: swap;
}

/* ---------- tokens ---------- */

:root {
  --f-display: 'Fredoka', ui-rounded, 'SF Pro Rounded', 'Nunito', system-ui, sans-serif;
  --f-body: 'Nunito', ui-rounded, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --st: env(safe-area-inset-top, 0px);
  --sb: env(safe-area-inset-bottom, 0px);
  --sl: env(safe-area-inset-left, 0px);
  --sr: env(safe-area-inset-right, 0px);

  --ink: #2b1f45;
  --ink-2: #5f5079;
  --ink-3: #8d81a6;
  --line: rgba(60, 35, 95, .1);
  --card: rgba(255, 251, 245, .94);
  --card-2: rgba(255, 251, 245, .74);
  --card-line: rgba(255, 255, 255, .9);
  --sheet-bg: #fffaf3;
  --shadow: 0 1px 2px rgba(43, 31, 69, .08), 0 8px 24px rgba(43, 31, 69, .14);
  --shadow-lg: 0 2px 6px rgba(43, 31, 69, .1), 0 24px 60px rgba(43, 31, 69, .3);
  --accent: #7a45cf;
  --accent-soft: rgba(122, 69, 207, .14);
  --p1: #7a45cf;
  --p2: #f0a91c;
  --star: #ffc23d;
  --focus: #ffb703;
}

[data-world="neon"] {
  --ink: #f4efff;
  --ink-2: #c3b8ef;
  --ink-3: #8e82c4;
  --line: rgba(140, 200, 255, .14);
  --card: rgba(20, 11, 50, .9);
  --card-2: rgba(20, 11, 50, .66);
  --card-line: rgba(120, 220, 255, .26);
  --sheet-bg: #120a31;
  --shadow: 0 0 0 1px rgba(120, 220, 255, .1), 0 10px 30px rgba(0, 0, 0, .45);
  --shadow-lg: 0 0 0 1px rgba(120, 220, 255, .16), 0 24px 70px rgba(0, 0, 0, .6);
  --accent: #ff3fd2;
  --accent-soft: rgba(255, 63, 210, .16);
  --p1: #ff3fd2;
  --p2: #27e8ff;
}

[data-world="dusk"] {
  --ink: #fbf6ff;
  --ink-2: #d9cdf2;
  --ink-3: #a99bcc;
  --line: rgba(255, 255, 255, .12);
  --card: rgba(255, 255, 255, .14);
  --card-2: rgba(255, 255, 255, .1);
  --card-line: rgba(255, 255, 255, .22);
  --shadow: 0 8px 24px rgba(10, 5, 30, .25);
  --accent: #9b6cf2;
}

/* ---------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  overflow: hidden;
  background: #2b2050;
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  touch-action: manipulation;
}
button { font: inherit; color: inherit; -webkit-user-select: none; user-select: none; }
button:not(:disabled) { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
[hidden] { display: none !important; }
[data-world] { color: var(--ink); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.ic { width: 22px; height: 22px; flex: none; display: block; }
.noscript, .oops { position: fixed; inset: 40% 20px auto; text-align: center; color: #fff; font-weight: 700; }
.oops a { color: #ffd36e; }

/* ---------- the stage ---------- */

#scene { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: #2b2050; contain: strict; }
.scene-layer {
  position: absolute; inset: 0;
  background-size: cover; background-position: 50% 62%;
  opacity: 0; transition: opacity .7s ease;
}
.scene-layer.on { opacity: 1; }
.scene-layer[data-kind="dusk"] {
  background:
    radial-gradient(120% 60% at 50% 115%, rgba(255, 150, 170, .75) 0%, rgba(255, 150, 170, 0) 60%),
    radial-gradient(70% 40% at 85% 5%, rgba(130, 110, 255, .35), rgba(130, 110, 255, 0)),
    linear-gradient(180deg, #17123a 0%, #2f2160 50%, #6a4386 100%);
}
.scene-tint { position: absolute; inset: 0; opacity: var(--tint, 0); background: #fff7ee; transition: opacity .6s; }
#scene[data-world="neon"] .scene-tint { background: #06021a; }
#scene[data-world="dusk"] .scene-tint { background: #120c2c; }
.motes { position: absolute; inset: 0; }
.motes i {
  position: absolute; width: 7px; height: 7px; border-radius: 50%;
  background: radial-gradient(closest-side, #fffbe0, rgba(255, 236, 160, .6) 50%, rgba(255, 236, 160, 0));
  animation: mote 16s linear infinite;
  opacity: 0;
}
#scene[data-world="neon"] .motes i { background: radial-gradient(closest-side, #fff, rgba(255, 63, 210, .7) 45%, rgba(255, 63, 210, 0)); }
#scene[data-world="neon"] .motes i:nth-child(2n) { background: radial-gradient(closest-side, #fff, rgba(39, 232, 255, .7) 45%, rgba(39, 232, 255, 0)); }
#scene[data-world="dusk"] .motes i { width: 3px; height: 3px; background: #fff; animation-name: twinkle; top: calc(var(--y, 0) * 1%) !important; }
@keyframes mote {
  0% { transform: translate(0, 0) scale(var(--s)); opacity: 0; }
  12% { opacity: .9; }
  50% { transform: translate(26px, -90px) scale(var(--s)); }
  85% { opacity: .8; }
  100% { transform: translate(-10px, -190px) scale(var(--s)); opacity: 0; }
}
@keyframes twinkle {
  0%, 100% { opacity: .08; transform: scale(var(--s)); }
  50% { opacity: .7; transform: scale(calc(var(--s) * 1.3)); }
}

#app { position: fixed; inset: 0; z-index: 1; }
.screen {
  position: absolute; inset: 0;
  overflow-x: hidden; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transition: opacity .28s ease, transform .28s ease;
}
.screen.entering { opacity: 0; transform: translateY(12px); }
.screen.leaving { opacity: 0; pointer-events: none; }
#fx { position: fixed; inset: 0; z-index: 60; pointer-events: none; }

/* ---------- top bar ---------- */

.topbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: calc(var(--st) + 12px) calc(var(--sr) + 14px) 8px calc(var(--sl) + 14px);
  position: relative;
  z-index: 3;
}
.tb-left, .tb-right { display: flex; gap: 8px; align-items: center; min-width: 46px; }
.tb-right { justify-content: flex-end; }
.tb-title { text-align: center; min-width: 0; }
.tb-title h1 {
  margin: 0; font: 600 21px/1.15 var(--f-display); color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tb-title p {
  margin: 2px 0 0; font: 700 12.5px/1.2 var(--f-body); color: var(--ink-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.icon-btn {
  width: 46px; height: 46px; border-radius: 50%; flex: none;
  display: grid; place-items: center; padding: 0;
  background: var(--card); color: var(--ink);
  border: 1px solid var(--card-line); box-shadow: var(--shadow);
  transition: transform .15s ease;
}
.icon-btn:active { transform: scale(.94); }
.star-total {
  display: inline-flex; align-items: center; gap: 6px; height: 46px; padding: 0 14px;
  border-radius: 999px; background: var(--card); border: 1px solid var(--card-line);
  font: 600 18px var(--f-display); color: var(--ink);
}
.star-total .ic { width: 20px; height: 20px; color: var(--star); }

/* ---------- buttons ---------- */

.btn {
  appearance: none; border: 0; margin: 0;
  min-height: 50px; padding: 0 22px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font: 600 17px/1 var(--f-display); letter-spacing: .01em;
  color: var(--ink); background: var(--card);
  border: 1px solid var(--card-line); box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .2s ease, opacity .2s;
  white-space: nowrap;
}
.btn .ic { width: 20px; height: 20px; }
.btn:active { transform: translateY(1px) scale(.98); }
.btn:disabled { opacity: .45; }
.btn-primary {
  color: #fff; border: 0;
  background: linear-gradient(180deg, #a074f4 0%, #7a45d6 52%, #6031bd 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), inset 0 -3px 0 rgba(45, 12, 100, .25), 0 10px 24px rgba(95, 48, 187, .4);
  text-shadow: 0 1px 1px rgba(40, 10, 90, .3);
}
[data-world="neon"] .btn-primary {
  background: linear-gradient(180deg, #ff74e4 0%, #e526c4 55%, #b0129f 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 0 0 1px rgba(255, 140, 235, .6), 0 0 26px rgba(255, 63, 210, .5);
}
.btn-glow {
  color: #fff; border: 1px solid rgba(255, 255, 255, .55);
  background: linear-gradient(180deg, rgba(255, 255, 255, .28), rgba(255, 255, 255, .12));
  box-shadow: 0 0 22px rgba(255, 63, 210, .45);
}
.btn-xl { min-height: 62px; font-size: 22px; padding: 0 34px; }
.btn-xl .ic { width: 24px; height: 24px; }
.btn-wide { width: 100%; }
.btn-small { min-height: 44px; font-size: 15.5px; padding: 0 16px; }
.btn-soft { background: var(--card-2); box-shadow: none; }
.btn-card { background: var(--card); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); font-size: 15px; text-decoration: underline; text-underline-offset: 4px; }
.btn-danger { color: #fff; border: 0; background: linear-gradient(180deg, #f07373, #d14646); box-shadow: 0 8px 20px rgba(209, 70, 70, .35); }
.btn-danger-soft { color: #b33b3b; background: rgba(255, 244, 242, .92); align-self: center; }

/* ---------- discs (shared by boards and chips) ---------- */

.disc { position: absolute; inset: 7%; display: block; pointer-events: none; z-index: 2; perspective: 260px; }
.disc[data-p="0"] { visibility: hidden; }
.disc .face { position: absolute; inset: 0; display: block; }
.disc .face i, .disc .mk { position: absolute; inset: 0; display: block; background-size: 100% 100%; background-repeat: no-repeat; }
.disc .mk { inset: 27%; display: none; background-image: var(--mark-1); z-index: 3; }
.disc[data-p="2"] .mk { background-image: var(--mark-2); }
.cb .disc .mk, .force-mk .disc .mk { display: block; }
[data-world="garden"] .disc::before {
  content: ''; position: absolute; inset: 12% 8% 0 14%; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(25, 55, 20, .38), rgba(25, 55, 20, 0));
  transform: translate(3%, 9%);
}
[data-world="neon"] .disc { inset: 2%; }
.disc.ghost { z-index: 3; }

.chip-disc { display: inline-block; position: relative; width: 28px; height: 28px; vertical-align: middle; flex: none; }
.chip-disc .disc { inset: 0; }
.chip-disc.big { width: 46px; height: 46px; }

/* Garden: blooms open, close and turn over. */
@keyframes g-l1-in { 0% { transform: scale(.2) rotate(-80deg); opacity: 0; } 60% { transform: scale(1.07) rotate(4deg); opacity: 1; } 100% { transform: none; opacity: 1; } }
@keyframes g-l2-in { 0%, 25% { transform: scale(.15) rotate(70deg); opacity: 0; } 75% { transform: scale(1.1) rotate(-3deg); opacity: 1; } 100% { transform: none; opacity: 1; } }
@keyframes g-l3-in { 0%, 45% { transform: scale(0); } 80% { transform: scale(1.3); } 100% { transform: none; } }
@keyframes turn-in { 0% { transform: rotateY(-90deg) scale(.86); } 100% { transform: none; } }
@keyframes turn-out { 0% { transform: none; opacity: 1; } 100% { transform: rotateY(90deg) scale(.86); opacity: .6; } }
@keyframes g-close { to { transform: scale(.45) rotate(55deg); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { from { opacity: 1; } to { opacity: 0; } }

[data-world="garden"] .disc.place .l1 { animation: g-l1-in .5s cubic-bezier(.2, .7, .3, 1) both; }
[data-world="garden"] .disc.place .l2 { animation: g-l2-in .56s cubic-bezier(.2, .7, .3, 1) both; }
[data-world="garden"] .disc.place .l3 { animation: g-l3-in .6s ease-out both; }
[data-world="garden"] .disc.place::before { animation: fade-in .35s both; }
[data-world="garden"] .disc.flip-in .face { animation: turn-in .3s .15s cubic-bezier(.25, .8, .35, 1.15) both; }
[data-world="garden"] .disc.flip-in .l1 { animation: g-l1-in .5s .15s cubic-bezier(.2, .7, .3, 1) both; }
[data-world="garden"] .disc.flip-in .l2 { animation: g-l2-in .52s .17s cubic-bezier(.2, .7, .3, 1) both; }
[data-world="garden"] .disc.flip-in .l3 { animation: g-l3-in .55s .19s ease-out both; }
[data-world="garden"] .disc.ghost.out .face { animation: turn-out .2s ease-in both; }
[data-world="garden"] .disc.ghost.out .l1 { animation: g-close .2s ease-in both; }
[data-world="garden"] .disc.ghost.out .l2 { animation: g-close .18s ease-in both; }
[data-world="garden"] .disc.ghost.out::before { animation: fade-out .2s both; }

/* Neon City: tiles crackle off and relight in the new colour. */
@keyframes n-on {
  0% { opacity: 0; transform: scale(1.16); }
  14% { opacity: 1; }
  28% { opacity: .2; }
  42% { opacity: 1; transform: scale(1); }
  58% { opacity: .5; }
  72%, 100% { opacity: 1; transform: none; }
}
@keyframes n-glow { 0% { opacity: 0; transform: scale(.5); } 40% { opacity: 1; transform: scale(1.4); } 100% { opacity: 1; transform: none; } }
@keyframes n-off { 0% { opacity: 1; } 30% { opacity: .25; } 50% { opacity: .85; } 100% { opacity: 0; transform: scale(.86); } }
[data-world="neon"] .disc.place .face { animation: n-on .42s linear both; }
[data-world="neon"] .disc.place .l1 { animation: n-glow .5s ease-out both; }
[data-world="neon"] .disc.flip-in .face { animation: n-on .42s .11s linear both; }
[data-world="neon"] .disc.flip-in .l1 { animation: n-glow .5s .11s ease-out both; }
[data-world="neon"] .disc.ghost.out .face { animation: n-off .22s linear both; }

/* Reduced motion: a quick cross-fade, nothing more. */
.disc.fade-in { animation: fade-in .16s ease-out both; }
.disc.ghost.fade-out { animation: fade-out .18s ease-in both; }

/* ---------- the board ---------- */

.board-wrap { --cell: 40px; --pad: calc(var(--cell) * .28); position: relative; width: max-content; margin: 0 auto; }
.board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--w), var(--cell));
  grid-template-rows: repeat(var(--h), var(--cell));
  padding: var(--pad);
  border-radius: calc(var(--pad) + var(--cell) * .2);
}
.board::before {
  content: ''; position: absolute; inset: var(--pad);
  border-radius: calc(var(--cell) * .2);
}
.brow { display: contents; }
.cell {
  position: relative; display: block; margin: 0; padding: 0; border: 0;
  width: var(--cell); height: var(--cell);
  background: none; color: inherit; appearance: none;
}
.cell::before {
  content: ''; position: absolute; inset: calc(var(--cell) * .035);
  border-radius: calc(var(--cell) * .2);
  background: var(--tile); box-shadow: var(--tile-shadow);
}
.cell:focus-visible { outline: 3px solid var(--focus); outline-offset: -1px; border-radius: calc(var(--cell) * .2); z-index: 4; }
.cell.legal { cursor: pointer; }
.board-wrap.waiting .cell { cursor: default; }

[data-world="garden"] .board {
  background: linear-gradient(160deg, #fffaf0 0%, #f4e4c6 55%, #e8d1aa 100%);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .95), inset 0 -3px 0 rgba(170, 125, 70, .25),
    0 2px 4px rgba(70, 40, 20, .14), 0 24px 54px rgba(70, 40, 20, .3);
}
[data-world="garden"] .board::before { background: #5f9a52; box-shadow: inset 0 2px 5px rgba(25, 60, 20, .4); }
[data-world="garden"] .cell { --tile: linear-gradient(180deg, #a6d48a 0%, #8cc173 100%); --tile-shadow: inset 0 1px 0 rgba(255, 255, 255, .4), inset 0 -2px 0 rgba(40, 95, 40, .2); }
[data-world="garden"] .cell.alt { --tile: linear-gradient(180deg, #9acd7f 0%, #81b869 100%); }
[data-world="garden"] .cell.legal:hover::before { filter: brightness(1.07); }
[data-world="garden"] .cell.hole::before { background: var(--water) center / 100% 100% no-repeat; box-shadow: none; inset: 0; border-radius: 0; }
[data-world="garden"] .cell.stone::after { content: ''; position: absolute; inset: 6%; background: var(--stone-garden) center / contain no-repeat; }
[data-world="garden"] .cell.last::before { box-shadow: inset 0 0 0 calc(var(--cell) * .05) rgba(255, 252, 230, .85), var(--tile-shadow); }

[data-world="neon"] .board {
  background: linear-gradient(180deg, rgba(34, 18, 80, .94), rgba(12, 6, 34, .96));
  box-shadow: 0 0 0 1px rgba(120, 220, 255, .45), 0 0 0 4px rgba(255, 63, 210, .16), 0 0 40px rgba(255, 63, 210, .28), 0 0 90px rgba(39, 232, 255, .16), 0 24px 60px rgba(0, 0, 0, .5);
}
[data-world="neon"] .board::before { background: #07031a; }
[data-world="neon"] .cell { --tile: linear-gradient(180deg, #23134f 0%, #170c3a 100%); --tile-shadow: inset 0 0 0 1px rgba(120, 200, 255, .16), inset 0 1px 0 rgba(255, 255, 255, .07); }
[data-world="neon"] .cell.alt { --tile: linear-gradient(180deg, #1f1149 0%, #140a34 100%); }
[data-world="neon"] .cell.legal:hover::before { box-shadow: inset 0 0 0 1px rgba(120, 220, 255, .5), var(--tile-shadow); }
[data-world="neon"] .cell.hole::before { background: rgba(5, 2, 18, .6); box-shadow: inset 0 0 0 1px rgba(255, 63, 210, .1); }
[data-world="neon"] .cell.stone::after { content: ''; position: absolute; inset: 3%; background: var(--stone-neon) center / contain no-repeat; }
[data-world="neon"] .cell.last::before { box-shadow: inset 0 0 0 calc(var(--cell) * .04) rgba(39, 232, 255, .55), var(--tile-shadow); }

/* Corners to watch (for corner goals and the corner tutorial): a golden
   ring and a little star, so they never look like a legal-move glow. */
.cell.corner-mark::before { box-shadow: inset 0 0 0 calc(var(--cell) * .055) rgba(255, 205, 70, .95), var(--tile-shadow); }
.cell.corner-mark .corner-star { display: block; }
.corner-star {
  display: none; position: absolute; z-index: 1; pointer-events: none;
  left: 8%; top: 8%; width: 30%; height: 30%;
  background: var(--corner-star) center / contain no-repeat;
}
[data-world="neon"] .cell.corner-mark::before { box-shadow: inset 0 0 0 calc(var(--cell) * .045) rgba(255, 196, 80, .85), 0 0 12px rgba(255, 196, 80, .35); }

/* Where you can play. */
.cell.legal::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 24%; height: 24%;
  border-radius: 50%; transform: translate(-50%, -50%); pointer-events: none; z-index: 1;
  background: rgba(255, 255, 255, .75);
  box-shadow: 0 0 0 calc(var(--cell) * .05) rgba(255, 255, 255, .25);
}
[data-world="garden"] [data-turn="1"] .cell.legal::after, [data-world="garden"][data-turn="1"] .cell.legal::after { background: rgba(110, 58, 196, .62); box-shadow: 0 0 0 calc(var(--cell) * .05) rgba(255, 255, 255, .45); }
[data-world="garden"][data-turn="2"] .cell.legal::after { background: rgba(246, 176, 30, .9); box-shadow: 0 0 0 calc(var(--cell) * .05) rgba(255, 255, 255, .5); }
[data-world="neon"][data-turn="1"] .cell.legal::after { background: #ff3fd2; box-shadow: 0 0 calc(var(--cell) * .2) rgba(255, 63, 210, .9); width: 16%; height: 16%; }
[data-world="neon"][data-turn="2"] .cell.legal::after { background: #27e8ff; box-shadow: 0 0 calc(var(--cell) * .2) rgba(39, 232, 255, .9); width: 16%; height: 16%; }
.glow-moves .cell.legal::after {
  width: 74%; height: 74%;
  background: radial-gradient(closest-side, rgba(255, 255, 255, .95), rgba(255, 246, 200, .55) 45%, rgba(255, 246, 200, 0)) !important;
  box-shadow: none !important;
  animation: glow-pulse 1.5s ease-in-out infinite;
}
@keyframes glow-pulse { 0%, 100% { opacity: .55; transform: translate(-50%, -50%) scale(.82); } 50% { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
.hide-moves .board-wrap:not(.glow-moves) .cell.legal::after { display: none; }
.board-wrap.waiting .cell.legal::after { display: none; }

.cell.nope { animation: nope .35s ease; }
@keyframes nope { 20% { transform: translateX(-4px); } 40% { transform: translateX(4px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }

.combo {
  position: absolute; left: 50%; top: 0; z-index: 7; pointer-events: none; white-space: nowrap;
  font: 700 max(15px, calc(var(--cell) * .42))/1 var(--f-display);
  padding: .2em .5em; border-radius: 999px; color: #fff;
  background: linear-gradient(180deg, #9b6cf2, #6a38c8);
  box-shadow: 0 0 0 2px #fff, 0 6px 14px rgba(60, 20, 120, .35);
  animation: combo 1.15s ease-out both;
}
.combo.p2 { color: #4a2a00; background: linear-gradient(180deg, #ffe07a, #f5ad1f); }
[data-world="neon"] .combo { background: #12082e; color: #ff8be8; box-shadow: 0 0 0 2px #ff3fd2, 0 0 18px rgba(255, 63, 210, .7); }
[data-world="neon"] .combo.p2 { color: #9ff6ff; box-shadow: 0 0 0 2px #27e8ff, 0 0 18px rgba(39, 232, 255, .7); }
@keyframes combo {
  0% { opacity: 0; transform: translate(-50%, 10%) scale(.6); }
  18% { opacity: 1; transform: translate(-50%, -45%) scale(1.12); }
  70% { opacity: 1; transform: translate(-50%, -75%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -115%) scale(1); }
}

.hint-arrow {
  position: absolute; z-index: 6; pointer-events: none;
  left: calc(var(--pad) + (var(--hx, 0) + .5) * var(--cell));
  top: calc(var(--pad) + var(--hy, 0) * var(--cell) + var(--cell) * .12);
  width: max(26px, calc(var(--cell) * .58));
  transform: translate(-50%, -100%);
  opacity: 0; transition: opacity .25s;
  filter: drop-shadow(0 3px 4px rgba(40, 20, 70, .35));
}
.hint-arrow svg { display: block; width: 100%; }
.hint-arrow path { fill: #fff; stroke: var(--accent); stroke-width: 3.5; stroke-linejoin: round; }
.hint-arrow.on { opacity: 1; animation: bob 1s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translate(-50%, -100%); } 50% { transform: translate(-50%, -128%); } }
.mini .hint-arrow { display: none; }
.mini .cell { cursor: default; }

/* ---------- title ---------- */

.title-screen { min-height: 100%; display: flex; flex-direction: column; }
.hero {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 0 20px 10px; text-align: center; min-height: 290px;
}
.wordmark {
  margin: 0; position: relative;
  font: 600 clamp(66px, 20vw, 140px)/1 var(--f-display);
  letter-spacing: -.025em;
  filter: drop-shadow(0 2px 0 rgba(255, 255, 255, .7)) drop-shadow(0 12px 26px rgba(85, 40, 150, .28));
}
.wm { display: inline-block; padding: .08em .04em .02em; }
.wm, .wi {
  background: linear-gradient(180deg, #8150d8 0%, #5a2bb0 55%, #3d1a85 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.wi { position: relative; display: inline-block; padding-top: .08em; margin-top: -.08em; }
.wdot {
  position: absolute; left: 50%; top: .27em;
  width: .3em; height: .3em;
  transform: translate(-50%, -50%);
}
.wdot .chip-disc { width: 100%; height: 100%; display: block; }
.wdot .disc { perspective: 120px; }
.wdot.d1 .face { animation: dot-flip 6s ease-in-out infinite; transform: rotateY(48deg) rotate(-14deg); }
.wdot.d2 .face { animation: dot-flip 6s 3s ease-in-out infinite; transform: rotateY(-52deg) rotate(12deg); }
.wdot.d2 { transform: translate(-46%, -46%); }
@keyframes dot-flip {
  0%, 82% { transform: rotateY(48deg) rotate(-14deg); }
  92% { transform: rotateY(228deg) rotate(-14deg) scale(1.12); }
  100% { transform: rotateY(408deg) rotate(-14deg); }
}
.wm-wave { display: block; width: 58%; height: .17em; margin: -.04em auto 0; overflow: visible; }
.wm-wave path {
  fill: none; stroke: #f4b322; stroke-width: 6; stroke-linecap: round;
  stroke-dasharray: 340; stroke-dashoffset: 340; animation: draw 1.4s .3s ease-out forwards;
}
@keyframes draw { to { stroke-dashoffset: 0; } }
.tagline {
  margin: 14px 0 0; font: 800 17px/1.2 var(--f-body); color: #4d3378;
  background: rgba(255, 250, 240, .6); padding: 8px 16px; border-radius: 999px;
}
.demo { margin-top: 22px; min-height: 64px; width: min(290px, 80vw); display: flex; justify-content: center; }
.demo .board { box-shadow: inset 0 2px 0 rgba(255, 255, 255, .95), 0 12px 30px rgba(70, 40, 20, .25); }
.title-actions {
  width: 100%; max-width: 460px; margin: 0 auto;
  padding: 0 20px calc(var(--sb) + 22px);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.title-actions .btn-xl { width: 100%; }
.title-row { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.title-row .btn { padding: 0 12px; position: relative; font-size: 16px; }
.title-row .btn .ic { color: var(--accent); }
.dot-new { position: absolute; top: 9px; right: 12px; width: 10px; height: 10px; border-radius: 50%; background: #ff7a59; box-shadow: 0 0 0 3px #fff; }
.badge-done { position: absolute; top: -4px; right: -2px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: #3fb26b; color: #fff; box-shadow: 0 0 0 3px #fff; }
.badge-done .ic { width: 14px; height: 14px; stroke-width: 3; color: #fff !important; }
.pill-link {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px;
  border: 0; border-radius: 999px; background: rgba(255, 250, 240, .78); color: #4a3470;
  font: 800 13.5px/1.2 var(--f-body); box-shadow: 0 4px 14px rgba(60, 30, 20, .12);
}
.pill-link .ic { width: 18px; height: 18px; color: #e8577e; }

/* ---------- world map ---------- */

.worlds-screen { min-height: 100%; display: flex; flex-direction: column; }
.carousel {
  flex: 1; display: flex; gap: 16px; align-items: stretch;
  overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory;
  padding: 10px calc(50% - min(39vw, 172px)) 14px;
  scrollbar-width: none; overscroll-behavior-x: contain;
}
.carousel::-webkit-scrollbar { display: none; }
.carousel:focus-visible { outline: none; }
.world-card {
  flex: 0 0 min(78vw, 344px); scroll-snap-align: center;
  position: relative; isolation: isolate; overflow: hidden;
  min-height: min(66vh, 560px); max-height: 640px;
  border-radius: 34px; display: flex; flex-direction: column; justify-content: flex-end;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .18), 0 24px 50px rgba(8, 4, 26, .5);
  transform: scale(.93); transition: transform .35s ease, filter .35s ease;
  filter: brightness(.88);
  cursor: pointer;
}
.world-card.current { transform: none; filter: none; }
.wc-art { position: absolute; inset: 0; z-index: -2; background-size: cover; background-position: 50% 62%; }
.world-card[data-world="ocean"] .wc-art, .world-card[data-world="space"] .wc-art, .world-card[data-world="glass"] .wc-art { background-position: 50% 40%; }
.wc-shade { position: absolute; inset: 48% 0 0; z-index: -1; background: linear-gradient(180deg, rgba(26, 14, 54, 0), rgba(26, 14, 54, .62) 45%, rgba(22, 12, 46, .86)); }
.world-card.soon .wc-art { filter: saturate(.85); }
.wc-body { padding: 22px; color: #fff; }
.wc-body h2 { margin: 6px 0 4px; font: 600 36px/1 var(--f-display); text-shadow: 0 2px 12px rgba(0, 0, 0, .35); }
.wc-tag { margin: 0 0 14px; font: 800 15px/1.3 var(--f-body); opacity: .94; text-shadow: 0 1px 6px rgba(0, 0, 0, .35); }
.wc-discs { display: flex; gap: 6px; }
.wc-discs .chip-disc { width: 42px; height: 42px; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .3)); }
.wc-progress { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; font: 800 13px var(--f-body); }
.wc-stars { display: inline-flex; align-items: center; gap: 4px; }
.wc-stars .ic { width: 16px; height: 16px; color: var(--star); }
.wc-progress .bar { flex: 1; height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .25); overflow: hidden; }
.wc-progress .bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #ffe07a, #ffb02e); }
.wc-count { opacity: .85; }
.wc-cta .btn { width: 100%; }
.soon-badge {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 20px; border-radius: 999px;
  font: 600 17px var(--f-display); color: #fff;
  background: rgba(255, 255, 255, .2); border: 1px solid rgba(255, 255, 255, .55);
}
.world-card[data-world="glass"] .wc-body, .world-card[data-world="glass"] .soon-badge { color: #fff; }
.wc-lock { position: absolute; top: 18px; right: 18px; width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; background: rgba(12, 6, 32, .55); color: #fff; box-shadow: 0 0 0 1px rgba(255, 255, 255, .3); }
.carousel-dots { display: flex; justify-content: center; gap: 0; padding: 0 0 calc(var(--sb) + 14px); }
.cdot { width: 44px; height: 44px; background: none; border: 0; position: relative; padding: 0; }
.cdot::after { content: ''; position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .4); transform: translate(-50%, -50%); transition: width .3s, background .3s; }
.cdot.on::after { width: 24px; background: #fff; }

/* ---------- level map ---------- */

.levelmap { height: 100%; display: flex; flex-direction: column; }
.levelmap .topbar { background: linear-gradient(180deg, rgba(255, 248, 238, .75), rgba(255, 248, 238, 0)); }
.levelmap[data-world="neon"] .topbar { background: linear-gradient(180deg, rgba(10, 4, 30, .85), rgba(10, 4, 30, 0)); }
.path-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 6px 0 calc(var(--sb) + 30px); -webkit-overflow-scrolling: touch; }
.path { position: relative; width: min(100% - 32px, 520px); margin: 0 auto; }
.path-line { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.pl-under { fill: none; stroke: rgba(255, 250, 238, .82); stroke-width: 18px; vector-effect: non-scaling-stroke; stroke-linecap: round; }
.pl-dash { fill: none; stroke: #e2b86a; stroke-width: 4px; stroke-dasharray: 1 13; vector-effect: non-scaling-stroke; stroke-linecap: round; }
.levelmap[data-world="neon"] .pl-under { stroke: rgba(18, 8, 50, .85); }
.levelmap[data-world="neon"] .pl-dash { stroke: #27e8ff; }
.node {
  position: absolute; width: 86px; height: 92px; padding: 0; border: 0; background: none;
  transform: translate(-50%, -40px);
  display: flex; flex-direction: column; align-items: center;
}
.node-disc {
  position: relative; width: 74px; height: 74px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font: 600 30px/1 var(--f-display); color: #fff;
  background: radial-gradient(circle at 35% 28%, #b994f3 0%, #7d48d3 50%, #4f2499 100%);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, .35), inset 0 -4px 0 rgba(40, 10, 90, .3), 0 0 0 5px rgba(255, 251, 242, .95), 0 12px 22px rgba(60, 30, 110, .35);
  transition: transform .15s;
}
.node:active .node-disc { transform: scale(.95); }
.node.open .node-disc { color: #5a3300; background: radial-gradient(circle at 35% 28%, #fff1b0 0%, #ffc63d 50%, #e48f0e 100%); box-shadow: inset 0 3px 0 rgba(255, 255, 255, .55), inset 0 -4px 0 rgba(150, 80, 0, .25), 0 0 0 5px rgba(255, 251, 242, .95), 0 12px 22px rgba(150, 90, 20, .35); }
.node.locked .node-disc { color: #9b917f; background: radial-gradient(circle at 35% 28%, #f1ece2, #d6cdbd 70%); box-shadow: inset 0 -3px 0 rgba(120, 100, 70, .2), 0 0 0 5px rgba(255, 251, 242, .7), 0 8px 16px rgba(60, 40, 20, .18); }
.node.locked .node-disc .ic { width: 26px; height: 26px; }
.node.next .node-disc::after { content: ''; position: absolute; inset: -12px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .95); animation: ring-pulse 1.8s ease-out infinite; }
@keyframes ring-pulse { 0% { transform: scale(.85); opacity: 1; } 100% { transform: scale(1.25); opacity: 0; } }
.node.nope { animation: nope .35s; }
.levelmap[data-world="neon"] .node-disc { background: radial-gradient(circle at 35% 28%, #ff9be9 0%, #e526c4 50%, #8a0f86 100%); box-shadow: 0 0 0 3px #0c0624, 0 0 0 5px rgba(255, 63, 210, .8), 0 0 26px rgba(255, 63, 210, .6); }
.levelmap[data-world="neon"] .node.open .node-disc { color: #022b36; background: radial-gradient(circle at 35% 28%, #d8fdff 0%, #27e8ff 55%, #0a8fb0 100%); box-shadow: 0 0 0 3px #0c0624, 0 0 0 5px rgba(39, 232, 255, .8), 0 0 26px rgba(39, 232, 255, .6); }
.levelmap[data-world="neon"] .node-stars .star { color: #3d3170; filter: none; }
.levelmap[data-world="neon"] .node.locked .node-disc { color: #6f66a0; background: #1a1240; box-shadow: 0 0 0 3px #0c0624, 0 0 0 5px rgba(120, 110, 200, .35); }
.node-stars { display: flex; gap: 1px; margin-top: -12px; position: relative; z-index: 1; }
.stars { display: inline-flex; gap: 2px; align-items: center; }
.star { display: inline-block; width: 20px; height: 20px; color: rgba(255, 255, 255, .85); }
.star .ic { width: 100%; height: 100%; }
.node-stars .star { width: 22px; height: 22px; color: #e9e1d2; filter: drop-shadow(0 1px 1px rgba(80, 50, 20, .35)); }
.node-stars .star:nth-child(2) { transform: translateY(4px); }
.star.on { color: var(--star) !important; }
.node-name {
  position: absolute; top: 20px; white-space: nowrap; pointer-events: none;
  font: 600 15px/1 var(--f-display); color: var(--ink);
  background: var(--card); padding: 8px 12px; border-radius: 999px; box-shadow: var(--shadow);
}
.node.label-right .node-name { left: calc(50% + 46px); }
.node.label-left .node-name { right: calc(50% + 46px); }
.node.locked .node-name { opacity: .7; }
.node-opp { position: absolute; top: -10px; width: 36px; height: 36px; border-radius: 50%; box-shadow: 0 0 0 3px #fff, 0 4px 10px rgba(0, 0, 0, .2); z-index: 2; }
.node-opp .portrait-svg { width: 100%; height: 100%; display: block; }
.node-opp.left { left: -2px; }
.node-opp.right { right: -2px; }

/* ---------- sheets ---------- */

.sheet-wrap { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(22, 12, 44, .5); opacity: 0; transition: opacity .26s; }
.sheet {
  position: relative; width: 100%; max-width: 520px;
  max-height: calc(100% - var(--st) - 20px); overflow-y: auto;
  padding: 26px 22px calc(var(--sb) + 22px);
  color: var(--ink); background: var(--sheet-bg);
  border-radius: 30px 30px 0 0; box-shadow: var(--shadow-lg);
  transform: translateY(105%); transition: transform .34s cubic-bezier(.2, .8, .25, 1);
}
[data-world="neon"] .sheet { border: 1px solid rgba(120, 220, 255, .25); border-bottom: 0; }
.sheet-wrap.on .sheet-backdrop { opacity: 1; }
.sheet-wrap.on .sheet { transform: none; }
.sheet-close { position: absolute; right: 14px; top: 14px; box-shadow: none; z-index: 2; }
.sheet-title { margin: 2px 0 14px; font: 600 28px/1.1 var(--f-display); color: var(--ink); }
.sheet-text { margin: 0 0 20px; color: var(--ink-2); font-weight: 700; }
.sheet-actions { display: flex; flex-direction: column; gap: 10px; }
.sheet-row { display: flex; gap: 10px; }
.sheet-row .btn { flex: 1; padding: 0 12px; }
@media (min-width: 700px) and (min-height: 560px) {
  .sheet-wrap { align-items: center; }
  .sheet { border-radius: 30px; transform: translateY(18px) scale(.97); opacity: 0; transition: transform .3s cubic-bezier(.2, .8, .25, 1), opacity .25s; padding-bottom: 26px; }
  [data-world="neon"] .sheet { border-bottom: 1px solid rgba(120, 220, 255, .25); }
  .sheet-wrap.on .sheet { opacity: 1; }
}

.level-sheet .ls-kicker, .dc-kicker { margin: 0; font: 900 12px/1 var(--f-body); letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.ls-grid { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px; align-items: center; }
.ls-preview { min-width: 120px; }
.ls-opp { display: flex; gap: 10px; align-items: center; }
.ls-portrait { width: 54px; height: 54px; flex: none; border-radius: 50%; box-shadow: 0 0 0 3px #fff, 0 3px 8px rgba(0, 0, 0, .15); }
.ls-portrait .portrait-svg { width: 100%; height: 100%; display: block; }
.ls-opp b { display: block; font: 600 18px/1.15 var(--f-display); }
.ls-opp small { display: block; color: var(--ink-2); font-weight: 700; font-size: 13px; }
.ls-blurb { margin: 8px 0 0; font-size: 14px; line-height: 1.4; color: var(--ink-2); font-weight: 600; }
.ls-note { margin: 14px 0 0; padding: 10px 14px; border-radius: 14px; background: var(--accent-soft); font-weight: 700; font-size: 14.5px; }
.ls-targets { list-style: none; padding: 0; margin: 14px 0 18px; display: grid; gap: 8px; }
.ls-targets li { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; }
.ls-targets .stars { min-width: 66px; }
.ls-targets .star { width: 19px; height: 19px; }
.ls-targets .star.on { color: #d9cfe6 !important; }
[data-world="neon"] .ls-targets .star.on { color: #3a2d6e !important; }
.ls-targets li.got .star.on { color: var(--star) !important; }

/* ---------- game ---------- */

.game { position: relative; height: 100%; display: flex; flex-direction: column; }
.game .topbar { padding-bottom: 4px; }
.game-main {
  flex: 1; min-height: 0;
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas: "opp" "board" "me";
  gap: 10px;
  padding: 4px calc(var(--sr) + 14px) 0 calc(var(--sl) + 14px);
  width: 100%; max-width: 760px; margin: 0 auto;
}
.side { position: relative; min-width: 0; }
.side-opp { grid-area: opp; margin-top: calc(var(--slack, 0px) * .7); }
.side-me { margin-bottom: calc(var(--slack, 0px) * 1.3); }
.side-me { grid-area: me; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 10px; align-items: center; }
.side-me .goal-card { grid-column: 1 / -1; grid-row: 2; }
.side-me .controls { grid-column: 2; grid-row: 1; }
.board-area { grid-area: board; min-height: 0; min-width: 0; align-self: stretch; display: flex; align-items: center; justify-content: center; position: relative; }
.board-slot { display: flex; align-items: center; justify-content: center; }

.pcard {
  position: relative; display: flex; align-items: center; gap: 10px;
  min-height: 62px; padding: 7px 14px 7px 8px; border-radius: 22px;
  background: var(--card); border: 1px solid var(--card-line); box-shadow: var(--shadow);
  transition: box-shadow .3s ease;
}
.pcard.active[data-p="1"] { box-shadow: 0 0 0 3px var(--p1), var(--shadow); }
.pcard.active[data-p="2"] { box-shadow: 0 0 0 3px var(--p2), var(--shadow); }
[data-world="neon"] .pcard.active[data-p="1"] { box-shadow: 0 0 0 2px var(--p1), 0 0 22px rgba(255, 63, 210, .45); }
[data-world="neon"] .pcard.active[data-p="2"] { box-shadow: 0 0 0 2px var(--p2), 0 0 22px rgba(39, 232, 255, .45); }
.pc-face { position: relative; width: 46px; height: 46px; flex: none; }
.pc-face .portrait-svg { width: 100%; height: 100%; display: block; border-radius: 50%; box-shadow: 0 0 0 2px #fff, 0 2px 6px rgba(0, 0, 0, .15); }
[data-world="neon"] .pc-face .portrait-svg { box-shadow: 0 0 0 2px rgba(120, 220, 255, .6); }
.pc-face .chip-disc.big { width: 46px; height: 46px; }
.pc-text { flex: 1; min-width: 0; }
.pc-name { display: block; font: 600 18px/1.1 var(--f-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-sub { display: block; font: 700 12.5px/1.25 var(--f-body); color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-score { display: flex; align-items: center; gap: 7px; font: 600 28px/1 var(--f-display); font-variant-numeric: tabular-nums; }
.pc-chip { display: inline-flex; }
.pc-count { min-width: 1.2em; text-align: right; display: inline-block; }
.pc-count.bump { animation: bump .35s ease; }
@keyframes bump { 40% { transform: scale(1.25); } }
.pc-think { position: absolute; right: -8px; bottom: -6px; display: none; gap: 3px; padding: 5px 6px; border-radius: 999px; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .18); }
[data-world="neon"] .pc-think { background: #1d1150; box-shadow: 0 0 0 1px rgba(120, 220, 255, .4); }
.pcard.thinking .pc-think { display: flex; }
.pc-think i { width: 5px; height: 5px; border-radius: 50%; background: var(--ink-2); animation: think 1s ease-in-out infinite; }
.pc-think i:nth-child(2) { animation-delay: .15s; }
.pc-think i:nth-child(3) { animation-delay: .3s; }
@keyframes think { 0%, 100% { transform: translateY(0); opacity: .5; } 40% { transform: translateY(-3px); opacity: 1; } }

.bubble {
  position: absolute; left: 4px; top: calc(100% + 10px); z-index: 20;
  max-width: min(84vw, 340px); padding: 10px 14px; border-radius: 18px;
  background: #fff; color: #2b1f45; font: 800 15px/1.35 var(--f-body);
  box-shadow: 0 2px 4px rgba(43, 31, 69, .1), 0 14px 34px rgba(43, 31, 69, .28);
  opacity: 0; transform: translateY(-6px) scale(.95); transform-origin: 24px 0;
  transition: opacity .25s ease, transform .25s ease; pointer-events: none;
}
.bubble::before { content: ''; position: absolute; left: 22px; top: -6px; width: 14px; height: 14px; background: inherit; transform: rotate(45deg); border-radius: 3px; }
.bubble.on { opacity: 1; transform: none; }
[data-world="neon"] .bubble { background: #1b1048; color: #f4efff; box-shadow: 0 0 0 1px rgba(39, 232, 255, .45), 0 0 26px rgba(39, 232, 255, .25); }
/* In portrait layouts the bubble sits over the opponent's own card, beside
   their face, so it never covers the board. */
@media (max-width: 899.98px), (max-aspect-ratio: 5/4) {
  .bubble {
    left: 56px; right: 84px; top: 50%; max-width: 460px;
    padding: 8px 12px; font-size: 14px; line-height: 1.3; border-radius: 16px;
    transform: translateY(-50%) scale(.94); transform-origin: 0 50%;
  }
  .bubble::before { left: -5px; top: calc(50% - 7px); }
  .bubble.on { transform: translateY(-50%); }
}

.goal-card {
  display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 14px 6px 8px;
  border-radius: 18px; background: var(--card-2); border: 1px solid var(--card-line);
}
.gc-ic { width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; color: #fff; background: var(--accent); }
.gc-ic .ic { width: 18px; height: 18px; }
.goal-card.quiet .gc-ic { background: var(--accent-soft); color: var(--accent); }
.gc-text { min-width: 0; }
.gc-text b { display: block; font: 600 15.5px/1.2 var(--f-display); }
.gc-extra { display: block; font: 700 12.5px/1.3 var(--f-body); color: var(--ink-2); }
.controls { display: flex; gap: 8px; justify-content: flex-end; }
.controls:empty { display: none; }

.status-line { margin: 0; padding: 10px 16px calc(var(--sb) + 14px); text-align: center; min-height: 58px; }
.sl-text {
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%;
  padding: 7px 16px; border-radius: 999px;
  font: 800 15px/1.3 var(--f-body); color: var(--ink);
  background: var(--card-2); border: 1px solid var(--card-line);
}
.sl-text:empty { visibility: hidden; }
.status-line.coach .sl-text {
  color: #fff; background: linear-gradient(180deg, #9b6cf2, #6c3bc9); border: 0;
  padding: 10px 18px; font-size: 16px; border-radius: 20px; text-align: left;
  box-shadow: 0 10px 24px rgba(95, 48, 187, .35);
  animation: coach-in .4s ease both;
}
.status-line.coach .ic { width: 18px; height: 18px; color: #ffe07a; }
@keyframes coach-in { from { opacity: 0; transform: translateY(6px); } }

/* Results */
.results { text-align: center; }
.res-stars { display: flex; justify-content: center; align-items: flex-end; gap: 4px; margin: 4px 0 6px; }
.res-star { width: 62px; height: 62px; color: #e3dbee; }
[data-world="neon"] .res-star { color: #2c2160; }
.res-star:nth-child(2) { width: 80px; height: 80px; }
.res-star .ic { width: 100%; height: 100%; }
.res-star.on { color: var(--star); filter: drop-shadow(0 3px 6px rgba(200, 120, 0, .35)); animation: star-pop .55s calc(.2s + var(--k) * .26s) cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes star-pop { 0% { transform: scale(0) rotate(-50deg); } 100% { transform: none; } }
.res-discs { display: flex; justify-content: center; margin-bottom: 6px; }
.res-discs .chip-disc.big { width: 72px; height: 72px; }
.res-line { margin: -6px 0 12px; font: 800 16.5px/1.35 var(--f-body); color: var(--ink-2); }
.res-score { display: flex; justify-content: center; align-items: center; gap: 14px; font: 600 30px/1 var(--f-display); }
.res-score > span { display: inline-flex; align-items: center; gap: 8px; }
.res-score .chip-disc { width: 34px; height: 34px; }
.res-vs { font: 800 14px var(--f-body) !important; color: var(--ink-3); }
.res-tip { margin: 12px 0 0; font-weight: 700; color: var(--ink-2); font-size: 14px; }
.res-react { display: flex; gap: 12px; align-items: center; text-align: left; margin: 16px 0 18px; padding: 10px 14px; border-radius: 18px; background: var(--accent-soft); }
.res-portrait { width: 50px; height: 50px; flex: none; border-radius: 50%; box-shadow: 0 0 0 2px #fff; }
.res-portrait .portrait-svg { width: 100%; height: 100%; display: block; }
.res-quote { margin: 0; font-weight: 800; font-size: 15px; line-height: 1.35; }
.results .sheet-actions { margin-top: 18px; }
.res-react + .sheet-actions { margin-top: 0; }

/* Big screens: the board in the middle, players either side. */
@media (min-width: 900px) and (min-aspect-ratio: 5/4) {
  .game-main {
    max-width: 1320px;
    grid-template-columns: minmax(220px, 290px) minmax(0, 1fr) minmax(220px, 290px);
    grid-template-rows: minmax(0, 1fr);
    grid-template-areas: "opp board me";
    gap: 28px; padding: 8px 32px 0; align-items: center;
  }
  .side { display: flex; flex-direction: column; gap: 14px; align-self: center; }
  .side-me { display: flex; align-items: stretch; }
  .pcard { flex-direction: column; text-align: center; gap: 10px; padding: 22px 18px 18px; border-radius: 28px; }
  .pc-face { width: 104px; height: 104px; }
  .pc-face .chip-disc.big { width: 104px; height: 104px; }
  .pc-text { flex: none; width: 100%; }
  .pc-name { font-size: 24px; }
  .pc-sub { font-size: 14px; white-space: normal; }
  .pc-score { font-size: 44px; gap: 10px; }
  .pc-score .chip-disc { width: 38px; height: 38px; }
  .pc-think { right: 2px; bottom: 2px; padding: 7px 8px; }
  .pc-think i { width: 7px; height: 7px; }
  .bubble { position: relative; left: auto; top: auto; max-width: none; transform-origin: 50% 0; text-align: center; font-size: 16px; padding: 14px 18px; }
  .bubble::before { left: calc(50% - 7px); }
  .goal-card { padding: 12px 16px 12px 12px; }
  .controls { justify-content: center; }
  .status-line { padding-top: 14px; }
}

/* ---------- quick play ---------- */

.quick { min-height: 100%; display: flex; flex-direction: column; }
.quick-body { flex: 1; width: 100%; max-width: 640px; margin: 0 auto; padding: 4px 16px 8px; display: flex; flex-direction: column; gap: 14px; }
.qsec { padding: 14px; border-radius: 24px; background: var(--card); border: 1px solid var(--card-line); box-shadow: var(--shadow); }
.qlabel { margin: 2px 4px 10px; font: 900 12px/1 var(--f-body); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); }
.qworlds { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.qworld { position: relative; height: 78px; padding: 0; border: 0; border-radius: 18px; overflow: hidden; background: #000; box-shadow: 0 0 0 1px var(--card-line); }
.qw-art { position: absolute; inset: 0; background-size: cover; background-position: 50% 62%; }
.qw-name { position: absolute; left: 12px; bottom: 10px; font: 600 18px/1 var(--f-display); color: #fff; text-shadow: 0 1px 8px rgba(0, 0, 0, .55); }
.qworld.on { box-shadow: 0 0 0 3px var(--accent), 0 0 0 6px rgba(255, 255, 255, .6); }
.qworld.locked .qw-art { filter: grayscale(.5) brightness(.65); }
.qw-lock { position: absolute; right: 10px; top: 10px; color: #fff; }
.qopps { display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 6px; }
.qopp { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px; min-height: 44px; border-radius: 18px; border: 2px solid transparent; background: var(--card-2); min-width: 0; }
.qopp.on { border-color: var(--accent); background: var(--accent-soft); }
.qo-face { width: 48px; height: 48px; display: grid; place-items: center; }
.qo-face .portrait-svg { width: 100%; height: 100%; display: block; border-radius: 50%; }
.qopp.full .qo-face .portrait-svg { box-shadow: 0 0 0 3px var(--star); }
.two-face { display: flex; }
.two-face .chip-disc { width: 32px; height: 32px; margin: 0 -4px; }
.qo-name { font: 600 13.5px/1.15 var(--f-display); text-align: center; max-width: 100%; overflow-wrap: anywhere; }
.qo-label { font: 800 11px/1.2 var(--f-body); color: var(--ink-2); text-align: center; }
.seg { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--card-2); border: 1px solid var(--line); }
.seg button { flex: 1; min-height: 46px; padding: 0 8px; border: 0; border-radius: 999px; background: transparent; color: var(--ink-2); font: 600 15.5px/1.1 var(--f-display); }
.seg button.on { background: var(--accent); color: #fff; box-shadow: 0 4px 12px rgba(95, 48, 187, .3); }
.qhint { margin: 10px 4px 0; font-size: 13.5px; font-weight: 700; color: var(--ink-2); }
.quick-go { position: sticky; bottom: 0; z-index: 2; display: flex; justify-content: center; padding: 22px 16px calc(var(--sb) + 16px); background: linear-gradient(180deg, rgba(255, 247, 238, 0), rgba(255, 247, 238, .92) 40%); }
.quick[data-world="neon"] .quick-go { background: linear-gradient(180deg, rgba(8, 3, 26, 0), rgba(8, 3, 26, .92) 40%); }
.quick-go .btn { width: 100%; max-width: 440px; }
@media (min-width: 900px) and (min-height: 600px) {
  .quick-body {
    max-width: 1040px; display: grid; gap: 16px; align-content: start;
    grid-template-columns: 1.15fr 1fr; grid-auto-flow: dense;
  }
  .quick-body .qsec:nth-child(1), .quick-body .qsec:nth-child(2) { grid-column: 1; }
  .quick-body .qsec:nth-child(n + 3) { grid-column: 2; }
  .quick-body .qsec:nth-child(2) { grid-row: 2 / span 3; }
  .quick-body .qsec:nth-child(3) { grid-row: 1; }
  .quick-body .qsec:nth-child(4) { grid-row: 2; }
  .quick-body .qsec:nth-child(5) { grid-row: 3; }
  .qopps { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .quick-go { background: none; }
}

/* ---------- daily puzzle ---------- */

.daily { height: 100%; display: flex; flex-direction: column; }
.daily-main { flex: 1; min-height: 0; width: 100%; max-width: 720px; margin: 0 auto; padding: 0 16px; display: flex; flex-direction: column; gap: 12px; }
.daily-card { padding: 14px 18px; border-radius: 22px; text-align: center; background: var(--card); border: 1px solid var(--card-line); box-shadow: var(--shadow); }
.dc-title { margin: 6px 0 4px; font: 600 22px/1.15 var(--f-display); }
.dc-prompt { margin: 0; font-size: 14.5px; line-height: 1.35; font-weight: 700; color: var(--ink-2); }
.daily .board-area { flex: 1; min-height: 160px; }
.daily-foot { text-align: center; padding-bottom: calc(var(--sb) + 10px); }
.daily-foot .status-line { padding: 0; min-height: 0; }
.daily-actions { display: flex; justify-content: center; gap: 10px; margin: 8px 0 0; }
.daily-actions:has(> :not([hidden])) { min-height: 44px; }
.tally { display: flex; align-items: center; justify-content: center; gap: 6px; width: fit-content; max-width: 100%; margin: 8px auto 0; padding: 6px 14px; border-radius: 999px; background: var(--card-2); font-weight: 800; font-size: 14px; color: var(--ink-2); }
.tally .ic { width: 16px; height: 16px; color: var(--star); }
.daily.solved .sl-text { background: linear-gradient(180deg, #4fc27b, #2f9e5c); color: #fff; border: 0; }

/* ---------- unlock ---------- */

.unlock { min-height: 100%; display: flex; flex-direction: column; color: var(--ink); }
.unlock-body { flex: 1; width: 100%; max-width: 520px; margin: 0 auto; padding: 0 22px calc(var(--sb) + 22px); display: flex; flex-direction: column; align-items: center; text-align: center; }
.orbs { position: relative; width: 300px; height: 138px; margin: 0 0 6px; }
.orb {
  position: absolute; left: calc(var(--k) * 56px); top: calc(12px + var(--o, 0px));
  width: 76px; height: 76px; border-radius: 50%;
  background-size: cover; background-position: 50% 55%;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .9), 0 12px 26px rgba(0, 0, 0, .35);
  animation: orb-float 5s ease-in-out infinite; animation-delay: calc(var(--k) * -1s);
}
.orb:nth-child(1), .orb:nth-child(5) { --o: 40px; }
.orb:nth-child(2), .orb:nth-child(4) { --o: 14px; }
.orb:nth-child(3) { width: 92px; height: 92px; left: 104px; top: 0; z-index: 2; }
.orb:nth-child(2), .orb:nth-child(4) { z-index: 1; }
@keyframes orb-float { 50% { transform: translateY(-6px); } }
.unlock-title { margin: 6px 0 10px; font: 600 clamp(29px, 8.4vw, 42px)/1.08 var(--f-display); }
.unlock-lede { margin: 0 0 18px; font: 700 16px/1.45 var(--f-body); color: var(--ink-2); }
.unlock-points { list-style: none; margin: 0 0 22px; padding: 0; width: 100%; display: grid; gap: 10px; text-align: left; }
.unlock-points li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 18px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .16); font-size: 15px; line-height: 1.4; font-weight: 600; }
.unlock-points li .ic { width: 22px; height: 22px; margin-top: 1px; color: #ffcf5c; }
.unlock-points b { font-weight: 900; }
.unlock-actions { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.unlock-actions .btn-xl { width: 100%; font-size: 19px; padding: 0 18px; white-space: normal; text-align: center; line-height: 1.15; }
.fine { margin: 0; font-size: 12.5px; color: var(--ink-3); font-weight: 700; }

/* ---------- settings ---------- */

.settings { min-height: 100%; display: flex; flex-direction: column; }
.settings-body { width: 100%; max-width: 600px; margin: 0 auto; padding: 4px 16px calc(var(--sb) + 24px); display: flex; flex-direction: column; gap: 16px; }
.toggles { list-style: none; margin: 0; padding: 6px; border-radius: 26px; background: var(--card); border: 1px solid var(--card-line); box-shadow: var(--shadow); }
.toggles li + li { border-top: 1px solid var(--line); }
.toggle { width: 100%; min-height: 66px; display: flex; align-items: center; gap: 12px; padding: 12px; border: 0; border-radius: 20px; background: none; text-align: left; color: var(--ink); }
.t-text { flex: 1; min-width: 0; }
.t-text b { display: block; font: 600 17px/1.2 var(--f-display); }
.t-text small { display: block; margin-top: 2px; font: 700 13px/1.35 var(--f-body); color: var(--ink-2); }
.t-demo { display: flex; gap: 2px; }
.t-demo .chip-disc { width: 32px; height: 32px; }
.switch { position: relative; width: 54px; height: 32px; flex: none; border-radius: 99px; background: #d8d0e4; transition: background .2s; }
.switch i { position: absolute; left: 3px; top: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0, 0, 0, .2); transition: transform .2s ease; }
.toggle[aria-checked="true"] .switch { background: var(--accent); }
.toggle[aria-checked="true"] .switch i { transform: translateX(22px); }
.about { padding: 16px 18px; border-radius: 24px; background: var(--card-2); border: 1px solid var(--card-line); }
.about h2 { margin: 0 0 6px; font: 600 19px var(--f-display); }
.about p { margin: 0 0 8px; font-size: 14.5px; line-height: 1.5; font-weight: 600; color: var(--ink-2); }
.about .version { margin: 0; font-size: 12.5px; color: var(--ink-3); }

/* ---------- toasts ---------- */

#toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--sb) + 22px); z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 16px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; max-width: 440px;
  padding: 12px 16px; border-radius: 18px; color: #fff; background: rgba(30, 20, 56, .96);
  font: 700 14.5px/1.35 var(--f-body); box-shadow: 0 16px 40px rgba(20, 10, 40, .4);
  opacity: 0; transform: translateY(10px); transition: opacity .25s, transform .25s;
}
.toast.on { opacity: 1; transform: none; }
.toast .ic { width: 20px; height: 20px; color: #ffcf5c; }

/* ---------- small phones ---------- */

@media (max-width: 360px) {
  .topbar { padding-left: calc(var(--sl) + 10px); padding-right: calc(var(--sr) + 10px); gap: 6px; }
  .icon-btn { width: 44px; height: 44px; }
  .tb-title h1 { font-size: 18px; }
  .game-main { padding-left: calc(var(--sl) + 10px); padding-right: calc(var(--sr) + 10px); gap: 8px; }
  .pc-score { font-size: 24px; }
  .btn-xl { font-size: 20px; padding: 0 24px; }
  .title-row .btn { font-size: 14.5px; gap: 6px; padding: 0 8px; }
  .title-row .btn .ic { width: 18px; height: 18px; }
  .seg button { font-size: 14px; }
  .sl-text { font-size: 14px; }
}
@media (max-height: 640px) {
  .pcard { min-height: 54px; padding-top: 4px; padding-bottom: 4px; }
  .pc-face { width: 40px; height: 40px; }
  .goal-card { min-height: 42px; padding-top: 3px; padding-bottom: 3px; }
  .status-line { min-height: 48px; padding-top: 6px; }
  .hero { min-height: 230px; }
  .demo { margin-top: 14px; }
}

/* ---------- reduced motion ---------- */

.rm *, .rm *::before, .rm *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
.rm .disc.fade-in { animation: fade-in .16s ease-out both !important; }
.rm .disc.ghost.fade-out { animation: fade-out .18s ease-in both !important; }
.rm .hint-arrow.on { animation: none; transform: translate(-50%, -110%); }
.rm .glow-moves .cell.legal::after { animation: none; opacity: .9; transform: translate(-50%, -50%); }
.rm .motes { display: none; }
.rm .wm-wave path { stroke-dashoffset: 0; }
