:root {
  --bg: #0d1020; --bg2: #141936; --panel: #151a33; --panel2: #1b2142; --line: rgba(143, 176, 255, .18);
  --text: #f2f3fa; --dim: #a9afcc; --accent: #8fb0ff; --good: #7dffb0; --bad: #ff7a8a; --warn: #ffd27a;
  --spark1: #c9d6ff; --spark2: #8fb0ff; --blaze1: #ffd27a; --blaze2: #ff9f43; --m1: #8fd8ff; --m2: #a98bff; --m3: #ff8fd8;
  --sq-light: #26305a; --sq-dark: #171d3d; --white-piece: #fff6e0; --black-piece: #c9a6ff;
  --radius: 16px; --ease: cubic-bezier(.2, .8, .2, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text); font: 16px/1.4 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background-image: radial-gradient(60% 50% at 15% 0%, rgba(110, 90, 255, .18), transparent 70%), radial-gradient(50% 45% at 95% 15%, rgba(60, 170, 255, .14), transparent 70%), radial-gradient(60% 50% at 50% 110%, rgba(255, 80, 180, .10), transparent 70%);
  background-attachment: fixed; overflow-x: hidden; -webkit-tap-highlight-color: transparent;
}
button, select, input { font: inherit; color: inherit; }
a { color: var(--accent); }
:focus { outline: none; }
:focus-visible, .kbd :focus { outline: 3px solid #fff; outline-offset: 3px; box-shadow: 0 0 0 7px rgba(143, 216, 255, .45); }

/* Top bar */
.topbar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; max-width: 1280px; margin: 0 auto; }
.home { font-size: 14px; text-decoration: none; color: var(--dim); padding: 8px 4px; }
.brand { font-weight: 800; letter-spacing: .04em; font-size: 18px; display: flex; align-items: center; gap: 8px; margin-right: auto; }
.brand img { width: 28px; height: 28px; border-radius: 7px; }
.iconbtn { min-width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0 10px; gap: 6px; font-size: 14px; }
.iconbtn svg { width: 20px; height: 20px; }
.iconbtn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }

main { max-width: 1280px; margin: 0 auto; padding: 0 16px 32px; }

/* Buttons */
.btn { min-height: 48px; padding: 0 24px; border-radius: 999px; border: 0; cursor: pointer; font-weight: 700; font-size: 17px; background: linear-gradient(90deg, #8fd8ff, #a98bff); color: #10132a; box-shadow: 0 6px 24px rgba(143, 176, 255, .25); transition: transform .15s var(--ease), filter .15s; }
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: var(--panel2); color: var(--text); border: 1px solid var(--line); box-shadow: none; }
.btn.danger { background: linear-gradient(90deg, #ff8f9e, #ff6fb5); }
.btn.small { min-height: 44px; padding: 0 16px; font-size: 15px; }
.btn[disabled] { opacity: .45; cursor: default; transform: none; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.center { text-align: center; justify-content: center; }

.card-panel { background: linear-gradient(180deg, rgba(27, 33, 66, .9), rgba(18, 22, 46, .9)); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: 0 10px 40px rgba(0, 0, 0, .3); }
h1 { font-size: clamp(30px, 6vw, 52px); margin: 8px 0 4px; letter-spacing: .02em; }
h2 { font-size: 22px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 8px; color: var(--dim); text-transform: uppercase; letter-spacing: .1em; }
.lede { color: var(--dim); margin: 0 0 20px; max-width: 640px; }
.glow-title { background: linear-gradient(90deg, #ffb36b, #ff6fb5 45%, #a98bff 80%); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 18px rgba(255, 111, 181, .35)); }

/* Setup */
.setup { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .setup { grid-template-columns: 1fr 1fr; } }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label, .lbl { font-size: 13px; color: var(--dim); text-transform: uppercase; letter-spacing: .08em; }
.field input[type=text], .field input[type=number] { min-height: 48px; border-radius: 12px; border: 1px solid var(--line); background: #0f1430; padding: 0 14px; width: 100%; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg button { min-height: 44px; padding: 6px 14px; border-radius: 12px; border: 1px solid var(--line); background: #0f1430; cursor: pointer; text-align: left; }
.seg button[aria-pressed="true"] { border-color: transparent; background: linear-gradient(90deg, rgba(143, 216, 255, .25), rgba(169, 139, 255, .3)); box-shadow: inset 0 0 0 2px var(--accent); }
.seg button small { display: block; color: var(--dim); font-size: 12px; }
.player-setup { display: grid; gap: 10px; padding: 14px; border-radius: 14px; background: rgba(13, 16, 32, .5); border: 1px solid var(--line); margin-bottom: 12px; }
.custom-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-top: 10px; }
.toggle { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.toggle input { width: 22px; height: 22px; accent-color: #a98bff; }
.hint { font-size: 13px; color: var(--dim); }

/* Screens */
.screen-center { min-height: calc(100dvh - 120px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; text-align: center; }
.vs { display: flex; gap: 18px; align-items: stretch; flex-wrap: wrap; justify-content: center; }
.vs .pcard { min-width: 240px; flex: 1; max-width: 340px; text-align: left; }
.vs .mid { align-self: center; font-weight: 900; font-size: 28px; color: var(--dim); }
.pcard .nm { font-size: 22px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.side-tag { font-size: 12px; padding: 3px 8px; border-radius: 999px; background: #0f1430; border: 1px solid var(--line); color: var(--dim); }
.side-tag.w { color: var(--white-piece); } .side-tag.b { color: var(--black-piece); }
.badge { font-size: 12px; color: #ffd27a; letter-spacing: -1px; }

.hp { position: relative; height: 14px; border-radius: 999px; background: #0b0e1f; border: 1px solid var(--line); overflow: hidden; }
.hp > i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #4ade80, #7dffb0); border-radius: 999px; transition: width .9s var(--ease); }
.hp.low > i { background: linear-gradient(90deg, #ff6b6b, #ffb36b); }
.hp > b { position: absolute; inset: 0 auto 0 0; background: #fff; opacity: .8; transition: width 1.2s .5s var(--ease); border-radius: 999px; }
.hpnum { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 14px; }

/* Augment chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { width: 36px; height: 36px; border-radius: 9px; padding: 3px; cursor: pointer; border: 0; background: var(--rg, linear-gradient(135deg, var(--spark1), var(--spark2))); position: relative; }
.chip > span { display: block; width: 100%; height: 100%; border-radius: 7px; background: #10142c; }
.chip svg { width: 100%; height: 100%; }
.chip.empty { background: rgba(143, 176, 255, .12); cursor: default; }
.r1 { --rg: linear-gradient(135deg, var(--spark1), var(--spark2)); --rc: var(--spark2); }
.r2 { --rg: linear-gradient(135deg, var(--blaze1), var(--blaze2)); --rc: var(--blaze2); }
.r3 { --rg: linear-gradient(120deg, var(--m1), var(--m2), var(--m3), var(--m1)); --rc: var(--m2); }

/* ===== Augment cards (draft) ===== */
.draft-head { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 6px 0 10px; }
.round-track { display: flex; gap: 6px; align-items: center; }
.round-track i { width: 26px; height: 6px; border-radius: 3px; background: rgba(143, 176, 255, .2); }
.round-track i.on { background: linear-gradient(90deg, #8fd8ff, #a98bff); box-shadow: 0 0 10px #a98bff; }
.round-track i.d { height: 10px; }
.timer-big { font-size: 46px; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1; text-shadow: 0 0 20px rgba(169, 139, 255, .6); }
.timer-big.hurry { color: var(--bad); }
.cards { display: flex; gap: 22px; justify-content: center; align-items: stretch; padding: 18px 4px 10px; perspective: 1200px; }
@media (max-width: 760px) {
  .cards { justify-content: flex-start; overflow-x: auto; scroll-snap-type: x mandatory; padding: 18px 12vw 14px; gap: 14px; margin: 0 -16px; scrollbar-width: none; }
  .cards::-webkit-scrollbar { display: none; }
  .cards .acard { scroll-snap-align: center; flex: 0 0 72vw; }
}
.acard { --c: 14px; position: relative; width: 270px; min-height: 410px; flex: 0 0 auto; cursor: pointer; background: none; border: 0; padding: 0; text-align: center; transform-style: preserve-3d; transition: transform .3s var(--ease), filter .3s; filter: drop-shadow(0 0 14px var(--rc)) drop-shadow(0 0 2px var(--rc)); }
.acard .flip { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .6s var(--ease); }
.acard.down .flip { transform: rotateY(180deg); }
.acard .face, .acard .back { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.acard .back { transform: rotateY(180deg); }
.chamf { clip-path: polygon(var(--c) 0, calc(100% - var(--c)) 0, 100% var(--c), 100% calc(100% - var(--c)), calc(100% - var(--c)) 100%, var(--c) 100%, 0 calc(100% - var(--c)), 0 var(--c)); }
.frame { position: absolute; inset: 0; background: var(--rg); background-size: 300% 300%; }
.r3 .frame, .r3.frame { animation: sheen 6s linear infinite; }
@keyframes sheen { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
.panel-in { position: absolute; inset: 5px; background: #0f1330; --c: 11px; }
.line-in { position: absolute; inset: 12px; background: var(--rg); background-size: 300% 300%; opacity: .75; --c: 9px; }
.r3 .line-in { animation: sheen 6s linear infinite; }
.body-in { position: absolute; inset: 13.5px; --c: 8px; background: radial-gradient(120% 60% at 50% 0%, rgba(143, 176, 255, .14), transparent 60%), #0d1020; display: flex; flex-direction: column; align-items: center; padding: 18px 16px 16px; gap: 8px; }
.acard .rar { font-size: 11px; letter-spacing: .3em; font-weight: 800; color: var(--rc); }
.acard .ico { width: 58%; aspect-ratio: 1; margin: 4px 0 6px; }
.acard .ico svg { width: 100%; height: 100%; overflow: visible; }
.acard .nm { font-size: 20px; font-weight: 800; line-height: 1.15; }
.pill { font-size: 11px; padding: 2px 8px; border-radius: 4px; background: rgba(143, 176, 255, .14); border: 1px solid rgba(143, 176, 255, .3); color: var(--text); font-weight: 700; letter-spacing: .05em; }
.acard .desc { font-size: 14px; color: #d8dcf0; line-height: 1.45; margin-top: 4px; }
.kw-p { color: var(--accent); font-weight: 600; } .kw-d { color: var(--bad); font-weight: 600; } .kw-c { color: var(--good); font-weight: 600; }
.acard .back .body-in { justify-content: center; }
.acard .back .body-in::after { content: ""; width: 60%; aspect-ratio: 1; background: url(icon.svg) center/contain no-repeat; opacity: .55; filter: grayscale(.2); }
.acard:hover, .acard.sel { transform: translateY(-12px) scale(1.02); }
.acard.sel { filter: drop-shadow(0 0 26px var(--rc)) drop-shadow(0 0 6px #fff); }
.acard.sel::after { content: "Selected"; position: absolute; left: 50%; bottom: -16px; transform: translateX(-50%); font-size: 12px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; color: #fff; background: var(--rc); padding: 3px 10px; border-radius: 999px; }
.acard:focus-visible { outline: none; transform: translateY(-12px) scale(1.02); filter: drop-shadow(0 0 0 #fff) drop-shadow(0 0 3px #fff) drop-shadow(0 0 20px var(--rc)); }
.acard.burst .face::before { content: ""; position: absolute; inset: -20%; background: radial-gradient(closest-side, var(--rc), transparent); animation: burst .7s ease-out forwards; pointer-events: none; z-index: 3; }
@keyframes burst { from { opacity: .9; transform: scale(.4); } to { opacity: 0; transform: scale(1.4); } }
.draft-foot { display: flex; gap: 12px; justify-content: center; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.reroll { min-height: 48px; min-width: 64px; padding: 0 16px; border-radius: 10px; border: 1px solid #8a6b3d; background: linear-gradient(180deg, #3a2c19, #241a0d); color: #ffd27a; font-weight: 800; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.reroll[disabled] { opacity: .4; cursor: default; }
.my-strip { display: flex; gap: 10px; align-items: center; justify-content: center; margin-top: 18px; flex-wrap: wrap; color: var(--dim); font-size: 14px; }

/* Small trick cards */
.tcard { --c: 9px; position: relative; width: 124px; height: 184px; flex: 0 0 auto; border: 0; padding: 0; background: none; cursor: pointer; filter: drop-shadow(0 0 8px var(--rc)); transition: transform .25s var(--ease), filter .25s; color: var(--text); }
.tcard .panel-in { inset: 3px; --c: 7px; }
.tcard .body-in { inset: 3px; --c: 7px; padding: 8px 6px; gap: 2px; justify-content: flex-start; }
.tcard .ico { width: 44px; height: 44px; margin: 2px 0; }
.tcard .ico svg { width: 100%; height: 100%; }
.tcard .nm { font-size: 13px; font-weight: 800; line-height: 1.1; }
.tcard .rar { font-size: 9px; letter-spacing: .2em; font-weight: 800; color: var(--rc); }
.tcard .free { font-size: 10px; color: var(--good); font-weight: 700; }
.tcard .tdesc { font-size: 11px; line-height: 1.25; color: #c9cee6; }
.tcard:hover, .tcard:focus-visible { transform: translateY(-6px); }
.tcard:focus-visible { outline: none; filter: drop-shadow(0 0 3px #fff) drop-shadow(0 0 12px var(--rc)); }
.tcard.active { transform: translateY(-8px); filter: drop-shadow(0 0 4px #fff) drop-shadow(0 0 18px var(--rc)); }
.tcard[disabled] { opacity: .45; cursor: default; transform: none; }
.tcard.deal { animation: deal .45s var(--ease) both; }
@keyframes deal { from { transform: translateY(40px) rotate(-6deg) scale(.8); opacity: 0; } }
.tback { width: 34px; height: 46px; border-radius: 6px; background: linear-gradient(135deg, #2a2f5e, #1a1f44); border: 1px solid var(--line); display: inline-block; position: relative; }
.tback::after { content: "?"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--dim); font-weight: 800; }

/* ===== Game ===== */
.game { display: grid; gap: 10px; grid-template-columns: 1fr; justify-items: center; }
.game .side { display: contents; }
.game .board-wrap { order: 2; } #ptop { order: 1; } #pbot { order: 3; } #tray { order: 4; } .gamebar { order: 5; }
.pstrip { width: 100%; max-width: 720px; display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; padding: 10px 12px; border-radius: 14px; background: rgba(21, 26, 51, .85); border: 1px solid var(--line); transition: box-shadow .3s, border-color .3s; }
.pstrip.turn { border-color: rgba(143, 216, 255, .7); box-shadow: 0 0 0 1px rgba(143, 216, 255, .4), 0 0 24px rgba(143, 216, 255, .18); }
.pstrip .who { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pstrip .who .nm { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pstrip .who svg { width: 26px; height: 26px; flex: 0 0 auto; }
.clock { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 26px; padding: 2px 12px; border-radius: 10px; background: #0b0e1f; border: 1px solid var(--line); min-width: 96px; text-align: center; }
.pstrip.turn .clock { background: linear-gradient(90deg, rgba(143, 216, 255, .25), rgba(169, 139, 255, .25)); border-color: var(--accent); }
.clock.low { color: var(--bad); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.pstrip .hpline { display: flex; align-items: center; gap: 8px; grid-column: 1 / -1; }
.pstrip .hpline .hp { flex: 1; height: 10px; }
.pstrip .extras { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.pstrip .chip { width: 30px; height: 30px; }
.lostrow { font-size: 13px; color: var(--dim); display: flex; gap: 1px; align-items: center; min-height: 16px; }
.lostrow svg { width: 16px; height: 16px; }
.lostrow .adv { margin-left: 4px; color: var(--good); font-weight: 700; }

.board-wrap { width: 100%; display: flex; justify-content: center; }
.board { --size: min(calc(100vw - 32px), calc(100dvh - 380px), 720px); width: max(var(--size), 280px); aspect-ratio: 1; position: relative; border-radius: 14px; box-shadow: 0 0 0 2px rgba(143, 176, 255, .35), 0 0 40px rgba(110, 90, 255, .35), 0 20px 60px rgba(0, 0, 0, .5); touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.board.flip-anim { animation: boardflip .5s var(--ease); }
@keyframes boardflip { 40% { transform: scale(.96); filter: brightness(1.3); } }
.squares { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); border-radius: 14px; overflow: hidden; }
.sq { position: relative; background: var(--sq-dark); }
.sq.l { background: var(--sq-light); }
.sq::before { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 0 .5px rgba(143, 176, 255, .08); }
.sq.last::after { content: ""; position: absolute; inset: 0; background: var(--lastc, rgba(143, 216, 255, .22)); }
.sq.sel::after { content: ""; position: absolute; inset: 0; background: rgba(255, 255, 255, .18); box-shadow: inset 0 0 0 3px #8fd8ff; }
.sq.check { background: radial-gradient(circle, rgba(255, 80, 100, .9), rgba(255, 80, 100, .25) 60%, transparent 75%), var(--sq-dark); animation: heartbeat 1s infinite; }
@keyframes heartbeat { 0%, 100% { filter: brightness(1); } 15% { filter: brightness(1.6); } 30% { filter: brightness(1.1); } 45% { filter: brightness(1.5); } }
.sq .dot { position: absolute; inset: 37%; border-radius: 50%; background: rgba(143, 216, 255, .75); box-shadow: 0 0 10px rgba(143, 216, 255, .9); z-index: 2; pointer-events: none; }
.sq .dot.aug { background: rgba(255, 143, 216, .85); box-shadow: 0 0 10px rgba(255, 143, 216, .95); border-radius: 3px; transform: rotate(45deg); inset: 38%; }
.sq .ring { position: absolute; inset: 6%; border-radius: 50%; border: 4px solid rgba(143, 216, 255, .75); z-index: 2; pointer-events: none; }
.sq .ring.aug { border-color: rgba(255, 143, 216, .85); }
.sq .tgt { position: absolute; inset: 8%; border-radius: 8px; border: 3px dashed rgba(255, 210, 122, .9); z-index: 2; pointer-events: none; animation: pulse 1.2s infinite; }
.sq.cursor::before { box-shadow: inset 0 0 0 4px #fff, inset 0 0 18px rgba(255, 255, 255, .6); z-index: 4; }
.sq .coord { position: absolute; font-size: 10px; font-weight: 700; color: rgba(169, 175, 204, .55); pointer-events: none; }
.sq .coord.f { right: 3px; bottom: 1px; } .sq .coord.r { left: 3px; top: 1px; }
.sq.wall { background: repeating-linear-gradient(45deg, #2b2f55 0 6px, #1d2147 6px 12px); }
.pieces, .fx { position: absolute; inset: 0; pointer-events: none; }
.pc { position: absolute; left: 0; top: 0; width: 12.5%; height: 12.5%; transition: transform .28s var(--ease); will-change: transform; z-index: 3; }
.pc.lift { z-index: 5; }
.pc svg { width: 100%; height: 100%; overflow: visible; }
.pc .art { filter: drop-shadow(0 0 3px var(--pg)); }
.pc.w { --pg: rgba(255, 246, 224, .55); } .pc.b { --pg: rgba(169, 139, 255, .75); }
.pc.frozen .art { filter: drop-shadow(0 0 4px #8fd8ff) saturate(.3) brightness(1.2); }
.pc.spawn { animation: spawn .5s var(--ease); }
@keyframes spawn { from { opacity: 0; } }
.pc.gone { opacity: 0; transition: opacity .3s, transform .28s var(--ease); }
.reduce .pc .art { filter: none; }

/* FX */
.shard { position: absolute; width: 6px; height: 6px; border-radius: 1px; background: var(--fc, #fff); box-shadow: 0 0 8px var(--fc, #fff); animation: shard .7s ease-out forwards; }
@keyframes shard { to { transform: translate(var(--dx), var(--dy)) rotate(260deg) scale(.3); opacity: 0; } }
.ringfx { position: absolute; width: 12.5%; height: 12.5%; border-radius: 50%; border: 4px solid var(--fc, #ffb36b); animation: ringfx .6s ease-out forwards; }
@keyframes ringfx { from { transform: scale(.3); opacity: 1; } to { transform: scale(3); opacity: 0; } }
.boltfx { position: absolute; width: 12.5%; top: 0; background: linear-gradient(180deg, transparent, #fff 70%, #8fd8ff); filter: drop-shadow(0 0 12px #8fd8ff); animation: bolt .45s ease-out forwards; clip-path: polygon(45% 0, 60% 0, 52% 40%, 66% 40%, 40% 100%, 48% 55%, 34% 55%); }
@keyframes bolt { from { opacity: 1; } to { opacity: 0; } }
.floattext { position: absolute; font-weight: 900; font-size: 18px; color: var(--warn); text-shadow: 0 0 10px rgba(0, 0, 0, .8); animation: floatup 1s ease-out forwards; white-space: nowrap; transform: translateX(-50%); }
@keyframes floatup { to { translate: 0 -40px; opacity: 0; } }
.shake { animation: shake .35s; }
@keyframes shake { 20% { translate: -5px 2px; } 40% { translate: 5px -2px; } 60% { translate: -3px 1px; } 80% { translate: 3px 0; } }
.slam { position: fixed; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 40; }
.slam span { font-size: clamp(40px, 10vw, 110px); font-weight: 900; letter-spacing: .06em; background: linear-gradient(90deg, #ffb36b, #ff6fb5, #a98bff); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 30px rgba(255, 111, 181, .6)); animation: slam .8s var(--ease) both; }
@keyframes slam { from { transform: scale(3); opacity: 0; } 60% { transform: scale(.95); opacity: 1; } }
.confetti { position: fixed; top: -20px; width: 10px; height: 14px; z-index: 39; pointer-events: none; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }
.toast { position: fixed; left: 50%; top: 70px; transform: translateX(-50%); background: rgba(21, 26, 51, .95); border: 1px solid var(--accent); padding: 10px 18px; border-radius: 12px; z-index: 50; font-weight: 700; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); animation: toast 2.6s ease forwards; pointer-events: none; text-align: center; max-width: calc(100vw - 32px); }
@keyframes toast { 0% { opacity: 0; translate: 0 -10px; } 10%, 85% { opacity: 1; translate: 0 0; } 100% { opacity: 0; } }

/* Tray */
.tray { width: 100%; max-width: 720px; border-radius: 14px; background: rgba(21, 26, 51, .6); border: 1px solid var(--line); padding: 10px 12px; display: grid; gap: 8px; }
.tray .status { font-weight: 700; display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.tray .status .msg { color: var(--accent); }
.tray .hand { display: flex; gap: 10px; overflow-x: auto; padding: 8px 2px 4px; align-items: flex-end; }
.tray .offer { border-radius: 12px; padding: 8px; background: linear-gradient(180deg, rgba(169, 139, 255, .16), rgba(143, 216, 255, .06)); border: 1px solid rgba(169, 139, 255, .45); }
.tray .offer .hand { padding-top: 10px; }
.offer-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 700; flex-wrap: wrap; }
.emptyhand { color: var(--dim); font-size: 14px; padding: 8px 0; }
.gamebar { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; width: 100%; max-width: 720px; }

@media (min-width: 1000px) {
  .game { grid-template-columns: auto minmax(320px, 400px); align-items: stretch; justify-content: center; gap: 20px; }
  .board { --size: min(calc(100vw - 480px), calc(100dvh - 110px), 760px); }
  .game .board-wrap { grid-column: 1; grid-row: 1; }
  .game .board-wrap, #ptop, #pbot, #tray, .gamebar { order: 0; }
  .game .side { display: flex; flex-direction: column; gap: 10px; grid-column: 2; grid-row: 1; width: 100%; }
  .game .side .tray { flex: 1; align-content: start; }
}

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(5, 7, 18, .72); backdrop-filter: blur(4px); z-index: 30; display: grid; place-items: center; padding: 16px; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.modal { max-width: 520px; width: 100%; text-align: center; max-height: calc(100dvh - 32px); overflow: auto; }
.modal .acard { margin: 10px auto 20px; cursor: default; }
.promo { display: flex; gap: 10px; justify-content: center; }
.promo button { width: 72px; height: 72px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel2); cursor: pointer; padding: 6px; }
.promo svg { width: 100%; height: 100%; }

/* Results */
.result-hp { display: grid; gap: 14px; width: min(520px, 100%); }
.result-hp .r { text-align: left; }
.result-hp .r .top { display: flex; justify-content: space-between; font-weight: 700; margin-bottom: 4px; }
.dmg { color: var(--bad); font-weight: 900; animation: dmgpop .5s .9s var(--ease) both; display: inline-block; font-size: 18px; }
@keyframes dmgpop { from { transform: scale(2.2); opacity: 0; } }
.big { font-size: clamp(28px, 6vw, 44px); font-weight: 900; margin: 0; }
.podium { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.help { max-width: 760px; margin: 0 auto; }
.help li { margin-bottom: 8px; }
.legend { display: inline-flex; gap: 6px; align-items: center; margin-right: 12px; }
.legend i { width: 12px; height: 12px; border-radius: 50%; background: rgba(143, 216, 255, .8); display: inline-block; }
.legend i.aug { background: rgba(255, 143, 216, .85); border-radius: 2px; transform: rotate(45deg); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.reduce *, .reduce *::before, .reduce *::after { animation-duration: .01s !important; animation-iteration-count: 1 !important; transition-duration: .05s !important; }
@media (max-width: 480px) {
  .topbar { gap: 6px; padding: 8px 12px; }
  .brand { font-size: 16px; }
  .brand span { white-space: nowrap; }
  .home { font-size: 13px; }
  .iconbtn { min-width: 44px; padding: 0 8px; }
  main { padding: 0 12px 24px; }
  .clock { font-size: 22px; min-width: 84px; }
}
@media (max-width: 400px) { .brand span { display: none; } }
