/* Riftbound Online — one quiet dark surface, thin gold lines, motion that explains what happened. */
:root {
  --ink-0: #04070d;
  --ink-1: #070b14;
  --ink-2: #0c121e;
  --ink-3: #121a29;
  --ink-4: #1a2436;
  --line: rgba(200, 170, 110, .16);
  --line-strong: rgba(200, 170, 110, .38);
  --line-cool: rgba(150, 170, 210, .10);
  --gold-0: #f4e9cf;
  --gold-1: #e3cd94;
  --gold-2: #c8aa6e;
  --gold-3: #8f6f37;
  --gold-4: #4a3a1c;
  --teal: #29d3c2;
  --me: #58a8ff;
  --opp: #ff5d6c;
  --good: #3ddc97;
  --text: #ece8df;
  --text-2: #a59e8f;
  --text-3: #6c6a66;
  --radius: 10px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --display: "Cinzel", "Trajan Pro", Georgia, serif;
  --ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, system-ui, sans-serif;
  /* card sizes (portrait ratio 744:1039) */
  --card-w: 78px;
  --hand-w: 112px;
  --rune-w: 46px;
  --pile-w: 60px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(200, 170, 110, .07), transparent 60%),
    radial-gradient(900px 500px at 100% 100%, rgba(41, 211, 194, .035), transparent 60%),
    var(--ink-1);
  color: var(--text); font: 14px/1.45 var(--ui); -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--gold-2); text-decoration: none; }
a:hover { color: var(--gold-1); }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: rgba(200, 170, 110, .35); }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 12px; }
.caps { text-transform: uppercase; letter-spacing: .14em; font-size: 11px; font-weight: 600; }
.display { font-family: var(--display); letter-spacing: .06em; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.spacer { flex: 1; }
.err { color: #ff9aa5; }
.okc { color: var(--good); }

/* ---------- buttons ---------- */
.btn {
  --b: var(--line-strong);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px; border-radius: 6px; cursor: pointer; user-select: none;
  background: linear-gradient(180deg, #172133 0%, #0d1420 100%);
  border: 1px solid var(--b); color: var(--gold-0);
  font-weight: 600; font-size: 12px; letter-spacing: .14em; text-transform: uppercase;
  transition: transform .12s var(--ease), border-color .2s, box-shadow .25s, background .25s, color .2s;
  overflow: hidden; white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: var(--gold-2); box-shadow: 0 0 0 1px rgba(200, 170, 110, .15), 0 6px 22px rgba(0, 0, 0, .45), inset 0 0 18px rgba(200, 170, 110, .10); }
.btn:active:not(:disabled) { transform: translateY(1px) scale(.985); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary {
  color: #1b1408; border: 1px solid #f0dca8;
  background: linear-gradient(180deg, #f3e2b4 0%, #d8bb7c 38%, #b48a45 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55), inset 0 -2px 6px rgba(80, 50, 10, .35), 0 4px 18px rgba(200, 170, 110, .18);
  text-shadow: 0 1px 0 rgba(255, 255, 255, .35);
}
.btn.primary:hover:not(:disabled) { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), inset 0 -2px 6px rgba(80, 50, 10, .35), 0 6px 28px rgba(227, 205, 148, .35); }
.btn.primary::after, .btn.shine::after {
  content: ""; position: absolute; inset: -40% auto -40% -60%; width: 40%; transform: skewX(-20deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent); opacity: 0;
}
.btn.primary:hover:not(:disabled)::after, .btn.shine:hover:not(:disabled)::after { animation: shine .9s var(--ease); }
@keyframes shine { 0% { left: -60%; opacity: 0; } 20% { opacity: 1; } 100% { left: 130%; opacity: 0; } }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); letter-spacing: .1em; }
.btn.ghost:hover:not(:disabled) { color: var(--gold-1); border-color: var(--line); box-shadow: none; background: rgba(200, 170, 110, .05); }
.btn.danger { color: #ffb4bc; --b: rgba(255, 93, 108, .35); }
.btn.danger:hover:not(:disabled) { border-color: var(--opp); box-shadow: 0 0 18px rgba(255, 93, 108, .18); }
.btn.big { height: 52px; padding: 0 28px; font-size: 13px; letter-spacing: .18em; }
.btn.sm { height: 30px; padding: 0 12px; font-size: 11px; }
.btn.icon { width: 36px; padding: 0; }
.btn .spin { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: rot .7s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }

/* ---------- inputs ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { color: var(--text-2); }
.input, textarea.input, select.input {
  height: 40px; padding: 0 12px; background: rgba(4, 7, 13, .7); border: 1px solid var(--line-cool); border-radius: 6px;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
textarea.input { display: block; width: 100%; height: auto; min-height: 200px; padding: 10px 12px; resize: vertical; font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }
.input:hover { border-color: rgba(200, 170, 110, .25); }
.input:focus { outline: none; border-color: var(--gold-2); box-shadow: 0 0 0 3px rgba(200, 170, 110, .14); background: rgba(4, 7, 13, .9); }
.input::placeholder { color: var(--text-3); }

/* toggle switch */
.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle .track { position: relative; width: 38px; height: 22px; border-radius: 11px; background: #1b2232; border: 1px solid var(--line-cool); transition: background .25s, border-color .25s; flex: none; }
.toggle .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #8d8a83; transition: transform .28s var(--ease-out), background .25s, box-shadow .25s; }
.toggle input:checked + .track { background: linear-gradient(180deg, #5a4520, #3a2c12); border-color: var(--gold-3); }
.toggle input:checked + .track::after { transform: translateX(16px); background: var(--gold-1); box-shadow: 0 0 10px rgba(227, 205, 148, .6); }
.toggle input:focus-visible + .track { outline: 2px solid var(--teal); outline-offset: 2px; }

/* segmented control */
.seg { position: relative; display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 3px; border-radius: 8px; background: rgba(4, 7, 13, .7); border: 1px solid var(--line-cool); }
.seg button { position: relative; z-index: 1; height: 32px; padding: 0 14px; border: 0; background: none; color: var(--text-2); font-size: 12px; font-weight: 600; letter-spacing: .06em; cursor: pointer; border-radius: 6px; transition: color .2s; white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button.on { color: var(--gold-0); }
.seg .thumb { position: absolute; z-index: 0; border-radius: 6px; background: linear-gradient(180deg, #2a2414, #1a160c); border: 1px solid var(--gold-3); box-shadow: 0 0 14px rgba(200, 170, 110, .15); transition: left .3s var(--ease-out), width .3s var(--ease-out), top .3s var(--ease-out); }
/* code boxes */
.code-input { display: inline-flex; gap: 8px; }
.code-input input { width: 44px; height: 52px; text-align: center; font: 600 22px/1 var(--display); text-transform: uppercase; background: rgba(4, 7, 13, .7); border: 1px solid var(--line-cool); border-radius: 8px; caret-color: var(--gold-2); transition: border-color .2s, box-shadow .2s, transform .15s var(--ease); }
.code-input input:focus { outline: none; border-color: var(--gold-2); box-shadow: 0 0 0 3px rgba(200, 170, 110, .14); transform: translateY(-1px); }
.code-input input.filled { border-color: var(--line-strong); color: var(--gold-0); }

/* ---------- shell ---------- */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 24px; height: 60px; padding: 0 24px; background: linear-gradient(180deg, rgba(4, 7, 13, .96), rgba(4, 7, 13, .82)); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.logo { display: flex; align-items: center; gap: 10px; color: var(--gold-0); }
.logo svg { width: 28px; height: 28px; }
.logo b { font: 600 17px/1 var(--display); letter-spacing: .16em; }
.logo i { font-style: normal; font-size: 10px; letter-spacing: .3em; color: var(--gold-2); margin-left: 2px; }
.nav { position: relative; display: flex; gap: 4px; height: 100%; }
.nav a { position: relative; display: flex; align-items: center; padding: 0 14px; color: var(--text-2); font-size: 12px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; transition: color .2s; }
.nav a:hover { color: var(--text); }
.nav a.on { color: var(--gold-0); }
.nav a::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: -1px; height: 2px; background: linear-gradient(90deg, transparent, var(--gold-2), transparent); transform: scaleX(0); transition: transform .35s var(--ease-out); }
.nav a.on::after { transform: scaleX(1); }
.who { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 13px; cursor: pointer; padding: 6px 10px; border-radius: 8px; transition: background .2s; }
.who:hover { background: rgba(200, 170, 110, .06); color: var(--text); }
.who .mini-sleeve { width: 22px; height: 30px; border-radius: 3px; overflow: hidden; box-shadow: 0 0 0 1px var(--line-strong); }
.page { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 32px 24px 64px; animation: rise .45s var(--ease-out); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.page-title { font: 600 30px/1.1 var(--display); letter-spacing: .08em; color: var(--gold-0); margin: 0 0 6px; }
.page-sub { color: var(--text-2); margin: 0 0 28px; }
.footer { padding: 16px 24px; border-top: 1px solid var(--line-cool); color: var(--text-3); font-size: 11px; text-align: center; }

/* panels */
.panel { position: relative; background: linear-gradient(180deg, rgba(18, 26, 41, .82), rgba(10, 15, 25, .82)); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: 0 10px 40px rgba(0, 0, 0, .35); }
.panel.flat { box-shadow: none; }
.panel h2, .panel h3 { margin: 0 0 4px; font: 600 15px/1.2 var(--display); letter-spacing: .1em; color: var(--gold-0); }
.panel .kicker { margin-bottom: 14px; }
.panel.hover { transition: border-color .25s, transform .25s var(--ease), box-shadow .25s; }
.panel.hover:hover { border-color: var(--line-strong); transform: translateY(-2px); box-shadow: 0 16px 50px rgba(0, 0, 0, .45); }
.divider { height: 1px; background: linear-gradient(90deg, transparent, var(--line-strong), transparent); margin: 18px 0; border: 0; }

/* ---------- play screen ---------- */
.play-grid { display: grid; grid-template-columns: 300px 1fr; gap: 20px; align-items: start; }
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.mode { display: flex; flex-direction: column; gap: 14px; min-height: 230px; }
.mode .glyph { width: 40px; height: 40px; color: var(--gold-2); }
.mode p { margin: 0; color: var(--text-2); font-size: 13px; }
.mode .bottom { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.loadout { display: flex; flex-direction: column; gap: 16px; }
.deck-banner { position: relative; height: 150px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--ink-3) 50% 22% / cover no-repeat; transition: background-position 1.2s var(--ease-out); }
.panel:hover .deck-banner, .deck-tile:hover .deck-banner { background-position: 50% 28%; }
.deck-banner::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(4, 7, 13, .05) 30%, rgba(4, 7, 13, .92)); }
.deck-banner .label { position: absolute; z-index: 1; left: 12px; right: 12px; bottom: 10px; }
.deck-banner .label b { display: block; font: 600 15px/1.2 var(--display); letter-spacing: .06em; color: var(--gold-0); }
.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--line-cool); }
.list-row:last-child { border-bottom: 0; }
.empty { color: var(--text-3); font-size: 13px; padding: 8px 0; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 0 rgba(61, 220, 151, .6); animation: ping 2s infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(61, 220, 151, .5); } 70% { box-shadow: 0 0 0 8px rgba(61, 220, 151, 0); } 100% { box-shadow: 0 0 0 0 rgba(61, 220, 151, 0); } }

/* deck & card grids */
.deck-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.deck-tile { cursor: pointer; padding: 0; overflow: hidden; }
.deck-tile .deck-banner { border: 0; border-radius: 0; height: 160px; }
.deck-tile .meta { padding: 12px 14px; display: flex; align-items: center; gap: 8px; }
.deck-tile.selected { border-color: var(--gold-2); box-shadow: 0 0 0 1px var(--gold-2), 0 10px 40px rgba(200, 170, 110, .12); }
.badge { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 10px; font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; border: 1px solid var(--line-strong); color: var(--gold-1); background: rgba(200, 170, 110, .06); }
.badge.cool { border-color: rgba(41, 211, 194, .35); color: var(--teal); background: rgba(41, 211, 194, .06); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; }
.thumb { position: relative; aspect-ratio: 744 / 1039; border-radius: 6px; overflow: hidden; background: var(--ink-3); box-shadow: 0 2px 8px rgba(0, 0, 0, .5), 0 0 0 1px rgba(0, 0, 0, .5); transition: transform .2s var(--ease), box-shadow .2s; --w: 96px; }
.thumb.landscape { aspect-ratio: 1039 / 744; grid-column: span 2; }
.thumb:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(0, 0, 0, .55), 0 0 0 1px var(--gold-3); }
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.card-grid .count { position: absolute; right: 4px; bottom: 4px; z-index: 3; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: rgba(4, 7, 13, .88); border: 1px solid var(--gold-3); color: var(--gold-0); font-weight: 700; font-size: 11px; display: flex; align-items: center; justify-content: center; }

/* sleeves screen */
.sleeve-stage { display: grid; grid-template-columns: 300px 1fr; gap: 28px; align-items: start; }
.sleeve-preview { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 30px 20px; }
.sleeve-preview .slot { --w: 190px; }
.sleeve-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 14px; }
.sleeve-pick { position: relative; aspect-ratio: 744 / 1039; border-radius: 7px; cursor: pointer; overflow: hidden; border: 1px solid var(--line-cool); transition: transform .2s var(--ease), border-color .2s, box-shadow .25s; background: none; padding: 0; }
.sleeve-pick:hover { transform: translateY(-3px); border-color: var(--line-strong); box-shadow: 0 10px 26px rgba(0, 0, 0, .5); }
.sleeve-pick.on { border-color: var(--gold-1); box-shadow: 0 0 0 1px var(--gold-1), 0 0 24px rgba(227, 205, 148, .25); }
.sleeve-pick .name { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; padding: 14px 6px 6px; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; text-align: center; color: var(--gold-0); background: linear-gradient(180deg, transparent, rgba(0, 0, 0, .8)); }

/* settings */
.settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; }
.setting { display: flex; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line-cool); }
.setting:last-child { border-bottom: 0; }
.setting .what { flex: 1; min-width: 0; }
.setting .what b { display: block; font-weight: 600; }
.setting .what span { color: var(--text-2); font-size: 12px; }

/* ---------- modal & toasts ---------- */
.scrim { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(2, 4, 8, .72); backdrop-filter: blur(4px); animation: fade .25s ease; }
.modal { width: min(680px, 100%); max-height: 90vh; overflow: auto; animation: pop .35s var(--ease-out); }
.modal.wide { width: min(980px, 100%); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.toasts { position: fixed; top: 72px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { padding: 10px 16px; border-radius: 8px; background: rgba(12, 18, 30, .96); border: 1px solid var(--line-strong); box-shadow: 0 10px 30px rgba(0, 0, 0, .5); animation: toast-in .35s var(--ease-out); font-size: 13px; }
.toast.bad { border-color: rgba(255, 93, 108, .5); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

/* ---------- cards ---------- */
/* A slot is sized by its height --h (portrait 744:1039). Rows set --h from the screen height; elsewhere --w sets it. */
.slot { --w: var(--card-w); --h: calc(var(--w) * 1.3965); position: relative; flex: none; width: calc(var(--h) * .716); height: var(--h); transform-origin: 0 0; transition: width .35s var(--ease-out); }
.slot.landscape { width: calc(var(--h) * 1.3965); }
.slot.exhausted { width: var(--h); }
.card { position: absolute; left: 50%; top: 50%; width: calc(var(--h) * .716); height: var(--h); margin-left: calc(var(--h) * -.358); margin-top: calc(var(--h) * -.5); perspective: 900px; transition: transform .38s var(--ease-out), filter .3s, opacity .2s; cursor: default; }
.slot.landscape .card { width: calc(var(--h) * 1.3965); margin-left: calc(var(--h) * -.69825); }
.slot.exhausted .card { transform: rotate(90deg); filter: saturate(.6) brightness(.8); }
.card-inner { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .55s var(--ease-out); }
.slot.is-back .card-inner { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; border-radius: calc(var(--h) * .04); overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden; box-shadow: 0 2px 6px rgba(0, 0, 0, .5), 0 0 0 1px rgba(0, 0, 0, .55); background: var(--ink-3); }
.face.back { transform: rotateY(180deg); }
.face img { display: block; width: 100%; height: 100%; object-fit: cover; -webkit-user-drag: none; }
.slot.actionable .card, .slot.draggable .card { cursor: pointer; }
.slot.draggable .card { cursor: grab; }
.slot.draggable { touch-action: none; }  /* a finger drag is a card drag, not a page pan */
.slot.actionable .face.front { box-shadow: 0 0 0 2px rgba(227, 205, 148, .85), 0 0 18px rgba(227, 205, 148, .45), 0 4px 10px rgba(0, 0, 0, .5); animation: glow 2.2s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 0 2px rgba(227, 205, 148, .55), 0 0 8px rgba(227, 205, 148, .2), 0 4px 10px rgba(0, 0, 0, .5); } }
.slot.target .face.front { box-shadow: 0 0 0 2px var(--teal), 0 0 20px rgba(41, 211, 194, .55); animation: glow-t 1.6s ease-in-out infinite; }
@keyframes glow-t { 50% { box-shadow: 0 0 0 2px rgba(41, 211, 194, .55), 0 0 8px rgba(41, 211, 194, .2); } }
.slot.focused .face.front, .slot.selected .face.front { animation: none; box-shadow: 0 0 0 2px var(--gold-0), 0 0 26px rgba(244, 233, 207, .65); }
.slot.selected .card { transform: translateY(-6%); }
.slot.exhausted.selected .card { transform: rotate(90deg) translateX(-6%); }
.slot.targeted .face { box-shadow: 0 0 0 2px var(--teal), 0 0 22px rgba(41, 211, 194, .55) !important; animation: none !important; }
.slot.dragging .card { opacity: .25; }
.slot.zoomable:hover .card, .slot.actionable:hover .card, .slot.draggable:hover .card, .slot.target:hover .card { transform: translateY(-4%) scale(1.04); }
.slot.exhausted.zoomable:hover .card, .slot.exhausted.actionable:hover .card, .slot.exhausted.draggable:hover .card, .slot.exhausted.target:hover .card { transform: rotate(90deg) translateX(-4%) scale(1.04); }
.slot.hit .card { animation: hit .5s var(--ease); }
@keyframes hit { 15% { transform: translateX(-4px); filter: brightness(1.4) sepia(1) hue-rotate(-50deg) saturate(4); } 35% { transform: translateX(4px); } 55% { transform: translateX(-2px); } }
.slot.exhausted.hit .card { animation: none; }
.text-card { position: absolute; inset: 0; padding: 7% 8%; display: flex; flex-direction: column; gap: 3px; background: linear-gradient(180deg, #1c2638, #0d131f); color: var(--text); font-size: max(9px, calc(var(--h) * .07)); line-height: 1.2; }
.text-card b { font-weight: 700; font-size: max(9.5px, calc(var(--h) * .08)); }
.text-card .t { color: var(--text-2); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; }
.text-card .stripe { position: absolute; left: 0; top: 0; bottom: 0; width: 3px; }
.badges { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.might { position: absolute; right: -4%; bottom: -3%; min-width: clamp(20px, calc(var(--h) * .19), 30px); height: clamp(20px, calc(var(--h) * .19), 30px); padding: 0 4px; display: flex; align-items: center; justify-content: center; border-radius: 999px; font: 700 max(11px, calc(var(--h) * .1))/1 var(--ui); color: var(--gold-0); background: radial-gradient(circle at 50% 30%, #2a3348, #0b1019); border: 1px solid var(--gold-3); box-shadow: 0 2px 6px rgba(0, 0, 0, .6); }
.might.up { color: #7ff0b8; border-color: #2f8f63; }
/* Off the board the printed might is on the art: show the badge only when it has changed. */
.hand .might:not(.up):not(.down), .mull-row .might:not(.up):not(.down), .chain-band .might:not(.up):not(.down) { display: none; }
.might.down { color: #ff9aa5; border-color: #8f2f3a; }
.dmg { position: absolute; right: -4%; top: -3%; min-width: max(18px, calc(var(--h) * .17)); height: max(18px, calc(var(--h) * .17)); padding: 0 4px; display: flex; align-items: center; justify-content: center; border-radius: 999px; font: 700 max(10px, calc(var(--h) * .09))/1 var(--ui); color: #fff; background: radial-gradient(circle at 50% 30%, #ff6b78, #a3192a); box-shadow: 0 2px 8px rgba(163, 25, 42, .6); animation: pop .3s var(--ease-out); }
.chips { position: absolute; left: -3%; top: 6%; display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.chip { padding: 1px 6px; border-radius: 4px; font-size: max(9px, calc(var(--h) * .065)); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; background: rgba(4, 7, 13, .9); border: 1px solid var(--line-strong); color: var(--gold-1); white-space: nowrap; }
.chip.bad { color: #ffb0b8; border-color: rgba(255, 93, 108, .5); }
.chip.atk { color: #ffb0b8; border-color: rgba(255, 93, 108, .6); }
.chip.def { color: #a8d1ff; border-color: rgba(88, 168, 255, .6); }
.slot.attacker .face { box-shadow: 0 0 0 2px rgba(255, 93, 108, .8), 0 0 16px rgba(255, 93, 108, .4); }
.slot.defender .face { box-shadow: 0 0 0 2px rgba(88, 168, 255, .8), 0 0 16px rgba(88, 168, 255, .4); }

/* sleeves (card backs) */
.sleeve { position: absolute; inset: 0; overflow: hidden; background: var(--sl-bg); color: var(--sl-ink); display: flex; align-items: center; justify-content: center; }
.sleeve::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(135deg, rgba(255, 255, 255, .035) 0 2px, transparent 2px 9px), radial-gradient(circle at 50% 45%, var(--sl-glow), transparent 62%); }
.sleeve .frame { position: absolute; inset: 7%; border: 1px solid var(--sl-line); border-radius: 4px; }
.sleeve .frame::after { content: ""; position: absolute; inset: 3px; border: 1px solid var(--sl-line); opacity: .45; border-radius: 3px; }
.sleeve svg { position: relative; width: 46%; filter: drop-shadow(0 0 6px var(--sl-glow)); }
.sleeve-art, .sleeve-custom { background: #000 center / cover no-repeat; }
.sleeve-art { background-size: 190% auto; background-position: 50% 13%; }
.sleeve-art::before, .sleeve-custom::before { background: linear-gradient(180deg, rgba(0, 0, 0, .05), rgba(0, 0, 0, .35)); }
.sleeve-art .frame, .sleeve-custom .frame { border-color: rgba(227, 205, 148, .55); }
.sl-rift { --sl-bg: linear-gradient(160deg, #123a63 0%, #0a2340 55%, #061528 100%); --sl-ink: #d9bf86; --sl-line: rgba(217, 191, 134, .55); --sl-glow: rgba(88, 168, 255, .28); }
.sl-obsidian { --sl-bg: linear-gradient(160deg, #1a1a1c 0%, #0b0b0c 60%, #040404 100%); --sl-ink: #d4b56e; --sl-line: rgba(212, 181, 110, .6); --sl-glow: rgba(212, 181, 110, .18); }
.sl-pearl { --sl-bg: linear-gradient(160deg, #f4f0e6 0%, #e2dccd 55%, #c9c1ad 100%); --sl-ink: #8c6a2c; --sl-line: rgba(140, 106, 44, .5); --sl-glow: rgba(255, 255, 255, .5); }
.sl-ember { --sl-bg: linear-gradient(160deg, #6a1420 0%, #3a0a11 55%, #1c0408 100%); --sl-ink: #f0c987; --sl-line: rgba(240, 201, 135, .5); --sl-glow: rgba(255, 110, 70, .25); }
.sl-jade { --sl-bg: linear-gradient(160deg, #11594b 0%, #0a3a31 55%, #04201b 100%); --sl-ink: #e3d39f; --sl-line: rgba(227, 211, 159, .5); --sl-glow: rgba(41, 211, 194, .22); }
.sl-aether { --sl-bg: linear-gradient(160deg, #3e2066 0%, #24113f 55%, #110722 100%); --sl-ink: #d7d2f0; --sl-line: rgba(215, 210, 240, .45); --sl-glow: rgba(160, 120, 255, .28); }
.sl-dusk { --sl-bg: linear-gradient(160deg, #0d4655 0%, #19255a 55%, #12093a 100%); --sl-ink: #f0d9a2; --sl-line: rgba(240, 217, 162, .5); --sl-glow: rgba(41, 211, 194, .2); }

/* piles */
.pile { position: relative; width: var(--pile-w); height: calc(var(--pile-w) * 1.3965); flex: none; }
.pile .layer { position: absolute; inset: 0; border-radius: 5px; overflow: hidden; box-shadow: 0 1px 3px rgba(0, 0, 0, .6), 0 0 0 1px rgba(0, 0, 0, .6); }
.pile .layer:nth-child(1) { transform: translate(3px, 3px); }
.pile .layer:nth-child(2) { transform: translate(1.5px, 1.5px); }
.pile .count { position: absolute; z-index: 5; left: 50%; bottom: -9px; transform: translateX(-50%); min-width: 26px; height: 18px; padding: 0 6px; border-radius: 9px; background: rgba(4, 7, 13, .95); border: 1px solid var(--gold-3); color: var(--gold-0); font-size: 10.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.pile .lbl { position: absolute; top: -16px; left: 0; right: 0; text-align: center; font-size: 9px; letter-spacing: .16em; text-transform: uppercase; color: var(--text-3); }
.pile.empty .layer { opacity: 0; }
.pile.empty::before { content: ""; position: absolute; inset: 0; border: 1px dashed var(--line-cool); border-radius: 5px; }
.pile.clickable { cursor: pointer; }
.pile.clickable:hover .layer:last-child { box-shadow: 0 0 0 1px var(--gold-2), 0 0 14px rgba(200, 170, 110, .3); }
.pile.shuffling .layer:nth-child(1) { animation: riffle-a .9s var(--ease) 2; }
.pile.shuffling .layer:nth-child(2) { animation: riffle-b .9s var(--ease) 2; }
.pile.shuffling .layer:nth-child(3) { animation: riffle-c .9s var(--ease) 2; }
@keyframes riffle-a { 0%, 100% { transform: translate(3px, 3px); } 35% { transform: translate(-58%, -4px) rotate(-8deg); } 65% { transform: translate(6px, 2px) rotate(2deg); } }
@keyframes riffle-b { 0%, 100% { transform: translate(1.5px, 1.5px); } 35% { transform: translate(58%, -6px) rotate(8deg); } 65% { transform: translate(-4px, 1px) rotate(-2deg); } }
@keyframes riffle-c { 0%, 100% { transform: none; } 50% { transform: translateY(-6px); } }

/* ---------- game table (full screen) ---------- */
.table { --unit-h: clamp(64px, 14vh, 190px); --lane-unit-h: clamp(56px, 12.2vh, 165px); --hand-h: clamp(110px, 27vh, 330px); --rune-h: clamp(34px, 6.2vh, 80px); --bf-h: clamp(54px, 12vh, 160px); --legend-h: clamp(60px, 13vh, 176px);
  --r-ohand: 5.5vh; --r-strip: 16vh; --r-hand: 22vh; --node: clamp(18px, 3.2vh, 32px);
  position: fixed; inset: 0; display: grid; grid-template-columns: minmax(0, 1fr) clamp(250px, 21vw, 320px); background:
    radial-gradient(ellipse 70% 50% at 45% 50%, rgba(200, 170, 110, .06), transparent 70%),
    radial-gradient(ellipse 60% 40% at 45% 105%, rgba(88, 168, 255, .07), transparent 70%),
    radial-gradient(ellipse 60% 40% at 45% -5%, rgba(255, 93, 108, .06), transparent 70%), var(--ink-1); overflow: hidden; }
.board { position: relative; display: grid; grid-template-rows: var(--r-ohand) var(--r-strip) minmax(0, 1fr) var(--r-strip) var(--r-hand); padding: 0 1.4vw; min-width: 0; overflow: hidden; user-select: none; -webkit-user-select: none; }
/* a faint drafting grid under the play area */
.board::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(rgba(140, 170, 220, .045) 1px, transparent 1px) 0 0 / 3.2vh 3.2vh, linear-gradient(90deg, rgba(140, 170, 220, .045) 1px, transparent 1px) 0 0 / 3.2vh 3.2vh;
  -webkit-mask-image: radial-gradient(ellipse 70% 62% at 50% 50%, #000 35%, transparent 100%); mask-image: radial-gradient(ellipse 70% 62% at 50% 50%, #000 35%, transparent 100%); }
.strip { display: flex; gap: 1.2vw; align-items: center; min-width: 0; }
.strip > .units { flex: 1 1 0; align-self: stretch; }
.cluster { display: flex; gap: .6vw; align-items: center; }
.cluster > .slot { --h: var(--legend-h); }
.units { container-type: inline-size; display: flex; gap: 8px; align-items: center; justify-content: center; min-width: 0; min-height: var(--unit-h); border-radius: 12px; transition: background .25s, box-shadow .25s; }
.units > .slot { --h: min(var(--unit-h), calc((100cqw - (var(--n, 1) - 1) * 8px) / var(--n, 1) / .8)); }
.runes { display: grid; grid-auto-flow: column; grid-template-rows: repeat(2, auto); gap: 4px; justify-content: end; align-content: center; }
.runes > .slot { --h: var(--rune-h); }
.piles { display: flex; gap: .8vw; align-items: center; padding-top: 12px; }
.pile { --pile-w: calc(var(--unit-h) * .55); }
.hand-row { container-type: inline-size; position: relative; display: flex; justify-content: center; align-items: flex-start; min-width: 0; }
.hand { display: flex; justify-content: center; align-items: flex-start; }
.hand.mine { margin-top: 1.5vh; }
/* cards overlap more as the hand grows, so a full hand stays on screen */
.hand.mine > .slot { --h: var(--hand-h); margin: 0 min(calc(var(--hand-h) * -.09), calc((96cqw / var(--n, 1) - var(--hand-h) * .716) / 2)); z-index: 1; transition: margin .3s var(--ease-out), width .35s var(--ease-out); }
.hand.mine > .slot .card { transform: rotate(var(--fan, 0deg)) translateY(var(--lift, 0px)); transform-origin: 50% 130%; }
.hand.mine > .slot:hover { z-index: 10; }
.hand.mine > .slot:hover .card { transform: rotate(0deg) translateY(-14%) scale(1.1); }
.hand.mine > .slot.selected .card { transform: rotate(0deg) translateY(-16%) scale(1.1); }
.hand.theirs { margin-top: -4.6vh; }
.hand.theirs > .slot { --h: calc(var(--unit-h) * .74); margin: 0 calc(var(--unit-h) * -.09); }
.hand.theirs > .slot .card { transform: rotate(calc(var(--fan, 0deg) * -1)); transform-origin: 50% -30%; }
.lanes { display: grid; grid-template-columns: calc(var(--node) * 1.75) repeat(var(--lanes, 2), minmax(0, 1fr)) calc(var(--node) * 1.75); gap: 1.4vw; min-height: 0; padding: .6vh 0; }
/* A battlefield is a framed area (corner brackets), its card in the middle, their units above and yours below. */
.lane { --unit-h: var(--lane-unit-h); --bk: rgba(227, 205, 148, .38); position: relative; display: grid; grid-template-rows: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: .4vh; min-height: 0; padding: .6vh .6vw; border-radius: 6px; border: 1px solid var(--line-cool);
  background: linear-gradient(var(--bk), var(--bk)) left 5px top 5px / 16px 1px no-repeat, linear-gradient(var(--bk), var(--bk)) left 5px top 5px / 1px 16px no-repeat,
    linear-gradient(var(--bk), var(--bk)) right 5px top 5px / 16px 1px no-repeat, linear-gradient(var(--bk), var(--bk)) right 5px top 5px / 1px 16px no-repeat,
    linear-gradient(var(--bk), var(--bk)) left 5px bottom 5px / 16px 1px no-repeat, linear-gradient(var(--bk), var(--bk)) left 5px bottom 5px / 1px 16px no-repeat,
    linear-gradient(var(--bk), var(--bk)) right 5px bottom 5px / 16px 1px no-repeat, linear-gradient(var(--bk), var(--bk)) right 5px bottom 5px / 1px 16px no-repeat,
    linear-gradient(180deg, rgba(255, 93, 108, .05), rgba(10, 15, 25, .35) 30%, rgba(10, 15, 25, .35) 70%, rgba(88, 168, 255, .06)); transition: border-color .3s, box-shadow .3s, background .3s; }
.lane.mine { border-color: rgba(88, 168, 255, .45); }
.lane.theirs { border-color: rgba(255, 93, 108, .4); }
.lane.showdown { box-shadow: inset 0 0 0 1px rgba(227, 205, 148, .6), inset 0 0 40px rgba(227, 205, 148, .12); }
.lane.mine { --bk: rgba(88, 168, 255, .55); }
.lane.theirs { --bk: rgba(255, 93, 108, .5); }
.conquer { position: absolute; z-index: 4; left: 50%; top: 50%; padding: 6px 14px; border-radius: 4px; pointer-events: none; white-space: nowrap; font: 600 clamp(11px, 1.6vh, 15px)/1 var(--display); letter-spacing: .22em; text-transform: uppercase;
  background: rgba(4, 7, 13, .9); border: 1px solid currentColor; box-shadow: 0 0 28px currentColor; animation: conquer 2.4s var(--ease-out) forwards; }
.conquer b { font-weight: 700; color: var(--gold-0); }
.conquer.me { color: var(--me); }
.conquer.opp { color: var(--opp); }
@keyframes conquer { 0% { opacity: 0; transform: translate(-50%, -50%) scale(1.4); } 14% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 78% { opacity: 1; transform: translate(-50%, -50%); } 100% { opacity: 0; transform: translate(-50%, -80%); } }
/* score tracks: 0 at your end, the victory score at the far end */
.track { position: relative; width: calc(var(--node) * 1.75); height: calc(var(--node) * (1 + (var(--nodes) - 1) * .62)); }
.track.me { grid-column: 1; grid-row: 1; align-self: end; }
.track.opp { grid-column: -2; grid-row: 1; align-self: start; }
.node { position: absolute; width: var(--node); height: var(--node); border-radius: 50%; display: flex; align-items: center; justify-content: center; font: 600 calc(var(--node) * .44)/1 var(--display); font-style: normal; color: var(--text-3);
  background: radial-gradient(circle at 50% 35%, #1a2335, #0a0f19); border: 1px solid var(--line-cool); box-shadow: 0 2px 6px rgba(0, 0, 0, .5); transition: background .4s, border-color .4s, color .4s, box-shadow .4s, transform .4s var(--ease-out); }
.track.me .node { bottom: calc(var(--i) * var(--node) * .62); left: calc(var(--x) * var(--node) * .75); }
.track.opp .node { top: calc(var(--i) * var(--node) * .62); right: calc(var(--x) * var(--node) * .75); }
.node.goal { border-color: var(--gold-3); color: var(--gold-2); }
.track.me .node.won { color: #cfe2ff; border-color: rgba(88, 168, 255, .5); background: radial-gradient(circle at 50% 35%, rgba(88, 168, 255, .42), rgba(14, 36, 66, .95)); }
.track.opp .node.won { color: #ffd3d7; border-color: rgba(255, 93, 108, .5); background: radial-gradient(circle at 50% 35%, rgba(255, 93, 108, .4), rgba(66, 14, 22, .95)); }
.node.now { z-index: 1; color: #fff; transform: scale(1.16); }
.track.me .node.now { border-color: var(--me); background: radial-gradient(circle at 50% 35%, rgba(88, 168, 255, .7), rgba(14, 36, 66, .95)); box-shadow: 0 0 0 2px rgba(88, 168, 255, .25), 0 0 18px rgba(88, 168, 255, .6); }
.track.opp .node.now { border-color: var(--opp); background: radial-gradient(circle at 50% 35%, rgba(255, 93, 108, .7), rgba(66, 14, 22, .95)); box-shadow: 0 0 0 2px rgba(255, 93, 108, .25), 0 0 18px rgba(255, 93, 108, .6); }
.node.now:not(:first-child) { animation: land .7s var(--ease-out); }
.node.now:not(:first-child)::after { content: ""; position: absolute; inset: -1px; border-radius: 50%; border: 2px solid currentColor; opacity: 0; animation: ring 1.1s var(--ease-out); }
@keyframes land { 0% { transform: scale(1.8); filter: brightness(1.8); } 60% { transform: scale(1.08); } }
@keyframes ring { 0% { opacity: .9; transform: scale(1); } 100% { opacity: 0; transform: scale(2.6); } }
.centerline { display: flex; align-items: center; justify-content: center; gap: 1vw; }
.centerline > .slot { --h: var(--bf-h); }
.bf-meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.bf-meta .title { font: 600 clamp(11px, 1.5vh, 15px)/1.15 var(--display); letter-spacing: .06em; color: var(--gold-0); }
.facedown { display: flex; gap: 4px; }
.facedown > .slot { --h: calc(var(--bf-h) * .62); }
.ctrl { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; color: var(--text-3); }
.ctrl.me { color: var(--me); }
.ctrl.opp { color: var(--opp); }
/* drop targets while dragging or placing */
.drop-ok { box-shadow: inset 0 0 0 2px rgba(227, 205, 148, .65), 0 0 26px rgba(227, 205, 148, .18) !important; background: rgba(227, 205, 148, .05) !important; cursor: pointer; }
.drop-hover { box-shadow: inset 0 0 0 2px var(--gold-0), 0 0 34px rgba(244, 233, 207, .4) !important; background: rgba(227, 205, 148, .1) !important; }
.lane.zone-target, .units.zone-target { box-shadow: inset 0 0 0 2px rgba(41, 211, 194, .7), 0 0 24px rgba(41, 211, 194, .2); cursor: pointer; }
.drag-ghost { position: fixed; z-index: 90; pointer-events: none; transform-origin: 50% 50%; filter: drop-shadow(0 18px 30px rgba(0, 0, 0, .6)); }
.drag-ghost .count { position: absolute; right: -8px; top: -8px; min-width: 24px; height: 24px; border-radius: 12px; background: var(--gold-1); color: #1b1408; font-weight: 800; font-size: 12px; display: flex; align-items: center; justify-content: center; }
.chain-band { position: absolute; z-index: 15; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; gap: 12px; align-items: center; padding: 14px 18px; border-radius: 16px; background: rgba(4, 7, 13, .84); border: 1px solid var(--line-strong); box-shadow: 0 20px 60px rgba(0, 0, 0, .6); backdrop-filter: blur(6px); animation: pop .3s var(--ease-out); pointer-events: none; }
.chain-band > .slot { --h: calc(var(--unit-h) * 1.25); pointer-events: auto; }
.chain-band .lbl { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 10px; letter-spacing: .3em; color: var(--gold-2); text-transform: uppercase; }
.phase { position: absolute; z-index: 12; left: 50%; top: calc(var(--r-ohand) + var(--r-strip)); transform: translate(-50%, -50%); display: inline-flex; gap: 10px; align-items: center; padding: 4px 14px; border-radius: 20px; background: rgba(4, 7, 13, .82); border: 1px solid var(--line); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-2); white-space: nowrap; }
.phase b { color: var(--gold-0); font-weight: 700; }
.phase .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); }
.phase .dot.me { background: var(--me); box-shadow: 0 0 8px var(--me); }
.phase .dot.opp { background: var(--opp); box-shadow: 0 0 8px var(--opp); }
.turn-banner { position: absolute; z-index: 30; left: 0; right: 0; top: 42%; text-align: center; pointer-events: none; font: 600 clamp(28px, 5vh, 48px)/1 var(--display); letter-spacing: .3em; color: var(--gold-0); text-shadow: 0 0 30px rgba(227, 205, 148, .6), 0 4px 20px rgba(0, 0, 0, .8); animation: banner 1.6s var(--ease-out) forwards; }
.turn-banner::before, .turn-banner::after { content: ""; display: block; height: 1px; margin: 14px auto; width: 40%; background: linear-gradient(90deg, transparent, var(--gold-2), transparent); }
@keyframes banner { 0% { opacity: 0; letter-spacing: .6em; } 20% { opacity: 1; letter-spacing: .3em; } 75% { opacity: 1; } 100% { opacity: 0; } }
.menu-btn { position: absolute; z-index: 25; left: 12px; top: 12px; }
.menu-pop { position: absolute; z-index: 26; left: 12px; top: 56px; width: 240px; padding: 12px; display: flex; flex-direction: column; gap: 10px; animation: pop .25s var(--ease-out); }
/* a question's answers that have no place on the board, over the opponent's hand row */
.ask { position: absolute; z-index: 18; left: 50%; top: .7vh; transform: translateX(-50%); max-width: min(760px, 74%); display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 12px;
  padding: 7px 12px; border-radius: 10px; background: rgba(6, 10, 18, .93); border: 1px solid var(--line-strong); box-shadow: 0 10px 34px rgba(0, 0, 0, .55); animation: ask-in .25s var(--ease-out); }
@keyframes ask-in { from { opacity: 0; transform: translate(-50%, -6px); } }
.ask .q { font: 600 13px/1.25 var(--display); letter-spacing: .06em; color: var(--gold-0); }
.ask .hint { font-size: 12px; color: var(--text-2); }
.ask .hint b { color: var(--gold-1); font-weight: 600; }
.ask .notice { padding: 4px 8px; }
.ask .answers { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.ask.in-rail { display: none; }
/* the server's clock: a bar that drains, the last ten seconds counted */
.clock { position: absolute; left: 18%; right: 18%; bottom: 8px; height: 3px; border-radius: 2px; background: rgba(0, 0, 0, .28); pointer-events: none; }
.clock i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 2px; background: currentColor; opacity: .75; transition: width .25s linear; }
.clock em { position: absolute; right: -2.4em; top: 50%; transform: translateY(-50%); font: 700 12px/1 var(--ui); font-style: normal; }
.clock.low i { background: #ff5d6c; opacity: 1; animation: clock-low 1s ease-in-out infinite; }
.clock.low em { color: #ff5d6c; }
@keyframes clock-low { 50% { opacity: .45; } }
.plate { position: relative; }
.plate .clock { left: 10px; right: 10px; bottom: 4px; height: 2px; color: var(--opp); }
.plate .clock em { right: 0; top: -12px; transform: none; font-size: 11px; }
/* card action popover */
.popover { position: fixed; z-index: 85; min-width: 200px; max-width: 300px; padding: 6px; border-radius: 12px; background: rgba(8, 12, 20, .97); border: 1px solid var(--line-strong); box-shadow: 0 18px 50px rgba(0, 0, 0, .65); animation: pop .2s var(--ease-out); display: flex; flex-direction: column; gap: 2px; }
.popover button { text-align: left; padding: 9px 12px; border-radius: 8px; border: 0; background: none; color: var(--text); cursor: pointer; font-size: 13px; line-height: 1.3; transition: background .15s, color .15s; }
.popover button:hover { background: rgba(200, 170, 110, .12); color: var(--gold-0); }
.popover button small { display: block; margin-top: 2px; font-size: 11px; color: var(--text-2); line-height: 1.35; }
.popover .head { padding: 6px 12px 4px; font: 600 12px/1.2 var(--display); letter-spacing: .08em; color: var(--gold-1); }

/* setup: who goes first, mulligans (one seat at a time) */
.setup { position: absolute; inset: 0; z-index: 22; display: grid; grid-template-rows: minmax(0, 1fr) auto minmax(0, 1fr); background: radial-gradient(ellipse at 50% 60%, rgba(14, 22, 38, .92), rgba(5, 8, 15, .95)); animation: fade .35s ease; }
.setup-label { position: relative; justify-self: center; align-self: center; z-index: 2; padding: 7px 20px; border-radius: 4px; border: 1px solid var(--line-strong); background: rgba(4, 7, 13, .94); font-size: 11px; font-weight: 600; letter-spacing: .26em; text-transform: uppercase; color: var(--gold-1); white-space: nowrap; }
.setup-label::before, .setup-label::after { content: ""; position: absolute; top: 50%; width: 22px; height: 1px; background: var(--gold-3); }
.setup-label::before { right: calc(100% + 8px); }
.setup-label::after { left: calc(100% + 8px); }
.half-pick { position: relative; margin: 1.2vh 1.4vw; border-radius: 8px; border: 1px solid var(--line); cursor: pointer; overflow: hidden; color: var(--gold-0); font: 600 clamp(15px, 2.4vh, 24px)/1 var(--display); letter-spacing: .2em; text-transform: uppercase; transition: filter .25s, box-shadow .3s, transform .2s var(--ease); animation: rise .5s var(--ease-out) backwards; }
.half-pick::before { content: ""; position: absolute; inset: 0; opacity: .5; background: radial-gradient(rgba(255, 255, 255, .06) 1px, transparent 1.4px) 0 0 / 4px 4px; }
.half-pick.theirs { background: radial-gradient(ellipse 60% 70% at 72% 35%, rgba(176, 64, 34, .45), transparent 70%), radial-gradient(ellipse 50% 60% at 18% 80%, rgba(120, 32, 22, .45), transparent 70%), linear-gradient(180deg, #2b1511, #150b0a); }
.half-pick.mine { background: radial-gradient(ellipse 60% 70% at 25% 60%, rgba(28, 140, 128, .38), transparent 70%), radial-gradient(ellipse 50% 60% at 80% 25%, rgba(30, 90, 120, .35), transparent 70%), linear-gradient(180deg, #0c2327, #071518); animation-delay: .06s; }
.half-pick span { position: relative; text-shadow: 0 2px 14px rgba(0, 0, 0, .7); }
.half-pick:hover:not(:disabled) { filter: brightness(1.22); box-shadow: inset 0 0 0 1px var(--gold-2), inset 0 0 70px rgba(227, 205, 148, .12); }
.half-pick:active:not(:disabled) { transform: scale(.995); }
.half-pick:disabled { cursor: default; filter: grayscale(.4) brightness(.7); }
.setup.mull { grid-template-rows: minmax(0, .55fr) auto minmax(0, 1.45fr); }
.setup-status { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
.mull-backs { display: flex; }
.mull-backs > .slot { --h: 9vh; margin: 0 -1.1vh; }
.mull-area { container-type: inline-size; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2.2vh; min-height: 0; }
.mull-row { display: flex; gap: 1.4vw; justify-content: center; }
.mull-row > .slot { --h: min(38vh, 320px, calc((92cqw - 4.2vw) / 4 / .716)); animation: rise .45s var(--ease-out) backwards; }
.mull-row > .slot:nth-child(2) { animation-delay: .05s; } .mull-row > .slot:nth-child(3) { animation-delay: .1s; } .mull-row > .slot:nth-child(4) { animation-delay: .15s; }
.mull-row > .slot .card { cursor: pointer; transition: transform .3s var(--ease-out), filter .3s; }
.mull-row > .slot.marked .card { transform: translateY(6%) scale(.92); filter: brightness(.48) saturate(.5); }
.mull-row.full > .slot:not(.marked) .card { cursor: default; }
.mull-row > .slot.marked::after { content: "Set aside"; position: absolute; left: 50%; bottom: -3.2vh; transform: translateX(-50%); font-size: 10px; font-weight: 700; letter-spacing: .22em; text-transform: uppercase; color: var(--gold-1); white-space: nowrap; }
.mull-area .hint { font-size: 12px; color: var(--text-2); text-align: center; max-width: 520px; }
.setup.waiting { display: flex; align-items: center; justify-content: center; background: rgba(5, 8, 15, .5); animation: fade .3s ease .45s backwards; }
.setup-wait { padding: 18px 26px; }
.setup-wait h3 { margin: 0; }
.turn-banner.initiative.opp { color: #ffd0d4; text-shadow: 0 0 30px rgba(255, 93, 108, .55), 0 4px 20px rgba(0, 0, 0, .8); }

/* right rail */
.rail > :not(.prompt) { flex-shrink: 0; }
.rail-tools { flex-wrap: nowrap !important; }
.rail { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-left: 1px solid var(--line); background: linear-gradient(180deg, rgba(10, 15, 25, .94), rgba(6, 10, 18, .97)); min-height: 0; }
.plate { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; background: rgba(4, 7, 13, .55); border: 1px solid var(--line-cool); transition: border-color .3s, box-shadow .3s; }
.plate.active { border-color: var(--line-strong); box-shadow: 0 0 22px rgba(200, 170, 110, .1); }
.plate .avatar { position: relative; width: 30px; height: 42px; border-radius: 4px; overflow: hidden; flex: none; box-shadow: 0 0 0 1px var(--line-strong); }
.plate .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plate .sub { font-size: 11px; color: var(--text-2); }
.score { margin-left: auto; font: 600 22px/1 var(--display); color: var(--gold-0); }
.plate.opp .score { color: #ffb0b8; }
.thinking { display: inline-flex; gap: 3px; margin-left: 6px; vertical-align: middle; }
.thinking i { width: 4px; height: 4px; border-radius: 50%; background: var(--text-2); animation: think 1.2s infinite; }
.thinking i:nth-child(2) { animation-delay: .15s; }
.thinking i:nth-child(3) { animation-delay: .3s; }
@keyframes think { 0%, 60%, 100% { opacity: .25; transform: none; } 30% { opacity: 1; transform: translateY(-2px); } }
.prompt { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 12px; background: linear-gradient(180deg, rgba(26, 36, 54, .9), rgba(12, 18, 30, .9)); border: 1px solid var(--line); overflow: hidden; transition: border-color .3s, box-shadow .3s; }
.prompt.mine { border-color: rgba(227, 205, 148, .55); box-shadow: 0 0 30px rgba(200, 170, 110, .12); }
.prompt h3 { margin: 0; font: 600 14px/1.25 var(--display); letter-spacing: .08em; color: var(--gold-0); }
.prompt .hint { font-size: 12px; color: var(--text-2); line-height: 1.45; }
.prompt .hint b { color: var(--gold-1); font-weight: 600; }
.choice { display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left; padding: 9px 11px; border-radius: 8px; cursor: pointer; background: rgba(4, 7, 13, .55); border: 1px solid var(--line-cool); color: var(--text); font-size: 13px; line-height: 1.35; transition: border-color .18s, background .18s, transform .12s var(--ease); animation: opt-in .3s var(--ease-out) backwards; }
@keyframes opt-in { from { opacity: 0; transform: translateX(6px); } }
.choice:hover:not(:disabled) { border-color: var(--gold-2); background: rgba(200, 170, 110, .08); }
.choice:active:not(:disabled) { transform: scale(.99); }
.choice:disabled { opacity: .5; cursor: default; }
.choice .k { flex: none; width: 18px; height: 18px; border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: var(--gold-1); border: 1px solid var(--gold-4); background: rgba(200, 170, 110, .06); margin-top: 1px; }
.choices { display: flex; flex-direction: column; gap: 6px; }
.pass-btn { position: relative; height: 64px; border-radius: 32px; font: 600 15px/1 var(--display); letter-spacing: .2em; text-transform: uppercase; cursor: pointer; color: #1b1408; border: 1px solid #f0dca8;
  background: linear-gradient(180deg, #f3e2b4 0%, #d8bb7c 38%, #b48a45 100%); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55), inset 0 -3px 8px rgba(80, 50, 10, .35), 0 6px 26px rgba(200, 170, 110, .25); transition: transform .12s var(--ease), box-shadow .25s, filter .25s; overflow: hidden; }
.pass-btn:hover:not(:disabled) { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), inset 0 -3px 8px rgba(80, 50, 10, .35), 0 8px 34px rgba(227, 205, 148, .45); }
.pass-btn:active:not(:disabled) { transform: scale(.98); }
.pass-btn:disabled { filter: grayscale(1) brightness(.45); cursor: default; box-shadow: none; }
.pass-btn::after { content: ""; position: absolute; inset: -40% auto -40% -60%; width: 40%; transform: skewX(-20deg); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent); opacity: 0; }
.pass-btn:hover:not(:disabled)::after { animation: shine .9s var(--ease); }
.pass-btn.end { background: linear-gradient(180deg, #bfe9ff 0%, #6fb6ec 40%, #2f6fa8 100%); border-color: #cdeeff; color: #04121f; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55), inset 0 -3px 8px rgba(5, 30, 60, .4), 0 6px 26px rgba(88, 168, 255, .3); }
.prompt .history { flex: 1; min-height: 0; margin-top: 2px; }
.history { display: flex; flex-direction: column; gap: 4px; overflow: auto; font-size: 12px; padding-right: 4px; }
.history div { padding: 3px 0 3px 10px; border-left: 2px solid var(--line-cool); }
.history .me { border-color: rgba(88, 168, 255, .6); color: #c4dcff; }
.history .opp { border-color: rgba(255, 93, 108, .6); color: #ffc7cd; }
.history .score { border-color: var(--gold-2); color: var(--gold-1); font-weight: 600; }
.history .end { border-color: var(--good); color: var(--good); font-weight: 700; }
.history .info { color: var(--text-3); }
.notice { padding: 8px 10px; border-radius: 8px; font-size: 12px; background: rgba(255, 180, 70, .08); border: 1px solid rgba(255, 180, 70, .35); color: #ffd59a; }
details.box > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; font-weight: 600; padding: 6px 0; }
details.box > summary::-webkit-details-marker { display: none; }
details.box > summary::before { content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform .25s var(--ease-out); }
details.box[open] > summary::before { transform: rotate(45deg); }

/* zoom */
.zoom { position: fixed; z-index: 50; width: var(--zw, 300px); pointer-events: none; animation: zoom-in .22s var(--ease-out); }
.zoom .slot { --w: var(--zw, 300px); }
.zoom .slot.landscape { --h: calc(var(--zw, 300px) / 1.3965); }
.zoom .facts { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: rgba(4, 7, 13, .94); border: 1px solid var(--line); font-size: 12px; color: var(--text-2); }
.zoom .facts b { color: var(--gold-0); }
@keyframes zoom-in { from { opacity: 0; transform: translateY(6px) scale(.97); } }

/* result */
.result { position: fixed; inset: 0; z-index: 70; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; background: radial-gradient(ellipse at 50% 45%, rgba(200, 170, 110, .16), rgba(2, 4, 8, .88) 60%); backdrop-filter: blur(3px); animation: fade .6s ease; }
.result.loss { background: radial-gradient(ellipse at 50% 45%, rgba(255, 93, 108, .14), rgba(2, 4, 8, .9) 60%); }
.result h1 { margin: 0; font: 600 clamp(48px, 9vw, 96px)/1 var(--display); letter-spacing: .22em; background: linear-gradient(180deg, #fff6dc 0%, #e3cd94 45%, #9c7a3c 100%); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 4px 30px rgba(227, 205, 148, .35)); animation: crown 1.2s var(--ease-out); }
.result.loss h1 { background: linear-gradient(180deg, #ffe1e4 0%, #d98a93 50%, #7a3440 100%); -webkit-background-clip: text; background-clip: text; }
@keyframes crown { from { opacity: 0; letter-spacing: .5em; transform: scale(1.06); } }
.result .line { width: min(420px, 70vw); height: 1px; background: linear-gradient(90deg, transparent, var(--gold-2), transparent); }

/* lobby */
.lobby { max-width: 760px; margin: 0 auto; text-align: center; }
.lobby .code { display: inline-flex; gap: 10px; margin: 18px 0; }
.lobby .code span { width: 58px; height: 72px; display: flex; align-items: center; justify-content: center; font: 600 34px/1 var(--display); color: var(--gold-0); border-radius: 10px; background: rgba(4, 7, 13, .7); border: 1px solid var(--line-strong); box-shadow: inset 0 0 20px rgba(200, 170, 110, .08); animation: pop .5s var(--ease-out) backwards; }
.lobby .code span:nth-child(2) { animation-delay: .06s; } .lobby .code span:nth-child(3) { animation-delay: .12s; } .lobby .code span:nth-child(4) { animation-delay: .18s; } .lobby .code span:nth-child(5) { animation-delay: .24s; }
.versus { display: grid; grid-template-columns: 1fr auto 1fr; gap: 24px; align-items: center; margin: 28px 0; }
.versus .vs { font: 600 18px/1 var(--display); letter-spacing: .3em; color: var(--gold-3); }
.seat { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 20px; }
.seat .slot { --w: 96px; }
.seat.waiting .slot { animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .45; transform: scale(.97); } }

/* reduced motion */
.motion-off *, .motion-off *::before, .motion-off *::after { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) { .motion-auto *, .motion-auto *::before, .motion-auto *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  :root { --card-w: 64px; }
  .modes { grid-template-columns: 1fr; }
  .play-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  :root { --card-w: 50px; }
  .topbar { gap: 8px; padding: 0 10px; }
  .logo b, .logo i { display: none; }
  .nav { min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .nav a { padding: 0 8px; letter-spacing: .08em; font-size: 11px; white-space: nowrap; }
  .who span { display: none; }
  .page { padding: 20px 14px 48px; }
  .sleeve-stage, .settings { grid-template-columns: 1fr; }
  .versus { grid-template-columns: 1fr; }
  .zoom { display: none; }
}
/* Phones: the board takes the top, a compact bar with the prompt and Pass takes the bottom. */
@media (max-width: 820px) {
  .table { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; --unit-h: 8.6vh; --lane-unit-h: 8.6vh; --hand-h: 16vh; --rune-h: 3.9vh; --bf-h: 6.6vh; --legend-h: 7vh;
    --r-ohand: 3.5vh; --r-strip: 9.5vh; --r-hand: 13.5vh; }
  .board { padding: 0 2vw; }
  .phase { font-size: 9.5px; padding: 3px 10px; }
  .lanes { grid-template-columns: repeat(var(--lanes, 2), minmax(0, 1fr)); }
  .track { display: none; }
  .bf-meta .title { font-size: 10px; }
  .bf-meta .ctrl { font-size: 8.5px; letter-spacing: .08em; }
  .centerline { gap: 6px; }
  .strip { gap: 2vw; }
  .strip .piles { display: none; }
  .lanes { gap: 2vw; }
  .rail { border-left: 0; border-top: 1px solid var(--line-strong); max-height: 30vh; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); gap: 8px; }
  .rail .plate, .rail .rail-tools, .prompt .history { display: none; }
  .board .ask { display: none; }
  .rail:has(.ask.in-rail) .prompt { display: none; }
  .ask.in-rail { display: flex; position: static; transform: none; max-width: none; padding: 8px 10px; justify-content: flex-start; animation: none; box-shadow: none; }
  .ask .q { font-size: 12px; }
  .prompt { padding: 10px; }
  .pass-btn { height: 48px; font-size: 13px; }
  .menu-btn { left: 6px; top: 6px; }
}
