/* Trick or Trade — visual identity: midnight purple, pumpkin, candy pink, slime lime */
:root {
  --font-head: 'Lilita One', 'Arial Rounded MT Bold', system-ui, sans-serif;
  --font-body: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --pumpkin: #ff7a1a;
  --pink: #ff4f9a;
  --lime: #b8f53a;
  --sky: #5cc8ff;
  --gold: #ffd23f;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 10px 30px rgba(10, 0, 30, .25);
  --ease: cubic-bezier(.2, .9, .3, 1.3);
}
html[data-theme='dark'] {
  --bg: #170b2b;
  --bg2: #1f1038;
  --surface: #26164a;
  --surface2: #321f5c;
  --ink: #fff4e6;
  --muted: #cdbde9;
  --line: rgba(255, 255, 255, .12);
  --accent: var(--pumpkin);
  --accent-ink: #1b0b2e;
  --good: #8ff05a;
  --bad: #ff6b81;
  --tray: rgba(0, 0, 0, .22);
  color-scheme: dark;
}
html[data-theme='light'] {
  --bg: #fff5e8;
  --bg2: #ffeeda;
  --surface: #ffffff;
  --surface2: #fbe6cf;
  --ink: #2a1446;
  --muted: #604b80;
  --line: rgba(42, 20, 70, .14);
  --accent: #e5600a;
  --accent-ink: #ffffff;
  --good: #1f8a3b;
  --bad: #c8203f;
  --tray: rgba(42, 20, 70, .06);
  --shadow: 0 10px 26px rgba(80, 40, 10, .14);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(255, 122, 26, .18), transparent 60%),
    radial-gradient(900px 500px at -10% 20%, rgba(255, 79, 154, .12), transparent 60%),
    var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
}
img, svg { max-width: 100%; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 400; line-height: 1.12; margin: 0 0 .5em; letter-spacing: .01em; }
h1 { font-size: clamp(2.4rem, 8vw, 4.6rem); }
h2 { font-size: clamp(1.6rem, 4.6vw, 2.4rem); }
h3 { font-size: 1.3rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 10px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--lime); outline-offset: 2px; }
html[data-theme='light'] :focus-visible { outline-color: #7a2cff; }

.wrap { width: min(1180px, 100% - 32px); margin-inline: auto; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 10px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--font-head); font-size: 1.3rem; color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand img { width: 34px; height: 34px; }
.brand span b { color: var(--pumpkin); font-weight: 400; }
.nav { display: flex; gap: 2px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { color: var(--muted); text-decoration: none; font-weight: 800; font-size: .92rem; padding: 8px 10px; border-radius: 999px; white-space: nowrap; }
.nav a:hover { color: var(--ink); background: var(--surface); }
.nav a[aria-current='page'] { color: var(--accent-ink); background: var(--accent); }
.icon-btn {
  flex: none; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-size: 1.1rem; cursor: pointer; display: grid; place-items: center;
}
.icon-btn:hover { transform: translateY(-1px); }
@media (max-width: 760px) {
  .header-inner { flex-wrap: wrap; padding-block: 6px; }
  .nav { order: 3; width: 100%; margin-left: 0; padding-bottom: 4px; }
  .brand { margin-right: auto; }
}

/* ---------- buttons ---------- */
.btn {
  --b: var(--accent);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 900; font-size: 1rem; letter-spacing: .01em;
  padding: 12px 20px; border-radius: 999px; border: 0; cursor: pointer; text-decoration: none;
  background: var(--b); color: var(--accent-ink);
  box-shadow: 0 4px 0 color-mix(in srgb, var(--b) 60%, #000), 0 10px 20px rgba(0, 0, 0, .18);
  transition: transform .15s var(--ease), box-shadow .15s;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 color-mix(in srgb, var(--b) 60%, #000); }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.btn.pink { --b: var(--pink); color: #fff; }
.btn.lime { --b: var(--lime); color: #1b0b2e; }
.btn.ghost { background: transparent; color: var(--ink); border: 2px solid var(--line); box-shadow: none; }
.btn.ghost:hover { border-color: var(--accent); }
.btn.sm { padding: 8px 14px; font-size: .9rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- hero ---------- */
.hero { padding: 36px 0 24px; position: relative; }
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 28px; align-items: center; }
.kicker { display: inline-flex; align-items: center; gap: 8px; font-weight: 900; font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); padding: 6px 12px; border-radius: 999px; margin-bottom: 14px; }
.hero h1 { margin-bottom: .2em; }
.hero h1 .t1 { color: var(--pumpkin); }
.hero h1 .t2 { color: var(--pink); }
.lede { font-size: 1.15rem; color: var(--muted); max-width: 36em; }
.hero-art { position: relative; aspect-ratio: 1 / .85; }
.pile { position: absolute; inset: 0; }
.pile .pc { position: absolute; width: 19%; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .3)); animation: drop .7s var(--ease) both; }
@keyframes drop { from { transform: translateY(-60px) rotate(var(--r, 0deg)); opacity: 0; } to { transform: translateY(0) rotate(var(--r, 0deg)); opacity: 1; } }
.stat-strip { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-weight: 800; font-size: .88rem; }
@media (max-width: 820px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-art { max-width: 380px; width: 100%; margin: 0 auto; order: -1; aspect-ratio: 1 / .6; }
  .pile .pc { width: 17%; }
}

/* ---------- cards / sections ---------- */
section.block { padding: 28px 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.banner { display: flex; gap: 12px; align-items: center; padding: 14px 18px; border-radius: var(--radius); background: linear-gradient(90deg, color-mix(in srgb, var(--pink) 30%, var(--surface)), var(--surface)); border: 1px solid var(--line); margin: 10px 0 0; font-weight: 800; }
.banner .big { font-size: 1.8rem; }

/* level select */
.levels { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 12px; }
.lvl {
  text-align: left; font: inherit; color: var(--ink); cursor: pointer;
  background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius-sm); padding: 12px 12px 10px;
  display: flex; flex-direction: column; gap: 4px; min-height: 118px; position: relative;
  transition: transform .15s var(--ease), border-color .15s;
}
.lvl:hover { transform: translateY(-3px) rotate(-.5deg); border-color: var(--accent); }
.lvl .num { font-family: var(--font-head); font-size: .95rem; color: var(--accent); }
.lvl .ttl { font-family: var(--font-head); font-size: 1.15rem; line-height: 1.1; }
.lvl .meta { font-size: .8rem; color: var(--muted); margin-top: auto; display: flex; justify-content: space-between; gap: 6px; }
.lvl .stars { letter-spacing: 1px; color: var(--gold); }
.lvl .stars .off { color: var(--line); opacity: .9; }
html[data-theme='light'] .lvl .stars .off { color: #d8c9b8; }
.lvl.meet { background: linear-gradient(135deg, color-mix(in srgb, var(--lime) 28%, var(--surface)), var(--surface)); }
.lvl .badge-bot { position: absolute; top: 8px; right: 8px; font-size: .9rem; }

/* ---------- game ---------- */
#game[hidden] { display: none; }
.game-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.game-top h2 { margin: 0; font-size: clamp(1.3rem, 4vw, 1.9rem); }
.game-top .back { margin-right: auto; }
.rules-line { color: var(--muted); margin: 0 0 12px; }
.hud { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.hud .cell { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; text-align: center; }
.hud .lab { display: block; font-size: .72rem; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.hud .val { font-family: var(--font-head); font-size: 1.35rem; line-height: 1.2; }
.hud .val.bump { animation: bump .45s var(--ease); }
@keyframes bump { 40% { transform: scale(1.3); color: var(--good); } }
.moons { letter-spacing: 1px; font-size: 1rem; }
.board {
  display: grid; gap: 12px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas: "kids kids" "table table" "mine mine";
}
@media (min-width: 980px) {
  .board { grid-template-columns: minmax(0, 1.05fr) minmax(0, .9fr) minmax(0, 1.05fr); grid-template-areas: "mine table kids"; align-items: start; }
}
.pane { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; min-width: 0; }
.pane h3 { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 1.15rem; margin-bottom: 8px; }
.pane h3 small { font-family: var(--font-body); font-weight: 800; font-size: .8rem; color: var(--muted); }
.pane.mine { grid-area: mine; }
.pane.table { grid-area: table; background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 10%, var(--surface)), var(--surface)); }
.pane.kids { grid-area: kids; }

.tokens { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.tok {
  position: relative; font: inherit; color: var(--ink); cursor: pointer;
  background: var(--bg2); border: 2px solid transparent; border-radius: 14px; padding: 6px 4px 5px;
  display: flex; flex-direction: column; align-items: center; gap: 1px; min-height: 92px;
  transition: transform .15s var(--ease), border-color .15s, opacity .15s;
}
.tok:hover { transform: translateY(-2px) rotate(-2deg); border-color: var(--line); }
.tok svg { width: 46px; height: 46px; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .25)); }
.tok .nm { font-size: .7rem; font-weight: 900; line-height: 1.1; text-align: center; max-width: 100%; overflow-wrap: anywhere; }
.tok .v { position: absolute; top: 3px; right: 3px; font-size: .7rem; font-weight: 900; background: var(--pink); color: #fff; border-radius: 999px; padding: 0 6px; line-height: 1.5; }
.tok .v.zero { background: #7a6a92; }
.tok .tv { position: absolute; top: 3px; left: 3px; font-size: .68rem; font-weight: 900; background: var(--sky); color: #08263a; border-radius: 999px; padding: 0 5px; line-height: 1.5; }
.tok[aria-pressed='true'] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 22%, var(--bg2)); transform: translateY(-3px); }
.tok.taxed { opacity: .5; }
.tok.new { animation: pop .5s var(--ease); }
@keyframes pop { from { transform: scale(.4) rotate(-20deg); opacity: 0; } }
.shake { animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.empty-note { color: var(--muted); font-size: .9rem; padding: 10px; text-align: center; grid-column: 1 / -1; }

.kidtabs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: 10px; }
.kid {
  font: inherit; color: var(--ink); text-align: left; cursor: pointer;
  background: var(--bg2); border: 2px solid transparent; border-radius: 14px; padding: 8px 10px;
  display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; align-items: center;
}
.kid .av { font-size: 1.9rem; grid-row: span 2; line-height: 1; }
.kid .kn { font-weight: 900; line-height: 1.1; }
.kid .ks { font-size: .75rem; color: var(--muted); line-height: 1.2; }
.kid .pat { grid-column: 1 / -1; font-size: .72rem; color: var(--muted); display: flex; justify-content: space-between; gap: 4px; }
.kid[aria-pressed='true'] { border-color: var(--pink); background: color-mix(in srgb, var(--pink) 16%, var(--bg2)); }
.kid.gone { opacity: .45; cursor: not-allowed; }
.kid-info { font-size: .86rem; background: var(--tray); border-radius: 12px; padding: 8px 10px; margin-bottom: 10px; }
.kid-info b { color: var(--accent); }
.kid-info .trait { display: inline-block; background: var(--pink); color: #fff; border-radius: 999px; padding: 0 8px; font-weight: 900; font-size: .75rem; margin-right: 4px; }
.speech {
  position: relative; background: var(--ink); color: var(--bg); border-radius: 16px; padding: 10px 14px; font-weight: 800; margin: 10px 0 0;
  min-height: 2.6em;
}
.speech::before { content: ''; position: absolute; top: -8px; left: 22px; border: 8px solid transparent; border-top: 0; border-bottom-color: var(--ink); }
.speech.ok { background: var(--good); color: #0c1f05; }
.speech.ok::before { border-bottom-color: var(--good); }
.speech.no { background: var(--bad); color: #fff; }
.speech.no::before { border-bottom-color: var(--bad); }

.trays { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: stretch; }
.tray { background: var(--tray); border: 2px dashed var(--line); border-radius: 14px; padding: 8px; min-height: 120px; }
.tray h4 { font-family: var(--font-body); font-weight: 900; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 6px; }
.tray .tokens { grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 6px; }
.tray .tok { min-height: 76px; }
.tray .tok svg { width: 36px; height: 36px; }
.swap-ico { align-self: center; font-size: 1.6rem; }
.offer-meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; margin: 10px 0; font-weight: 800; font-size: .92rem; }
.gain.pos { color: var(--good); }
.gain.neg { color: var(--bad); }
.offer-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.offer-actions .btn { flex: 1 1 auto; }
.log { margin-top: 12px; font-size: .85rem; max-height: 160px; overflow: auto; padding-left: 18px; color: var(--muted); }
.log li { margin-bottom: 3px; }
.log li.ok { color: var(--good); }
.howto { margin-top: 16px; }
.howto summary { cursor: pointer; font-weight: 900; }
.howto ol { padding-left: 20px; }

/* ---------- dialog ---------- */
dialog {
  border: 0; padding: 0; border-radius: 24px; background: var(--surface); color: var(--ink);
  width: min(560px, calc(100% - 24px)); max-height: calc(100vh - 24px); box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
}
dialog::backdrop { background: rgba(10, 3, 25, .7); backdrop-filter: blur(3px); }
.dlg { padding: 22px; overflow: auto; }
.dlg h2 { margin-bottom: .2em; }
.result-stars { font-size: 2.6rem; letter-spacing: 6px; color: var(--gold); text-align: center; line-height: 1.2; }
.result-stars .off { color: var(--line); }
.result-stars span { display: inline-block; animation: starpop .5s var(--ease) both; }
.result-stars span:nth-child(2) { animation-delay: .15s; }
.result-stars span:nth-child(3) { animation-delay: .3s; }
@keyframes starpop { from { transform: scale(0) rotate(-90deg); } }
.score-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.score-grid .cell { background: var(--bg2); border-radius: 14px; padding: 10px 6px; text-align: center; }
.score-grid .lab { display: block; font-size: .72rem; font-weight: 900; text-transform: uppercase; color: var(--muted); letter-spacing: .05em; }
.score-grid .val { font-family: var(--font-head); font-size: 1.6rem; }
.receipt { background: #fffdf6; color: #2a1446; border-radius: 6px; padding: 14px 16px; font-family: 'Courier New', monospace; font-size: .85rem; box-shadow: inset 0 0 0 1px #e8dcc2; margin: 12px 0; }
.receipt h4 { font-family: 'Courier New', monospace; font-size: .95rem; text-align: center; margin-bottom: 6px; }
.receipt ul { list-style: none; margin: 0; padding: 0; }
.receipt li { border-bottom: 1px dashed #d9caa8; padding: 3px 0; }
.receipt .tot { display: flex; justify-content: space-between; font-weight: 700; margin-top: 6px; }

/* ---------- map ---------- */
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px; gap: 2px; flex-wrap: wrap; }
.seg button { font: inherit; font-weight: 900; font-size: .9rem; border: 0; background: transparent; color: var(--muted); padding: 8px 14px; border-radius: 999px; cursor: pointer; }
.seg button[aria-pressed='true'] { background: var(--accent); color: var(--accent-ink); }
.tilemap { display: grid; grid-template-columns: repeat(11, minmax(0, 1fr)); gap: 4px; margin: 16px 0; }
.tile {
  font: inherit; aspect-ratio: 1; border-radius: 10px; border: 2px solid transparent; cursor: pointer; position: relative; padding: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; font-weight: 900; font-size: clamp(.55rem, 1.6vw, .9rem);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .6); transition: transform .15s var(--ease);
  overflow: hidden;
}
.tile svg { width: 58%; height: 58%; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .35)); }
.tile .ab { position: absolute; top: 2px; left: 4px; font-size: clamp(.5rem, 1.4vw, .78rem); }
.tile:hover { transform: scale(1.12); z-index: 2; }
.tile[aria-pressed='true'] { border-color: var(--ink); transform: scale(1.12); z-index: 3; }
.tile.dim { opacity: .22; }
.tile .chg { position: absolute; bottom: 2px; right: 3px; font-size: .7em; }
.map-layout { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .map-layout { grid-template-columns: 1fr; } }
.state-card { min-height: 220px; }
.state-card .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.state-card .pick { background: var(--bg2); border-radius: 14px; padding: 10px; text-align: center; }
.state-card .pick svg { width: 64px; height: 64px; }
.state-card .pick .src { font-size: .72rem; text-transform: uppercase; font-weight: 900; letter-spacing: .06em; color: var(--muted); }
.state-card .pick .cn { font-weight: 900; }
.legend { display: flex; flex-wrap: wrap; gap: 6px; }
.legend button { font: inherit; display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border-radius: 999px; background: var(--bg2); border: 1px solid var(--line); font-size: .82rem; font-weight: 800; color: var(--ink); cursor: pointer; }
.legend button[aria-pressed='true'] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 20%, var(--bg2)); }
.legend .sw { width: 22px; height: 22px; border-radius: 50%; display: inline-block; border: 2px solid rgba(255, 255, 255, .6); }
.legend .n { color: var(--muted); }
.bars { display: grid; gap: 6px; }
.bar-row { display: grid; grid-template-columns: 9.5em 1fr 2em; gap: 8px; align-items: center; font-size: .86rem; font-weight: 800; }
.bar-row .track { height: 14px; background: var(--bg2); border-radius: 999px; overflow: hidden; }
.bar-row .fill { height: 100%; border-radius: 999px; transition: width .6s ease; }
.compare-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .compare-cols { grid-template-columns: 1fr; } .bar-row { grid-template-columns: 7.5em 1fr 2em; } }
ol.rank { padding-left: 1.6em; margin: 0; }
ol.rank li { padding: 3px 0; font-weight: 700; }

/* quiz */
.quiz-box { max-width: 640px; margin: 0 auto; }
.q-state { font-family: var(--font-head); font-size: clamp(1.8rem, 6vw, 2.8rem); text-align: center; margin: 6px 0; }
.q-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.q-opt { font: inherit; font-weight: 900; color: var(--ink); background: var(--bg2); border: 2px solid var(--line); border-radius: 16px; padding: 10px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.q-opt svg { width: 52px; height: 52px; }
.q-opt:hover { border-color: var(--accent); }
.q-opt.right { border-color: var(--good); background: color-mix(in srgb, var(--good) 22%, var(--bg2)); }
.q-opt.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 22%, var(--bg2)); }
.q-progress { height: 8px; background: var(--bg2); border-radius: 99px; overflow: hidden; margin: 10px 0; }
.q-progress div { height: 100%; background: linear-gradient(90deg, var(--pumpkin), var(--pink)); transition: width .3s; }

/* ---------- twin ---------- */
.picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.pk { position: relative; font: inherit; color: var(--ink); background: var(--surface); border: 2px solid var(--line); border-radius: 16px; padding: 8px 4px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; transition: transform .15s var(--ease); }
.pk svg { width: 52px; height: 52px; }
.pk .nm { font-size: .78rem; font-weight: 900; text-align: center; line-height: 1.15; }
.pk:hover { transform: translateY(-2px); }
.pk .rk { position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: var(--pumpkin); color: #1b0b2e; font-weight: 900; font-size: .8rem; display: grid; place-items: center; }
.pk.chosen { border-color: var(--pumpkin); background: color-mix(in srgb, var(--pumpkin) 16%, var(--surface)); }
.pk.never { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, var(--surface)); }
.pk.never .rk { background: var(--bad); color: #fff; }
.mode-bar { position: sticky; top: 64px; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; box-shadow: var(--shadow); }
@media (max-width: 760px) { .mode-bar { top: 100px; } }
.mode-bar .grow { flex: 1 1 200px; font-weight: 800; }
.twin-result { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 820px) { .twin-result { grid-template-columns: 1fr; } }
.twin-hero { text-align: center; background: linear-gradient(160deg, color-mix(in srgb, var(--pink) 30%, var(--surface)), var(--surface) 70%); }
.twin-hero .st { font-family: var(--font-head); font-size: clamp(2.4rem, 9vw, 4rem); color: var(--pumpkin); line-height: 1; margin: 6px 0; }
.twin-hero .arch { font-family: var(--font-head); font-size: 1.5rem; }
.persona-emoji { font-size: 3rem; }
canvas.card-canvas { width: 100%; height: auto; border-radius: 16px; box-shadow: var(--shadow); display: block; }

/* ---------- tier ---------- */
.tiers { display: grid; gap: 8px; }
.tier-row { display: grid; grid-template-columns: 64px 1fr; min-height: 76px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: var(--surface); }
.tier-row .lbl { font: inherit; font-family: var(--font-head); font-size: 1.8rem; border: 0; cursor: pointer; color: #1b0b2e; }
.tier-row .slots { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; align-content: flex-start; }
.tier-row.target .slots { background: var(--tray); }
.tc { font: inherit; color: var(--ink); background: var(--bg2); border: 2px solid transparent; border-radius: 12px; width: 70px; padding: 4px 2px; cursor: pointer; display: flex; flex-direction: column; align-items: center; }
.tc svg { width: 40px; height: 40px; }
.tc .nm { font-size: .64rem; font-weight: 900; line-height: 1.1; text-align: center; }
.tc[aria-pressed='true'] { border-color: var(--accent); transform: translateY(-2px); }
.pool { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px; border-radius: 14px; background: var(--surface); border: 2px dashed var(--line); min-height: 90px; }
.hot-take { border-left: 6px solid var(--pink); }

/* ---------- about ---------- */
.prose { max-width: 760px; }
.prose h2 { margin-top: 1.4em; }
.prose li { margin-bottom: .4em; }
.src-list li { overflow-wrap: anywhere; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); margin-top: 40px; padding: 24px 0 40px; color: var(--muted); font-size: .9rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; }
.site-footer a { color: var(--muted); }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 140%); background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 999px; font-weight: 900; z-index: 200; transition: transform .3s var(--ease); max-width: calc(100% - 32px); text-align: center; }
.toast.show { transform: translate(-50%, 0); }

/* confetti */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 150; overflow: hidden; }
.confetti i { position: absolute; top: -40px; width: 34px; height: 34px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .confetti { display: none; }
}
@media (max-width: 420px) {
  .hud { grid-template-columns: repeat(2, 1fr); }
  .tokens { grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); }
  .trays { grid-template-columns: 1fr; }
  .swap-ico { transform: rotate(90deg); justify-self: center; }
  .q-opts { grid-template-columns: 1fr 1fr; }
  .tilemap { gap: 2px; }
  .tile { border-radius: 6px; }
}
