:root {
  --felt: #1b2a1a; --felt-2: #223321; --gold: #c9a84c; --gold-2: #e6cc7a; --gold-dk: #7a6024;
  --ink: #e9dfc4; --ink-dim: #a99d7d; --wax: #8e1f1f; --wood: #2a1a10;
  --parch: #e9dcb8; --parch-2: #d6c497; --parch-ink: #3b2b17;
  --card-h: 180px; --card-w: calc(var(--card-h) * 0.707);
  --legal: rgba(255, 205, 110, .85);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #120c07; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { cursor: default; }
a { color: inherit; }

#table { position: fixed; inset: 0; }
#stage {
  position: absolute; left: 0; top: 0; width: 1440px; height: 900px; overflow: hidden; overflow: clip;
  transform-origin: 0 0; transform: translate(var(--ox, 0px), var(--oy, 0px)) scale(var(--k, 1));
  color: var(--ink); font-family: 'IM Fell English', Georgia, serif;
  background:
    repeating-linear-gradient(92deg, rgba(0,0,0,.18) 0 2px, transparent 2px 9px, rgba(255,255,255,.025) 9px 10px, transparent 10px 23px),
    repeating-linear-gradient(90deg, #2b1b11 0 140px, #24160d 140px 300px, #2e1d12 300px 420px), var(--wood);
}
#table.portrait #stage { width: 440px; height: 956px; }
#table.busy .mat { cursor: progress; }

/* ── felt ─────────────────────────────────────────────────────────────── */
.mat {
  /* clip, not just hidden: a hidden box can still be scrolled (focus, scrollIntoView), which shifted the felt */
  position: absolute; inset: 46px 22px 0 22px; border-radius: 28px 28px 0 0; overflow: hidden; overflow: clip;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(255,214,140,.10), transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .22 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    radial-gradient(ellipse at center, var(--felt-2), var(--felt) 70%, #111b10);
  box-shadow: inset 0 0 0 2px #0c120b, inset 0 0 0 9px #3a2a14, inset 0 0 0 10px var(--gold-dk), inset 0 0 120px rgba(0,0,0,.75);
}
.mat::before { content: ''; position: absolute; inset: 18px 18px -10px 18px; border-radius: 18px 18px 0 0; pointer-events: none; border: 2px dashed rgba(201,168,76,.35); }
.crest { position: absolute; left: 50%; top: 48%; width: 330px; height: 330px; transform: translate(-50%,-50%); border-radius: 50%; pointer-events: none;
  border: 1px solid rgba(201,168,76,.12); box-shadow: 0 0 0 26px rgba(201,168,76,.035), 0 0 0 27px rgba(201,168,76,.10); }

/* ── site bar ─────────────────────────────────────────────────────────── */
.sitebar { position: absolute; top: 0; left: 22px; right: 22px; height: 46px; display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.brand { font-family: 'Cinzel'; font-weight: 900; font-size: 19px; letter-spacing: .14em; color: var(--gold-2); text-shadow: 0 2px 0 #000; margin-right: 10px;
  text-decoration: none; }   /* a link home */
.brand:hover, .brand:focus-visible { color: #fff0c2; text-shadow: 0 2px 0 #000, 0 0 14px rgba(230,204,122,.55); }
/* stays clickable over the dim on the sheets around a game (choosing a deck, taking your seat,
   the game's end); a choice mid-game keeps it covered, since leaving would ask in that sheet */
#table:has(#modal.deckbook:not([hidden]), #modal.start-sheet:not([hidden]), #modal.game-over:not([hidden])) .sitebar .brand { position: relative; z-index: 22; }
.tab { font-family: 'Cinzel'; font-size: 12px; letter-spacing: .14em; color: var(--ink); padding: 7px 13px 6px; border-radius: 3px; text-decoration: none;
  background: linear-gradient(#3b2a19, #2a1c10); box-shadow: inset 0 1px 0 rgba(255,220,160,.15), 0 0 0 1px #120b05, 0 2px 4px rgba(0,0,0,.5); }
.tab b { color: var(--gold-2); font-weight: 700; }
.tab:hover, .tab.on { background: linear-gradient(#5a3f1e, #3d2a14); color: var(--gold-2); }
.spacer { flex: 1; }

/* ── rows and slots ───────────────────────────────────────────────────── */
/* No transform or z-index on a row, so it's no layer of its own: from the bottom up go the mat
   (empty slots), the opponent's hand, then the cards in play. The row spans the mat, so only
   its slots and cards take clicks. */
.row { position: absolute; left: 0; right: 0; display: flex; justify-content: center; gap: 14px; align-items: center; pointer-events: none; }
.row > * { pointer-events: auto; }
.row > .card { z-index: 2; }
.row.opp { top: 48px; } .row.you { top: 404px; }
.terrain-gap { width: 26px; display: flex; justify-content: center; }
.terrain-gap::after { content: ''; width: 1px; height: 150px; background: linear-gradient(transparent, rgba(201,168,76,.45), transparent); }
.slot { width: var(--card-w); height: var(--card-h); border-radius: 9px; position: relative; box-shadow: inset 0 2px 6px rgba(0,0,0,.65);
  background: rgba(0,0,0,.16); outline: 1px solid rgba(201,168,76,.22); outline-offset: 5px; display: grid; place-items: center; color: rgba(201,168,76,.35);
  font-family: 'Cinzel'; font-size: 11px; letter-spacing: .25em; text-transform: uppercase; }
.slot .sigil { width: 46px; height: 46px; border: 1px solid rgba(201,168,76,.28); transform: rotate(45deg); display: grid; place-items: center; }
.slot .sigil span { transform: rotate(-45deg); font-size: 20px; letter-spacing: 0; }
.slot .label { position: absolute; bottom: 14px; }
/* a slot a card added (Mind Palace, Super Auto Pets, Joke Boat), named under its label */
.slot.granted { outline-color: rgba(201,168,76,.5); background: rgba(201,168,76,.06); }
.slot .from { position: absolute; top: 12px; left: 6px; right: 6px; text-align: center; font-family: 'IM Fell English', serif;
  font-size: 12px; letter-spacing: 0; text-transform: none; font-style: italic; color: rgba(230,204,122,.75); }
/* a slot a card closed (Little Plate) */
.slot.sealed { background: repeating-linear-gradient(45deg, rgba(0,0,0,.28) 0 8px, rgba(0,0,0,.12) 8px 16px); outline-style: dashed; color: rgba(201,168,76,.3); }
.slot.sealed .shut { font-size: 30px; line-height: 1; color: rgba(201,168,76,.32); }
/* rows with more cards (extra slots, a second terrain) shrink to stay clear of the side panels
   (the opponent's Loot counter on the left, the piles on the right): about 740px wide at most */
.row[data-slots="5"] { --card-h: 148px; }
.row[data-slots="6"] { --card-h: 130px; gap: 10px; }
.row[data-slots="7"], .row[data-slots="8"] { --card-h: 112px; gap: 10px; }
.row[data-slots="6"] .stat { font-size: 10px; padding: 1px 4px; }
.row[data-slots="7"] .stat, .row[data-slots="8"] .stat { font-size: 9px; padding: 1px 3px; letter-spacing: 0; }

/* ── cards ────────────────────────────────────────────────────────────── */
/* --card-w on :root is computed from :root's --card-h, so recompute it wherever --card-h is overridden */
.card, .slot { --card-w: calc(var(--card-h) * 0.707); }
.card { width: var(--card-w); height: var(--card-h); position: relative; border-radius: calc(var(--card-h) * .05); flex: none; }
.card img { width: 100%; height: 100%; display: block; border-radius: calc(var(--card-h) * .05);   /* the art's own corner, at any size */
  box-shadow: 0 6px 10px rgba(0,0,0,.55), 0 14px 26px rgba(0,0,0,.35); user-select: none; }
/* Divine cards are holographic wherever they show: a slow rainbow sheen across the art */
.card.divine::after { content: ''; position: absolute; inset: 0; border-radius: calc(var(--card-h) * .05); pointer-events: none;
  mix-blend-mode: color-dodge; opacity: .5; background-size: 250% 250%; animation: divine-holo 4.5s linear infinite;
  background-image: linear-gradient(115deg, transparent 22%, rgba(255, 255, 255, .55) 38%, rgba(140, 220, 255, .45) 46%,
    rgba(255, 170, 240, .4) 54%, rgba(255, 236, 150, .35) 60%, transparent 74%); }
@keyframes divine-holo { from { background-position: 110% 0; } to { background-position: -160% 0; } }
/* a hand card that costs something other than its printed cost right now */
.cost-seal { position: absolute; left: -8px; top: -8px; z-index: 3; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  font-family: 'Cinzel'; font-weight: 900; font-size: 16px; color: #10240b; pointer-events: none;
  background: radial-gradient(circle at 35% 30%, #d8efc4, #5e9a46 60%, #23461a); box-shadow: 0 3px 8px rgba(0, 0, 0, .6), inset 0 0 0 2px rgba(20, 50, 10, .45); }
.cost-seal.dearer { color: #2a0e0a; background: radial-gradient(circle at 35% 30%, #d9c6c0, #8a5a52 60%, #3e1f1a); }
#table.portrait .cost-seal { width: 32px; height: 32px; font-size: 14px; left: -6px; top: -6px; }
@media (prefers-reduced-motion: reduce) { .card.divine::after { animation: none; } }
.card.no-art { display: grid; place-items: center; padding: 8px; text-align: center; background: var(--parch); color: var(--parch-ink); font-family: 'Cinzel'; font-size: 12px; }
.card.tilt-l { transform: rotate(-1.2deg); } .card.tilt-r { transform: rotate(1deg); }
.card.selected { transform: translateY(-14px) rotate(-.5deg); z-index: 3; }
.card.selected img { box-shadow: 0 0 0 2px var(--gold-2), 0 0 26px 6px rgba(255,190,90,.55), 0 22px 30px rgba(0,0,0,.6); }
.card.rested img { filter: brightness(.82) saturate(.85); }
.target-ring::after { content: ''; position: absolute; inset: -5px; border-radius: 12px; border: 2px solid rgba(220,70,50,.85); box-shadow: 0 0 18px rgba(220,70,50,.55); pointer-events: none; }
.target-ring { cursor: crosshair; }
.legal { cursor: pointer; }
.slot.legal, .zone-empty.legal { outline: 2px solid var(--legal); box-shadow: inset 0 2px 6px rgba(0,0,0,.65), 0 0 22px rgba(255,190,90,.45); color: var(--gold-2); }
.card.legal img { box-shadow: 0 0 0 2px var(--legal), 0 0 22px rgba(255,190,90,.5), 0 10px 18px rgba(0,0,0,.5); }

.wax { position: absolute; right: -10px; top: 40px; width: 46px; height: 46px; display: grid; place-items: center; z-index: 2;
  font-family: 'Cinzel'; font-weight: 900; font-size: 17px; color: #f6dcc8; text-shadow: 0 1px 0 rgba(0,0,0,.5);
  background: radial-gradient(circle at 35% 30%, #c0392b, var(--wax) 55%, #4a0c0c); border-radius: 47% 53% 44% 56% / 52% 45% 55% 48%;
  box-shadow: 0 3px 6px rgba(0,0,0,.6), inset 0 -3px 6px rgba(0,0,0,.35); }
.token { position: absolute; left: -9px; top: 44px; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; z-index: 2;
  background: radial-gradient(circle at 35% 30%, #f3e2a6, #b48a32 60%, #5e4314); color: #3a2706; font-family: 'Cinzel'; font-weight: 900; font-size: 12px;
  box-shadow: 0 3px 6px rgba(0,0,0,.6), inset 0 0 0 2px rgba(80,55,10,.5); }
.token.down { background: radial-gradient(circle at 35% 30%, #d9c6c0, #8a5a52 60%, #3e1f1a); color: #2a0e0a; }
/* health buff, under the attack one */
.token.hp { top: 84px; font-size: 10px; letter-spacing: -.02em; background: radial-gradient(circle at 35% 30%, #d8efc4, #5e9a46 60%, #23461a); color: #10240b; }
.token.hp.down { background: radial-gradient(circle at 35% 30%, #d9c6c0, #8a5a52 60%, #3e1f1a); color: #2a0e0a; }
.stat { position: absolute; left: 50%; bottom: -22px; transform: translateX(-50%); white-space: nowrap; padding: 2px 8px; border-radius: 2px; z-index: 2;
  background: linear-gradient(var(--parch), var(--parch-2)); color: var(--parch-ink); font-family: 'Cinzel'; font-size: 11px; letter-spacing: .04em; box-shadow: 0 2px 4px rgba(0,0,0,.5); }
.stat .hurt { color: #8b1d1d; }
.stat .boost { color: #2c6420; font-weight: 700; }   /* max health above the printed health */
/* the opponent's row sits just above the global terrain: keep its stat bar tucked against the card */
.row.opp .stat { bottom: -8px; }
.items { position: absolute; left: 6px; bottom: 26px; display: flex; gap: 3px; z-index: 2; }
.items .card { --card-h: 46px; }
.pins { position: absolute; top: -9px; right: 8px; display: flex; gap: 4px; z-index: 2; }
/* a warrior whose ability was taken or copied (⇄), or that lost its own (∅) */
.ability-mark { position: absolute; left: -9px; top: -9px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; z-index: 2;
  background: radial-gradient(circle at 35% 30%, #e9d8ff, #8a5cc8 60%, #3a1f63); color: #fff; font-size: 16px; font-weight: 700;
  box-shadow: 0 3px 6px rgba(0,0,0,.6), inset 0 0 0 2px rgba(40,20,70,.5); }
.ability-mark.gone { background: radial-gradient(circle at 35% 30%, #d9d4cc, #77706a 60%, #2c2925); }
.pin { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700;
  background: radial-gradient(circle at 35% 30%, #f1dd9c, #a57c2c 60%, #4e3710); box-shadow: 0 2px 4px rgba(0,0,0,.6); }
.pin.up { color: #1f4d17; } .pin.down { color: #7a140d; }

/* ── center line ──────────────────────────────────────────────────────── */
.center { position: absolute; left: 50%; top: 240px; transform: translateX(-50%); display: flex; align-items: center; gap: 46px; }
.center .card, .center .slot { --card-h: 150px; }
.turn-banner { font-family: 'Cinzel'; text-align: center; width: 310px; }
.turn-banner .big { font-size: 24px; white-space: nowrap; font-weight: 700; letter-spacing: .14em; color: var(--gold-2); text-shadow: 0 2px 0 #000, 0 0 18px rgba(230,204,122,.35); }
.turn-banner .small { font-family: 'IM Fell English'; font-style: italic; font-size: 16px; color: var(--ink-dim); margin-top: 2px; }
.phases { display: flex; justify-content: center; gap: 6px; margin-top: 8px; font-family: 'Cinzel'; font-size: 10px; letter-spacing: .18em; color: rgba(169,157,125,.6); }
.phases span.on { color: var(--gold-2); }
.phases i { color: rgba(201,168,76,.4); font-style: normal; }
/* under the turn banner, in the gap above your row */
.cast-zone { position: absolute; left: 472px; top: 360px; transform: translateX(-50%); z-index: 6; padding: 8px 18px; font-family: 'Cinzel'; font-size: 14px; letter-spacing: .12em; white-space: nowrap;
  color: var(--gold-2); background: rgba(0,0,0,.6); border: 1px solid var(--legal); border-radius: 3px; box-shadow: 0 0 22px rgba(255,190,90,.45); }
.pending-btn { position: absolute; left: 50%; top: 380px; transform: translateX(-50%); z-index: 6; padding: 8px 16px; font-family: 'Cinzel'; font-size: 13px; letter-spacing: .1em;
  color: #3b2b17; background: linear-gradient(var(--parch), var(--parch-2)); border-radius: 2px; box-shadow: 0 4px 10px rgba(0,0,0,.6); }
/* the line naming each action: on a dark, see-through band so it reads over cards and felt */
.herald { position: absolute; left: 50%; top: 372px; transform: translateX(-50%); z-index: 5; pointer-events: none; font-family: 'Cinzel'; font-size: 15px;
  letter-spacing: .06em; color: var(--gold-2); text-shadow: 0 1px 0 #000; opacity: 0; transition: opacity .2s;
  width: max-content; max-width: 760px; text-align: center; line-height: 1.35; padding: 7px 18px; border-radius: 4px;
  background: rgba(8, 12, 7, .72); box-shadow: 0 0 0 1px rgba(201,168,76,.35), 0 6px 18px rgba(0,0,0,.45); }
.herald:empty { display: none; }
.herald.on { opacity: 1; }

/* ── side panels ──────────────────────────────────────────────────────── */
.side { position: absolute; width: 270px; }
.side.left { left: 40px; } .side.right { right: 34px; width: 214px; }
#opp-side { top: 52px; } #you-side { top: 668px; } #opp-piles { top: 56px; } #you-piles { top: 456px; }
.who { font-family: 'Cinzel'; font-weight: 700; font-size: 18px; letter-spacing: .08em; color: var(--gold-2); }
.who small { display: block; font-family: 'IM Fell English'; font-weight: 400; font-style: italic; letter-spacing: 0; font-size: 15px; color: var(--ink-dim); }
.tally { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.tally .k { font-family: 'Cinzel'; font-size: 12px; letter-spacing: .2em; color: var(--ink-dim); width: 64px; }
.coins { display: flex; }
.coin { width: 22px; height: 22px; border-radius: 50%; margin-right: -6px; background: radial-gradient(circle at 35% 30%, #fff1b8, #d4a83c 55%, #6b4b12); box-shadow: 0 2px 3px rgba(0,0,0,.6), inset 0 0 0 2px rgba(110,75,15,.6); }
.coin.off { background: rgba(0,0,0,.25); box-shadow: inset 0 1px 3px rgba(0,0,0,.7); }
.num { font-family: 'Cinzel'; font-weight: 700; font-size: 16px; margin-left: 12px; color: var(--ink); white-space: nowrap; }
/* past five crystals they overlap (each shrinks, its gem spills under the next) so the row stays clear of the terrain slot */
.crystals { display: flex; align-items: center; height: 32px; max-width: 132px; }
.xtal { display: inline-block; flex: 0 1 25px; min-width: 0;filter: drop-shadow(0 0 5px rgba(120,230,200,.55)) drop-shadow(0 2px 2px rgba(0,0,0,.6)); }
.xtal i { display: block; width: 25px; height: 29px;
  background: conic-gradient(from 210deg at 44% 42%, #f2fffb 0 34deg, #9fe9d6 34deg 96deg, #2aa48b 96deg 150deg, #0d5246 150deg 214deg, #1f7e6c 214deg 268deg, #6fd6bd 268deg 322deg, #e2fff7 322deg 360deg); }
.xtal:nth-child(4n+1) i { clip-path: polygon(28% 0, 74% 8%, 100% 40%, 84% 86%, 48% 100%, 8% 84%, 0 38%); transform: rotate(-8deg); }
.xtal:nth-child(4n+2) i { clip-path: polygon(40% 0, 92% 18%, 100% 64%, 66% 100%, 18% 92%, 0 48%, 12% 12%); transform: rotate(14deg) scale(.92); }
.xtal:nth-child(4n+3) i { clip-path: polygon(18% 6%, 62% 0, 100% 30%, 92% 78%, 58% 100%, 6% 82%, 0 34%); transform: rotate(-20deg) scale(1.05); }
.xtal:nth-child(4n+4) i { clip-path: polygon(34% 0, 84% 10%, 100% 52%, 78% 96%, 30% 100%, 0 66%, 8% 20%); transform: rotate(6deg) scale(.96); }
.xtal.spent { filter: drop-shadow(0 2px 2px rgba(0,0,0,.5)); opacity: .55; }
.xtal.spent i { background: conic-gradient(from 210deg at 44% 42%, rgba(255,255,255,.4) 0 34deg, rgba(190,200,195,.22) 34deg 150deg, rgba(60,70,66,.4) 150deg 268deg, rgba(200,210,205,.3) 268deg 360deg); }

/* ── piles ────────────────────────────────────────────────────────────── */
.pile { width: 84px; height: 119px; position: relative; display: inline-block; margin-right: 18px; vertical-align: top; }
.back { width: 84px; height: 119px; border-radius: 7px; position: absolute; overflow: hidden; background: #0f1a0d; box-shadow: 0 0 0 1px #0a0f08, 0 4px 8px rgba(0,0,0,.6); }
.back img { width: 108%; height: 108%; margin: -4%; object-fit: cover; display: block; }
.pile .back:nth-child(1) { transform: translate(4px, 4px); filter: brightness(.6); } .pile .back:nth-child(2) { transform: translate(2px, 2px); filter: brightness(.8); }
.pile.discard { cursor: pointer; }
.pile.discard .card { --card-h: 119px; }
.pile.discard:hover::after { content: 'view'; position: absolute; top: 46px; left: 50%; transform: translateX(-50%); font-family: 'Cinzel'; font-size: 10px; letter-spacing: .2em; color: var(--gold-2); background: rgba(0,0,0,.65); padding: 3px 8px; border-radius: 2px; }
.pile .empty { position: absolute; inset: 0; border-radius: 7px; border: 1px dashed rgba(201,168,76,.3); }
.pile-label { position: absolute; bottom: -24px; width: 100%; text-align: center; font-family: 'Cinzel'; font-size: 11px; letter-spacing: .2em; color: var(--ink-dim); }
.opp-hand { position: absolute; top: -66px; left: 50%; transform: translateX(-50%); display: flex; z-index: 1; }
.opp-hand .back { width: 92px; height: 130px; position: relative; margin: 0 -14px; transform: rotate(var(--rot, 0deg)); }

/* ── your hand ────────────────────────────────────────────────────────── */
.hand { position: absolute; bottom: -62px; display: flex; align-items: flex-end; justify-content: center;
  left: 326px; right: 210px; }   /* the lane between your loot and energy and the End turn seal; hand.js fits the fan to it */
.hand .card { --card-h: 236px; margin: 0 calc(var(--overlap, 36px) / -2); transform-origin: 50% 120%; transform: rotate(var(--rot, 0deg)) translateY(var(--lift, 0px)); transition: transform .15s; cursor: pointer; }
.hand .card:hover { transform: rotate(var(--rot, 0deg)) translateY(calc(var(--lift, 0px) - 24px)); z-index: 2; }
.hand .card.selected { transform: rotate(0deg) translateY(-48px); z-index: 4; }
.hand .card.playable img { box-shadow: 0 0 0 2px rgba(230,204,122,.55), 0 10px 18px rgba(0,0,0,.55); }
.hand .card.unplayable img { filter: grayscale(.6) brightness(.72); }

/* ── controls ─────────────────────────────────────────────────────────── */
.seal { position: absolute; right: 70px; bottom: 54px; width: 128px; height: 128px; display: grid; place-items: center; text-align: center;
  background: radial-gradient(circle at 38% 32%, #c9443a, #8b1d1d 55%, #3d0909); border-radius: 49% 51% 46% 54% / 53% 47% 53% 47%;
  box-shadow: 0 8px 16px rgba(0,0,0,.6), inset 0 -6px 12px rgba(0,0,0,.4), inset 0 4px 8px rgba(255,170,150,.25); }
.seal::before { content: ''; position: absolute; inset: 14px; border-radius: 50%; border: 2px solid rgba(255,200,180,.25); }
.seal span { font-family: 'Cinzel'; font-weight: 900; font-size: 15px; letter-spacing: .1em; color: #f3d2c4; line-height: 1.15; }
.seal:disabled { filter: grayscale(.7) brightness(.6); }
.draw-extra { position: absolute; right: 70px; bottom: 198px;   /* between your piles and the seal, clear of the hand */ font-family: 'Cinzel'; font-size: 13px; letter-spacing: .12em; color: var(--gold-2);
  padding: 9px 16px; border: 1px solid rgba(201,168,76,.5); background: rgba(0,0,0,.35); border-radius: 3px; }
/* the energy credit symbol from the cards (a d20), in outline */
.energy-icon { width: 1.25em; height: 1.25em; vertical-align: -.28em; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linejoin: round; }
.draw-extra.refused { opacity: .45; }
.draw-extra:disabled { opacity: .3; }
.skip { position: absolute; right: 196px; bottom: 148px; z-index: 7; font-family: 'Cinzel'; font-size: 13px; letter-spacing: .14em; color: var(--gold-2);
  padding: 7px 14px; border: 1px solid rgba(201,168,76,.6); background: rgba(0,0,0,.6); border-radius: 3px; }

/* ── ledger ───────────────────────────────────────────────────────────── */
.ledger { position: absolute; right: 46px; top: 268px; width: 262px; padding: 14px 18px 12px; transform: rotate(1.2deg);
  background: linear-gradient(var(--parch), var(--parch-2)); color: var(--parch-ink); border-radius: 2px; box-shadow: 0 8px 18px rgba(0,0,0,.55); font-size: 15px; line-height: 1.35; }
.ledger h4 { margin: 0 0 6px; font-family: 'Cinzel'; font-size: 12px; letter-spacing: .25em; color: #6b4a1e; display: flex; justify-content: space-between; }
.ledger .link { letter-spacing: .1em; font-size: 11px; color: #8b6a3a; font-family: 'Cinzel'; }
.ledger p { margin: 0 0 5px; }

/* ── overlays ─────────────────────────────────────────────────────────── */
.dim { position: absolute; inset: 0; background: rgba(5,8,4,.62); z-index: 20; display: none; }
.drawer { position: absolute; top: 0; bottom: 0; width: 360px; z-index: 21; display: none; padding: 24px 26px;
  background: linear-gradient(90deg, #22170d, #2f2013); box-shadow: 0 0 40px rgba(0,0,0,.8), inset 0 0 0 1px #4a3417; }
.drawer.left { left: 0; } .drawer.right { right: 0; }
.drawer h3 { margin: 0 0 14px; font-family: 'Cinzel'; font-weight: 700; font-size: 18px; letter-spacing: .2em; color: var(--gold-2); display: flex; justify-content: space-between; }
.drawer .x { font-size: 22px; color: var(--ink-dim); }
.nav a, .nav .navbtn { display: block; width: 100%; text-align: left; padding: 10px 0; border-bottom: 1px solid rgba(201,168,76,.15); font-family: 'Cinzel'; font-size: 15px; letter-spacing: .1em; color: var(--ink); text-decoration: none; }
.nav .navbtn[hidden] { display: none; }   /* Forfeit, outside a game */
.nav small { display: block; font-family: 'IM Fell English'; font-style: italic; font-size: 14px; letter-spacing: 0; color: var(--ink-dim); }
.opt { margin-top: 20px; } .opt .k { font-family: 'Cinzel'; font-size: 11px; letter-spacing: .25em; color: var(--ink-dim); margin-bottom: 8px; }
.toggle { display: inline-flex; border: 1px solid var(--gold-dk); }
.toggle button { padding: 6px 16px; font-family: 'Cinzel'; font-size: 12px; letter-spacing: .1em; }
.toggle button.on { background: var(--gold-dk); color: #fff3cf; }
.report { color: var(--gold-2); font-family: 'Cinzel'; font-size: 14px; letter-spacing: .1em; text-decoration: none; }
.legal-links { font-size: 14px; color: var(--ink-dim); } .legal-links a { color: var(--ink-dim); }
.opt .volume { display: block; margin-top: 12px; }
.opt .volume span { display: flex; justify-content: space-between; font-family: 'Cinzel'; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-dim); margin-bottom: 6px; }
.opt .volume output { letter-spacing: .06em; color: var(--ink); }
.opt .volume input { width: 100%; accent-color: var(--gold); }
.scroll-log { height: 790px; overflow-y: auto; padding: 16px 18px; background: linear-gradient(var(--parch), var(--parch-2)); color: var(--parch-ink); font-size: 15px; line-height: 1.35; }
.scroll-log p { margin: 0 0 4px; }
/* whose line it is (chronicle.js): yours in blue, your opponent's in red, the game's own in plain italics */
.scroll-log p, .ledger p { padding-left: 8px; border-left: 3px solid transparent; }
.scroll-log .by-you, .ledger .by-you { color: #1d4a63; border-left-color: #3b78a0; }
.scroll-log .by-foe, .ledger .by-foe { color: #7d1b1b; border-left-color: #b13a2e; }
.scroll-log .by-game, .ledger .by-game { color: #6b5a3e; font-style: italic; }
.log-key { display: flex; gap: 18px; margin: -6px 0 10px; font-family: 'Cinzel'; font-size: 12px; letter-spacing: .12em; }
.log-key span { padding-left: 8px; border-left: 3px solid; }
.log-key .by-you { color: #8fc3e6; border-color: #3b78a0; } .log-key .by-foe { color: #e89a8f; border-color: #b13a2e; }

.modal { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 21; width: 960px; max-height: 840px; overflow-y: auto; padding: 30px 40px 28px; text-align: center;
  background: radial-gradient(ellipse at 30% 20%, rgba(255,255,255,.35), transparent 60%), linear-gradient(var(--parch), var(--parch-2)); color: var(--parch-ink);
  box-shadow: 0 30px 60px rgba(0,0,0,.7), inset 0 0 0 1px rgba(107,74,30,.35), inset 0 0 0 8px rgba(255,255,255,.12), inset 0 0 0 9px rgba(107,74,30,.35); border-radius: 3px; }
.modal[hidden] { display: none; }
.modal .src { font-family: 'Cinzel'; font-size: 12px; letter-spacing: .3em; color: #8b6a3a; text-transform: uppercase; }
.modal h2 { margin: 4px 0 4px; font-family: 'Cinzel'; font-weight: 700; font-size: 26px; letter-spacing: .06em; color: #4a2f10; }
.modal .why { font-style: italic; font-size: 17px; color: #6b5536; margin-bottom: 22px; }
.modal .count { font-family: 'Cinzel'; font-size: 12px; letter-spacing: .15em; color: #8b6a3a; margin-top: 30px; }
.choices { display: flex; flex-wrap: wrap; justify-content: center; gap: 22px 22px; }
.choices .card { --card-h: 230px; cursor: pointer; margin-bottom: 28px; }
.choices.list .card { --card-h: 170px; cursor: default; }
.choices .card .cap { position: absolute; bottom: -26px; left: -10px; right: -10px; font-family: 'Cinzel'; font-size: 12px; letter-spacing: .08em; color: #6b4a1e; }
.choices .card.picked { transform: translateY(-8px); }
.choices .card.picked img { box-shadow: 0 0 0 3px #8b1d1d, 0 0 0 6px rgba(139,29,29,.25), 0 14px 22px rgba(0,0,0,.45); }
.choices .card.dimmed { opacity: .45; filter: grayscale(.4); cursor: not-allowed; }
.opt-btn { padding: 10px 18px; font-family: 'Cinzel'; font-size: 14px; letter-spacing: .08em; color: #4a2f10; border: 1px solid rgba(107,74,30,.5); border-radius: 2px; background: rgba(255,255,255,.25); }
.opt-btn.picked { background: #8b1d1d; color: #f3d2c4; border-color: #8b1d1d; }
.opt-btn.dimmed { opacity: .45; cursor: not-allowed; }
.card-actions { position: absolute; bottom: -54px; left: 0; right: 0; display: flex; justify-content: center; }
.actions { display: flex; justify-content: center; align-items: center; gap: 28px; margin-top: 40px; }
.btn-seal { width: 92px; height: 92px; display: grid; place-items: center; background: radial-gradient(circle at 38% 32%, #c9443a, #8b1d1d 55%, #3d0909);
  border-radius: 49% 51% 46% 54% / 53% 47% 53% 47%; box-shadow: 0 6px 12px rgba(0,0,0,.45), inset 0 -5px 10px rgba(0,0,0,.4);
  font-family: 'Cinzel'; font-weight: 900; font-size: 14px; letter-spacing: .08em; color: #f3d2c4;
  padding: 8px; line-height: 1.15; text-align: center; }
.btn-seal:disabled { filter: grayscale(.8) brightness(.8); opacity: .6; }
.btn-plain { font-family: 'Cinzel'; font-size: 13px; letter-spacing: .14em; color: #6b4a1e; border-bottom: 1px solid rgba(107,74,30,.5); padding-bottom: 2px; }

#table.view-menu .dim, #table.view-menu #menu-drawer,
#table.view-log .dim, #table.view-log #log-drawer,
#table.view-modal .dim { display: block; }

.popover { position: absolute; z-index: 15; min-width: 160px; padding: 8px; display: flex; flex-direction: column; gap: 6px;
  background: linear-gradient(var(--parch), var(--parch-2)); color: var(--parch-ink); border-radius: 2px; box-shadow: 0 8px 16px rgba(0,0,0,.6); }
.popover[hidden] { display: none; }
.popover button { padding: 8px 12px; text-align: left; font-family: 'Cinzel'; font-size: 13px; letter-spacing: .06em; border-radius: 2px; }
.popover button:hover { background: rgba(107,74,30,.18); }
#notes { position: absolute; inset: 0; pointer-events: none; z-index: 30; }
.note { position: absolute; width: 260px; padding: 10px 12px 9px; background: linear-gradient(var(--parch), var(--parch-2)); color: var(--parch-ink); pointer-events: auto;
  font-size: 15px; line-height: 1.3; border-radius: 2px; box-shadow: 0 8px 16px rgba(0,0,0,.6); transition: opacity .3s; }
.note.warn { border-left: 4px solid #8b1d1d; }
.note.fading { opacity: 0; }
.note b { font-family: 'Cinzel'; font-size: 12px; letter-spacing: .06em; display: block; color: #6b4a1e; margin-bottom: 2px; }
.note p { margin: 0 0 6px; } .note p:last-child { margin: 0; }
.note .up { color: #2c6420; } .note .down { color: #8b1d1d; }
.note a { color: #8b1d1d; }
.zoom { position: absolute; z-index: 40; pointer-events: none; }
.zoom .card { --card-h: 460px; }

/* ── animations (playback) ────────────────────────────────────────────── */
@keyframes arrive { from { transform: translateY(-40px) scale(1.15); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes lunge-up { 50% { transform: translateY(-46px) scale(1.05); } }
@keyframes lunge-down { 50% { transform: translateY(46px) scale(1.05); } }
@keyframes hit { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@keyframes heal { 50% { filter: drop-shadow(0 0 18px rgba(140,255,170,.9)); } }
@keyframes fall { to { transform: translateY(30px) rotate(6deg); opacity: 0; } }
@keyframes pulse { 50% { transform: scale(1.06); filter: brightness(1.3); } }
@keyframes swap { 50% { transform: rotateY(25deg) scale(1.05); filter: drop-shadow(0 0 18px rgba(170,120,255,.95)); } }
.anim-arrive { animation: arrive .45s ease-out; }
.anim-lunge-up { animation: lunge-up .45s ease-in-out; }
.anim-lunge-down { animation: lunge-down .45s ease-in-out; }
.anim-hit { animation: hit .4s ease-in-out; }
.anim-heal { animation: heal .6s ease-in-out; }
.anim-fall { animation: fall .4s ease-in forwards; }
.anim-pulse { animation: pulse .5s ease-in-out; }
.anim-swap { animation: swap .7s ease-in-out; }
@media (prefers-reduced-motion: reduce) { .anim-arrive, .anim-lunge-up, .anim-lunge-down, .anim-hit, .anim-heal, .anim-pulse, .anim-swap { animation: none; } }

/* ── card detail panel ────────────────────────────────────────────────── */
.detail { position: absolute; inset: 0; z-index: 26; background: rgba(5,8,4,.72); display: grid; place-items: center; }
.detail[hidden] { display: none; }
.detail-panel { display: flex; gap: 30px; max-height: 840px; padding: 28px 32px; text-align: left;
  background: radial-gradient(ellipse at 30% 20%, rgba(255,255,255,.35), transparent 60%), linear-gradient(var(--parch), var(--parch-2)); color: var(--parch-ink);
  border-radius: 3px; box-shadow: 0 30px 60px rgba(0,0,0,.7), inset 0 0 0 1px rgba(107,74,30,.35); }
.detail-art .card { --card-h: 470px; }
.detail-body { width: 400px; max-height: 784px; overflow-y: auto; }
.detail-body .src { font-family: 'Cinzel'; font-size: 12px; letter-spacing: .3em; color: #8b6a3a; text-transform: uppercase; }
.detail-body h2 { margin: 4px 0 10px; font-family: 'Cinzel'; font-weight: 700; font-size: 26px; letter-spacing: .04em; color: #4a2f10; }
.stats { display: grid; grid-template-columns: auto 1fr; gap: 5px 16px; margin: 0 0 6px; font-size: 17px; }
.stats dt { font-family: 'Cinzel'; font-size: 11px; letter-spacing: .2em; color: #8b6a3a; text-transform: uppercase; align-self: center; }
.stats dd { margin: 0; }
.detail-section h4 { margin: 16px 0 4px; font-family: 'Cinzel'; font-size: 12px; letter-spacing: .25em; color: #6b4a1e; text-transform: uppercase; }
.detail-section p { margin: 0 0 5px; font-size: 16px; line-height: 1.35; }
.detail-section .up { color: #2c6420; } .detail-section .down { color: #8b1d1d; }
.detail-items { display: flex; gap: 10px; }
.detail-items .card { --card-h: 100px; cursor: pointer; }
.detail-body .btn-plain { display: inline-block; margin-top: 20px; }
.card { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }

/* ── dragging ─────────────────────────────────────────────────────────── */
.drag-ghost { position: absolute; z-index: 35; pointer-events: none; --card-h: 210px; transform: translate(-50%, -55%) rotate(-4deg); opacity: .93; }
.drag-ghost img { box-shadow: 0 0 0 2px var(--gold-2), 0 24px 40px rgba(0,0,0,.65); }
.drop-hover { outline-color: #fff2c4 !important; box-shadow: inset 0 2px 6px rgba(0,0,0,.65), 0 0 34px rgba(255,210,120,.8) !important; }
.card.drop-hover img { box-shadow: 0 0 0 3px #fff2c4, 0 0 34px rgba(255,210,120,.8) !important; }

/* read by screen readers, not shown */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* keyboard focus (keyboard.js): a bright ring that doesn't depend on color alone */
#table [tabindex="0"]:focus-visible, #table button:focus-visible, #table a:focus-visible, #table input:focus-visible {
  outline: 3px solid #fff2c4; outline-offset: 3px; box-shadow: 0 0 0 6px rgba(20,12,4,.85); }
#hand .card:focus-visible { transform: rotate(0deg) translateY(-26px); z-index: 5; }

/* ── portrait: phones held upright (stage 956 tall, 440-600 wide; --grow from stage.js) ── */
.bar-turn { display: none; }
#table.portrait .sitebar { left: 0; right: 0; height: 44px; padding: 0 8px; gap: 6px; }
#table.portrait .brand, #table.portrait #tab-new, #table.portrait #tab-map, #table.portrait #tab-difficulty, #table.portrait #tab-report,
#table.portrait #tab-account, #table.portrait .spacer { display: none; }
#table.portrait .bar-turn { display: block; flex: 1; text-align: center; font-family: 'Cinzel'; font-size: 13px; letter-spacing: .1em; color: var(--gold-2); white-space: nowrap; }
#table.portrait #tab-chronicle { font-size: 0; padding: 6px 10px; }
#table.portrait #tab-chronicle::before { content: '📜'; font-size: 16px; }
#table.portrait .mat { inset: 44px 0 0 0; border-radius: 16px 16px 0 0; }
#table.portrait .mat::before { inset: 8px 8px -10px 8px; border-radius: 10px 10px 0 0; }
#table.portrait .crest, #table.portrait .ledger, #table.portrait .zoom { display: none; }

/* strips: who, loot, energy on two compact lines; piles become chips */
#table.portrait .side { width: auto; }
#table.portrait #opp-side { top: 8px; left: 14px; right: 150px; }
#table.portrait #you-side { top: calc(448px + 3 * var(--grow, 0px)); left: 14px; right: 112px; }
#table.portrait .who { font-size: 13px; }
#table.portrait .who small { display: none; }
#table.portrait .tally { margin-top: 3px; gap: 6px; }
#table.portrait .tally .k { width: 48px; font-size: 9px; letter-spacing: .12em; }
#table.portrait .coin { width: 12px; height: 12px; margin-right: -3px; }
#table.portrait .crystals { height: 18px; max-width: 110px; }
#table.portrait .xtal i { width: 14px; height: 16px; }
#table.portrait .num { font-size: 12px; margin-left: 6px; }
#table.portrait #opp-piles { top: 8px; right: 6px; width: auto; }
#table.portrait #you-piles { top: calc(448px + 3 * var(--grow, 0px)); right: 6px; width: auto; }
#table.portrait .pile { width: 36px; height: 50px; margin-right: 8px; }
#table.portrait .pile .back { width: 36px; height: 50px; border-radius: 4px; }
#table.portrait .pile.discard .card { --card-h: 50px; }
#table.portrait .pile .empty { border-radius: 4px; }
#table.portrait .pile-label { bottom: -14px; font-size: 8px; letter-spacing: .06em; }
#table.portrait .opp-hand { top: 14px; left: auto; right: 100px; transform: none; }
#table.portrait .opp-hand .back { width: 20px; height: 28px; margin: 0 -6px; border-radius: 3px; }

/* rows */
#table.portrait .row { gap: 6px; --card-h: calc(104px + var(--grow, 0px)); }
#table.portrait .row[data-slots="5"] { --card-h: calc(92px + var(--grow, 0px)); }
#table.portrait .row[data-slots="6"] { --card-h: calc(74px + var(--grow, 0px)); }
#table.portrait .row[data-slots="7"] { --card-h: calc(62px + var(--grow, 0px)); }
#table.portrait .row[data-slots="8"] { --card-h: calc(54px + var(--grow, 0px)); }
#table.portrait .row[data-slots="7"] .stat, #table.portrait .row[data-slots="8"] .stat { font-size: 6px; padding: 0 2px; }
#table.portrait .row.opp { top: 74px; } #table.portrait .row.you { top: calc(316px + 2 * var(--grow, 0px)); }
#table.portrait .terrain-gap { width: 4px; } #table.portrait .terrain-gap::after { height: 80px; }
#table.portrait .slot { outline-offset: 2px; font-size: 8px; letter-spacing: .1em; }
#table.portrait .slot .sigil { width: 22px; height: 22px; } #table.portrait .slot .sigil span { font-size: 11px; }
#table.portrait .slot .label { bottom: 6px; }
#table.portrait .slot .from { top: 4px; font-size: 8px; } #table.portrait .slot.sealed .shut { font-size: 16px; }
#table.portrait .stat, #table.portrait .row.opp .stat { font-size: 8px; padding: 1px 4px; bottom: -15px; letter-spacing: 0; }
#table.portrait .wax { width: 26px; height: 26px; font-size: 11px; right: -6px; top: 20px; }
#table.portrait .token { width: 22px; height: 22px; font-size: 9px; left: -6px; top: 22px; }
#table.portrait .token.hp { top: 48px; font-size: 7px; }
#table.portrait .pins { top: -6px; right: 2px; gap: 2px; }
#table.portrait .ability-mark { width: 18px; height: 18px; font-size: 10px; left: -5px; top: -5px; }
#table.portrait .pin { width: 14px; height: 14px; font-size: 8px; }
#table.portrait .items { left: 2px; bottom: 14px; } #table.portrait .items .card { --card-h: 26px; }

/* center line */
#table.portrait .center { top: calc(198px + var(--grow, 0px)); gap: 12px; }
#table.portrait .center .card, #table.portrait .center .slot { --card-h: 88px; }
#table.portrait .turn-banner { width: 150px; }
#table.portrait .turn-banner .big { font-size: 14px; letter-spacing: .08em; }
#table.portrait .turn-banner .small { font-size: 12px; }
#table.portrait .phases { font-size: 8px; gap: 3px; letter-spacing: .08em; }
#table.portrait .herald { top: calc(292px + var(--grow, 0px)); width: calc(100% - 20px); white-space: normal; text-align: center; font-size: 11px; }
#table.portrait .cast-zone { left: 50%; top: calc(288px + var(--grow, 0px)); font-size: 12px; padding: 5px 12px; }
#table.portrait .pending-btn { top: calc(288px + var(--grow, 0px)); font-size: 11px; padding: 5px 12px; }

/* hand and thumb bar */
#table.portrait .hand { bottom: 122px; left: 12px; right: 12px; }
#table.portrait .hand .card { --card-h: 214px; margin: 0 calc(var(--overlap, 40px) / -2); }
#table.portrait .hand .card:hover { transform: rotate(var(--rot, 0deg)) translateY(var(--lift, 0px)); }
#table.portrait .hand .card.selected { transform: translateY(-70px); }
#table.portrait .draw-extra { right: auto; left: 12px; bottom: 26px; font-size: 11px; padding: 8px 10px; }
#table.portrait .seal { right: 12px; bottom: 8px; width: 80px; height: 80px; }
#table.portrait .seal::before { inset: 8px; }
#table.portrait .seal span { font-size: 11px; }
#table.portrait .skip { right: 104px; bottom: 30px; }

/* sheets and drawers */
#table.portrait .drawer { width: 100%; padding: 16px; }
#table.portrait .scroll-log { height: calc(100% - 50px); }
#table.portrait .popover { min-width: 150px; }

#table.portrait .modal { left: 0; right: 0; top: auto; bottom: 0; transform: none; width: auto; max-height: 80%;
  padding: 18px 14px 20px; border-radius: 14px 14px 0 0; }
#table.portrait .modal h2 { font-size: 19px; }
#table.portrait .modal .why { font-size: 14px; margin-bottom: 12px; }
/* cards three to a row and the sheet scrolls down: a sideways row couldn't be reached with a
   mouse wheel (a narrow desktop window), and Cancel / Take it stay pinned at the foot */
#table.portrait .modal .choices:not(.list) { padding: 6px 0 0; gap: 4px 12px; }
#table.portrait .choices .card { --card-h: 150px; margin-bottom: 34px; }
#table.portrait .choices .card .cap { top: calc(100% + 5px); bottom: auto; font-size: 10px; line-height: 1.2; }   /* a long name wraps downwards */
#table.portrait .modal.choice .actions { position: sticky; bottom: -20px; z-index: 2; margin: 6px -14px -20px; padding: 10px 14px 14px;
  background: linear-gradient(rgba(233,220,184,0), #e6d6ae 30%); }
#table.portrait .choices.list .card { --card-h: 120px; }
#table.portrait .actions { margin-top: 14px; gap: 20px; }
#table.portrait .btn-seal { width: 76px; height: 76px; font-size: 12px; }

/* Phone readability (2026-11-06). The phone stage is 956 tall and shows at about 0.7 of its size on a
   phone, so stage px x 0.7 is what the eye gets: nothing under 13 stage px (about 9 on screen), the
   numbers you play by (Loot, energy, a warrior's stats) 17-19 (about 12-13). */
#table.portrait .bar-turn { font-size: 16px; }
#table.portrait .sitebar .tab { font-size: 15px; }
#table.portrait .who { font-size: 17px; line-height: 1.1; }
#table.portrait .tally { margin-top: 1px; height: 20px; }
#table.portrait .tally .k { width: 66px; font-size: 13px; letter-spacing: .06em; }
#table.portrait .num { font-size: 18px; line-height: 1; }
/* the count sits inside the foot of its pile as a badge: below it, it would touch their row or your hand */
#table.portrait .pile-label { left: 50%; bottom: 3px; width: auto; min-width: 24px; padding: 1px 6px; transform: translateX(-50%); border-radius: 10px;
  background: rgba(10,8,4,.82); box-shadow: 0 0 0 1px rgba(201,168,76,.55); font-size: 16px; font-weight: 700; letter-spacing: 0; line-height: 1.2; color: var(--ink); }
#table.portrait .pile-word { display: none; }   /* the number alone: "Deck" / "Discard" is the pile's aria-label */
#table.portrait .slot { font-size: 13px; letter-spacing: .04em; }
#table.portrait .slot .from { font-size: 12px; }
/* a warrior's stats sit over the foot of the card (its rules text can't be read at this size; tap the
   card for it): attack and attack cost on one line, health under them */
#table.portrait .stat, #table.portrait .row.opp .stat, #table.portrait .row[data-slots] .stat {
  bottom: 2px; width: calc(100% - 4px); padding: 2px 0 1px; font-size: 15px; line-height: 1.12; text-align: center; white-space: normal;
  display: grid; grid-template-columns: 1fr 1fr; letter-spacing: 0; font-weight: 700; }
#table.portrait .stat .sep { display: none; }
#table.portrait .stat .hp { grid-column: 1 / -1; grid-row: 2; }
/* a terrain: its health alone, wrapping under the heart if it must */
#table.portrait .stat.solo, #table.portrait .row[data-slots] .stat.solo { display: block; font-size: 14px; padding: 2px 1px; }
#table.portrait .wax { width: 32px; height: 32px; font-size: 15px; }
#table.portrait .token { width: 28px; height: 28px; font-size: 13px; }
#table.portrait .token.hp { top: 52px; font-size: 11px; }
#table.portrait .pin { width: 20px; height: 20px; font-size: 12px; }
#table.portrait .ability-mark { width: 22px; height: 22px; font-size: 13px; }
#table.portrait .turn-banner { width: 168px; }
#table.portrait .turn-banner .big { font-size: 19px; }
#table.portrait .turn-banner .small { font-size: 16px; }
#table.portrait .phases { font-size: 13px; gap: 4px; letter-spacing: .02em; flex-wrap: wrap; }
#table.portrait .herald { font-size: 15px; }
#table.portrait .cast-zone, #table.portrait .pending-btn { font-size: 15px; }
#table.portrait .draw-extra { font-size: 15px; padding: 10px 14px; }
#table.portrait .seal span { font-size: 15px; }
#table.portrait .choices .card .cap { font-size: 13px; }
#table.portrait .btn-seal { font-size: 14px; }
/* Phone tap targets: 44 px on screen is about 63 stage px. The bar's buttons fill its height and reach
   past it, the piles grow, and each gets an invisible margin that still takes the tap. */
#table.portrait .sitebar { z-index: 8; }   /* above the mat, so the buttons' margins below the bar take taps */
#table.portrait .sitebar .tab { position: relative; align-self: stretch; display: flex; align-items: center; padding: 0 14px; }
#table.portrait .sitebar .tab::after { content: ''; position: absolute; inset: -6px -3px -18px; }
#table.portrait #tab-chronicle { min-width: 60px; justify-content: center; }
#table.portrait .pile { width: 44px; height: 62px; }
#table.portrait .pile .back { width: 44px; height: 62px; }
#table.portrait .pile.discard .card { --card-h: 62px; }
#table.portrait .pile { margin-right: 16px; }
#table.portrait .pile::before { content: ''; position: absolute; inset: -6px -8px -8px; }
#table.portrait #you-side { right: 132px; }   /* clear of the wider piles */
#table.portrait .draw-extra { padding: 12px 16px; }
#table.portrait .draw-extra::after { content: ''; position: absolute; inset: -10px -6px; }
#table.portrait .skip { padding: 10px 16px; font-size: 15px; }
#table.portrait .deckbook .choose-deck { width: auto; height: auto; padding: 12px 26px; font-size: 13px; border-radius: 40px; }
#table.portrait .detail-panel { flex-direction: column; align-items: center; width: 420px; max-height: 920px; overflow-y: auto; padding: 16px; gap: 10px; }
#table.portrait .detail-art .card { --card-h: 300px; }
#table.portrait .detail-body { width: 100%; max-height: none; overflow: visible; }
#table.portrait .detail-body h2 { font-size: 21px; }

/* ── the new-game ledger ──────────────────────────────────────────────── */
.modal.deckbook { width: 1240px; max-height: none; height: 780px; padding: 0; background: none; box-shadow: none; text-align: left; overflow: visible; }
.deckbook .book { display: flex; height: 100%; position: relative; filter: drop-shadow(0 30px 40px rgba(0,0,0,.65)); }
.deckbook .book::after { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: rgba(70,45,15,.5); }
.deckbook .page { flex: 1 1 0; min-width: 0; position: relative; padding: 38px 44px; color: var(--parch-ink); overflow-y: auto;
  background: radial-gradient(ellipse at 70% 10%, rgba(255,255,255,.35), transparent 55%), linear-gradient(90deg, var(--parch-2), var(--parch) 12%, var(--parch) 88%, var(--parch-2)); }
.deckbook .page.left { border-radius: 6px 0 0 6px; box-shadow: inset -24px 0 30px -18px rgba(70,45,15,.55); }
.deckbook .page.right { border-radius: 0 6px 6px 0; box-shadow: inset 24px 0 30px -18px rgba(70,45,15,.55); overflow: visible; }
.deckbook h1 { margin: 0; font-family: 'Cinzel'; font-weight: 700; font-size: 26px; letter-spacing: .12em; color: #4a2f10; }
.deckbook .sub { font-style: italic; color: #6b5536; margin: 2px 0 14px; }
.deckbook .chapters { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
.deckbook .chapter { font-family: 'Cinzel'; font-size: 11px; letter-spacing: .14em; padding: 5px 10px; border-bottom: 2px solid transparent; color: #8b6a3a; }
.deckbook .chapter.on { color: #4a2f10; border-color: #8b1d1d; }
.deckbook .rows { display: flex; flex-direction: column; }
.deckbook .entry { width: 100%; display: grid; grid-template-columns: 46px 1fr auto; gap: 14px; align-items: center; padding: 7px 8px; text-align: left; border-bottom: 1px dotted rgba(107,74,30,.45); }
.deckbook .entry .card { --card-h: 65px; }
.deckbook .entry b { display: block; font-family: 'Cinzel'; font-size: 16px; letter-spacing: .06em; color: #4a2f10; }
.deckbook .entry .classes { display: flex; gap: 6px; align-items: center; }
.deckbook .entry .classes img { width: 24px; height: 24px; opacity: .85; }
.deckbook .entry .class-name { font-family: 'Cinzel'; font-size: 10px; letter-spacing: .1em; color: #8b6a3a; }
.deckbook .entry.on { background: rgba(139,29,29,.10); box-shadow: inset 3px 0 0 #8b1d1d; }
.deckbook-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.deckbook-build { flex: none; padding: 7px 14px; border: 1px solid rgba(139,29,29,.55); border-radius: 3px; font-family: 'Cinzel'; font-size: 12px; letter-spacing: .1em;
  color: #8b1d1d; text-decoration: none; background: rgba(255,250,235,.4); }
.deckbook-build:hover { background: #8b1d1d; color: #fff3cf; }
.deckbook .ribbon { position: absolute; top: -10px; right: 18px; width: 28px; height: 130px; background: linear-gradient(#8b1d1d, #5e1111); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 88%, 0 100%); }
.deckbook .hero { display: flex; gap: 26px; }
.deckbook .hero > .card { --card-h: 290px; transform: rotate(-2deg); }
.deckbook .info { min-width: 0; padding-right: 30px; }   /* clear of the ribbon */
.deckbook .k { font-family: 'Cinzel'; font-size: 11px; letter-spacing: .26em; color: #8b6a3a; margin: 18px 0 8px; text-transform: uppercase; }
.deckbook .info .k { margin-top: 0; }
.deckbook h2 { margin: 4px 0 0; font-family: 'Cinzel'; font-weight: 900; font-size: 26px; letter-spacing: .06em; line-height: 1.15; color: #4a2f10; overflow-wrap: break-word; }
.deckbook .blurb { font-size: 16px; line-height: 1.4; }
.deckbook .mix { display: flex; gap: 18px; font-family: 'Cinzel'; font-size: 11px; letter-spacing: .14em; color: #8b6a3a; }
.deckbook .mix b { display: block; font-size: 26px; color: #4a2f10; letter-spacing: 0; }
.deckbook .fan { position: relative; height: 150px; margin: 18px 0 0; }
.deckbook .fan .card { --card-h: 132px; position: absolute; left: calc(160px + var(--i) * 62px); transform: rotate(calc(var(--i) * 6deg)); transform-origin: 50% 120%; }
.deckbook .line, .start-sheet .line { display: flex; align-items: center; justify-content: center; gap: 22px; }
.deckbook .foe, .start-sheet .foe { padding: 8px 14px; border: 1px solid rgba(107,74,30,.45); font-family: 'Cinzel'; font-size: 13px; letter-spacing: .1em; }
.deckbook .foe.on, .start-sheet .foe.on { background: #6b4a1e; color: #fff3cf; }
.start-sheet .foe-named { font-family: 'IM Fell English', serif; font-style: italic; font-size: 17px; color: #4a3417; }
.deckbook .toss, .start-sheet .toss { width: 78px; height: 78px; border-radius: 50%; display: grid; place-items: center; font-family: 'Cinzel'; font-weight: 900; font-size: 12px; letter-spacing: .08em; color: #3a2706;
  background: radial-gradient(circle at 35% 30%, #fff1b8, #d4a83c 55%, #6b4b12); box-shadow: 0 5px 10px rgba(0,0,0,.4), inset 0 0 0 4px rgba(110,75,15,.5); }
.deckbook .toss:disabled { filter: grayscale(.6); }
.deckbook .hint, .start-sheet .hint { font-style: italic; color: #6b5536; }
.deckbook .back-to-game { display: block; margin-top: 18px; font-family: 'Cinzel'; font-size: 13px; letter-spacing: .12em; color: #6b4a1e; border-bottom: 1px solid rgba(107,74,30,.5); }
.deckbook .page-back { display: none; }

#table.portrait .modal.deckbook { left: 0; right: 0; top: 0; bottom: 0; width: auto; height: auto; max-height: none; border-radius: 0; padding: 0; }
#table.portrait .deckbook .book { filter: none; }
#table.portrait .deckbook .book::after { display: none; }
#table.portrait .deckbook .page { border-radius: 0; padding: 22px 18px; box-shadow: none; }
#table.portrait .deckbook .page.right { display: none; overflow-y: auto; }
#table.portrait .deckbook.reading .page.left { display: none; }
#table.portrait .deckbook.reading .page.right { display: block; }
#table.portrait .deckbook .page-back { display: inline-block; margin-bottom: 12px; font-family: 'Cinzel'; font-size: 13px; letter-spacing: .1em; color: #8b1d1d; }
#table.portrait .deckbook .ribbon { right: 24px; height: 90px; }
#table.portrait .deckbook .hero { flex-direction: column; align-items: center; gap: 12px; }
#table.portrait .deckbook .hero > .card { --card-h: 260px; }
#table.portrait .deckbook .info { padding: 0; width: 100%; }
#table.portrait .deckbook .fan { height: 120px; }
#table.portrait .deckbook .fan .card { --card-h: 100px; left: calc(150px + var(--i) * 46px); }

/* ── the coin flip ────────────────────────────────────────────────────── */
.coinflip { position: absolute; inset: 0; z-index: 27; display: grid; place-items: center; background: rgba(5,8,4,.55); cursor: pointer; }
.coinflip[hidden] { display: none; }
.coinflip .called { position: absolute; top: 22%; width: 100%; text-align: center; font-family: 'Cinzel'; font-size: 22px; letter-spacing: .14em; color: var(--gold-2); text-shadow: 0 2px 0 #000; }
.coinflip .toss { width: 200px; height: 200px; border-radius: 50%; display: grid; place-items: center; font-size: 64px; color: #3a2706;
  background: radial-gradient(circle at 35% 30%, #fff1b8, #d4a83c 55%, #6b4b12); box-shadow: 0 10px 20px rgba(0,0,0,.5), inset 0 0 0 6px rgba(110,75,15,.5), inset 0 0 0 10px rgba(255,240,190,.35); }
.coinflip .toss.spinning { animation: coin-spin 1.5s cubic-bezier(.2,.7,.3,1); }
@keyframes coin-spin { 0% { transform: translateY(160px) rotateX(0); } 50% { transform: translateY(-140px) rotateX(900deg); } 100% { transform: translateY(0) rotateX(1800deg); } }
.coinflip .stamp { position: absolute; bottom: 22%; left: 50%; transform: translateX(-50%) rotate(-4deg) scale(1.6); opacity: 0; transition: transform .25s ease-out, opacity .25s;
  padding: 16px 30px; border-radius: 40% 46% 42% 48%; background: radial-gradient(circle at 38% 32%, #c9443a, #8b1d1d 55%, #3d0909); color: #f3d2c4;
  font-family: 'Cinzel'; font-weight: 900; font-size: 19px; letter-spacing: .1em; white-space: nowrap; box-shadow: 0 8px 16px rgba(0,0,0,.6); }
.coinflip .stamp.on { opacity: 1; transform: translateX(-50%) rotate(-4deg) scale(1); }
.coinflip .skip-hint { position: absolute; bottom: 9%; width: 100%; text-align: center; font-size: 15px; font-style: italic; color: var(--ink-dim); }
.start-sheet { width: 560px; }
.start-sheet .k { font-family: 'Cinzel'; font-size: 11px; letter-spacing: .26em; color: #8b6a3a; margin: 22px 0 10px; text-transform: uppercase; }
.start-sheet .start-back { display: inline-block; margin-top: 26px; }
.start-sheet .start-tips { display: inline-flex; align-items: center; gap: 8px; margin-top: 24px; font-style: italic; color: #6b5536; cursor: pointer; }
.start-sheet .start-tips input { margin: 0; width: 16px; height: 16px; accent-color: #6b4a1e; cursor: pointer; }
.deckbook .choose-deck { width: auto; height: auto; padding: 14px 30px; margin-top: 26px; border-radius: 40px; font-size: 15px; }
#table.portrait .coinflip .toss { width: 150px; height: 150px; font-size: 48px; }
#table.portrait .coinflip .stamp { font-size: 15px; padding: 12px 20px; }
@media (prefers-reduced-motion: reduce) { .coinflip .toss.spinning { animation: none; } }

/* ── the game-over scroll ─────────────────────────────────────────────── */
.modal.game-over h2 { font-weight: 900; font-size: 54px; letter-spacing: .14em; margin: 6px 0 2px; }
.modal.game-over .why { font-size: 18px; }
.modal.game-over { width: 760px; }
.over-body { display: flex; justify-content: center; align-items: center; gap: 44px; margin: 26px 0 8px; }
.over-body .mvp { text-align: center; }
.over-body .mvp .card { --card-h: 200px; transform: rotate(-3deg); box-shadow: 0 10px 22px rgba(0,0,0,.35); }
.over-body .mvp small { display: block; margin-top: 12px; font-family: 'Cinzel'; font-size: 11px; letter-spacing: .24em; color: #8b6a3a; text-transform: uppercase; }
.over-grid { display: grid; grid-template-columns: repeat(2, 170px); gap: 18px 26px; text-align: left; }
.over-grid .over-stat { border-top: 1px solid rgba(107,74,30,.35); padding-top: 8px; }
.over-grid .over-stat b { display: block; font-family: 'Cinzel'; font-size: 34px; line-height: 1.1; color: #4a2f10; }
.over-grid .over-stat small { font-family: 'Cinzel'; font-size: 10px; letter-spacing: .22em; color: #8b6a3a; text-transform: uppercase; }
.over-rematch { margin-top: 26px; padding-top: 18px; border-top: 1px solid rgba(107,74,30,.25); }
.over-rematch .k { font-family: 'Cinzel'; font-size: 11px; letter-spacing: .26em; color: #8b6a3a; text-transform: uppercase; margin-bottom: 12px; }
.over-buttons { display: flex; justify-content: center; gap: 16px; }
.modal.game-over .over-pill { width: auto; height: auto; min-width: 170px; padding: 12px 28px; border-radius: 40px; font-size: 14px; }
.over-links { display: flex; justify-content: center; gap: 30px; margin-top: 24px; }
.over-links a.btn-plain { text-decoration: none; }
#table.portrait .modal.game-over { width: auto; }
#table.portrait .modal.game-over h2 { font-size: 36px; }
#table.portrait .over-body { flex-direction: column; gap: 16px; margin-top: 14px; }
#table.portrait .over-body .mvp .card { --card-h: 140px; }
#table.portrait .over-grid { grid-template-columns: repeat(2, 1fr); gap: 12px 18px; width: 100%; }
#table.portrait .over-grid .over-stat b { font-size: 24px; }
#table.portrait .modal.game-over .over-pill { width: auto; height: auto; border-radius: 40px; min-width: 0; flex: 1; padding: 11px 12px; font-size: 12px; }
#table.portrait .over-links { gap: 18px; flex-wrap: wrap; }

/* ── the deck builder (/decks/build) ─────────────────────────────────── */
/* every class here starts with builder-: table.css is one shared sheet */
.builder-binder { position: absolute; left: 34px; top: 26px; right: 456px; bottom: 22px; border-radius: 10px; padding: 16px 20px; display: flex; flex-direction: column; gap: 10px;
  background: linear-gradient(#3a2414, #2a190d); box-shadow: 0 20px 40px rgba(0,0,0,.6), inset 0 0 0 2px #5a3a1d, inset 0 0 0 5px #24160c; }
.builder-filter-row { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.builder-search { flex: 1; min-width: 180px; padding: 8px 12px; font: 16px 'IM Fell English', Georgia, serif; color: var(--parch-ink); background: var(--parch); border: 0; border-radius: 3px; }
.builder-pill { font-family: 'Cinzel'; font-size: 11px; letter-spacing: .12em; padding: 7px 11px; color: var(--ink-dim); border: 1px solid rgba(201,168,76,.35); border-radius: 2px; }
.builder-pill.on { color: #2a1c10; background: var(--gold-2); border-color: var(--gold-2); }
.builder-class-icons { display: flex; gap: 5px; margin-right: auto; }
.builder-class img { width: 26px; height: 26px; padding: 3px; border-radius: 50%; background: var(--parch); opacity: .5; display: block; }
.builder-class.on img { opacity: 1; box-shadow: 0 0 0 2px var(--gold-2); }
.builder-select { font: 13px 'Cinzel'; letter-spacing: .06em; padding: 5px 6px; color: var(--ink); background: #2a1c10; border: 1px solid rgba(201,168,76,.35); border-radius: 2px; }
.builder-size { display: inline-flex; border: 1px solid rgba(201,168,76,.45); }
.builder-size button { padding: 5px 10px; font-family: 'Cinzel'; font-size: 11px; letter-spacing: .1em; color: var(--ink-dim); }
.builder-size button.on { background: var(--gold-dk); color: #fff3cf; }
.builder-view { margin-right: 10px; }   /* All cards | Your deck, then Large | Compact */
.builder-grid { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; border-radius: 4px; display: grid; gap: 12px; align-content: start;
  background: linear-gradient(var(--parch), var(--parch-2)); box-shadow: inset 0 0 18px rgba(70,45,15,.35); }
.builder-grid.builder-large { grid-template-columns: repeat(4, 1fr); }
.builder-grid.builder-compact { grid-template-columns: repeat(8, 1fr); gap: 8px; }
.builder-sleeve { position: relative; padding: 6px; border-radius: 6px; background: rgba(70,45,15,.12); box-shadow: inset 0 0 0 1px rgba(107,74,30,.25); cursor: pointer; }
.builder-sleeve .card { --card-h: auto; width: 100%; height: auto; aspect-ratio: .707; }
.builder-sleeve .card img { border-radius: 4.5% / 3.2%; }
.builder-compact .builder-sleeve { padding: 3px; }
.builder-sleeve:hover { box-shadow: inset 0 0 0 2px var(--gold-2); }
.builder-sleeve.builder-full img { filter: saturate(.55) brightness(.8); }
.builder-pip { position: absolute; right: 2px; top: 2px; display: flex; align-items: center; gap: 2px; z-index: 2; }
.builder-pip b { min-width: 28px; height: 28px; display: grid; place-items: center; font-family: 'Cinzel'; font-weight: 900; font-size: 14px; color: #f3d2c4;
  border-radius: 47% 53% 44% 56%; background: radial-gradient(circle at 38% 32%, #c9443a, #8b1d1d 55%, #3d0909); box-shadow: 0 2px 4px rgba(0,0,0,.5); }
.builder-compact .builder-pip b { min-width: 22px; height: 22px; font-size: 12px; }
.builder-minus { width: 22px; height: 22px; border-radius: 50%; display: none; place-items: center; font-weight: 700; color: #3b2b17; background: var(--parch); box-shadow: 0 1px 3px rgba(0,0,0,.5); }
.builder-sleeve:hover .builder-minus, .builder-pip:focus-within .builder-minus { display: grid; }
.builder-empty { grid-column: 1 / -1; padding: 30px; text-align: center; font-style: italic; color: #6b5536; }

.builder-box { position: absolute; right: 34px; top: 26px; bottom: 22px; width: 400px; padding: 20px 22px; color: var(--parch-ink); display: flex; flex-direction: column;
  background: radial-gradient(ellipse at 30% 10%, rgba(255,255,255,.35), transparent 55%), linear-gradient(var(--parch), var(--parch-2)); border-radius: 3px;
  box-shadow: 0 20px 40px rgba(0,0,0,.6), inset 0 0 0 1px rgba(107,74,30,.35); }
.builder-name { font: 900 22px 'Cinzel'; letter-spacing: .05em; color: #4a2f10; background: transparent; border: 0; border-bottom: 1px dashed rgba(107,74,30,.5); padding: 2px 0 4px; }
.builder-name:focus { outline: none; border-bottom-color: #8b1d1d; }
.builder-count { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-top: 8px; }
.builder-count b { font-family: 'Cinzel'; font-size: 28px; color: #4a2f10; }
.builder-issue { font-style: italic; color: #8b1d1d; text-align: right; }
.builder-ready { font-family: 'Cinzel'; font-size: 13px; letter-spacing: .12em; color: #2c6420; }
.builder-mix { display: flex; gap: 16px; margin-top: 6px; font-family: 'Cinzel'; font-size: 10px; letter-spacing: .12em; color: #8b6a3a; }
.builder-mix b { display: block; font-size: 18px; color: #4a2f10; letter-spacing: 0; }
.builder-deck-classes { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; min-height: 22px; font-family: 'Cinzel'; font-size: 13px; }
.builder-deck-class img { width: 22px; height: 22px; vertical-align: middle; }
.builder-k { font-family: 'Cinzel'; font-size: 10px; letter-spacing: .24em; color: #8b6a3a; margin-top: 12px; text-transform: uppercase; }
.builder-curve { display: flex; align-items: flex-end; gap: 6px; height: 70px; margin-top: 4px; padding-bottom: 16px; }
.builder-bar { flex: 1; height: 100%; position: relative; display: flex; align-items: flex-end; }
.builder-bar i { display: block; width: 100%; height: var(--h, 0%); min-height: 2px; background: linear-gradient(#8b1d1d, #5e1111); border-radius: 2px 2px 0 0; }
.builder-bar small { position: absolute; bottom: -16px; left: 0; right: 0; text-align: center; font-family: 'Cinzel'; font-size: 10px; color: #8b6a3a; }
.builder-list { flex: 1; min-height: 0; overflow-y: auto; margin-top: 4px; }
.builder-row { display: grid; grid-template-columns: 22px 1fr auto 22px 22px; gap: 6px; align-items: center; padding: 3px 0; border-bottom: 1px dotted rgba(107,74,30,.35); font-size: 15px; }
.builder-cost { font-family: 'Cinzel'; font-size: 12px; text-align: center; color: #4a2f10; background: rgba(107,74,30,.15); border-radius: 50%; width: 22px; height: 22px; line-height: 22px; }
.builder-x { font-family: 'Cinzel'; font-size: 13px; color: #8b1d1d; }
.builder-step { width: 22px; height: 22px; border-radius: 50%; font-weight: 700; color: #4a2f10; background: rgba(107,74,30,.15); }
.builder-step:hover { background: rgba(107,74,30,.3); }
.builder-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 12px; }
.builder-seal { padding: 11px 18px; border-radius: 30px; font-family: 'Cinzel'; font-weight: 900; font-size: 13px; letter-spacing: .08em; color: #f3d2c4;
  background: radial-gradient(circle at 38% 32%, #c9443a, #8b1d1d 55%, #3d0909); box-shadow: 0 4px 8px rgba(0,0,0,.4); }
.builder-seal-quiet { filter: saturate(.7); }
.builder-seal:disabled { filter: grayscale(.8); opacity: .55; cursor: not-allowed; }
.builder-plain { font-family: 'Cinzel'; font-size: 12px; letter-spacing: .1em; color: #6b4a1e; border-bottom: 1px solid rgba(107,74,30,.5); }
.builder-tray { display: none; }
.builder-picker-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-height: 520px; overflow-y: auto; text-align: left; margin-bottom: 8px; }
.builder-picker-entry { display: grid; grid-template-columns: 42px 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; padding: 6px 8px; border-bottom: 1px dotted rgba(107,74,30,.45); text-align: left; }
.builder-picker-entry .card { --card-h: 58px; grid-row: 1 / 3; }
.builder-picker-entry b { font-family: 'Cinzel'; font-size: 14px; color: #4a2f10; }
.builder-picker-entry small { font-style: italic; color: #6b5536; }
.builder-picker-entry:hover { background: rgba(139,29,29,.08); }
.builder-textarea { width: 100%; height: 300px; padding: 10px; font: 15px/1.4 'IM Fell English', Georgia, serif; color: var(--parch-ink); background: rgba(255,255,255,.5); border: 1px solid rgba(107,74,30,.5); }

#table.portrait.builder-page .builder-binder { left: 8px; right: 8px; top: 8px; bottom: 60px; padding: 10px; }
#table.portrait.builder-page .builder-class-icons { margin-right: 0; flex-wrap: wrap; }
#table.portrait.builder-page .builder-class img { width: 22px; height: 22px; }
#table.portrait.builder-page .builder-grid.builder-large { grid-template-columns: repeat(2, 1fr); }
#table.portrait.builder-page .builder-grid.builder-compact { grid-template-columns: repeat(3, 1fr); }
#table.portrait.builder-page .builder-box { display: none; }
#table.portrait.builder-page.builder-open .builder-box { display: flex; left: 0; right: 0; top: auto; bottom: 0; width: auto; height: 78%; z-index: 12; border-radius: 14px 14px 0 0; }
#table.portrait.builder-page .builder-tray { display: block; position: absolute; left: 8px; right: 8px; bottom: 8px; height: 44px; z-index: 13; border-radius: 8px;
  font-family: 'Cinzel'; font-size: 13px; letter-spacing: .08em; color: #3b2b17; background: linear-gradient(var(--parch), var(--parch-2)); box-shadow: 0 4px 12px rgba(0,0,0,.6); }
#table.portrait.builder-page.builder-open .builder-tray { bottom: calc(78% + 6px); }
#table.portrait.builder-page .builder-picker-list { grid-template-columns: 1fr; }
#table.portrait.builder-page .builder-hide-phone { display: none; }
#table.portrait.builder-page .builder-filter-row { gap: 4px; }
#table.portrait.builder-page .builder-search { min-width: 0; flex: 1 1 100%; padding: 6px 10px; font-size: 14px; }
#table.portrait.builder-page .builder-pill { flex: 1; padding: 5px 4px; font-size: 9px; letter-spacing: .06em; text-align: center; }
#table.portrait.builder-page .builder-class-icons { gap: 3px; flex: 1 1 100%; justify-content: space-between; }
#table.portrait.builder-page .builder-select { flex: 1; font-size: 10px; padding: 4px 2px; min-width: 0; }
#table.portrait.builder-page .builder-size button { padding: 4px 6px; font-size: 9px; }
/* Phone readability and tap targets (2026-11-06): the builder's stage shows at about 0.7 on a phone, so
   text is 15 stage px (about 10.5 on screen) and controls about 52 tall (36), with invisible margins
   into the gaps between them. */
#table.portrait.builder-page .builder-filter-row { gap: 8px; }
#table.portrait.builder-page .builder-search { padding: 12px 12px; font-size: 18px; }
#table.portrait.builder-page .builder-pill, #table.portrait.builder-page .builder-select,
#table.portrait.builder-page .builder-size button { position: relative; min-height: 50px; font-size: 15px; letter-spacing: .02em; }
#table.portrait.builder-page .builder-pill { padding: 6px 2px; }
#table.portrait.builder-page .builder-select { padding: 6px 2px; }
#table.portrait.builder-page .builder-size { flex: 1; }
#table.portrait.builder-page .builder-size button { flex: 1; padding: 6px 8px; }
#table.portrait.builder-page .builder-class { position: relative; }
#table.portrait.builder-page .builder-class img { width: 40px; height: 40px; padding: 5px; }
#table.portrait.builder-page .builder-pill::after, #table.portrait.builder-page .builder-class::after,
#table.portrait.builder-page .builder-size button::after { content: ''; position: absolute; inset: -4px -4px; }
#table.portrait.builder-page .builder-tray { height: 56px; font-size: 17px; }
#table.portrait.builder-page .builder-binder { bottom: 72px; }

/* ── first-game tips ──────────────────────────────────────────────────── */
.note.tip-note { width: 270px; border-left: 4px solid var(--gold-dk); }
/* a tip waits under any modal or the detail panel (it sits above them otherwise) */
#stage:has(> #modal:not([hidden])) .tip-note, #stage:has(> #detail:not([hidden])) .tip-note { display: none; }
.tip b { font-family: 'Cinzel'; font-size: 11px; letter-spacing: .2em; color: #8b6a3a; text-transform: uppercase; }
.tip p { margin: 3px 0 6px; }
.tip-ok { font-family: 'Cinzel'; font-size: 11px; letter-spacing: .12em; color: #8b1d1d; border-bottom: 1px solid rgba(139,29,29,.4); cursor: pointer; }
.tips-reset { margin-left: 10px; font-family: 'Cinzel'; font-size: 11px; letter-spacing: .1em; color: var(--gold-2); border-bottom: 1px solid rgba(201,168,76,.5); }

/* ── ambient motion (transform and opacity only; off for reduced motion) ── */
@keyframes candle { 0%, 100% { opacity: .55; } 22% { opacity: .75; } 41% { opacity: .5; } 63% { opacity: .82; } 80% { opacity: .6; } }
@keyframes glint { 0%, 86%, 100% { filter: drop-shadow(0 0 5px rgba(120,230,200,.55)) drop-shadow(0 2px 2px rgba(0,0,0,.6)); }
  92% { filter: drop-shadow(0 0 11px rgba(200,255,240,.95)) drop-shadow(0 2px 2px rgba(0,0,0,.6)); } }
@keyframes sway { 0%, 100% { transform: translateY(-48px) rotate(-.6deg); } 50% { transform: translateY(-52px) rotate(.6deg); } }
/* candlelight: on the crest, which is drawn under everything else on the felt */
.crest::before { content: ''; position: absolute; left: 50%; top: 50%; width: 1400px; height: 900px; transform: translate(-50%, -50%); pointer-events: none;
  background: radial-gradient(ellipse at 50% 45%, rgba(255,196,120,.12), transparent 55%); animation: candle 5.5s ease-in-out infinite; }
.xtal:not(.spent) { animation: glint 7s ease-in-out infinite; }
.xtal:nth-child(3n+2):not(.spent) { animation-delay: 2.3s; } .xtal:nth-child(3n):not(.spent) { animation-delay: 4.6s; }
.hand .card.selected { animation: sway 3.2s ease-in-out infinite; }
#table.portrait .hand .card.selected { animation: none; }
@media (prefers-reduced-motion: reduce) {
  .crest::before, .xtal:not(.spent), .hand .card.selected { animation: none; }
}

/* ── Adventure Mode run fights (runfight.js, board.js) ─────────────────── */
/* the opponent's portrait and taunt under their tallies, and the run's lanterns */
.run-foe { position: absolute; left: 40px; top: 186px; width: 240px; z-index: 1; pointer-events: none; }
.run-foe-top { display: flex; gap: 12px; align-items: flex-start; }
.run-portrait { position: relative; width: 92px; height: 116px; flex: none; border-radius: 46px 46px 8px 8px; overflow: hidden;
  box-shadow: 0 0 0 2px var(--gold), 0 0 0 5px #2a1c0f, 0 8px 18px rgba(0,0,0,.7); }
.run-portrait img { position: absolute; width: 230px; left: -69px; top: -44px;   /* runfight.js centres the face */ animation: run-bob 3.5s ease-in-out infinite; }
.run-taunt { position: relative; margin-top: 8px; padding: 9px 12px; border-radius: 10px; font-size: 15px; line-height: 1.3; color: var(--parch-ink);
  background: linear-gradient(var(--parch), var(--parch-2)); box-shadow: 0 6px 14px rgba(0,0,0,.5); }
.run-taunt::before { content: ''; position: absolute; left: -7px; top: 22px; width: 14px; height: 14px; transform: rotate(45deg); background: #e5d6ae; }
.run-lanterns { margin-top: 22px; }
.run-lanterns .k { font-family: 'Cinzel'; font-size: 12px; letter-spacing: .2em; color: var(--ink-dim); text-transform: uppercase; }
.run-lantern-row { display: flex; gap: 18px; margin-top: 8px; padding-left: 6px; }
.run-lantern { position: relative; display: block; }
.run-lantern.lit::before { content: ''; position: absolute; left: -24px; top: -14px; width: 82px; height: 82px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,200,100,.4), rgba(255,200,100,0) 65%); animation: run-halo 2.4s ease-in-out infinite; }
.run-lantern svg { position: relative; display: block; }
.run-lantern .flame { animation: run-flicker 1.4s ease-in-out infinite; transform-origin: 10px 16px; }
@keyframes run-bob { 0%,100% { translate: 0 0; } 50% { translate: 0 -3px; } }
@keyframes run-halo { 0%,100% { opacity: .9; } 50% { opacity: .55; } }
@keyframes run-flicker { 0%,100% { opacity: 1; transform: scale(1); } 40% { opacity: .8; transform: scale(.92); } 70% { opacity: .95; transform: scale(1.05); } }
/* the opponent's signature warrior: destroying it pays the Signature kill bonus */
.card.signature img { box-shadow: 0 0 0 2px var(--gold-2), 0 0 24px 4px rgba(230,204,122,.5), 0 6px 10px rgba(0,0,0,.55); }
.sig-flag { position: absolute; left: 50%; top: -12px; transform: translateX(-50%); z-index: 3; white-space: nowrap; padding: 3px 10px; border-radius: 2px;
  font-family: 'Cinzel'; font-weight: 700; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: #3b2a0a;
  background: linear-gradient(#f6dc8a, #c9973c); box-shadow: 0 2px 6px rgba(0,0,0,.6); pointer-events: none; }
/* on a phone held upright: the portrait small beside the opponent's name, the taunt a bubble
   under it for the fight's first seconds (runfight.js keeps its clock across redraws), the
   lanterns in the gap between the center and your row (it widens by 1.5 x --grow) */
#table.portrait .run-foe { inset: 0; width: auto; }
#table.portrait .run-foe-top { position: absolute; left: 10px; top: 6px; }
#table.portrait .run-portrait { zoom: .5; }
#table.portrait:has(#run-foe) #opp-side { left: 66px; }
#table.portrait .run-taunt { position: absolute; left: 56px; top: 58px; width: max-content; max-width: 250px; margin: 0; padding: 7px 10px;
  font-size: 13px; z-index: 8; animation: run-taunt-out 7s ease-in forwards; }
#table.portrait .run-taunt::before { left: 10px; top: -6px; width: 12px; height: 12px; }
#table.portrait .run-lanterns { position: absolute; left: calc(50% + 62px); top: calc(288px + 1.5 * var(--grow, 0px)); margin: 0; }
#table.portrait .run-lanterns .k { display: none; }
#table.portrait:has(#coinflip:not([hidden])) .run-lanterns { visibility: hidden; }   /* they'd float beside the coin */
#table.portrait .run-lantern-row { gap: 12px; margin: 0; padding: 0; }
#table.portrait .run-lantern { zoom: .55; }
@keyframes run-taunt-out { 0%, 85% { opacity: 1; } 100% { opacity: 0; visibility: hidden; } }
@media (prefers-reduced-motion: reduce) { .run-portrait img, .run-lantern.lit::before, .run-lantern .flame { animation: none; } }

/* ── run boards: the mat a map's fights are played on (runfight.js dressBoard) ── */
.board-decor { position: absolute; inset: 0; pointer-events: none; }
.board-decor svg, .board-decor span { position: absolute; }

/* The Darkwood: a tree stump in the woods (Jordan's "Wildwood" mockup) */
#table[data-board="darkwood"] #stage { background: radial-gradient(ellipse at 50% 0%, #22341a, #0a0f07 70%); }
#table[data-board="darkwood"] .mat {
  background:
    radial-gradient(ellipse at 50% 46%, rgba(255,205,130,.18), rgba(0,0,0,0) 42%),
    radial-gradient(ellipse at 50% 46%, rgba(0,0,0,0) 30%, rgba(10,6,2,.86) 82%),
    repeating-radial-gradient(circle at 50% 48%, #6a4e30 0 7px, #735534 7px 15px, #5f4529 15px 17px, #6e5132 17px 28px);
  box-shadow: inset 0 0 0 2px #0c120b, inset 0 0 0 9px #2f4420, inset 0 0 0 10px #7a6024, inset 0 0 140px rgba(0,0,0,.75);
}
#table[data-board="darkwood"] .mat::before { border-color: rgba(166,211,107,.16); }
#table[data-board="darkwood"] .crest { display: none; }
/* round the global slot (.center: top 240px, 150px cards), flattened to fit between the rows */
.board-decor .bd-ring { left: 50%; top: 318px; width: 420px; height: 200px; transform: translate(-50%, -50%); opacity: .8; }
.board-decor .bd-vines { left: 0; top: 0; width: 1396px; height: 110px; }
.board-decor .bd-spark { left: 282px; top: 556px; width: 16px; height: 16px; animation: bd-sparkle 2.4s ease-in-out infinite; }
.board-decor .bd-jar { left: 236px; top: 572px; width: 50px; height: 68px; }
.board-decor .bd-glow { fill: #e8ffb0; transform-box: fill-box; transform-origin: center; animation: bd-flicker 1.3s ease-in-out infinite; }
.board-decor .bd-glow:nth-of-type(2) { animation-duration: 1.1s; }
.board-decor .bd-glow:nth-of-type(3) { animation-duration: 1.5s; }
.board-decor .bd-shrooms { left: 1296px; top: 760px; width: 110px; height: 100px; }
.board-decor .bd-fly { width: 5px; height: 5px; border-radius: 50%; background: #e8ffb0; box-shadow: 0 0 10px 3px rgba(214,255,140,.6);
  animation: bd-drift 6s ease-in-out infinite; }
/* the Sanctum: white marble with grey veins, a gilded rim, gold motes */
#table[data-board="sanctum"] #stage { background: radial-gradient(ellipse at 50% 0%, #2a2440, #0b0a12 70%); }
#table[data-board="sanctum"] .mat {
  background:
    radial-gradient(ellipse at 50% 46%, rgba(255,236,190,.22), rgba(0,0,0,0) 45%),
    radial-gradient(ellipse at 50% 46%, rgba(0,0,0,0) 34%, rgba(20,16,30,.8) 86%),
    linear-gradient(115deg, rgba(120,120,130,0) 0 30%, rgba(120,120,130,.18) 31%, rgba(120,120,130,0) 33% 60%, rgba(120,120,130,.14) 61%, rgba(120,120,130,0) 63%),
    linear-gradient(160deg, #aaa396, #948c7f 60%, #81796c);   /* dark enough that the slot labels read */
  box-shadow: inset 0 0 0 2px #14111d, inset 0 0 0 9px #3a3346, inset 0 0 0 10px #c9a84c, inset 0 0 140px rgba(0,0,0,.6);
}
#table[data-board="sanctum"] .mat::before { border-color: rgba(201,168,76,.3); }
#table[data-board="sanctum"] .crest { display: none; }
#table[data-board="sanctum"] .bd-fly { background: #ffe9a8; box-shadow: 0 0 10px 3px rgba(255,214,120,.55); }
#table[data-board="sanctum"] .bd-glow { fill: #ffcf5a; }
/* the marble is pale: the mat's words take dark ink here (the Darkwood's are pale gold on dark wood) */
#table[data-board="sanctum"] .turn-banner .small, #table[data-board="sanctum"] .slot .label { color: rgba(40,30,22,.72); }
#table[data-board="sanctum"] .phases { color: rgba(40,30,22,.6); }
#table[data-board="sanctum"] .phases span.on { color: #6e1414; }
#table[data-board="sanctum"] .phases i { color: rgba(40,30,22,.4); }
.board-decor .bd-arcade { left: 0; top: 0; width: 1396px; height: 110px; }
.board-decor .bd-candles-l { left: 226px; top: 560px; width: 70px; height: 90px; }
.board-decor .bd-candles-r { left: 1300px; top: 760px; width: 70px; height: 90px; }
@keyframes bd-drift { 0% { transform: translate(0,0); opacity: .15; } 50% { transform: translate(16px,-24px); opacity: 1; } 100% { transform: translate(-8px,-52px); opacity: .1; } }
@keyframes bd-flicker { 0%,100% { opacity: 1; transform: scale(1); } 40% { opacity: .8; transform: scale(.92); } 70% { opacity: .95; transform: scale(1.05); } }
@keyframes bd-sparkle { 0%,100% { opacity: 0; transform: scale(.3) rotate(0deg); } 50% { opacity: 1; transform: scale(1) rotate(45deg); } }
@media (prefers-reduced-motion: reduce) { .board-decor * { animation: none !important; } }
/* the phone table: the stump and the fireflies, without the pieces placed for the wide table */
#table.portrait .board-decor .bd-ring, #table.portrait .board-decor .bd-vines, #table.portrait .board-decor .bd-jar,
#table.portrait .board-decor .bd-spark, #table.portrait .board-decor .bd-shrooms, #table.portrait .board-decor .bd-arcade,
#table.portrait .board-decor .bd-candles-l, #table.portrait .board-decor .bd-candles-r { display: none; }

/* an enchanted copy: its class's icon stamped across it in red (the run screens draw the same) */
.card .enchant-stamp { position: absolute; inset: 22% 14%; z-index: 2; pointer-events: none; opacity: .5; transform: rotate(-14deg);
  background: #b3121a; -webkit-mask: var(--stamp) center / contain no-repeat; mask: var(--stamp) center / contain no-repeat; }
.detail-body .enchanted { color: #b3121a; font-style: italic; }
