:root {
  --bg: #312e2b;
  --bg2: #262421;
  --bg3: #1f1e1b;
  --panel: #262421;
  --line: #3c3a37;
  --text: #ffffff;
  --muted: #b5b3b0;
  --accent: #81b64c;
  --accent-d: #45753c;
  --light: #ebecd0;
  --dark: #739552;
  --common: #8f8d89;
  --rare: #4aa3ff;
  --chaos: #d64bff;
  --radius: 10px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}
a { color: var(--accent); }
.hidden { display: none !important; }
button { font: inherit; color: inherit; }

/* ------------------------------------------------------------ top bar */
.topbar {
  height: 52px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; background: var(--bg3); border-bottom: 1px solid #000;
  position: sticky; top: 0; z-index: 30;
}
.logo { color: var(--text); text-decoration: none; font-weight: 800; font-size: 20px; letter-spacing: -.3px; }
.logo sup { color: var(--accent); }
.logo-k { color: var(--accent); }
.icon-btn { background: none; border: 0; font-size: 20px; cursor: pointer; padding: 6px; border-radius: 8px; }
.icon-btn:hover { background: #ffffff14; }
main { flex: 1; }
.foot { text-align: center; color: #77756f; font-size: 12px; padding: 14px 16px 18px; }

/* ------------------------------------------------------------ buttons */
.btn {
  background: #3c3a37; border: 0; border-bottom: 3px solid #2a2926; color: #fff; border-radius: 8px;
  padding: 9px 14px; font-weight: 700; cursor: pointer; transition: background .12s, transform .06s;
}
.btn:hover { background: #4a4844; }
.btn:active { transform: translateY(2px); border-bottom-width: 1px; margin-bottom: 2px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--accent); border-bottom-color: var(--accent-d); }
.btn.primary:hover { background: #95c95d; }
.btn.ghost { background: transparent; border-bottom-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: #ffffff12; color: #fff; }
.btn.big { font-size: 19px; padding: 16px 20px; width: 100%; text-align: left; border-radius: 12px; }
.btn.on { background: var(--accent); border-bottom-color: var(--accent-d); }

/* ------------------------------------------------------------ lobby */
.hero {
  max-width: 1100px; margin: 0 auto; padding: 48px 16px; display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; align-items: center;
}
.hero h1 { font-size: clamp(36px, 6vw, 64px); margin: 0 0 12px; letter-spacing: -1.5px; line-height: 1.02; }
.asterisk { color: var(--chaos); }
.tagline { color: var(--muted); font-size: 17px; margin: 0 0 24px; max-width: 520px; }
.menu { display: flex; flex-direction: column; gap: 10px; max-width: 420px; }
.color-pick { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 6px 4px; color: var(--muted); animation: pop .2s; }
.fine { color: #8b8984; font-size: 12px; margin-top: 22px; max-width: 420px; }
.hero-cards { position: relative; height: 380px; }
.hero-cards .card { position: absolute; left: 50%; top: 40px; margin-left: -100px; transition: transform .3s; }
.hero-cards .fan0 { transform: rotate(-14deg) translateX(-120px) translateY(20px); }
.hero-cards .fan1 { transform: rotate(0) translateY(-10px); z-index: 2; }
.hero-cards .fan2 { transform: rotate(14deg) translateX(120px) translateY(20px); }
.hero-cards:hover .fan0 { transform: rotate(-18deg) translateX(-150px) translateY(10px); }
.hero-cards:hover .fan2 { transform: rotate(18deg) translateX(150px) translateY(10px); }
.hero-cards:hover .fan1 { transform: translateY(-24px); }
@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; padding-top: 24px; gap: 8px; }
  .hero-cards { height: 330px; transform: scale(.82); transform-origin: top center; }
}

/* ------------------------------------------------------------ library */
.lib-head { max-width: 1200px; margin: 0 auto; padding: 20px 16px 8px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.lib-head h2 { margin: 0 12px 0 0; }
.lib-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.lib-grid { max-width: 1200px; margin: 0 auto; padding: 12px 16px 40px; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; justify-items: center; }

/* ------------------------------------------------------------ cards */
.card {
  width: 200px; height: 286px; border-radius: 14px; padding: 12px 12px 14px; position: relative; flex: none;
  display: flex; flex-direction: column; align-items: center; text-align: center; user-select: none;
  background: linear-gradient(160deg, #45433f, #2a2926 70%);
  border: 2px solid #5d5b57; box-shadow: 0 10px 24px #0008, inset 0 1px 0 #ffffff1a;
}
.card-top { display: flex; justify-content: space-between; width: 100%; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; }
.card .rar { padding: 2px 7px; border-radius: 99px; background: #ffffff1a; }
.card .kind { color: #d6d3cf; padding: 2px 0; }
.card-icon { font-size: 64px; line-height: 1; margin: 18px 0 10px; filter: drop-shadow(0 6px 8px #0007); }
.card-name { font-weight: 900; font-size: 19px; line-height: 1.1; margin-bottom: 8px; }
.card-desc { font-size: 12.5px; color: #dcd9d4; line-height: 1.35; }
.card.r-rare { background: linear-gradient(160deg, #23476f, #15253b 70%); border-color: var(--rare); box-shadow: 0 10px 24px #0008, 0 0 18px #4aa3ff55; }
.card.r-rare .rar { background: var(--rare); color: #04172b; }
.card.r-chaos { background: linear-gradient(160deg, #5a1d6e, #22102b 65%); border-color: transparent; box-shadow: 0 10px 24px #0008, 0 0 26px #d64bff77; }
.card.r-chaos::before {
  content: ''; position: absolute; inset: -2px; border-radius: 15px; padding: 2px; pointer-events: none;
  background: conic-gradient(from var(--ang, 0deg), #ff4d6d, #ffbe0b, #3affb0, #3a86ff, #d64bff, #ff4d6d);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  animation: spinang 3s linear infinite;
}
.card.r-chaos .rar { background: linear-gradient(90deg, #ff4d6d, #d64bff); color: #fff; }
@property --ang { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
@keyframes spinang { to { --ang: 360deg; } }

/* ------------------------------------------------------------ game layout */
.game-layout {
  display: flex; gap: 20px; justify-content: center; align-items: flex-start;
  padding: 16px; max-width: 1280px; margin: 0 auto;
}
.board-col { width: min(calc(100vh - 170px), calc(100vw - 32px), 780px); min-width: 280px; flex: none; }
.side { width: 340px; display: flex; flex-direction: column; gap: 10px; max-height: calc(100vh - 90px); position: sticky; top: 68px; }
@media (max-width: 980px) {
  .game-layout { flex-direction: column; align-items: center; padding: 8px 16px; gap: 12px; }
  .board-col { width: min(calc(100vw - 32px), 620px); }
  .side { width: min(calc(100vw - 32px), 620px); max-height: none; position: static; }
  #feed { max-height: 220px; }
}
.panel { background: var(--panel); border-radius: var(--radius); padding: 12px 14px; }
.panel h3 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; color: var(--muted); letter-spacing: .6px; }
.panel.grow { flex: 1; min-height: 120px; display: flex; flex-direction: column; overflow: hidden; }
.status .st-main { font-size: 17px; font-weight: 800; }
.status .st-sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.controls { display: flex; gap: 8px; flex-wrap: wrap; }
.controls .btn { flex: 1; white-space: nowrap; }

.invite p { margin: 0 0 8px; color: var(--muted); font-size: 13px; }
.invite-row { display: flex; gap: 6px; }
.invite-row input { flex: 1; min-width: 0; background: #1a1917; border: 1px solid var(--line); color: #fff; border-radius: 8px; padding: 8px; font-size: 13px; }
.invite .btn.ghost { margin-top: 6px; width: 100%; }

#rules { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; }
#rules .empty { color: #8b8984; font-size: 13px; font-style: italic; }
.rule { background: #ffffff0a; border-radius: 8px; padding: 6px 8px; border-left: 3px solid var(--common); animation: slidein .35s; }
.rule.r-rare { border-left-color: var(--rare); }
.rule.r-chaos { border-left-color: var(--chaos); }
.rule summary { display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; }
.rule summary::-webkit-details-marker { display: none; }
.ricon { font-size: 18px; }
.rname { flex: 1; font-weight: 700; font-size: 13.5px; }
.rleft { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rowner { width: 10px; height: 10px; border-radius: 50%; border: 1px solid #000; }
.rowner.o-w { background: #fff; } .rowner.o-b { background: #000; border-color: #888; }
.rule p { margin: 6px 0 2px; font-size: 12.5px; color: #cfccc7; }
.rbar { height: 3px; background: #ffffff14; border-radius: 3px; margin-top: 5px; overflow: hidden; }
.rbar div { height: 100%; background: var(--accent); transition: width .4s; }
.rule.r-chaos .rbar div { background: var(--chaos); }
.rule.r-rare .rbar div { background: var(--rare); }

#feed { overflow-y: auto; display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.fi { padding: 3px 6px; border-radius: 6px; animation: slidein .25s; }
.fi.move { color: #d9d6d1; font-variant-numeric: tabular-nums; }
.fi.note { color: #a9a6a1; font-size: 12.5px; }
.fi.fcard { background: #ffffff0d; }
.fi.fcard.r-chaos { background: #d64bff22; }
.fi.fcard.r-rare { background: #4aa3ff1f; }
.mv-w { color: #fff; } .mv-b { color: #9e9b96; }

/* ------------------------------------------------------------ player bars */
.player-bar { display: flex; align-items: center; gap: 10px; padding: 7px 4px; min-height: 48px; border-radius: 8px; transition: background .2s; }
.player-bar.active { background: #ffffff0d; }
.avatar { width: 36px; height: 36px; border-radius: 6px; display: grid; place-items: center; font-size: 26px; background: #4a4844; }
.av-w { background: #e8e6e1; color: #222; } .av-b { background: #1e1e1e; color: #ddd; border: 1px solid #555; }
.pname { font-weight: 800; display: flex; align-items: center; gap: 6px; }
.captured { display: flex; align-items: center; font-size: 18px; line-height: 1; flex-wrap: wrap; margin-left: 2px; min-width: 0; flex: 1; }
@media (max-width: 600px) { .captured { font-size: 13px; } .pname { font-size: 14px; } .avatar { width: 30px; height: 30px; font-size: 21px; } }
.captured span { margin-right: -3px; }
.cap-w { color: #fff; text-shadow: 0 0 1px #000, 0 0 1px #000; }
.cap-b { color: #111; text-shadow: 0 0 1px #999; }
.adv { color: var(--muted); font-size: 13px; margin-left: 8px !important; font-weight: 700; }
.turn-pill { white-space: nowrap; margin-left: auto; background: var(--accent); color: #fff; font-weight: 800; font-size: 12px; padding: 3px 9px; border-radius: 99px; animation: pulse 1.6s infinite; }
.conn { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.conn.on { background: var(--accent); } .conn.off { background: #e0533d; }

/* ------------------------------------------------------------ board */
.board-wrap { position: relative; width: 100%; aspect-ratio: 1; border-radius: 4px; box-shadow: 0 6px 30px #0007; }
.board { position: absolute; inset: 0; container-type: inline-size; touch-action: none; user-select: none; -webkit-user-select: none; border-radius: 4px; overflow: hidden; }
.layer { position: absolute; inset: 0; pointer-events: none; }
.layer-fx { overflow: visible; z-index: 9; }
.layer-pieces { z-index: 5; }
.layer-fog { z-index: 6; }
.layer-hints { z-index: 4; }
.sq, .pc, .ter, .mark, .hint, .fogsq { position: absolute; left: 0; top: 0; width: 12.5%; height: 12.5%; }
.sq.light { background: var(--light); }
.sq.dark { background: var(--dark); }
.sq::after { content: ''; position: absolute; inset: 0; }
.sq.hl-last::after { background: rgba(255, 255, 51, .45); }
.sq.hl-sel::after { background: rgba(255, 255, 51, .55); }
.sq.hl-check::after { background: radial-gradient(circle, #ff0000 0%, #e70000cc 25%, #a9000000 89%); }
.sq.hl-hover::after { box-shadow: inset 0 0 0 calc(0.6cqw) #ffffffcc; }
.sq.hl-target::after { background: rgba(214, 75, 255, .38); box-shadow: inset 0 0 0 calc(.4cqw) #f3b6ff; animation: tpulse 1s ease-in-out infinite; }
.coord { position: absolute; font-weight: 700; font-size: max(9px, 1.6cqw); line-height: 1; }
.coord.rank { left: 4%; top: 4%; }
.coord.file { right: 5%; bottom: 3%; }
.sq.light .coord { color: var(--dark); } .sq.dark .coord { color: var(--light); }

.pc { z-index: 2; transition: transform .2s cubic-bezier(.25, .8, .35, 1); will-change: transform; }
.pc img { width: 100%; height: 100%; display: block; pointer-events: none; }
.pc.dragging { z-index: 50; transition: none; cursor: grabbing; }
.pc.dragging > img, .pc.dragging > .token { transform: scale(1.12); filter: drop-shadow(0 6px 6px #0006); }
.pc.fling { transition: transform .5s cubic-bezier(.3, -.4, .4, 1.4); }
.pc > img, .pc > .token { transition: transform .12s; }
.pc.spawn > img, .pc.spawn > .token { animation: spawnIn .45s cubic-bezier(.3, 1.6, .5, 1) both; animation-delay: inherit; }
.pc.morph > img, .pc.morph > .token { animation: morph .55s ease-out; }
.pc.tp > img, .pc.tp > .token { animation: tpIn .4s ease-out; }
.pc.fadeout { opacity: 0; transition: opacity .25s; }
.pc.zombie img { filter: sepia(1) hue-rotate(55deg) saturate(3.2) brightness(.85); }
.pc.frozen img { filter: saturate(.3) brightness(1.15) drop-shadow(0 0 6px #9be7ff); }
.pc.dragon img { filter: drop-shadow(0 0 7px #ff3b1f) hue-rotate(-20deg); }
.token {
  position: absolute; inset: 10%; border-radius: 50%; display: grid; place-items: center;
  font-size: 6.2cqw; line-height: 1; box-shadow: 0 3px 6px #0006;
}
.token.w { background: radial-gradient(circle at 35% 30%, #fff, #cfcac2); border: .4cqw solid #fff; }
.token.b { background: radial-gradient(circle at 35% 30%, #5b5753, #1d1c1a); border: .4cqw solid #000; }
.token.n { background: radial-gradient(circle at 35% 30%, #c5e3a3, #6c8f48); border: .4cqw solid #3d5528; }
.token.mask { font-size: 5cqw; font-weight: 900; color: #888; }
.token.mask.b { color: #aaa; }
.badges { position: absolute; left: 2%; bottom: 0; font-size: 2.3cqw; line-height: 1; text-shadow: 0 1px 2px #000; pointer-events: none; white-space: nowrap; }
.flames { position: absolute; inset: 40% 10% 0; background: radial-gradient(ellipse at 50% 100%, #ffb30088, #ff450055 50%, transparent 70%); animation: flicker .25s infinite alternate; pointer-events: none; }

.hint::after { content: ''; position: absolute; inset: 0; background: radial-gradient(circle, rgba(0, 0, 0, .16) 24%, transparent 25%); }
.hint.cap::after { background: radial-gradient(circle, transparent 78%, rgba(0, 0, 0, .16) 79%); }

/* dying pieces */
.pc.dying { transition: none; }
.pc.dying > * { animation: dieDefault .45s ease-in forwards; }
.pc.d-boom > * { animation: dieBoom .5s ease-out forwards; animation-delay: .12s; }
.pc.d-burn > * { animation: dieBurn .8s ease-in forwards; }
.pc.d-dust > * { animation: dieDust .9s ease-in forwards; }
.pc.d-ascend > * { animation: dieAscend .9s ease-in forwards; }
.pc.d-fall > * { animation: dieFall .6s ease-in forwards; }
.pc.d-sink > * { animation: dieSink .6s ease-in forwards; }
.pc.d-void > * { animation: dieVoid .7s ease-in forwards; }
.pc.d-flat > * { animation: dieFlat .4s ease-in forwards; transform-origin: bottom; }
.pc.d-chomp > * { animation: dieChomp .5s ease-in forwards; }
.pc.d-melt > * { animation: dieMelt .7s ease-in forwards; transform-origin: bottom; }

/* terrain */
.ter { z-index: 1; display: grid; place-items: center; font-size: 5cqw; }
.ter-wall { background: repeating-linear-gradient(0deg, #8d4b2f 0 22%, #5e2e1b 22% 25%), #8d4b2f; box-shadow: inset 0 0 0 .3cqw #00000055; }
.ter-wall::before { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 46%, #5e2e1b 46% 50%); opacity: .7; }
.ter-lava { background: radial-gradient(circle at 30% 30%, #ffd166, #ff7b00 40%, #c1121f 80%); animation: lava 1.6s ease-in-out infinite alternate; box-shadow: 0 0 2cqw #ff5a0099; }
.ter-hole { background: radial-gradient(circle, #000 35%, #241913 65%, #3e2a1b 80%, transparent 82%); }
.ter-water { background: linear-gradient(180deg, #4ea8de66, #1e6091aa); animation: water 2s ease-in-out infinite alternate; }
.ter-portal { border-radius: 50%; }
.ter-portal::before { content: ''; position: absolute; inset: 8%; border-radius: 50%; border: 1.1cqw solid; animation: spin 1.5s linear infinite; }
.ter-portal.portal0::before { border-color: #2f8cff #9fd0ff #2f8cff #155fbf; box-shadow: 0 0 2cqw #2f8cff, inset 0 0 2cqw #2f8cff; }
.ter-portal.portal1::before { border-color: #ff8a1f #ffd29e #ff8a1f #c45d00; box-shadow: 0 0 2cqw #ff8a1f, inset 0 0 2cqw #ff8a1f; }
.ter-tramp::before { content: ''; position: absolute; inset: 12%; border-radius: 50%; background: radial-gradient(circle, #222 45%, #e63946 47% 60%, #222 62%); box-shadow: 0 2px 4px #0006; }
.ter-banana span, .ter-mine span { filter: drop-shadow(0 2px 2px #0006); }
.ter-mine { opacity: .65; }
.ter-belt { background: repeating-linear-gradient(90deg, #2b2b2b 0 30%, #444 30% 50%); background-size: 50% 100%; animation: belt .6s linear infinite; opacity: .75; }
.ter-belt::after { content: '›'; position: absolute; inset: 0; display: grid; place-items: center; font-size: 6cqw; color: #ffd60a; font-weight: 900; }
.mark { z-index: 3; display: grid; place-items: center; font-size: 4.8cqw; }
.mark-storm { background: #7b2cbf88; box-shadow: inset 0 0 1.5cqw #c77dff; }
.mark-target { background: #e6394640; box-shadow: inset 0 0 0 .3cqw #e63946aa; animation: tpulse .8s infinite; }
.mark-warn { background: radial-gradient(circle, #ff7b0099, transparent 70%); animation: tpulse .7s infinite; }
.mark-lane { background: repeating-linear-gradient(45deg, #ffd60a55 0 10%, transparent 10% 20%); font-size: 3cqw; }
.mark-ufo span { animation: bob 1.2s ease-in-out infinite alternate; font-size: 6cqw; }
.mark-ufo::before { content: ''; position: absolute; inset: 30% 18% 0; background: linear-gradient(#b9fbc066, #b9fbc000); clip-path: polygon(35% 0, 65% 0, 100% 100%, 0 100%); }
.mark-tornado span, .mark-void span { animation: spin 1s linear infinite; font-size: 6cqw; display: inline-block; }
.mark-void { background: radial-gradient(circle, #000, #3c096c88 60%, transparent 75%); }
.mark-wave { background: #4ea8de44; font-size: 3.2cqw; }
.fogsq { background: #1d1c1aee; z-index: 6; }

/* effects */
.fx { position: absolute; transform: translate(-50%, -50%); pointer-events: none; }
.fx.boom { width: calc(var(--r, 1) * 12.5%); aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, #fff 0%, #ffe066 25%, #ff7b00 55%, #ff000000 70%); animation: boom .7s ease-out forwards; }
.fx.boom.fire { background: radial-gradient(circle, #ffd166, #ff4800 50%, transparent 70%); }
.fx.boom i { position: absolute; left: 50%; top: 50%; width: 1cqw; height: 1cqw; border-radius: 50%; background: #ffbe0b; box-shadow: 0 0 6px #ff7b00; animation: spark .7s ease-out forwards; }
.fx.bubble { background: #fff; color: #222; font-weight: 900; padding: 4px 10px; border-radius: 12px; font-size: 2.6cqw; animation: bubble 1s ease-out forwards; }
.fx.emoji-pop { font-size: 9cqw; animation: emojipop 1s ease-out forwards; }
.fx.emoji-pop.small { font-size: 5cqw; }
.fx.beam { width: 12.5%; height: 200%; transform: translate(-50%, -100%); background: linear-gradient(#b9fbc000, #b9fbc0cc); animation: beam 1s ease-out forwards; transform-origin: bottom; }
.fx.car { font-size: 7cqw; transform: translate(0, -50%); animation: car .9s ease-in forwards; white-space: nowrap; }
.fx.wave-fx { inset: 0; transform: none; background: linear-gradient(90deg, #4ea8decc 0 12.5%, transparent 12.5% 87.5%, #4ea8decc 87.5%); animation: wave 1.1s ease-out forwards; }
.board.shake { animation: shake .35s; }
.board.shake-big { animation: shakeBig .55s; }

/* board overlays */
#boardOverlay { position: absolute; inset: 0; z-index: 20; pointer-events: none; }
#boardOverlay button { pointer-events: auto; }
.wait-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; gap: 18px; align-items: center; justify-content: center;
  text-align: center; background: #0009; backdrop-filter: blur(2px); font-size: 17px; animation: fadein .25s; border-radius: 4px;
}
.wait-overlay.paused { background: #0b0a14a8; }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 5px solid #ffffff33; border-top-color: var(--accent); animation: spin .8s linear infinite; }
.backs { display: flex; gap: 10px; }
.cback { width: 54px; height: 78px; border-radius: 8px; border: 2px solid #d64bff; background: repeating-linear-gradient(45deg, #3c1452 0 6px, #2a0f3a 6px 12px); box-shadow: 0 0 14px #d64bff66; animation: bob .7s ease-in-out infinite alternate; }
.cback:nth-child(2) { animation-delay: .2s; } .cback:nth-child(3) { animation-delay: .4s; }
.target-banner {
  position: absolute; left: 50%; top: 10px; transform: translateX(-50%); display: flex; gap: 10px; align-items: center;
  background: #1f1e1bee; border: 2px solid var(--common); border-radius: 12px; padding: 8px 14px; font-size: 14px;
  box-shadow: 0 6px 18px #0008; animation: drop .3s cubic-bezier(.3, 1.5, .5, 1); max-width: 92%;
}
.target-banner.r-rare { border-color: var(--rare); } .target-banner.r-chaos { border-color: var(--chaos); }
.target-banner .ti { font-size: 28px; }
.gameover { position: absolute; inset: 0; display: grid; place-items: center; background: #0008; animation: fadein .4s; border-radius: 4px; }
.go-card { background: var(--bg2); border-radius: 14px; padding: 24px 30px; text-align: center; box-shadow: 0 10px 40px #000a; animation: pop .4s cubic-bezier(.3, 1.6, .5, 1); }
.go-title { font-size: 30px; font-weight: 900; }
.go-reason { color: var(--muted); margin: 4px 0 18px; }
.go-btns { display: flex; gap: 10px; justify-content: center; }

/* card pick overlay */
#overlay.pick, #overlay.promo { position: fixed; inset: 0; z-index: 100; background: #000000c4; backdrop-filter: blur(4px); display: grid; place-items: center; animation: fadein .25s; transition: opacity .2s; overflow-y: auto; }
#overlay.pick.peeking { opacity: .06; }
.pick-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 20px 12px; }
.pick-title { font-size: 32px; font-weight: 900; letter-spacing: -.5px; animation: drop .4s cubic-bezier(.3, 1.5, .5, 1); }
.pick-sub { color: var(--muted); margin-bottom: 14px; text-align: center; }
.pick-row { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; perspective: 900px; }
.pick-row .card { cursor: pointer; transition: transform .18s, box-shadow .18s, opacity .3s; }
.pick-row .card.deal { animation: deal .55s cubic-bezier(.2, 1.3, .4, 1) both; animation-delay: calc(var(--i) * 120ms); }
.pick-row .card:hover { transform: translateY(-12px) rotateX(6deg) scale(1.04); }
.pick-row .card.chosen { animation: chosen .65s ease forwards; z-index: 3; }
.pick-row .card.discard { animation: discard .45s ease-in forwards; pointer-events: none; }
@media (max-width: 700px) {
  .pick-row { gap: 10px; }
  .pick-row .card { width: 150px; height: 230px; padding: 9px; }
  .pick-row .card .card-icon { font-size: 44px; margin: 10px 0 6px; }
  .pick-row .card .card-name { font-size: 16px; }
  .pick-row .card .card-desc { font-size: 11.5px; }
  .pick-title { font-size: 26px; }
}
.promo-box { background: var(--bg2); padding: 16px; border-radius: 14px; animation: pop .25s; }
.promo-row { display: flex; gap: 8px; }
.promo-row button { width: 72px; height: 72px; background: var(--light); border: 0; border-radius: 10px; cursor: pointer; padding: 4px; }
.promo-row button:hover { background: #f5f682; }
.promo-row img { width: 100%; }

/* reveal */
.reveal { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 90; pointer-events: none; display: flex; flex-direction: column; align-items: center; gap: 10px; animation: revealIn .5s cubic-bezier(.3, 1.5, .5, 1); }
.reveal-label { background: #000c; padding: 5px 14px; border-radius: 99px; font-weight: 800; }
.reveal.out { animation: revealOut .45s ease-in forwards; }

.slots, .coinpop { position: absolute; inset: 0; display: grid; place-items: center; z-index: 25; pointer-events: none; animation: fadein .2s; }
.slot-box { display: flex; gap: 8px; background: linear-gradient(#d4a017, #8a6408); padding: 12px; border-radius: 14px; box-shadow: 0 10px 30px #000a; }
.reel { width: 70px; height: 80px; background: #fff; border-radius: 8px; overflow: hidden; position: relative; color: #111; font-size: 52px; }
.reel .strip { position: absolute; left: 0; right: 0; text-align: center; word-break: break-all; width: 70px; line-height: 80px; animation: reel .25s linear infinite; }
.reel .final { position: absolute; inset: 0; display: grid; place-items: center; background: #fff; opacity: 0; animation: reelstop .2s forwards; animation-delay: calc(.8s + var(--i) * .45s); }
.coin { width: 110px; height: 110px; position: relative; transform-style: preserve-3d; animation: flipH 1.4s cubic-bezier(.3, .6, .4, 1) forwards; }
.coin.tails { animation-name: flipT; }
.coin .face { position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center; font-size: 56px; background: radial-gradient(circle at 35% 30%, #ffe28a, #d4a017 60%, #8a6408); border: 4px solid #8a6408; backface-visibility: hidden; }
.coin .back { transform: rotateY(180deg); }

/* toasts */
#toasts { position: fixed; top: 62px; left: 50%; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; width: max-content; max-width: 94vw; }
.toast { background: #1b1a18f0; border: 1px solid #45433f; padding: 8px 14px; border-radius: 99px; box-shadow: 0 6px 16px #0008; display: flex; gap: 8px; align-items: center; font-weight: 700; font-size: 14px; animation: toastIn .35s cubic-bezier(.3, 1.5, .5, 1); }
.toast .ticon { font-size: 18px; }
.toast.out { animation: toastOut .35s ease-in forwards; }

/* ------------------------------------------------------------ keyframes */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .65; } }
@keyframes tpulse { 50% { opacity: .45; } }
@keyframes fadein { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.7); opacity: 0; } }
@keyframes drop { from { transform: translate(-50%, -30px); opacity: 0; } }
.pick-title { --x: 0; }
@keyframes slidein { from { transform: translateX(12px); opacity: 0; } }
@keyframes bob { from { transform: translateY(-3px); } to { transform: translateY(4px); } }
@keyframes flicker { from { opacity: .7; transform: scaleY(.95); } to { opacity: 1; transform: scaleY(1.08); } }
@keyframes lava { to { filter: brightness(1.25) hue-rotate(-8deg); } }
@keyframes water { to { filter: brightness(1.2); } }
@keyframes belt { to { background-position: 50% 0; } }
@keyframes spawnIn { from { transform: scale(0) rotate(-20deg); opacity: 0; } }
@keyframes morph { 0% { transform: scale(1); filter: brightness(1); } 35% { transform: scale(1.3); filter: brightness(2.2) drop-shadow(0 0 10px #fff); } 100% { transform: scale(1); } }
@keyframes tpIn { from { transform: scale(0); filter: brightness(3) drop-shadow(0 0 12px #2f8cff); } }
@keyframes dieDefault { to { transform: scale(.6); opacity: 0; } }
@keyframes dieBoom { 30% { transform: scale(1.25); filter: brightness(3); } to { transform: scale(.2) rotate(40deg); opacity: 0; } }
@keyframes dieBurn { 40% { filter: sepia(1) saturate(4) brightness(.6); } to { filter: brightness(0); opacity: 0; transform: translateY(-10%); } }
@keyframes dieDust { to { filter: blur(6px) sepia(1); opacity: 0; transform: translate(20%, -30%) scale(1.15); } }
@keyframes dieAscend { 30% { filter: brightness(2) drop-shadow(0 0 10px #fff); } to { transform: translateY(-140%); opacity: 0; filter: brightness(3); } }
@keyframes dieFall { to { transform: scale(0) rotate(270deg); opacity: 0; } }
@keyframes dieSink { to { transform: translateY(50%) scale(.8); opacity: 0; } }
@keyframes dieVoid { to { transform: scale(0) rotate(720deg); opacity: 0; } }
@keyframes dieFlat { 40% { transform: scaleY(.15) scaleX(1.3); } to { transform: scaleY(.1) scaleX(1.4); opacity: 0; } }
@keyframes dieChomp { 20% { transform: translateX(-8%); } 40% { transform: translateX(8%) scale(.8); } to { transform: scale(0); opacity: 0; } }
@keyframes dieMelt { to { transform: scaleY(0) scaleX(1.5); opacity: .3; filter: hue-rotate(90deg); } }
@keyframes boom { 0% { transform: translate(-50%, -50%) scale(.1); opacity: 1; } 60% { opacity: 1; } 100% { transform: translate(-50%, -50%) scale(2.4); opacity: 0; } }
@keyframes spark { to { transform: translate(var(--dx), var(--dy)); opacity: 0; } }
@keyframes bubble { from { transform: translate(-50%, -50%) scale(.3); } 20% { transform: translate(-50%, -120%) scale(1.15); } to { transform: translate(-50%, -150%); opacity: 0; } }
@keyframes emojipop { from { transform: translate(-50%, -20%) scale(.3); opacity: 0; } 30% { transform: translate(-50%, -60%) scale(1.2); opacity: 1; } to { transform: translate(-50%, -90%); opacity: 0; } }
@keyframes beam { from { opacity: 0; } 30% { opacity: 1; } to { opacity: 0; } }
@keyframes car { from { left: -15%; } to { left: 105%; } }
@keyframes wave { from { opacity: 0; transform: scaleX(.3); } 40% { opacity: 1; } to { opacity: 0; transform: scaleX(1); } }
@keyframes shake { 20% { transform: translate(-4px, 2px); } 40% { transform: translate(4px, -2px); } 60% { transform: translate(-3px, -1px); } 80% { transform: translate(2px, 2px); } }
@keyframes shakeBig { 10% { transform: translate(-9px, 4px) rotate(-.6deg); } 25% { transform: translate(8px, -6px) rotate(.6deg); } 40% { transform: translate(-7px, -3px); } 60% { transform: translate(6px, 5px); } 80% { transform: translate(-3px, 2px); } }
@keyframes deal { from { transform: translateY(120px) rotate(calc((var(--i) - 1) * 12deg)) scale(.5); opacity: 0; } }
@keyframes chosen { 30% { transform: translateY(-30px) scale(1.15); box-shadow: 0 0 60px #fff8; } to { transform: translateY(-60px) scale(1.25); opacity: 0; } }
@keyframes discard { to { transform: translateY(160px) rotate(10deg) scale(.8); opacity: 0; } }
@keyframes revealIn { from { transform: translate(-50%, -50%) scale(.3) rotate(-12deg); opacity: 0; } }
@keyframes revealOut { to { transform: translate(-50%, -80%) scale(.6); opacity: 0; } }
@keyframes reel { from { top: 0; } to { top: -480px; } }
@keyframes reelstop { from { opacity: 0; transform: translateY(-30%); } to { opacity: 1; } }
@keyframes flipH { from { transform: rotateY(0) scale(.5); } 50% { transform: rotateY(900deg) scale(1.2); } to { transform: rotateY(1800deg) scale(1); } }
@keyframes flipT { from { transform: rotateY(0) scale(.5); } 50% { transform: rotateY(900deg) scale(1.2); } to { transform: rotateY(1980deg) scale(1); } }
@keyframes toastIn { from { transform: translateY(-14px) scale(.85); opacity: 0; } }
@keyframes toastOut { to { transform: translateY(-10px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .pc { transition-duration: .08s; }
  .card.r-chaos::before { animation: none; }
}
