/* board-lite: TV and phone, one folded-paper world, the same as the board's.
   The table is a sheet of night-blue construction paper (the lobby's sky);
   everything on it is cut from paper too. Paper here is matte: grain, soft
   clouds of pulp, crisp square-cut edges and at most one faint crease, never a
   sheen. A sheet lying on another casts a short, hard shadow (its thickness)
   and a soft one under it. Buttons are tabs of coloured card that stand up off
   the sheet and press flat; banners are ribbons with notched ends like the
   cards' name strips. Words on paper are ink; player colours are inked darker
   there so yellow still reads. */

:root {
  --bg: #1d1934;
  --bg2: #2b2452;
  --panel: #262046;
  --panel2: #332b5c;
  --line: #4a4170;
  --text: #f3ecdc;
  --muted: #b3aac8;
  --accent: #f5c542;
  --good: #4cc26e;
  --bad: #e5484d;
  --warn: #f2a33a;
  --heal: #ff8f8f;
  --hit: #ff7a59;
  /* paper */
  --paper: #f1e7d0;
  --paper-hi: #f7f0de;
  --paper-lo: #e8dcc0;
  --paper-edge: #bfa982;
  --ink: #2b2228;
  --ink-soft: #6b5a6e;
  --serif: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  /* fine grain: specks of fibre */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .4 0 0 0 0 .3 0 0 0 .16 0'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
  /* the pulp's clouds: paper is never one flat colour */
  --mottle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='n' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.016' numOctaves='3' seed='4' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .34 0 0 0 0 .2 .28 0 0 0 -.105'/%3E%3C/filter%3E%3Crect width='260' height='260' filter='url(%23n)'/%3E%3C/svg%3E");
  /* the night table's own grain and clouds, in lighter fibre */
  --table-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .85 0 0 0 0 .8 0 0 0 0 1 .75 0 0 0 -.42'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  --table-mottle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='420' height='420'%3E%3Cfilter id='n' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.008' numOctaves='3' seed='9' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .55 0 0 0 0 .5 0 0 0 0 .85 .26 0 0 0 -.1'/%3E%3C/filter%3E%3Crect width='420' height='420' filter='url(%23n)'/%3E%3C/svg%3E");
  --table: var(--table-grain), var(--table-mottle), radial-gradient(ellipse 120% 90% at 50% 40%, var(--bg2), var(--bg) 72%);
  /* a sheet: matte, lit a little from above, one faint crease where it was folded and opened flat */
  --crease: linear-gradient(97deg, transparent 63%, #ffffff55 63% calc(63% + 1px), #6b553010 calc(63% + 1px));
  --sheet: var(--grain), var(--mottle), var(--crease), linear-gradient(180deg, var(--paper-hi), var(--paper) 45%, var(--paper-lo));
  /* paper lying on the table: its cut edge, a second sheet of darker stock under it, a hard
     shadow as thick as card and a soft one under both */
  --lift: inset 0 1px 0 #fffbf0aa, 0 .1em 0 var(--paper-edge), .2em .24em 0 -.04em #cdb68c, .2em .24em 0 -.02em #0b081a40, .26em .38em .1em -.04em #0b081a66, .2em .7em 1em -.15em #0b081ab3;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { background: var(--table); background-color: var(--bg); background-attachment: scroll, scroll, fixed; }

/* Paper: on any of these, words are ink, and colours that were picked for the
   night table are inked darker. */
.pcard, .side .corner, .panel, .production, .result, .endbox, .summary, .recap-page .sheet, .target, .roost, .offer, .ptarget, .big-note, .mylog, .watchtv,
.fhead, .fightscene .outcome, .heldback, .fig-name, .talkbar, .card, .mehead, .ally, .sent, .pover .standings, .pmap, .toast, .join-box, .seatcard, .seatlist li, button:not(.primary), a.button:not(.primary), input, select {
  --text: var(--ink); --muted: var(--ink-soft); --line: var(--paper-edge);
  --good: #1f8a47; --bad: #c0392b; --warn: #b35a00; --heal: #c0392b; --hit: #c0392b;
  color: var(--text);
}
:is(.pcard, .side .corner, .panel, .production, .result, .endbox, .summary, .recap-page .sheet, .target, .roost, .offer, .ptarget, .big-note, .mylog, .watchtv, .fhead, .fightscene .outcome, .heldback, .talkbar, .mehead, .ally, .pover .standings, button:not(.primary)) :is(.ptag, .pname) { color: color-mix(in oklab, var(--pc) 72%, #1a1218); }
/* Icons drawn for the night table get a thin ink outline on paper (livestock is cream). */
:is(.pcard, .side .corner, .panel, .production, .result, .endbox, .summary, .recap-page .sheet, .target, .roost, .offer, .ptarget, .mylog, .fhead, .fightscene .outcome, .heldback, .talkbar, .mehead, .ally, .pover .standings, button:not(.primary)) .ricon { filter: drop-shadow(0 0 .5px #2b2228) drop-shadow(0 0 .5px #2b2228); }
.panel, .roost, .offer, .ptarget, .big-note, .mylog, .watchtv, .ally, .sent, .pmap, .pover .standings { background: var(--sheet); box-shadow: var(--lift); border-radius: 2px; }

/* Buttons: a tab of matte card standing up off the sheet, as thick as its
   hard edge below; pressed, it lies flat. Plain is cream card, primary blue,
   ghost the table's own night card (a kraft tab on a sheet), chosen gold.
   A link that leaves the game (a.button) looks the same. */
button, a.button { font: inherit; font-weight: 700; color: var(--text); background: var(--grain), var(--mottle), linear-gradient(180deg, #faf4e4, #ece0c5); border: 0; border-radius: 2px; padding: .5em .9em; cursor: pointer;
  --edge: var(--paper-edge); box-shadow: inset 0 1px 0 #fffbf0b3, 0 .16em 0 var(--edge), .05em .28em .12em #0b081a66; transition: transform .08s, box-shadow .08s; }
button:active:not(:disabled), a.button:active { transform: translateY(.14em); box-shadow: inset 0 1px 0 #fffbf0b3, 0 .02em 0 var(--edge), 0 .06em .1em #0b081a66; }
button:disabled { opacity: .45; cursor: default; box-shadow: 0 .06em 0 var(--edge); }
button.primary, a.button.primary { --text: #fff; --muted: #e3e9ff; --edge: #213f8a; color: #fff; background: var(--grain), var(--mottle), linear-gradient(180deg, #4d7bdf, #3c68cb); box-shadow: inset 0 1px 0 #ffffff40, 0 .16em 0 var(--edge), .05em .28em .12em #0b081a77; text-shadow: 0 1px 0 #0003; }
button.primary:active:not(:disabled), a.button.primary:active { box-shadow: inset 0 1px 0 #ffffff40, 0 .02em 0 var(--edge); }
button.ghost { --text: var(--paper); --edge: #15112a; color: var(--paper); background: var(--table-grain), var(--mottle), linear-gradient(180deg, #4b4279, #3d3567); box-shadow: inset 0 1px 0 #ffffff24, 0 .16em 0 var(--edge), .05em .28em .12em #0b081a77; }
:is(.talkbar, .panel, .pmap) button.ghost { --text: var(--ink); --edge: #a38a5c; color: var(--ink); background: var(--grain), var(--mottle), linear-gradient(180deg, #e6d7b6, #d8c59e); box-shadow: inset 0 1px 0 #fffbf080, 0 .16em 0 var(--edge), .05em .28em .12em #0b081a55; }
button.small { padding: .2em .5em; font-size: .85em; }
button.big, a.button.big { font-size: 1.15em; padding: .8em 1em; width: 100%; }
a.button { display: inline-block; box-sizing: border-box; text-align: center; text-decoration: none; }
input, select { font: inherit; background: var(--grain), #fffaf0; border: 1px solid var(--paper-edge); border-radius: 2px; padding: .5em; box-shadow: inset 0 .12em .2em #0002; }
small { color: var(--muted); }
/* Headings and banners in the cards' book face. */
.title, .topbar .phase, .production h1, .result h1, .endbox h1, .summary h1, .recap-page h1, .recap-page h2, .raidbox h1, .target h2, .result.fight h2, .panel h3, .corner.titles h3, .pover h1, .plobby h1, .pbody h2, .trade h3, .phone .status { font-family: var(--serif); }
/* A ribbon: a strip of paper with notched ends, like the cards' name strips. */
.doing, .phone .status.you, .topbar .phase { clip-path: polygon(0 0, 100% 0, calc(100% - .45em) 50%, 100% 100%, 0 100%, .45em 50%); }
.loading { min-height: 100vh; margin: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5em; color: var(--muted); }
.loading .title { font-size: 2.5em; }
.hidden { display: none !important; }

.ptag { color: var(--pc); font-weight: 800; }
.chip { display: inline-flex; align-items: center; gap: .15em; margin-right: .45em; font-weight: 700; white-space: nowrap; }
.chip small { font-weight: 500; }
.chip.free { color: var(--muted); font-weight: 500; }
.ricon { vertical-align: middle; }
.hpbar { display: inline-block; width: 4em; height: .5em; background: color-mix(in srgb, var(--text) 22%, transparent); border-radius: 2px; overflow: hidden; vertical-align: middle; }
.hpbar span { display: block; height: 100%; transition: width .6s ease-out, background-color .6s; }
.ok { color: var(--good); font-weight: 800; }
.wait { color: var(--muted); }
.none { color: var(--muted); font-style: italic; }
/* Dice: one white paper shape per kind of die, the same blank (a die to roll,
   "2" and a square for 2d6). A rolled die is that shape's flat face with its
   number on it (dieFace). */
.dicechip { display: inline-flex; align-items: center; gap: .05em; }
.die { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 2.4em; height: 2.4em; margin: 0 .15em; color: #111; vertical-align: middle; line-height: 1; filter: drop-shadow(0 2px 0 #0007); }
.die .dieicon { position: absolute; inset: 0; width: 100%; height: 100%; }
.die b { position: relative; font-size: 1.15em; font-weight: 800; }
.die[data-sides="4"] b { margin-top: .3em; font-size: 1em; }
.die[data-sides="8"] b { font-size: 1em; }
.die.rolling { animation: shake .18s infinite; }
@keyframes shake { 0% { transform: rotate(-8deg); } 50% { transform: rotate(8deg); } 100% { transform: rotate(-8deg); } }

.toast { position: fixed; left: 50%; bottom: 1.5em; transform: translateX(-50%) rotate(-.6deg); background: var(--sheet); border-left: .4em solid var(--bad); box-shadow: var(--lift); font-weight: 600; padding: .7em 1em; border-radius: 2px; z-index: 50; max-width: 90vw; }
/* Toasts and notes slide up as they come and fade as they go (tv.ts). */
.toast { animation: toastin .3s ease-out; transition: opacity .4s ease-in, translate .4s ease-in; }
.toast.gone { opacity: 0; translate: 0 .8em; }
@keyframes toastin { from { opacity: 0; translate: 0 .8em; } }
.offline-note { display: none; position: fixed; top: 0; left: 0; right: 0; background: var(--grain), #c0392b; color: #fff; font-weight: 700; text-align: center; padding: .3em; z-index: 60; box-shadow: 0 .2em .4em #0006; }
body.offline .offline-note { display: block; }
/* Offline, the phone's page greys out and can't be tapped (phone.ts makes it
   inert), and the banner sits above your header instead of over it. */
body.phone.offline { padding-top: 2em; }
body.phone .offline-note { line-height: 1.4em; }
body.phone.offline .mehead { top: 2em; }
/* Greyed with a sheet over the page, not a filter on #app: a filter would make
   #app the box the fixed hand and bars are placed in, and move them. */
body.phone.offline::after { content: ''; position: fixed; inset: 0; z-index: 55; pointer-events: none; backdrop-filter: grayscale(.8); background: #1b1530a0; }

/* map */
svg.map { width: 100%; height: 100%; display: block; }
.hex.selectable { cursor: pointer; }
.pulse { animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .35; } }

/* ================= TV ================= */
body.tv { font-size: clamp(14px, 1.05vw, 26px); overflow: hidden; }
.tv .lobby { display: flex; flex-direction: column; height: 100vh; }
/* the title picture: a pop-up scene of the table's towers, the name on a paper plate */
.tv .hero { position: relative; flex: 0 0 44vh; overflow: hidden; }
.tv .hero svg.scene { width: 100%; height: 100%; display: block; }
.nameplate { position: absolute; left: 6%; top: 50%; transform: translateY(-50%) rotate(-1.5deg); background: #f3ead7; color: #2a1d33; padding: .3em 1.6em .5em; text-align: center;
  clip-path: polygon(0 8%, 4% 0, 96% 3%, 100% 14%, 98% 92%, 93% 100%, 3% 97%, 0 86%); filter: drop-shadow(0 .3em .4em #0008); }
.nameplate .title { color: #2a1d33; }
.nameplate .subtitle { color: #5a4a5e; }
.title { font-size: 4em; margin: 0; letter-spacing: .02em; color: var(--accent); }
.subtitle { margin: 0; color: var(--muted); font-size: 1.3em; }
.lobby-main { flex: 1; display: flex; gap: 2.5em; align-items: center; justify-content: center; padding: 1em 2em; min-width: 0; }
/* how to join, on a sheet of paper */
.join-box { flex: none; background: var(--sheet); color: #2a1d33; border-radius: 2px; padding: 1em 2em 1.2em; font-size: 1.3em; text-align: center; box-shadow: var(--lift); transform: rotate(-.6deg); }
.join-box .step { color: #6b5a6e; font-weight: 700; }
.join-box .url { font-size: 1.9em; font-weight: 800; margin: .1em 0 .5em; }
.join-box .alt { color: #6b5a6e; margin: -.5em 0 .5em; }
.join-box .code { display: flex; gap: .25em; justify-content: center; margin-top: .2em; }
.join-box .code span { font-size: 3.4em; font-weight: 900; width: 1.25em; line-height: 1.3; background: #2a1d33; color: var(--accent); border-radius: 6px; box-shadow: 0 .12em 0 #0005; }
.table { min-width: 0; flex: 0 1 auto; display: flex; flex-direction: column; align-items: center; gap: 1em; }
.seatcards { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(7em, 12em)); gap: .8em; font-size: 1.35em; }
.seatcard { position: relative; height: 4.2em; display: flex; align-items: center; gap: .5em; padding: 0 .8em; background: var(--sheet); color: #2a1d33; border-radius: 2px; border-top: .35em solid var(--pc); box-shadow: var(--lift); }
.seatcard .pname { color: #2a1d33; font-weight: 800; font-size: 1.1em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seatcard .tag { font-size: .7em; font-weight: 700; color: #6b5a6e; border: 1px solid #b8a9a0; border-radius: 4px; padding: 0 .3em; }
.seatcard.open { background: transparent; border: 2px dashed #f3ead740; box-shadow: none; }
.seatcard.open.needed { border-color: #f3ead780; }
.seatcard.open[style] { border-color: color-mix(in oklab, var(--pc) 70%, transparent); }
.seatcard.open .pname { color: #f3ead7d0; font-weight: 600; }
.seatcard.open svg.token { opacity: .55; }
.table h2.seating { margin: 0; font-size: 2em; color: var(--accent); }
.seatcard .x { position: absolute; top: .15em; right: .2em; background: none; border: none; color: #6b5a6e; font-size: 1.1em; padding: 0 .3em; opacity: 0; }
.seatcard:hover .x { opacity: 1; }
svg.token { flex: none; }
.tv .tipline { flex: none; margin: 0 auto 1.6em; max-width: 60em; padding: 0 2em; text-align: center; font-size: 1.3em; color: #f3ead7d0; }
.tv .tipline b { color: var(--accent); margin-right: .4em; }
.lobby-actions { display: flex; gap: 1em; font-size: 1.3em; }
.hint { color: var(--muted); }
/* Full screen (tv.ts): top right, over the lobby's sky or the board's goal;
   in a game only while the mouse moves. */
#tvbtns { position: fixed; top: .8em; right: 1em; z-index: 50; font-size: 1.2em; display: flex; gap: .6em; }
#fullscreen, #savegame { display: none; }
body.tv:has(#app > .lobby) #fullscreen, body.tv.pointing #fullscreen { display: block; }
body.tv.fullscreen #fullscreen { display: none; }
/* Save game (tv.ts): beside it, in a game, while the mouse moves, even full screen. */
body.tv.pointing.playing #savegame { display: block; }
/* A new room's lobby offers the saved games; a saved game's lobby has Continue. */
.tv .savedgames { flex: none; display: flex; align-items: center; gap: 1em; margin: 0 2em 1.2em; font-size: 1.15em; }
.tv .savedgames h3 { flex: none; margin: 0; font-family: var(--serif); color: var(--accent); font-size: 1.1em; }
.tv .savedgames ul { flex: 1; min-width: 0; list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6em; }
.tv .savedgames li { min-width: 0; display: flex; align-items: center; gap: .8em; padding: .35em .5em .35em .8em; background: #f3ead714; border: 1px solid #f3ead730; border-radius: 3px; }
.tv .savedgames .who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tv .savedgames .who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tv .savedgames .who small { color: var(--muted); }
.tv .savedgames button { flex: none; }

/* The board is read from a couch about 3 m away: nothing on it is smaller
   than 1.1em of the TV's base size (about 22px at 1080p). */
/* The board is the TV: it fills the screen, centred, and everything else
   stands in the columns either side of it and in its corners. */
.board { position: relative; height: 100vh; overflow: hidden; --colw: 21vw; }
.topbar { position: absolute; top: 0; left: 0; right: 0; z-index: 3; display: flex; align-items: center; gap: .8em; padding: .35em 1em; pointer-events: none; }
/* Over the sea, the round and the goal stand on a dark wash, to read. */
.mapwrap:has(> .board3d) ~ .topbar { background: linear-gradient(#000a, #0006 70%, #0000); }
.topbar .round { font-size: 1.5em; font-weight: 800; color: var(--accent); }
/* what's happening, on a gold ribbon */
.topbar .phase { font-size: 1.7em; font-weight: 700; color: var(--ink); background: var(--grain), linear-gradient(175deg, #ffd866 0 50%, #f0bb34 50%); padding: .05em .9em .1em; filter: drop-shadow(0 .12em .15em #0008); }
.topbar .phase .ptag { color: color-mix(in oklab, var(--pc) 62%, #1a1218); }
/* the round's phases in order, the current one on the ribbon, the rest faint beside it */
.topbar .phases { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: .9em; }
.topbar .phases li:not(.phase) { font-size: 1.15em; font-weight: 600; color: var(--muted); opacity: .75; white-space: nowrap; }
.topbar .phases li.phase { white-space: nowrap; }
.topbar .goal { margin-left: auto; font-size: 1.3em; display: inline-flex; align-items: center; gap: .2em; align-self: center; }
/* This round's turn order (#430): centred under the TV's top bar, over the board's top edge; open offers sit below it (placed in tv.ts). */
.turnorder { list-style: none; margin: 0; position: absolute; top: 2.45em; left: 50%; transform: translateX(-50%); z-index: 3; max-width: calc(100vw - 2 * var(--colw) - 2em); display: flex; flex-wrap: wrap; justify-content: center; gap: .3em; font-size: 1.25em; padding: .2em .4em; border-radius: 1em; background: #0009; pointer-events: none; }
.turnorder li { background: var(--pc); color: #111; font-weight: 800; padding: .05em .6em; border-radius: 1em; white-space: nowrap; max-width: 5.5em; overflow: hidden; text-overflow: ellipsis; }
.turnorder li.done { opacity: .4; }
.turnorder li.now { outline: .16em solid #ffd866; outline-offset: .12em; box-shadow: 0 0 .7em #ffd866aa; }
.remote .board > .turnorder { position: static; order: 0; transform: none; max-width: none; justify-content: flex-start; font-size: 1em; background: none; padding: 0; }
.mapwrap { position: absolute; inset: 0 calc(var(--colw) - 6vw) 0; display: flex; flex-direction: column; }
.mapwrap svg.map { flex: 1; min-height: 0; }
/* The 3D board's canvas spans the whole screen, the sea running off every
   edge; the land is fitted to the middle (.mapwrap's box), between the
   columns, so no hex hides under a player's card. */
.mapwrap:has(> .board3d) { inset: 0 calc(var(--colw) + .5em); }
.board3d { position: absolute; inset: 0 calc(-.5em - var(--colw)); }
.board3d canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.legend { display: flex; gap: 1.1em; justify-content: center; color: var(--muted); font-size: .9em; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: .3em; text-transform: capitalize; }
.legend i { width: 1em; height: 1em; border-radius: 3px; display: inline-block; }

/* The sides: one card per player, as large as the player count allows, then
   the feed (left) or the titles (right) in the bottom corner. */
.side { position: absolute; top: 3.2em; bottom: .5em; width: var(--colw); z-index: 2; display: flex; flex-direction: column; gap: .4em; overflow: hidden; }
.side.left { left: .5em; } .side.right { right: .5em; }
.side .corner { margin-top: auto; }
/* Where each count starts; the TV steps it down if the cards don't fit (tv.ts fitSide). */
.side.p2 { font-size: 1.6em; } .side.p3, .side.p4 { font-size: 1.45em; }
.side.p5, .side.p6 { font-size: 1.3em; }
/* each player a sheet, their colour a folded strip down its edge; the one whose turn it is is tinted and ringed */
.pcard { background: var(--sheet); border-left: .4em solid var(--pc); border-radius: 2px; padding: .3em .6em .4em; box-shadow: var(--lift); }
.pcard.turn { background: var(--grain), var(--mottle), var(--crease), linear-gradient(180deg, color-mix(in srgb, var(--pc) 12%, var(--paper-hi)), color-mix(in srgb, var(--pc) 18%, var(--paper-lo)));
  box-shadow: 0 0 0 .18em var(--pc), .06em .3em 0 color-mix(in srgb, var(--pc) 45%, #0b081a), .1em .7em 1.1em -.1em #0b081acc; }
.phead { display: flex; align-items: center; gap: .45em; white-space: nowrap; }
.pname { font-size: 1.3em; font-weight: 800; color: var(--pc); line-height: 1.1; }
/* titles and slain beasts: when the row is full they wrap first, then a long name ends in "…": the cards and points always show (#398) */
.phead .badges { display: flex; flex-wrap: wrap; gap: .2em .45em; }
.phead .pname { flex-shrink: 0; max-width: 50%; overflow: hidden; text-overflow: ellipsis; }
.phead .hand, .phead .pts { flex-shrink: 0; }
.pcard > .doing { display: inline-block; margin: .1em 0; }
.doing { background: var(--grain), linear-gradient(175deg, #ffd866 0 50%, #f0bb34 50%); color: var(--ink); font-weight: 800; padding: 0 .75em; white-space: nowrap; }
.hand { margin-left: auto; display: inline-flex; align-items: center; gap: .1em; font-weight: 700; color: var(--muted); }
.pts { display: inline-flex; align-items: center; gap: .1em; margin-left: .4em; }
.pts b { font-size: 1.5em; line-height: 1; }
.title-badge { background: var(--grain), linear-gradient(175deg, #ffe18a 0 50%, #f3c64a 50%); color: var(--ink); border-radius: 3px; padding: 0 .35em; font-weight: 700; white-space: nowrap; box-shadow: 0 .08em 0 #a8801c; }
.dragons { display: flex; flex-wrap: wrap; gap: .2em .9em; margin-top: .2em; }
/* a player's points as a track to the goal: one segment per source, in their colour, each a shade lighter, the sources named under it */
.ptrack { margin: .15em 0 .1em; }
.pbar { display: flex; gap: .12em; height: .5em; border-radius: .25em; overflow: hidden; background: color-mix(in srgb, var(--ink) 14%, transparent); }
.ptrack i { flex: none; background: var(--pc); }
.ptrack i.s1 { background: color-mix(in srgb, var(--pc) 55%, #1a1218); }
.ptrack i.s2 { background: color-mix(in srgb, var(--pc) 50%, #fff); }
.ptrack i.s3 { background: color-mix(in srgb, var(--pc) 30%, #1a1218); }
.ptrack i.s4 { background: color-mix(in srgb, var(--pc) 25%, #fff); }
.pwhy span { display: inline-flex; align-items: center; gap: .25em; white-space: nowrap; }
.pwhy span i { width: .7em; height: .7em; border-radius: 2px; }
.ptrack.full .pbar { box-shadow: 0 0 0 .12em var(--accent); }
.pwhy { display: flex; flex-wrap: wrap; gap: 0 .8em; font-size: .78em; line-height: 1.25; color: color-mix(in srgb, var(--ink) 70%, transparent); }
.pwhy b { color: var(--ink); }
/* someone has the points to win: the top bar says this round is the last */
.topbar .goal.last { display: inline-block; background: var(--grain), linear-gradient(175deg, #ffd866 0 50%, #f0bb34 50%); color: var(--ink); font-weight: 700; padding: .05em .7em; border-radius: 3px; font-size: 1.2em; }
.tvdragon { display: flex; align-items: center; gap: .25em; line-height: 1.1; }
.tvdragon svg { width: 1.9em; height: 1.9em; flex: none; }
.tvdragon > div { display: flex; flex-direction: column; }
.tvdragon b { white-space: nowrap; }
.tvdragon span { display: flex; align-items: center; gap: .35em; color: var(--muted); white-space: nowrap; }
.tvdragon .hpbar { width: 3em; height: .45em; }
/* A crowded board shows each player's dragons in brief (tv.ts fitSide): a
   picture per dragon over its health bar, grouped by element, then their power. */
.dragons.brief, .side.brief .dragons:not(.brief) { display: none; }
.side.brief .dragons.brief { display: block; }
.btiles { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .25em .1em; }
.bdragon { display: inline-flex; flex-direction: column; align-items: center; gap: .05em; }
.bdragon.gap { margin-left: .45em; }
.bdragon svg { width: 1.75em; height: 1.75em; }
.bdragon .hpbar, .bdragon > i { width: 1.5em; height: .32em; }
.bdragon.perched svg { border-radius: 50%; box-shadow: 0 0 0 .12em var(--warn); }
.bsum { display: flex; align-items: center; align-self: center; gap: .4em; margin-left: .6em; white-space: nowrap; }
.grow { color: var(--muted); letter-spacing: -.05em; }
.st-out, .st-perched { font-style: normal; font-weight: 800; }
.st-perched { color: var(--warn); }
/* Hungry (#362): went hungry at this round's production. */
.st-hungry { font-style: normal; font-weight: 800; color: var(--warn); white-space: nowrap; }
.dchip .hunger { display: flex; flex-wrap: wrap; gap: 0 .6em; }
.tvdragon b:has(.st-hungry) { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: .4em; white-space: normal; }
.tvdragon b .st-hungry { font-size: .8em; line-height: 1.3; }
.card.big .dhunger { display: flex; flex-wrap: wrap; gap: 0 .6em; padding: 0 .3em; }
/* A knocked-out dragon is greyed: it can't fight until it heals. Its tag stays bright. */
.st-out { align-self: flex-start; background: var(--bad); color: #fff; padding: .05em .45em; border-radius: .3em; }
.out svg { filter: grayscale(1); opacity: .35; }
.out > div > b, .out > div > span { opacity: .4; }
/* The phone's and the raid's dragon chips. */
.dchip { display: flex; align-items: center; gap: .3em; font-size: .85em; line-height: 1.15; }
.dchip > div { display: flex; flex-direction: column; }
.dchip .grow { color: var(--muted); letter-spacing: -.05em; }
.dchip em { font-size: .85em; }
.panel { padding: .4em .8em; }
.panel h3 { margin: .1em 0 .3em; font-size: 1em; }
.panel ul { margin: 0; padding-left: 1.1em; }
/* Trade offers sit over the board's top edge while they're open. */
.board > .offers { position: absolute; top: 3.2em; left: 50%; transform: translateX(-50%) rotate(-.4deg); z-index: 3; max-width: 46vw; font-size: 1.4em; border-top: .3em solid var(--accent); }
.board > .offers h3 { display: none; }
.offers ul { list-style: none; padding: 0; }
.offers li { margin: .15em 0; }

/* The bottom corners: what happened and what was said, and the titles. */
.side .corner { background: var(--sheet); box-shadow: var(--lift); border-radius: 2px; padding: .3em .7em; font-size: clamp(15px, 1.15vw, 28px); flex: none; }
.feedbox ul.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; justify-content: flex-end; max-height: 7.2em; overflow: hidden; }
.feedbox li { padding: .05em 0; color: var(--muted); line-height: 1.45; }
/* a line reads as a sentence: the icons sit in the words, not spaced out as cells */
.feedbox li :is(svg, .ricon, .chip) { vertical-align: middle; }
.feedbox li .evround { display: block; }
.feedbox li .chip { margin-right: .15em; }
.feedbox .feed li:last-child { color: var(--text); font-weight: 600; }
.feedbox .said { color: var(--text); display: block; }
/* A long message keeps who said it and ends in "…" instead of losing its top. */
.feedbox .said { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; line-clamp: 4; overflow: hidden; }
.feedbox .said q { font-style: italic; }
.corner.titles h3 { margin: 0 0 .1em; font-size: 1em; }
.corner.titles ul { list-style: none; margin: 0; padding: 0; }
/* Each title: its name on one line, everyone's count and what it takes under it. */
.corner.titles li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .1em .3em; margin: .15em 0; }
.corner.titles li > b { grid-column: 2 / 4; }
.corner.titles .tvals { grid-column: 1 / 3; }
/* The great beasts' race: one line each, what it's weak to until someone slays it. */
.corner.titles li.beast { display: flex; gap: .3em; }
.corner.titles li.beast > b { flex: 1; grid-column: auto; }
.corner.titles li.beast .weak { display: inline-flex; align-items: center; gap: .1em; font-weight: 700; }
.corner.titles li.beast.slain > b { text-decoration: line-through; color: var(--muted); }
q { quotes: "“" "”"; }
q::before { content: open-quote; }
q::after { content: close-quote; }

/* TV overlays */
/* Nothing on the TV cuts: an overlay fades in over the board and out again,
   and a new screen in it (the next scene, the raid's next step) rises in while
   the last one fades away above it (tv.ts, .overlay-ghost). The raid's mottled
   table is a layer that fades in and out under the boxes. */
.overlay { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; background: #140f2ae8; transition: opacity .4s ease-in, background-color .4s; }
.overlay::before { content: ''; position: fixed; inset: 0; z-index: -1; background: var(--table-mottle), radial-gradient(ellipse at 50% 40%, #2b2452f8, #140f2afa 75%); opacity: 0; transition: opacity .4s; pointer-events: none; }
.overlay.raid::before { opacity: 1; }
.overlay.banner { background-color: #140f2ad0; }
.overlay.in { animation: fadein .4s ease-out; }
.overlay.out { opacity: 0; pointer-events: none; }
.overlay > .enter { animation: enter .4s ease-out; }
.overlay-ghost { position: fixed; z-index: 21; margin: 0 !important; pointer-events: none; animation: leave .4s ease-in forwards; }
@keyframes fadein { from { opacity: 0; } }
@keyframes enter { from { opacity: 0; translate: 0 1.5rem; } }
@keyframes leave { to { opacity: 0; translate: 0 -1.5rem; } }
/* the TV's big moments: a large sheet laid on the table, its top-right corner folded down */
.production, .result, .endbox { position: relative; background: var(--sheet); border-radius: 2px; padding: 1.2em 2.5em; min-width: 40em; text-align: center; box-shadow: 0 .18em 0 var(--paper-edge), 0 1.2em 2.4em #05030fcc;
  clip-path: polygon(0 0, calc(100% - 2.2em) 0, 100% 2.2em, 100% 100%, 0 100%); }
.production::before, .result::before, .endbox::before { content: ''; position: absolute; z-index: 2; top: 0; right: 0; width: 2.2em; height: 2.2em; background: linear-gradient(225deg, transparent 50%, var(--paper-edge) 50%, #e1d2b2 75%); box-shadow: -.1em .1em .25em #0004; }
.production h1, .result h1, .endbox h1 { margin: .2em 0 .6em; font-size: 2.3em; }
.production { max-width: 92vw; }
.production h2 { margin: -.5em 0 .3em; font-size: 1.5em; color: var(--muted); font-family: var(--serif); }
.production ul { list-style: none; padding: 0; margin: 0; text-align: left; }
/* One player at a time, then everyone's totals: all in one place on the sheet
   (one grid cell), so the sheet is its final size from the start. */
.production .pstage { display: grid; font-size: 2.2em; }
.production .pstage > * { grid-area: 1 / 1; opacity: 0; translate: -1em 0; transition: opacity .35s ease-out, translate .35s ease-out; }
.production .pstage > .on { opacity: 1; translate: none; }
.production .pturn { padding: .2em .6em .4em; border-radius: 12px; border-left: .3em solid var(--pc); background: color-mix(in srgb, var(--pc) 20%, transparent); }
.production .who { font-size: 1.15em; margin-bottom: .15em; }
/* A resource's row: its icon, the fixed amount, its dice, then the total once they land. */
/* a card is never wider than the sheet (#333) */
.production .pstage > * { min-width: 0; }
.production .prow { display: flex; align-items: center; gap: .5em; min-height: 2.6em; opacity: 0; translate: -.8em 0; transition: opacity .3s ease-out, translate .3s ease-out; }
.production .prow > svg, .production .eq { flex: none; }
.production .prow.up { opacity: 1; translate: none; }
.production .parts { display: inline-flex; align-items: center; gap: .1em; }
.production .dice { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .3em; }
.production .parts i, .production .eq > i { font-style: normal; color: var(--muted); margin: 0 .2em; }
.production .base { min-width: 1em; text-align: center; }
.production .eq { opacity: 0; transition: opacity .25s ease-out; }
.production .prow.landed .eq { opacity: 1; }
.production .chip.minus { color: var(--bad); }
.production .parts .eat { display: inline-flex; align-items: center; gap: .1em; color: var(--bad); }
.production .ptotal { margin-top: .3em; padding-top: .3em; border-top: 2px solid color-mix(in srgb, var(--pc) 45%, transparent); opacity: 0; transition: opacity .3s ease-out; }
.production .ptotal.up { opacity: 1; }
/* the round's total over all resources (#471), after the chips */
.production .pall { display: inline-flex; align-items: center; margin-left: .3em; font-weight: 800; }
.production .psum .pall { margin-left: auto; padding-left: .6em; }
.production .pall > i { font-style: normal; color: var(--muted); margin-right: .3em; font-weight: 400; }
.production .psum { align-self: center; }
.production .psum li { display: flex; align-items: center; gap: .6em; margin: .3em 0; padding: .1em .4em; border-radius: 12px; border-left: .3em solid var(--pc); background: color-mix(in srgb, var(--pc) 20%, transparent); }
.production .psum li > .ptag { min-width: 4.5em; }
/* Production's dragon step (#442): every player's changing dragons at once,
   each as its panel row; the changes play in place. */
.tending .tend { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, auto)); justify-content: center; align-items: start; gap: .5em .8em; font-size: var(--tsize); }
.tending .tplayer { padding: .2em .6em .4em; border-radius: 12px; border-left: .3em solid var(--pc); background: color-mix(in srgb, var(--pc) 20%, transparent); }
.tending .who { font-size: 1em; margin-bottom: .1em; }
.tending .trow { display: flex; align-items: center; gap: .35em; margin: .2em 0; line-height: 1.15; }
.tending .tbadge svg { width: 1.9em; height: 1.9em; display: block; }
.tending .trow > div { display: flex; flex-direction: column; min-width: 0; }
.tending .tname { display: flex; align-items: baseline; gap: .4em; white-space: nowrap; }
.tending .tline { display: flex; align-items: center; gap: .35em; color: var(--muted); white-space: nowrap; }
.tending .tstate:empty { display: none; }
.tending .hpbar { width: 3.5em; height: .5em; }
.tending .grow i { font-style: normal; }
.tending .grow i.new { color: var(--good); animation: tend-pop .5s ease-out both; }
.tending .trow.staged .tbadge, .tending .trow.staged .tstage, .tending .trow.staged .power { animation: tend-pop .6s ease-out both; }
.tending .trow.staged .tstage { color: var(--good); font-weight: 800; }
.tending .trow .st-hungry { font-size: .85em; opacity: 0; scale: 1.8; transition: opacity .25s ease-out, scale .3s cubic-bezier(.3, 1.6, .6, 1); display: inline-block; }
.tending .trow.stamped .st-hungry { opacity: 1; scale: 1; }
.tending .trow.hungry.stamped .tlook, .tending .trow.hungry.stamped .tbadge { opacity: .55; transition: opacity .4s; }
@keyframes tend-pop { 0% { scale: 1; } 40% { scale: 1.35; } 100% { scale: 1; } }
.endbox { padding: 0 0 1.2em; overflow: hidden; min-width: 44em; }
.endbox svg.scene { display: block; width: 100%; height: 13em; }
.endbox h1 { margin: .4em 0 .1em; font-size: 2.8em; }
.endbox .tiebreak { margin: 0 0 .3em; color: var(--muted); font-size: 1.2em; }
.endbox .standings { font-size: 1.5em; margin: .5em 2em; }
.endbox :is(button, a.button) { font-size: 1.4em; margin-top: .6em; }
.endbox .endactions { display: flex; gap: .8em; justify-content: center; }
/* With the recap's QR code beside the standings, for anyone to scan on the way out. */
.endbox .endbody { display: flex; align-items: center; justify-content: center; gap: 1.5em; margin: 0 2em; }
.endbox .endbody .standings { flex: 1; margin: .5em 0; }
.endbox .recapqr { flex: none; width: 15em; text-align: center; color: var(--ink-soft); }
.endbox .recapqr .qr { display: block; width: 11em; height: 11em; margin: 0 auto .4em; border-radius: 3px; box-shadow: 0 0 0 2px #2a1d3322; }
.endbox .recapqr .step { font-weight: 700; font-size: 1.1em; color: var(--ink); }
.endbox .recapqr .url { font-size: .95em; overflow-wrap: anywhere; }

/* ---------- the recap: the TV's summary at the end, and the recap page ---------- */
.summary { position: relative; background: var(--sheet); border-radius: 2px; width: min(92vw, 100em); padding: .8em 2.5em 1.2em; box-shadow: 0 .18em 0 var(--paper-edge), 0 1.2em 2.4em #05030fcc; text-align: center;
  clip-path: polygon(0 0, calc(100% - 2.2em) 0, 100% 2.2em, 100% 100%, 0 100%); }
.summary h1 { margin: .2em 0 .4em; font-size: 2.6em; }
.summary > button { position: absolute; right: 1.6em; bottom: 1.2em; font-size: 1.1em; }
.summary .sumbody { display: grid; grid-template-columns: 1fr 30em; gap: 2em; align-items: start; text-align: left; min-height: 34em; }
.summary .chart svg { display: block; width: 100%; height: auto; }
.summary .told { font-size: 1.4em; }
.summary.points-step { width: min(80vw, 70em); padding-bottom: 4em; }
.summary.growth-step { padding-bottom: 4em; }
.summary .growth { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5em; }
.summary .growth figure { margin: 0; }
.summary .growth figcaption { font-family: var(--serif); font-weight: 700; font-size: 1.6em; margin-bottom: .2em; }
.summary .growth svg { display: block; width: 100%; height: auto; }
.summary.points-step .breakdown { font-size: 1.6em; }

.race { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.race .grid { stroke: #6b553026; stroke-width: 1.5; }
.race .axis { fill: var(--ink-soft); font-size: 20px; }
.race .axis.label { font-size: 18px; }
.race .goal { stroke: #a8801c; stroke-width: 2.5; stroke-dasharray: 10 8; }
.race .goal-label { fill: #8a6610; font-weight: 700; }
.race .run { fill: none; stroke: var(--pc); stroke-width: 5; stroke-linejoin: round; stroke-linecap: round; }
.race .run.grow { stroke-dasharray: 1; animation: race-draw .5s ease-out both; }
@keyframes race-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
.race .end { fill: var(--pc); stroke: var(--paper-hi); stroke-width: 2.5; }
.race .mark { fill: var(--paper-hi); stroke: var(--pc); stroke-width: 4; }
.race .mark.beast, .race .mark.fall { fill: var(--pc); stroke: var(--paper-hi); stroke-width: 3; }
.race .mark.new { animation: race-mark .5s ease-out both; transform-box: fill-box; transform-origin: center; }
@keyframes race-mark { from { transform: scale(2.4); opacity: 0; } }
.race .who { fill: var(--pc); font-size: 22px; font-weight: 800; }
.race .who .pts { fill: var(--ink); font-weight: 700; }

.moments { list-style: none; padding: 0; margin: 0; }
.moments > li { margin: 0 0 .7em; }
.moments .rnd { display: block; font-family: var(--serif); font-weight: 700; color: var(--ink-soft); font-size: .85em; }
.moments ul { list-style: none; padding: 0; margin: .1em 0 0; }
.moments ul li { margin: .15em 0; line-height: 1.3; }
.moments .gain { white-space: nowrap; font-weight: 700; }
.summary .moments > li { opacity: .55; transition: opacity .4s; }
.summary .moments > li.now { opacity: 1; animation: enter .4s ease-out; }
.summary .moments > li.now .rnd { color: var(--ink); }

.breakdown { list-style: none; padding: 0; margin: .3em 0; text-align: left; }
.breakdown li { display: grid; grid-template-columns: 6.5em 1fr 3.6em; align-items: center; gap: .6em; margin: .35em 0; }
.breakdown .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 800; }
.breakdown .bar { display: block; }
.breakdown .fill { display: flex; height: 1.5em; border-radius: 3px; overflow: hidden; animation: grow-bar .9s ease-out both; transform-origin: left; }
.breakdown li:nth-child(2) .fill { animation-delay: .15s; } .breakdown li:nth-child(3) .fill { animation-delay: .3s; }
.breakdown li:nth-child(4) .fill { animation-delay: .45s; } .breakdown li:nth-child(5) .fill { animation-delay: .6s; } .breakdown li:nth-child(6) .fill { animation-delay: .75s; }
@keyframes grow-bar { from { transform: scaleX(0); } }
.breakdown .part { flex-basis: 0; display: flex; align-items: center; justify-content: center; min-width: 1.4em; font-size: .7em; font-weight: 800; color: #fff; box-shadow: inset -2px 0 0 #fff6; }
.breakdown .total { text-align: right; white-space: nowrap; }
.part.buildings { background: #7a5c3e; } .part.monuments { background: #4f7d80; } .part.titles { background: #c4951c; } .part.beasts { background: #6a4bb0; } .part.kingdoms { background: #b0443a; } .part.hand { background: #8a8296; }
.partkey { display: flex; flex-wrap: wrap; gap: .4em 1.2em; justify-content: center; color: var(--ink-soft); font-size: 1.1em; }
.partkey i { display: inline-block; width: .9em; height: .9em; border-radius: 2px; margin-right: .35em; vertical-align: -.1em; }

/* the recap page: one sheet, for a phone first */
html:has(body.recap-page), body.recap-page { height: auto; min-height: 100%; }
body.recap-page { font-size: 16px; }
.recap-page main { max-width: 46em; margin: 0 auto; padding: 1em .8em 2em; }
.recap-page .sheet { background: var(--sheet); box-shadow: var(--lift); border-radius: 2px; overflow: hidden; padding-bottom: 1em; }
.recap-page .sheet svg.scene { display: block; width: 100%; height: 9em; }
.recap-page header { text-align: center; padding: 0 1em; }
.recap-page h1 { margin: .4em 0 .1em; font-size: 2em; }
.recap-page .when { color: var(--ink-soft); margin: 0; }
.recap-page section { padding: 0 1em; }
.recap-page h2 { font-size: 1.3em; margin: 1.1em 0 .4em; padding-top: .6em; border-top: 1px solid #6b553030; }
.recap-page .race { width: 100%; height: auto; display: block; }
.recap-page h3 { font-family: var(--serif); font-size: 1.05em; color: var(--ink-soft); margin: .8em 0 .1em; }
.recap-page .breakdown li { grid-template-columns: 5.5em 1fr 3.2em; }
.recap-page .partkey { font-size: .9em; }
.recap-page .missing { text-align: center; padding: 3em 1em; }
/* the final standings, TV and phone */
.standings { list-style: none; padding: 0; text-align: left; }
.standings li { display: grid; grid-template-columns: 2.6em 1fr auto 3.2em; align-items: center; gap: .5em; padding: .2em .5em; border-radius: 8px; }
.standings li.won { background: var(--grain), linear-gradient(175deg, #ffe18a 0 50%, #f3c64a 50%); font-size: 1.15em; box-shadow: 0 .1em 0 #a8801c; }
.standings li.you { outline: 2px solid var(--line); }
.standings .place { color: var(--muted); font-weight: 700; }
.standings li.won .place { color: var(--ink); }
.standings li.won .ptag { color: color-mix(in oklab, var(--pc) 45%, #1a1218); }
.standings .total { justify-self: end; display: inline-flex; align-items: center; gap: .15em; }
.standings .tie { font-size: .65em; font-weight: 700; color: var(--text); border: 1px solid currentColor; border-radius: 4px; padding: 0 .3em; vertical-align: middle; }
.raidbox { width: 94vw; max-height: 96vh; overflow: hidden; text-align: center; }
.raidbox h1 { font-size: 2.6em; margin: .2em 0; color: var(--hit); }
.raidbox h1 small { font-size: .5em; }
.raidbox .sub { color: var(--muted); font-size: 1.2em; margin: 0 0 .8em; }
.candidates { display: flex; flex-wrap: wrap; gap: 1em; justify-content: center; align-items: stretch; }
.target { background: var(--sheet); box-shadow: var(--lift); border-radius: 2px; padding: .8em 1.2em; text-align: left; min-width: 24em; position: relative; }
.target h2 { margin: 0 0 .4em; font-size: 1.6em; }
.target .num { position: absolute; top: -.5em; left: -.5em; width: 1.8em; height: 1.8em; border-radius: 50%; background: var(--accent); color: #111; font-weight: 900; font-size: 1.4em; display: flex; align-items: center; justify-content: center; }
.voters { display: flex; flex-wrap: wrap; gap: .3em; margin-top: .5em; }
.voter { display: inline-flex; align-items: baseline; gap: .1em; white-space: nowrap; }
.voters .voter { margin-right: .4em; }
.vote-power { display: flex; flex-wrap: wrap; gap: .3em 1.1em; margin: .1em 0 .5em; font-size: 1.1em; color: var(--paper); }
.vote-power .voter .ptag { font-weight: 800; }
.voters .ptag { background: var(--pc); color: #111 !important; font-weight: 800; padding: .1em .55em; border-radius: 1em; }
.target .voters { font-size: 1.5em; }
.candidates.vote { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 21em)); gap: 1.6em 2em; }
.cand { display: flex; flex-direction: column; align-items: flex-start; gap: .5em; min-width: 0; padding: .9em 1.3em 1em; }
.cand h2 { margin: 0; font-size: 1.9em; line-height: 1.1; }
.cand-fight { display: flex; align-items: center; gap: .3em 1.2em; flex-wrap: wrap; }
.pshield { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 1em; height: 1em; flex: none; }
.pshield svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.pshield b { position: relative; font-size: .36em; font-weight: 900; color: #fff; margin-top: -.15em; text-shadow: 0 .05em .1em #0006; }
.cand.lead, .choice.lead { outline: .25em solid var(--accent); outline-offset: .2em; }
.foeicons { display: flex; flex-wrap: wrap; gap: .2em .9em; align-items: center; }
.foeicon { display: inline-flex; align-items: center; gap: .15em; }
.foeicon b { font-size: 1.5em; font-weight: 900; }
.cand .loot { font-size: 1.4em; margin-top: 0; gap: .1em .2em; }
.cand .loot .chip { margin-right: .5em; }
.cand .loot .loot-label { margin-right: .4em; }
.cand .voters { margin-top: auto; padding-top: .3em; }
.weak { color: var(--good); }
.loot { margin-top: .5em; font-size: 1.2em; display: flex; flex-wrap: wrap; align-items: center; gap: .1em .3em; }
.loot-label { font-size: .75em; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-right: .2em; }
.loot.worth { margin-top: .2em; }
.loot.worth small { font-size: .65em; color: var(--muted); }
.loot.worth .leads { font-size: .7em; display: inline-flex; align-items: center; gap: .25em; }
.elem { color: color-mix(in oklab, var(--ec) 50%, var(--text)); }
.status { margin-top: 1em; font-size: 1.4em; display: flex; gap: 1em; justify-content: center; align-items: center; flex-wrap: wrap; }
/* A kingdom's defenders: a picture per kind, how many, health, attack, and what it is weak to */
.foes { display: flex; flex-direction: column; gap: .35em; }
.foe { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: .6em; }
.foe-pic { display: inline-flex; align-items: center; }
.foe-body { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.foe-name { font-weight: 800; }
.foe-stats { display: flex; flex-wrap: wrap; gap: 0 .8em; }
.foe-stats .stat { margin: 0; font-weight: 400; }
.foe-stats .stat b, .stat.power b { font-weight: 800; }
.foe-elem { font-size: .9em; font-weight: 600; }
.target .foes { font-size: 1.2em; }
.target .loot { font-size: 1.5em; }
.moreraids { display: inline-block; vertical-align: middle; font-size: .55em; margin-left: .6em; padding: .1em .6em; border-radius: .3em; background: var(--gold, #f2b600); color: #1a1218; font-weight: 800; }
.raidbox h1 .tag { font-size: .45em; vertical-align: middle; font-weight: 600; opacity: .8; border: 1px solid currentColor; border-radius: .3em; padding: .05em .4em; margin-left: .4em; }
/* The raid's arena: raiders left, defenders right */
.arena { display: flex; gap: 2em; justify-content: center; align-items: center; }
.arena .vs { opacity: .6; }
.raiders { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .5em; font-size: 1.4em; min-width: 14em; }
.raider { --text: var(--ink); --muted: var(--ink-soft); color: var(--text); display: flex; align-items: center; gap: .6em; background: var(--sheet); box-shadow: var(--lift); padding: .3em .8em; border-radius: 2px; border-left: 5px solid var(--pc); min-height: 3.3em; }
.raider > .ptag { min-width: 3.5em; text-align: left; }
.raider .rds { flex: 1; display: flex; gap: .4em; align-items: center; }
.unit-art { filter: drop-shadow(0 1px 1px #0008); }
/* Fight or hold back (tv.ts renderRaid): the raiders' rows line up in columns
   (name, dragons, power, choice); a raider who has chosen shows a card face
   down in their colour, one still choosing an empty dashed place for it. */
.arena.deciding .raiders { display: grid; grid-template-columns: repeat(4, max-content); justify-content: start; gap: .5em 0; min-width: 0; }
.arena.deciding .raider { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; column-gap: 1em; padding: .35em .9em .35em 1em; transition: transform .3s, box-shadow .3s; }
.arena.deciding .raider .rds { justify-content: flex-start; }
.arena.deciding .raider .power { font-size: 1.05em; white-space: nowrap; }
/* A raider's dragons in brief: a count and a picture per element, then their health added up. */
.rsum { display: grid; grid-template-columns: repeat(5, max-content); justify-content: start; align-items: center; gap: .1em .7em; }
.rgroup { display: inline-flex; align-items: center; gap: .15em; font-size: 1.1em; }
.rgroup b { font-weight: 800; }
.rgroup svg { width: 1.7em; height: 1.7em; filter: drop-shadow(0 0 .2em color-mix(in oklab, var(--pc) 60%, transparent)); }
.rhp { grid-column: 1 / -1; display: flex; align-items: center; gap: .5em; font-size: .75em; }
.rhp .stat { margin: 0; }
.rhp .hpbar { flex: 1; max-width: 12em; min-width: 5em; height: .45em; }
.choice { display: inline-flex; flex-direction: column; align-items: center; gap: .25em; font-size: .55em; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); min-width: 6em; }
.choice i { display: block; width: 3em; height: 4.2em; border-radius: .3em; border: .18em dashed color-mix(in oklab, var(--ink) 35%, transparent); animation: choosing 1.6s ease-in-out infinite; }
.choice.done { color: color-mix(in oklab, var(--pc) 72%, #1a1218); }
.choice.done i { border: .2em solid #f7f0de; animation: none; transform: rotate(-6deg);
  background: repeating-linear-gradient(45deg, #fff2 0 .25em, transparent .25em .5em), var(--pc);
  box-shadow: 0 0 0 .08em #0004, .12em .18em .25em #0006; }
@keyframes choosing { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .choice i { animation: none; } }
/* The two sides' power, end to end: the raiders' shares in their colours
   against the kingdom's; a notch marks the middle, past which the raiders
   usually win. */
.balance { display: grid; grid-template-columns: auto minmax(10em, 1fr) auto; align-items: center; gap: 1em; width: min(100%, 60em); margin: .2em auto 1.1em; font-size: 1.3em; color: #f7f0de; }
.balance .bside { display: flex; flex-direction: column; align-items: flex-end; gap: .1em; }
.balance .bside.foe { align-items: flex-start; }
.balance .bside small { font-size: .6em; color: #cfc6dd; white-space: nowrap; }
.balance .power { font-size: 1.2em; white-space: nowrap; }
.bbar { position: relative; display: flex; height: 1.1em; border-radius: .55em; overflow: hidden; background: #0005; box-shadow: inset 0 0 0 .1em #f7f0de55, 0 .1em .4em #0007; }
.bbar i { display: block; min-width: .3em; background: var(--pc); border-right: .08em solid #1a121866; }
.bbar i.foe { background: repeating-linear-gradient(-45deg, #0002 0 .3em, transparent .3em .6em), #8c2a20; border: 0; }
.bbar .mid { position: absolute; left: 50%; top: -.1em; bottom: -.1em; width: .18em; margin-left: -.09em; background: #f7f0de; box-shadow: 0 0 .2em #000a; }
/* A fight, on its own stage (#326, tv.ts battle): the TV cuts from the map to
   the place's backdrop, full screen; the dragons stand on the left facing the
   defenders on the right, each a paper figure at its size (--s, the square
   root of its full health, times --k). --k is as big as lets the more crowded
   side fit across (--sl, --sr: the sums of their sizes) and the biggest
   figure (--mx) fit up. */
.fightscene { position: fixed; inset: 0; overflow: hidden; color: var(--text); }
.overlay > .fightscene.enter { animation: fadein .4s ease-out; }
.fightscene .backdrop { position: absolute; inset: 0; width: 100%; height: 100%; }
/* The folded diorama (board3d.ts stageArt): cropped to the screen, its ground kept. */
.fightscene img.backdrop { object-fit: cover; object-position: 50% 100%; }
.fhead { position: absolute; top: 2.2vh; left: 0; right: 0; display: flex; justify-content: center; align-items: center; gap: 1.2em; }
.fhead h2 { margin: 0; max-width: calc(94vw - 6em); font-family: var(--serif); font-size: 2.4em; display: flex; flex-wrap: wrap; justify-content: center; gap: 0 .4em; align-items: center; background: var(--sheet); color: var(--ink); padding: .2em .9em; border-radius: 2px; box-shadow: var(--lift); }
.fhead h2 .ptag { white-space: nowrap; }
.fhead .bvs { background: var(--sheet); color: var(--ink-soft); border-radius: 2px; box-shadow: var(--lift); padding: .15em .7em .3em; min-width: 3.5em; }
.bvs { display: flex; flex-direction: column; align-items: center; }
.bvs small { font-size: .9em; text-transform: uppercase; letter-spacing: .1em; }
.bvs b { font-size: 2.2em; line-height: 1; color: var(--ink); min-height: 1em; }
.bvs.bfirst b { font-size: 1.3em; line-height: 1.4; font-family: var(--serif); white-space: nowrap; } /* who won the coin flip, a word not a number */
/* The coin flip before the hits (#439, tv.ts coinFlip), timed to fit the
   fight's lead (scenes.ts FIGHT_LEAD_MS, 2.4 s): tossed at .3 s, it spins up
   and down for 1 s and lands on the winner's face (the dragon, or the
   defenders' turned a half turn more), who strikes first shows under it, and
   at 2 s it shrinks away up toward the header, whose "Strikes first" glows
   as it goes and keeps it for the fight. */
.coinflip { position: absolute; left: 50%; top: 24vh; translate: -50% -50%; z-index: 6; display: flex; flex-direction: column; align-items: center; gap: .5em; pointer-events: none; perspective: 40em; }
.coinflip.go { animation: coinin .2s .3s both, coinaway .4s 2s ease-in forwards; }
/* At rest it's landed and read (as a still, with animations off, shows it); the animations lead up to that. */
.coin { position: relative; width: 7em; height: 7em; transform-style: preserve-3d; --land: 1800deg; transform: rotateY(var(--land)); }
.coinflip.them .coin { --land: 1980deg; }
.coinflip.go .coin { animation: coinspin 1s .3s cubic-bezier(.2, .6, .35, 1) both, cointoss 1s .3s both; }
.cface { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 50%; backface-visibility: hidden;
  background: radial-gradient(circle at 35% 30%, #fff3b8, #f5c542 45%, #c79314); box-shadow: inset 0 0 0 .35em #c79314, inset 0 0 0 .5em #fff0bd, 0 .3em .8em #0008; }
.cface .ricon { width: 4.2em !important; height: 4.2em !important; filter: drop-shadow(0 .05em 0 #7a5a0a); }
.cface.tails { transform: rotateY(180deg); }
.coinflip > b { font-family: var(--serif); font-size: 2em; max-width: 86vw; text-align: center; text-wrap: balance; background: var(--sheet); color: var(--ink); padding: .1em .8em; border-radius: 2px; box-shadow: var(--lift); }
.coinflip.go > b { animation: coinin .3s 1.3s both; }
.fightscene:has(.coinflip.go) .bfirst b { animation: firstglow .45s 1.95s ease-out both; }
@keyframes coinspin { from { transform: rotateY(0); } to { transform: rotateY(var(--land)); } }
@keyframes cointoss { 0%, 100% { translate: 0 0; scale: 1; } 45% { translate: 0 -6vh; scale: 1.2; } }
@keyframes coinin { from { opacity: 0; } }
@keyframes coinaway { to { opacity: 0; translate: -50% -50%; top: 4vh; scale: .25; } }
@keyframes firstglow { 0% { color: var(--ink); } 40% { color: #b8860b; text-shadow: 0 0 .4em #f5c542; } 100% { color: var(--ink); } }
@media (prefers-reduced-motion: reduce) { .coinflip.go .coin { animation: none; } }
.battle { position: absolute; left: 3vw; right: 3vw; bottom: 9vh; top: 30vh; display: grid; grid-template-columns: 1fr 1fr; gap: 6vw; align-items: end;
  --k: clamp(.45em, min(calc(34vw / var(--sl)), calc(34vw / var(--sr)), calc(46vh / var(--mx))), 3em); }
/* wrap-reverse: a second row stands behind the first, and flex-start is the ground. */
.bside { display: flex; flex-wrap: wrap-reverse; align-items: flex-start; align-content: flex-start; gap: 3.2em .8em; }
.bside.bl { justify-content: flex-end; }
.bside.br { justify-content: flex-start; }
.fig { position: relative; display: flex; flex-direction: column; align-items: center; width: calc(var(--s) * var(--k)); min-width: 0; flex: none; }
.fig .hpbar { width: max(3em, 70%); height: .7em; margin-bottom: .35em; box-shadow: 0 0 0 2px #f7f0de, 0 .15em .3em #0006; transition: opacity .4s; }
.fig-body { position: relative; display: block; width: 100%; transition: transform .5s cubic-bezier(.5, 0, .7, 1), filter .5s, opacity .5s; transform-origin: 15% 100%; }
.fig-body::after { content: ''; position: absolute; z-index: -1; left: 8%; right: 8%; bottom: -.35em; height: .9em; border-radius: 50%; background: radial-gradient(closest-side, color-mix(in oklab, var(--pc, #1a1220) 70%, #000) , transparent); opacity: .75; }
.fig-art { display: block; width: 100%; height: auto; filter: drop-shadow(.12em .2em .1em #0007); }
.fig-u .fig-body { transform-origin: 85% 100%; }
/* A rival's dragon perched on the hex faces the raiders. */
.fig-u.fig-d .fig-art:not(.fig-3d) { transform: scaleX(-1); }
.fig-name { margin-top: .5em; font-size: clamp(.75em, calc(var(--s) * var(--k) * .17), 1.25em); line-height: 1.1; text-align: center; background: var(--sheet); color: color-mix(in oklab, var(--pc, var(--ink)) 72%, #1a1218); padding: .1em .45em; border-radius: 2px; box-shadow: 0 .1em 0 var(--paper-edge), 0 .2em .4em #0005; max-width: max(100%, 7em); }
.fig-u:not(.fig-d) .fig-name { color: var(--ink); }
/* The attacker lunges at what it hits, and what's hit flinches. */
.fig.strike .fig-body { animation: lunge .3s ease-out; }
.fig-u.strike .fig-body { animation-name: lunge-l; }
@keyframes lunge { 40% { translate: 18% -3%; } }
@keyframes lunge-l { 40% { translate: -18% -3%; } }
.fig.hit .fig-art { animation: flinch .25s; }
@keyframes flinch { 30% { filter: brightness(2.2) drop-shadow(0 0 .3em #fff); } }
/* Knocked out: it falls over backwards, and greys. */
.fig.down .fig-body { transform: translateY(8%) rotate(-82deg); filter: grayscale(.9) brightness(.85); opacity: .7; }
.fig-u.down .fig-body { transform: translateY(8%) rotate(82deg); }
.fig.down .hpbar { opacity: 0; }
.fig.down .fig-name { opacity: .55; }
/* The bolt from attacker to target, in the attacker's colour. */
.beam { position: absolute; z-index: 3; height: .55em; margin-top: -.27em; transform-origin: 0 50%; background: linear-gradient(90deg, transparent, var(--bc) 30%, #fff 85%, var(--bc)); border-radius: 99px; pointer-events: none; box-shadow: 0 0 .8em .15em var(--bc); animation: beamin .14s ease-out; transition: opacity .25s; }
.beam.gone { opacity: 0; }
@keyframes beamin { from { scale: 0 1; opacity: .4; } }
/* The damage, over the figure; a hit whose element beats its target's
   bursts behind its number in the attacker's colour. */
.fig .dmg { position: absolute; z-index: 4; top: 18%; left: 50%; translate: -50% 0; display: grid; place-items: center; pointer-events: none; animation: dmg 1.2s forwards;
  transform: translateY(calc(var(--slot, 0) * -1.1em)) scale(calc(1 - var(--slot, 0) * .3)); transform-origin: 50% 100%; transition: transform .15s ease-out; }
.fig .dmg b { grid-area: 1 / 1; font-size: 2em; font-weight: 900; color: var(--hit); line-height: 1; -webkit-text-stroke: .1em #f7f0de; paint-order: stroke fill; text-shadow: 0 .08em .15em #0008; }
.fig .dmg.beats b { font-size: 2.6em; color: #fff; -webkit-text-stroke: .1em #1a1020; }
.fig .dmg .burst-art { grid-area: 1 / 1; width: 6.5em; height: 6.5em; filter: drop-shadow(0 0 .5em var(--bc)); animation: burst .5s ease-out; }
@keyframes burst { from { scale: .2; rotate: -40deg; } }
.fig .dmg.gone { animation: dmg 1.2s forwards, out .45s forwards; }
@keyframes out { to { opacity: 0; } }
@keyframes dmg { from { scale: 1.5; } 15% { scale: 1; } 60% { translate: -50% 0; opacity: 1; } to { translate: -50% -.8em; opacity: 0; } }
/* The outcome, on a sheet under the heading. */
.fightscene .outcome { position: absolute; left: 50%; top: 11vh; translate: -50% 0; box-sizing: border-box; width: max-content; min-width: 34em; max-width: 92vw; background: var(--sheet); color: var(--ink); text-align: center; padding: .3em 2.2em .9em; border-radius: 2px; box-shadow: var(--lift); opacity: 0; transition: opacity .4s; z-index: 5; }
.fightscene .outcome:empty { display: none; }
.outcome.show { opacity: 1; }
.outcome h1 { margin: .3em 0 .2em; font-family: var(--serif); font-size: 2.3em; }
/* Each winner's name and loot stay whole; a long row wraps inside the sheet.
   Past three winners, each stands its name over its loot, smaller, so six fit across. */
.spoils { display: flex; flex-wrap: wrap; gap: .3em 2em; justify-content: center; font-size: 1.6em; }
.spoils > span { display: inline-flex; align-items: center; gap: .3em; white-space: nowrap; }
.spoils .gains { display: inline-flex; align-items: center; }
.spoils.many { font-size: 1.25em; gap: .5em 1em; }
.spoils.many .chip { margin: 0 .15em; }
.spoils.many > span { flex-direction: column; gap: 0; }
/* The freed peak's rule, popping up on its gold token after the points. */
.outcome .boon { display: flex; align-items: center; justify-content: center; gap: .6em; max-width: 30em; margin: .55em auto 0; padding-top: .5em; border-top: 1px solid var(--paper-edge); font-size: 1.35em; text-align: left; }
.outcome.show .boon { animation: boon .5s .9s cubic-bezier(.3, 1.6, .5, 1) both; }
.ptoken { flex: none; display: inline-grid; place-items: center; width: 2.1em; height: 2.1em; border-radius: 50%; background: #e7b43f; color: #3a2710; font-family: var(--serif); font-weight: 700; font-size: 1.15em; box-shadow: 0 2px 0 #b88a2a, var(--lift); }
@keyframes boon { from { opacity: 0; scale: .6; } to { opacity: 1; scale: 1; } }
/* The scoring beat: the crown comes down on the most power standing, on
   their dragons and their name, then the points. */
.outcome .score { display: flex; align-items: center; justify-content: center; gap: .5em; margin-top: .5em; padding-top: .45em; border-top: 1px solid var(--paper-edge); font-size: 1.6em; opacity: 0; transition: opacity .4s; }
.outcome .score .crown { width: 1.6em; height: 1.2em; }
.outcome .score .pts { display: inline-flex; align-items: center; gap: .15em; font-size: 1.5em; opacity: 0; scale: 1.8; transition: opacity .3s, scale .45s cubic-bezier(.3, 1.6, .5, 1); }
.crowned .outcome .score { opacity: 1; }
.scored .outcome .score .pts { opacity: 1; scale: 1; }
.fig-crown { position: absolute; z-index: 2; left: 50%; top: 0; width: 50%; max-width: 4em; min-width: 2.2em; translate: -50% -180%; opacity: 0; transition: opacity .3s, translate .6s cubic-bezier(.3, 1.4, .5, 1); pointer-events: none; }
.fig-crown .crown { display: block; width: 100%; height: auto; filter: drop-shadow(0 0 .5em #f5c542); }
.fig.king .fig-crown { opacity: 1; translate: -50% -110%; }
.fig.king .fig-art { filter: drop-shadow(0 0 .6em color-mix(in oklab, var(--pc) 60%, #fff)); }
/* Whoever held back, in a corner: out of the fight, still in for the loot. */
.backrow { position: absolute; left: 1.5vw; bottom: 1.5vh; display: flex; flex-direction: column; gap: .3em; }
.heldback { display: flex; align-items: center; gap: .5em; padding: .2em .8em; font-size: 1.2em; background: var(--sheet); color: var(--ink); border-radius: 2px; box-shadow: var(--lift); }
.tag { display: inline-flex; vertical-align: middle; font-size: .6em; }

/* The log, drawn: a row of icons per thing that happened */
/* What people said is a sentence, and wraps rather than running off the edge. */
.evround { color: var(--muted); font-size: .8em; text-transform: uppercase; letter-spacing: .1em; border-top: 1px dashed var(--line); flex: 1; padding-top: .15em; }
.arrow { color: var(--muted); margin: 0 .1em; }
.no { color: var(--bad); font-weight: 800; }
.bchip { vertical-align: middle; flex: none; }
.floors { background: #fff; color: #111; border-radius: 99px; padding: 0 .4em; font-weight: 900; font-size: .85em; }
.evcard { background: #e4dcf5; color: var(--ink); border: 1px solid #7a5cc8; border-radius: 3px; padding: 0 .35em; font-size: .9em; }
.title-badge { display: inline-flex; align-items: center; gap: .2em; }

/* Titles: everyone's count, the holder's ringed */
.titles li { display: flex; align-items: center; gap: .4em; margin: .15em 0; white-space: nowrap; }
.titles li > b { flex: 1; }
.tvals { display: flex; gap: .25em; }
.tval { min-width: 1.6em; text-align: center; border-radius: 2px; font-weight: 800; background: color-mix(in srgb, var(--pc) 28%, var(--paper)); color: var(--text); border: 2px solid transparent; box-shadow: 0 .08em 0 var(--paper-edge); }
.tval.under { opacity: .5; }
.tval.held { border-color: var(--ink); background: var(--pc); color: #111; box-shadow: 0 .12em 0 color-mix(in srgb, var(--pc) 60%, #000); }
.tmin { color: var(--muted); min-width: 2em; text-align: right; }
.hiddenpts { display: inline-flex; align-items: center; gap: .1em; color: var(--muted); }

/* ================= phone ================= */
body.phone { font-size: 16px; max-width: 34em; margin: 0 auto; padding-bottom: 2em; }
/* The phone is tapped, not read for copying: a tap held a moment too long, or
   two quick taps, would select a word instead of pressing the button (a vote,
   most of all, which is a whole card of text). Nothing on it selects but what a
   player types into, and no double-tap zooms. */
body.phone { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
/* No pull-to-refresh, and no swipe back to the last page: a tap that drifts
   down at the top of a page that doesn't scroll reloaded it (#396), and a
   sideways swipe (through open cards) could leave the game. The page never
   needs either: it reconnects by itself. The viewport takes this from the
   root element, so it's set there. */
:root:has(> body.phone), body.phone { overscroll-behavior: none; }
body.phone :is(input, textarea, [contenteditable]) { user-select: text; -webkit-user-select: text; -webkit-touch-callout: default; }
/* phone: joining and the lobby, under a strip of the papercraft scene */
.phone .hero { position: relative; flex: none; height: 11em; overflow: hidden; }
.phone .hero svg.scene { width: 100%; height: 100%; display: block; }
.joinpage .hero .title { position: absolute; left: 50%; top: .5em; transform: translateX(-50%) rotate(-1.5deg); font-size: 2.3em; color: #2a1d33; background: var(--sheet); padding: .05em .6em .15em; white-space: nowrap;
  clip-path: polygon(0 8%, 4% 0, 96% 3%, 100% 14%, 98% 92%, 93% 100%, 3% 97%, 0 86%); filter: drop-shadow(0 .2em .3em #0008); }
.joinform { display: flex; flex-direction: column; gap: 1em; padding: 1.2em 1.2em 2em; }
.joinform .subtitle { text-align: center; font-size: 1.05em; }
.joinform label { display: flex; flex-direction: column; gap: .3em; font-weight: 700; }
.joinform label small { font-weight: 500; }
.joinform input { font-size: 1.4em; padding: .5em; color: var(--ink); }
#code { text-transform: uppercase; letter-spacing: .3em; font-weight: 800; }
/* The placeholder is a hint, not a code: plain, so it can't be read as one. */
#code::placeholder { text-transform: none; letter-spacing: normal; font-weight: 400; font-style: italic; }
.error { color: #ff8f8f; font-weight: 700; min-height: 1.2em; }
.plobby { padding: 0 0 1.5em; display: flex; flex-direction: column; gap: .8em; text-align: center; }
.plobby .lobbybody { padding: 0 1.2em; display: flex; flex-direction: column; gap: .8em; }
.plobby h1 { color: var(--pc); margin: .1em 0 0; }
.plobby p { margin: 0; }
.muted { color: var(--muted); }
.seatlist { list-style: none; padding: 0; margin: .4em 0; display: flex; flex-direction: column; gap: .4em; text-align: left; }
.seatlist li { display: flex; align-items: center; gap: .6em; padding: .35em .8em; background: var(--sheet); color: #2a1d33; font-weight: 800; font-size: 1.15em; border-radius: 2px; border-left: .4em solid var(--pc); box-shadow: var(--lift); }
.seatlist li.me { box-shadow: 0 0 0 2px var(--pc); }
.seatlist li.open { background: transparent; color: #f3ead7d0; font-weight: 600; box-shadow: none; outline: 2px dashed color-mix(in oklab, var(--pc) 70%, transparent); outline-offset: -2px; }
.seatlist li.open svg.token { opacity: .55; }
.seatlist .x { margin-left: auto; background: none; border: none; box-shadow: none; color: #6b5a6e; font-size: 1.3em; line-height: 1; padding: 0 .3em; width: auto; }
.seatlist .tag { font-size: .7em; font-weight: 700; color: #6b5a6e; border: 1px solid #b8a9a0; border-radius: 4px; padding: 0 .3em; }
/* your header: a sheet with your colour folded over its top, your resources on the strip below */
.mehead { position: sticky; top: 0; z-index: 5; background: var(--sheet); box-shadow: 0 .12em 0 var(--paper-edge), 0 4px 10px #0009; }
.me { display: flex; align-items: center; padding: .55em 1em .45em; border-top: .35em solid var(--pc); }
.me .pname { font-size: 1.3em; }
.me .pts { font-weight: 800; font-size: 1.3em; margin-left: auto; display: inline-flex; align-items: center; gap: .25em; }
.resbar { display: grid; grid-template-columns: repeat(5, 1fr); background: #0000000d; border-top: 1px dashed var(--paper-edge); padding: .4em .3em; text-align: center; }
.res { display: flex; align-items: center; justify-content: center; gap: .2em; }
.res { flex-direction: column; gap: 0; }
.res > div { display: flex; align-items: center; gap: .2em; }
.res b { font-size: 1.4em; }
.res.zero > div { opacity: .45; }
.res .inc { font-size: .78em; font-weight: 700; color: var(--good); white-space: nowrap; letter-spacing: -.02em; }
.res .inc.minus { color: var(--bad); }
.res .inc .eat { color: var(--bad); white-space: nowrap; }
.res .inc.none { color: var(--muted); font-weight: 500; }
/* The roost: your dragons, and an empty nest for each one you have room for. */
.roost { display: flex; align-items: center; gap: .6em; padding: .45em .7em; }
.roost .nests { display: flex; flex-wrap: wrap; gap: .35em .9em; align-items: center; }
.nest { width: 32px; height: 32px; opacity: .85; flex: none; }
.roost .room { display: inline-flex; align-items: center; gap: .35em; color: var(--muted); font-size: .9em; white-space: nowrap; }
.roost .room.over { color: var(--bad); font-weight: 600; white-space: normal; }
.phone .status { margin: .5em .7em 0; font-size: 1.1em; font-weight: 700; padding: .45em 1em; justify-content: flex-start; color: var(--text); border-bottom: 1px dashed var(--line); }
/* your turn, and anything you're asked to do: a gold ribbon */
.phone .status.you { --text: var(--ink); --muted: var(--ink-soft); --hit: #c0392b; color: var(--ink); background: var(--grain), linear-gradient(175deg, #ffd866 0 50%, #f0bb34 50%); border: 0; margin: .55em .4em 0; padding: .45em 1.3em; font-size: 1.3em; filter: drop-shadow(0 .15em .2em #0009); }
.pbody { padding: .7em; display: flex; flex-direction: column; gap: .6em; }
.pbody h2 { margin: .2em 0; }
.pbody .hint { margin: 0; font-size: .9em; }
.tabs { display: flex; gap: .3em; }
.tabs button { flex: 1; padding: .6em .3em; }
/* Cards: illustrated paper. Cream card stock, the picture in a window, the
   name on a strip of the kind's coloured paper (dragons: their element), the
   cost on the stock below. A faint grain sits over all of it. */
.handfan { --cw: 6.6em; position: fixed; left: 50%; bottom: 3.9em; z-index: 15; width: min(100vw, 34em); height: calc(9.4em * var(--hs, 1)); transform: translateX(-50%); pointer-events: none; }
.handfan::before { content: ''; position: absolute; inset: auto 0 -3.2em; height: 7em; background: var(--table); background-color: var(--bg); background-attachment: fixed; -webkit-mask-image: linear-gradient(to top, #000 55%, transparent); mask-image: linear-gradient(to top, #000 55%, transparent); }
/* The hand comes up from the bottom edge (it leaves the same way: .leave-down). */
.handfan { animation: handin .3s ease-out; }
@keyframes handin { from { translate: 0 3em; opacity: 0; } }
.handfan.empty { height: auto; pointer-events: auto; text-align: center; }
.handfan.empty .hint { position: relative; margin: 0 1em .8em; }
/* Each card: placed by its share of the spread (--x), tilted (--r) and dropped along the arc (--y). */
.handfan .card { position: absolute; left: calc(50% - var(--cw) / 2 + var(--x) * min(37% - var(--cw) / 2, (var(--n) - 1) * var(--cw) * .45)); top: .6em; width: var(--cw); font-size: calc(.78em * var(--hs, 1)); pointer-events: auto;
  transform: translateY(var(--y)) rotate(calc(var(--r) / var(--hs, 1))); transform-origin: 50% 160%; transition: transform .15s, left .25s ease-out; }
.handfan .card .cname { font-size: .95em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.handfan .card.longname .cname { font-size: .8em; letter-spacing: -.02em; padding-top: .42em; padding-bottom: .48em; }
.handfan .card .ccost { flex-wrap: nowrap; white-space: nowrap; }
/* A cost of four kinds or more (the Market's) is set tighter and a little smaller, to stay on the card. */
.card .ccost.long { gap: 0; font-size: .82em; letter-spacing: -.03em; }
.card .ccost.long .chip { margin: 0 .06em; }
.handfan .card .ckind { width: calc(18px * var(--hs, 1)); height: calc(18px * var(--hs, 1)); }
.handfan .card .ckind svg { width: calc(11px * var(--hs, 1)); height: calc(11px * var(--hs, 1)); }
.handfan .card.ready { box-shadow: 0 0 0 2px #7dff9b, 0 0 14px 2px #4cc26e, 0 6px 14px #0007; }
.handfan .card.picked { transform: translateY(calc(var(--y) - 1.6em)) rotate(calc(var(--r) / var(--hs, 1))); }
.handfan .card { touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
body.phone.hand-below .handfan .card { touch-action: pan-y; } /* a hand after the page: an upward slide scrolls the page */
/* The card under your thumb rises out of the hand, straight and big enough to read (phone.ts showGrip);
   pulled out, it follows the thumb, and lights up once letting go plays it. */
.handfan .card.peek { z-index: 99 !important; transform-origin: 50% 100%; transform: translate(var(--gx, 0px), calc(var(--y) - 4.5em + var(--gy, 0px))) scale(1.55); box-shadow: 0 0 0 2px #fff9, 0 14px 30px #000c; }
.handfan .card.peek.ready { box-shadow: 0 0 0 2px #7dff9b, 0 0 14px 2px #4cc26e, 0 14px 30px #000c; }
.handfan .card.peek.picked { box-shadow: 0 0 0 3px var(--bad), 0 14px 30px #000c; }
.handfan .card.peek.offered { box-shadow: 0 0 0 3px var(--accent), 0 14px 30px #000c; }
.handfan .card.lift { transition: none; }
.handfan .card.lift.out { box-shadow: 0 0 0 3px var(--accent), 0 0 22px 4px var(--accent), 0 14px 30px #000c; }
/* Offering cards in a trade: tapped cards rise out of the fan, outlined like any other choice. */
.handfan .card.offered { transform: translateY(calc(var(--y) - 1.6em)) rotate(calc(var(--r) / var(--hs, 1))); box-shadow: 0 0 0 3px var(--accent), 0 8px 16px #000a; }
body.phone.has-hand { padding-bottom: calc(5.1em + 9.4em * var(--hs, 1)); } /* the fan sits over the talk bar: room for both; --hs is how far the hand has grown into free space (phone.ts fitHand) */
/* A page too long for the hand to fit below it: the hand sits after the page, not over it (phone.ts fitHand). */
body.phone.hand-below .handfan { position: relative; left: auto; bottom: auto; transform: none; margin: .4em auto 0; }
body.phone.hand-below .handfan::before { display: none; }
body.phone.hand-below.has-hand { padding-bottom: 3.6em; }
/* No card to play here (others' turns, the raid, keeping a card): the hand is tucked
   down to the bottom edge, only the tops of the cards showing, and a tap raises it (phone.ts render). */
.handfan { transition: height .25s ease-out; }
.handfan.tucked { height: 3.2em; pointer-events: auto; cursor: pointer; clip-path: inset(-10em -10em 0 -10em); -webkit-tap-highlight-color: transparent; }
.handfan.tucked .card { pointer-events: none; }
body.phone.has-hand.hand-tucked { padding-bottom: 7.6em; }
body.phone.hand-below.has-hand.hand-tucked { padding-bottom: 3.6em; }
.card { --paper: #f4ecd8; --ink: #2b2228; position: relative; display: flex; flex-direction: column; background: var(--paper); color: var(--ink); border-radius: 4px; padding: 5px 5px 6px; cursor: pointer; box-shadow: 0 1px 0 #fff8 inset, 0 2px 0 #b9a47e, 1px 3px 1px #0b081a55, 2px 7px 12px #0b081a88; -webkit-tap-highlight-color: transparent; }
.card::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: .5; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .55 0 0 0 0 .45 0 0 0 0 .35 0 0 0 .18 0'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E"); }
.cart { position: relative; aspect-ratio: 10 / 7; border-radius: 3px; overflow: hidden; box-shadow: 0 0 0 1px #0002, 0 1px 2px #0003 inset; }
.cart svg.art { display: block; width: 100%; height: 100%; }
.ckind { position: absolute; top: 4px; left: 4px; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; background: var(--kc); border-radius: 50%; box-shadow: 0 0 0 1.5px var(--paper), 0 1px 3px #0006; }
.cname { position: relative; margin: -9px -8px 0; padding: .32em .5em .38em; background: var(--kc); color: #fff; font: 700 1em/1.15 "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif; text-align: center; text-shadow: 0 1px 0 #0005; box-shadow: 0 2px 3px #0004;
  clip-path: polygon(0 0, 100% 0, calc(100% - 6px) 50%, 100% 100%, 0 100%, 6px 50%); }
.card.k-dragon .cname, .card.k-upgrade .cname { color: #2b2228; text-shadow: 0 1px 0 #fff6; }
.ccost { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .15em; margin-top: .4em; min-height: 1.5em; font-size: .95em; }
.card .chip { color: var(--ink); margin: 0 .15em; }
.card .chip.free { color: #8a7d70; font-style: italic; }
.card .chip.short { color: #c0392b; }
/* Icons drawn for the dark table get a thin ink outline on paper (livestock is cream). */
.card .ricon { filter: drop-shadow(0 0 .5px #2b2228) drop-shadow(0 0 .5px #2b2228); }
.card.dim .cart { filter: saturate(.7) brightness(.9); }
.card.picked { box-shadow: 0 0 0 3px var(--bad), 0 8px 16px #000a; }
.card.picked::before { content: '✕'; position: absolute; z-index: 2; top: -8px; right: -8px; width: 26px; height: 26px; border-radius: 50%; background: var(--bad); color: #fff; font-weight: 900; display: flex; align-items: center; justify-content: center; }
/* New cards fly in from above, one after another. */
.card.dealt { animation: deal .65s cubic-bezier(.2, .9, .3, 1.15) both; }
@keyframes deal { from { transform: translateY(-70vh) rotate(-14deg) scale(.7); opacity: 0; } 30% { opacity: 1; } }
/* A card tapped open, over the hand. */
.zoom { touch-action: pan-y; position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; align-items: center; justify-content: safe center; gap: 1em; padding: 1em; background: #140f2aed; overflow-y: auto; animation: fadein .15s; }
.card.big { width: min(19em, 88vw); cursor: default; padding: 8px 8px 10px; animation: zoomin .2s ease-out; }
.card.big .cname { margin: -12px -11px 0; font-size: 1.45em; }
.card.big .ckind { width: 30px; height: 30px; top: 6px; left: 6px; }
.card.big .ckind svg { width: 18px; height: 18px; }
.card.big .ccost { font-size: 1.1em; justify-content: space-between; padding: 0 .3em; }
.card.big .ccost small { color: #8a7d70; text-transform: uppercase; letter-spacing: .06em; font-size: .7em; }
.card.big .ctext { margin: .5em .3em 0; font-size: 1em; line-height: 1.35; }
@keyframes zoomin { from { transform: scale(.8) rotate(-3deg); opacity: 0; } }
/* Its close button, on the corner: for whoever doesn't know a tap outside closes it too. */
.card.big .zoomx { position: absolute; z-index: 3; top: -14px; right: -14px; width: 44px; height: 44px; padding: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.15em; line-height: 1; }
@media (max-width: 340px) { .card.big .zoomx { top: -8px; right: -4px; width: 40px; height: 40px; } } /* kept on the screen */
.zoomacts { width: min(19em, 88vw); display: flex; flex-direction: column; gap: .4em; text-align: center; }
.zoomacts .row { justify-content: center; }
.zoomacts .hint { color: var(--muted); }
.dstats { margin: .4em .2em 0; display: grid; gap: .1em; }
.drow { display: grid; grid-template-columns: 4.2em 1fr; align-items: center; gap: .4em; font-weight: 700; }
.drow .dvals { display: flex; flex-wrap: wrap; gap: 0 1em; }
.drow .dvals .stat { margin: 0; }
.dgrow { display: inline-flex; align-items: center; gap: .3em; }
.drow .sfig { display: flex; flex-direction: column; align-items: center; gap: 0; }
.drow .sfig small { color: #6a5d52; font-size: .72em; font-weight: 600; line-height: 1; }
.drow .stagefig { width: 4.2em; height: 2.6em; }
.dgrow { margin-top: .2em; color: #6a5d52; font-size: .9em; }
.glyph { flex: none; }
.zoomnav { display: flex; align-items: center; gap: 1.2em; color: var(--muted); }
.zoomnav button { font-size: 1.6em; padding: .1em .7em; line-height: 1; }
.blocked { color: var(--warn); font-weight: 600; margin: .3em 0; font-size: .9em; }
.row { display: flex; gap: .4em; flex-wrap: wrap; margin-top: .3em; }
.row.big2 > button { flex: 1; }
.endturn { margin-top: .4em; }
.offer { padding: .6em .8em; }
.offer.in { border-left: .4em solid var(--accent); box-shadow: 0 0 0 2px var(--accent), var(--lift); }
.offer.out { background: transparent; box-shadow: none; border: 2px dashed #f3ead766; --text: var(--paper); --muted: var(--muted); color: var(--paper); }
.offer.out .ricon { filter: none; }
.offer.out .ptag { color: var(--pc); }
.offer.in .open { margin: .2em 0 .4em; font-size: .9em; color: var(--muted); }
.offer.out .declined { margin: .3em 0 0; font-size: .9em; color: var(--muted); }
.proj { display: flex; align-items: center; gap: .5em; margin: .35em 0; }
.proj b { min-width: 7em; margin-right: .4em; }
.proj button { margin-left: auto; }
.proj.dim b { opacity: .5; }
.elembtn { outline: 2px solid var(--ec); outline-offset: -3px; }
.iconbtn { padding: .3em .5em; line-height: 0; position: relative; }
.iconbtn .rate { position: absolute; right: -.35em; bottom: -.45em; font-size: .7rem; line-height: 1; font-weight: 800; padding: .12em .3em; border-radius: .6em; background: var(--ink); color: var(--paper); }
.respick { display: flex; gap: .3em; flex-wrap: wrap; }
.bankrow { display: flex; align-items: center; gap: .6em; margin-bottom: .4em; }
.bankrow > span { min-width: 2.4em; font-weight: 700; }
#bankgo { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: .3em; }
#bankgo .chip { margin: 0; }
.bank { display: flex; align-items: center; flex-wrap: wrap; gap: .4em; margin-bottom: .5em; }
.stepper { display: inline-flex; align-items: center; gap: .3em; }
.stepper button { padding: .15em .6em; font-weight: 800; }
.stepper b { min-width: 1.3em; text-align: center; }
.tgrid { display: grid; grid-template-columns: auto 1fr 1fr; align-items: center; gap: .3em .6em; }
.tgrid h3 { margin: .4em 0 0; }
#offer { margin: .6em 0; width: 100%; }
.tpick { margin: .4em 0 0; }
.who button { color: color-mix(in oklab, var(--pc) 72%, #1a1218); font-weight: 800; padding: .35em .7em; }
.trade h3 { margin: .6em 0 .2em; }
.picker h3 { margin: .2em 0; }
.pmap { padding: .3em; display: flex; justify-content: center; }
.pmap svg.map { width: 100%; height: auto; } /* phone.ts fitMap sizes it to the room left on the screen */
/* What's being placed, under the map: the card's picture, its name and rule text. */
.pabout { display: flex; align-items: center; gap: .7em; margin: 0; }
.pabout .pabart { flex: none; width: 5.2em; height: 3.64em; border-radius: 3px; overflow: hidden; box-shadow: 0 0 0 3px var(--kc), var(--lift); }
.pabout .pabart svg { width: 100%; height: 100%; display: block; }
.pabout b { display: block; font-size: 1.05em; }
.pabout small { display: block; color: var(--muted); line-height: 1.3; }
.picker { display: flex; flex-direction: column; gap: .6em; }
/* A phone held sideways: the map beside the question, the card and Cancel, so it gets the screen's whole height. */
@media (orientation: landscape) and (max-height: 600px) {
  .picker { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto 1fr; align-items: start; gap: .6em .8em; }
  .picker .pmap { grid-row: 1 / 4; grid-column: 1; }
  .picker > :not(.pmap) { grid-column: 2; }
  .picker .pabout { align-items: flex-start; }
  /* A card tapped open: the card on the left, its buttons and why on the right. */
  .zoom { display: grid; grid-template-columns: auto auto; grid-template-rows: 1fr auto; justify-content: center; align-content: safe center; column-gap: 1.5em; }
  .zoom > .card.big { grid-row: 1 / 3; }
  .zoom > .zoomacts { align-self: end; }
  .zoom > .zoomnav { grid-column: 2; align-self: start; justify-self: center; }
}
.choice:not(.cand) { display: flex; flex-direction: column; align-items: flex-start; gap: .2em; text-align: left; width: 100%; padding: .7em .9em; }
.choice:not(.cand) b { font-size: 1.15em; }
.dragon { display: flex; align-items: center; gap: .6em; text-align: left; width: 100%; }
/* A dragon to send: a box at the row's end that ticks when tapped, so the row reads as a choice. */
.dragon.pick > span { flex: 1; }
.tick { flex: none; width: 1.5em; height: 1.5em; border: .14em solid var(--paper-edge); border-radius: 3px; background: #fffaf0; box-shadow: inset 0 .1em .15em #0002; display: grid; place-items: center; }
:is(.dragon, .allpick).on .tick { border-color: var(--ink); background: var(--ink); }
:is(.dragon, .allpick).on .tick::after { content: ''; width: .38em; height: .72em; margin-top: -.18em; border: solid #fcd660; border-width: 0 .2em .2em 0; transform: rotate(45deg); }
/* A choice's prompt ("Choose a resource to gain"), then its options (phone.ts, choose) */
.ask { margin: .3em 0 0; font-size: 1.05em; }
.pbody > .ask, .zoomacts .ask, .pbody > .askrow .ask { color: var(--paper); }
/* "Choose dragons to send" with its "Choose all" tick at the line's end, in the dragons' column of ticks. */
.askrow { display: flex; align-items: center; justify-content: space-between; gap: .6em; margin-top: .3em; }
.askrow .ask { margin: 0; }
button.allpick, button.allpick.on { flex: none; white-space: nowrap; display: flex; align-items: center; gap: .5em; padding: .3em .9em; background: none; box-shadow: none; color: var(--paper); font-weight: 600; }
.choose { display: flex; flex-direction: column; gap: .3em; }
.choose .row { justify-content: center; }
.choose .dragon { flex: 1 1 100%; }

.dragon em { font-style: normal; color: var(--warn); font-weight: 800; }
.big-note { font-size: 1.2em; text-align: center; padding: 1.2em .5em; margin: 0; }
.mylog { list-style: none; margin: .5em .7em; padding: .5em .7em; color: var(--muted); font-size: .9em; }
.pover { display: flex; flex-direction: column; text-align: center; }
.pover h1 { margin: .5em 1rem 0; font-size: 2em; }
.pover .tiebreak, .pover .mine { margin: .2em 1rem 0; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; gap: .25em; }
.pover .standings { font-size: 1.2em; margin: .8em 1rem; }
.pover :is(button, a.button) { margin: 0 1rem; width: auto; }
.pover a.button + button { margin-top: .8em; }

/* Table talk on the phone: the latest line under everything, tap for the whole conversation. */
body.phone { height: auto; min-height: 100%; padding-bottom: 3.6em; } /* not 100% tall, or the padding sits at the first screen's bottom, not after the page */
.talkbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--sheet); box-shadow: 0 -.12em 0 var(--paper-edge), 0 -4px 12px #0008; }
.talkbar > .latest { display: flex; align-items: center; gap: .5em; width: 100%; background: none; border: 0; border-radius: 0; box-shadow: none; padding: .75em .9em; text-align: left; color: var(--text); font: inherit; transform: none; }
.talkbar > .latest span { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.talkbar .unread { background: var(--bad); color: #fff; border-radius: 99px; padding: 0 .5em; font-size: .85em; }
.talkbar .sheet { display: none; flex-direction: column; height: 70vh; padding: .5em .7em .7em; }
.talkbar.open .sheet { display: flex; }
.talkbar.open > .latest { display: none; }
.talkbar .sheet header { display: flex; justify-content: space-between; align-items: center; }
.talkbar .sheet ul { flex: 1; overflow-y: auto; list-style: none; margin: .3em 0; padding: 0; display: flex; flex-direction: column; gap: .35em; }
.talkbar .sheet li { background: var(--grain), var(--paper-hi); border-radius: 2px; padding: .4em .6em; box-shadow: 0 .1em 0 var(--paper-edge), .04em .16em .08em #0b081a33; max-width: 88%; align-self: flex-start; }
.talkbar .sheet li.private { border-left: 3px solid var(--accent); }
.talkbar .sheet li.mine { align-self: flex-end; background: #dfe8f7; }
.talkbar .sheet li small { color: var(--muted); }
.talkbar form { display: flex; gap: .4em; }
.talkbar form select { max-width: 7.5em; }
.talkbar form input { flex: 1; min-width: 0; }
.join-box .alt { color: #6b5a6e; margin-top: -.3em; }

/* Icons inside game text ("gains 3" and a sheep): no gap after them. */
.nobr { white-space: nowrap; }
.tchip { display: inline-flex; align-items: center; gap: .1em; font-weight: 700; white-space: nowrap; vertical-align: bottom; }
.ricon { flex: none; }

/* Cards phase: the two building cards drawn, side by side; tap Keep under one. */
.keeprow { display: grid; grid-template-columns: 1fr 1fr; gap: .6em; align-items: start; }
.keepone { display: flex; flex-direction: column; gap: .4em; min-width: 0; }
.keepone .card.big { width: 100%; font-size: .78em; }
.keepone .card.big .cname { font-size: 1.25em; }
.proj > svg { flex: none; margin-right: -.2em; }
.proj b { min-width: 6.5em; }
/* The name and its costs take what the button leaves; on a narrow phone the
   costs drop under the name rather than push the button off the edge. */
.proj .what { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: .2em .5em; }
.proj .costs { display: flex; gap: .5em; white-space: nowrap; }
.proj button { flex: none; }
/* Anything chosen (a tab, a player, a resource, a dragon, a vote) is lit the
   same way, gold on gold, and stays lit once made. */
button.on { --edge: #a8801c; background: var(--grain), var(--mottle), linear-gradient(180deg, #fcd660, #f0bb34); color: var(--ink); }
/* The player's colour lit from above: a white wash over the plain colour, not a
   gradient between color-mix() stops. Some phones (Android Chrome) draw a gradient
   with color-mix() stops in pale horizontal stripes. */
.who button.on { --edge: color-mix(in srgb, var(--pc) 60%, #000); background: var(--grain), var(--mottle), linear-gradient(180deg, #ffffff1f, #ffffff00), var(--pc); }
.who button.on .ptag, .who button.on { color: var(--ink); }
button.on:disabled { opacity: 1; }
.row.big2 > button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15em; }
.row.big2 > button small { font-size: .7em; font-weight: 600; }
.row.big2 > button small .chip { margin: 0 .15em; }
.sent { display: flex; flex-wrap: wrap; align-items: center; gap: .4em; margin-bottom: .6em; padding: .4em .6em; color: var(--text); }
.sent .sentwho { margin-right: .3em; }
.stat { display: inline-flex; align-items: baseline; gap: .25em; margin-left: .3em; white-space: nowrap; }
.stat.power { font-weight: 800; }
.stat.power.big { font-size: 1.15em; }
.status .over, .status .tag { display: inline-flex; align-items: center; gap: .15em; margin-left: .4em; font-size: .85em; }
.status .over { color: var(--bad); }
.pts .hiddenpts { display: inline-flex; align-items: center; gap: .1em; margin-left: .5em; font-size: .7em; background: #0001; border-radius: 6px; padding: .05em .35em; color: var(--text); }
.panel.offers ul { list-style: none; padding: 0; }
.panel.offers li { display: flex; align-items: center; gap: .3em; }
.pover .hero { height: 14em; }
.joinpage .hero { height: 15em; }
.plobby button { width: auto; }

/* Phone raid: the target drawn above the choice, who else is going */
.ptarget { padding: .6em .8em; margin-bottom: .6em; display: flex; align-items: center; justify-content: space-between; gap: .4em .6em; }
.ptarget .tname { margin: 0; flex: 1; font-size: 1.15em; }
.ptarget .foes, .ptarget .loot { flex-basis: 100%; }
.ptarget .loot { margin: 0; }
.choice .foes { margin: .2em 0; font-size: .95em; }
.choice .loot { margin: 0; }
.allies { display: flex; flex-wrap: wrap; gap: .4em .9em; margin-bottom: .6em; }
.ally { display: inline-flex; align-items: center; gap: .2em; padding: .2em .6em; }
.row.big2 > button { flex-direction: column; }
/* Narrow phones: a defender's stats wrap under its picture, the loot under the defenders */
.ptarget { flex-wrap: wrap; }
.ptarget .foes, .choice .foes { min-width: 0; }

.huntbtn { width: 100%; margin-top: .4em; display: flex; align-items: center; justify-content: center; gap: .35em; }
.huntname { margin: .2em 0 .5em; }

/* Joining by camera: the room's address as a QR code on the TV's join card. */
.join-box:has(.qr) { display: flex; align-items: center; gap: 1.1em; padding-left: 1.1em; }
.join-box .qr { flex: none; display: block; width: 9.5em; height: 9.5em; border-radius: 3px; box-shadow: 0 0 0 2px #2a1d3322; }
.join-box .join-text { min-width: 0; }
.join-box:has(.qr) .url { font-size: 1.45em; margin-bottom: .35em; }
.join-box:has(.qr) .code span { font-size: 2.5em; }
.join-box .how { color: #6b5a6e; font-size: .85em; margin-bottom: .1em; }
.roomline { text-align: center; font-size: 1.2em; margin: 0; }
/* A game that has started: the seats a phone can take back. */
.joinform.seats p { margin: 0; text-align: center; }
.joinform.inner { padding: 0; }
.seatlist .seatbtn { display: flex; align-items: center; gap: .6em; width: 100%; padding: .45em .8em; background: var(--sheet); font-weight: 800; font-size: 1.15em; border-radius: 3px; border-left: .4em solid var(--pc); box-shadow: var(--lift); text-align: left; }
.seatlist .seatbtn .tag { margin-left: auto; font-size: .7em; font-weight: 700; color: #6b5a6e; border: 1px solid #b8a9a0; border-radius: 4px; padding: 0 .3em; }
/* The menu under your name: out of the way, but always there. */
.me .menubtn { --text: var(--ink); color: var(--ink-soft); box-shadow: none; background: transparent; font-size: 1.3em; line-height: 1; padding: .05em .35em .2em; margin: 0 -.5em 0 .3em; }
/* The element wheel: a ring of element dots beside your points, one tap from the rulebook's Elements tab. */
.me .wheelbtn { --text: var(--ink); color: var(--ink-soft); box-shadow: none; background: transparent; line-height: 0; padding: .15em; margin: 0 0 0 .4em; }
.me .wheelbtn svg { width: 1.6em; height: 1.6em; display: block; }
.menuback { position: fixed; inset: 0; background: #0008; z-index: 40; }
.menu { position: fixed; top: .6em; left: .6em; right: .6em; max-width: 26em; margin: 0 auto; z-index: 41; background: var(--grain), var(--sheet); --text: var(--ink); color: var(--ink); border-radius: 4px; box-shadow: var(--lift); padding: .8em 1em 1em; }
.menu h3 { margin: 0 0 .3em; font-family: var(--serif); }
.menu p { margin: 0 0 .7em; color: var(--ink-soft); }
.menu .row { display: flex; gap: .5em; }
.menu .row + h3 { margin-top: 1.1em; }
/* The rulebook (book.ts): Rules in the header opens it over the screen; Close goes back. */
.me .bookbtn { --text: var(--ink); color: var(--ink-soft); box-shadow: none; background: transparent; font-weight: 700; font-size: .9em; padding: .2em .35em; margin: 0 0 0 .4em; }
.menu.booksheet { bottom: .6em; display: flex; flex-direction: column; padding: .6em .8em .4em; max-width: 34em; }
.booksheet .bookbar { display: flex; align-items: center; justify-content: space-between; }
.booksheet .bookbar h3 { margin: 0; }
.booksheet .booktabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: .3em; margin: .5em 0; }
.booksheet .booktabs button { padding: .45em .2em; font-size: .9em; }
.booksheet .booktabs button.on { background: var(--grain), var(--accent); color: var(--ink); }
.booksheet .bookpage { flex: 1; overflow-y: auto; overscroll-behavior: contain; margin: 0 -.4em; padding: 0 .4em .6em; }
.booksheet .bhead { margin: .9em 0 .2em; font-size: 1.05em; }
.booksheet .bookpage > .bhead:first-child { margin-top: .2em; }
.booksheet p.bintro { margin: 0 0 .5em; font-size: .9em; }
.booksheet .bentry { display: flex; gap: .7em; align-items: flex-start; padding: .45em 0; border-bottom: 1px solid #0001; }
.booksheet .bpic { flex: none; width: 6.2em; aspect-ratio: 5 / 4; border-radius: 3px; background: color-mix(in oklab, var(--paper-lo) 70%, #8aa 30%); object-fit: contain; }
.booksheet .bpic.none { display: block; }
.booksheet .bpic.bcard { overflow: hidden; border: .2em solid var(--kc); }
.booksheet .bpic.bcard .art { width: 100%; height: 100%; display: block; }
.booksheet .bbody { flex: 1; min-width: 0; }
.booksheet .bbody h4 { margin: 0 0 .15em; font-size: 1em; }
.booksheet p.btext { margin: 0 0 .25em; color: var(--ink); font-size: .9em; line-height: 1.3; }
.booksheet .bcost, .booksheet .bstats { display: flex; flex-wrap: wrap; gap: .25em; font-size: .9em; }
.booksheet .bstats { margin-bottom: .2em; }
.booksheet .loot { font-size: .9em; margin: 0 0 .2em; }
.booksheet .belem { border-top: .25em solid var(--ec); margin-top: .8em; padding-top: .3em; }
.booksheet .bepics { display: flex; gap: .4em; float: right; }
.booksheet .bepics .bpic { width: 4.6em; }
.booksheet .bdragon { clear: both; padding: .4em 0; border-bottom: 1px solid #0001; }
.booksheet .bdhead { display: flex; align-items: center; justify-content: space-between; gap: .4em; margin-bottom: .15em; }
.booksheet .bstage { display: flex; align-items: center; gap: .3em; font-size: .85em; }
.booksheet .bstage small { width: 5.2em; color: var(--ink-soft); }
.booksheet .wheel { position: relative; width: min(16em, 70vw); aspect-ratio: 1; margin: .6em auto; color: var(--ink-soft); }
.booksheet .wheel > svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.booksheet .wnode { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.booksheet .wnode b { font-size: .85em; color: var(--ink); }
.booksheet p.wheelrule { margin: 0 0 .6em; text-align: center; color: var(--ink); font-weight: 600; }
.booksheet .bking { box-shadow: none; border-bottom: 1px solid #0001; border-radius: 0; padding: .5em 0; margin: 0; background: none; }
button.danger { background: var(--grain), #c0392b; color: #fff; --text: #fff; }
/* Someone the table waits on is away: anyone can let a bot play for them. */
.awayline { margin: .35em .7em 0; padding: .3em 1em; display: flex; align-items: center; gap: .5em; flex-wrap: wrap; font-weight: 600; color: var(--text); }
.awayline button { margin-left: auto; }
.lastround { margin: .35em .7em 0; padding: .3em 1em; border-radius: 3px; font-weight: 700; color: var(--ink); background: var(--grain), linear-gradient(175deg, #ffd866 0 50%, #f0bb34 50%); }
.toast.news { border-left-color: var(--accent); }
/* The answers to your trade offers: they stay at the top until tapped. */
.notices { position: fixed; top: .5em; left: 50%; transform: translateX(-50%); z-index: 55; display: flex; flex-direction: column; gap: .4em; width: max-content; max-width: 92vw; }
.notices .toast { position: static; transform: rotate(-.6deg); max-width: none; font: inherit; font-weight: 600; color: var(--ink); text-align: left; cursor: pointer; }
.notices .toast small { display: block; font-weight: 400; opacity: .7; }
.pcard .seatnote { display: block; color: var(--warn); font-weight: 700; font-size: .9em; }
.join-box:has(.qr) .alt { font-size: .8em; margin: -.2em 0 .4em; }
/* What just happened to this phone: news, not an error. */
.joinform .news { margin: 0; text-align: center; font-weight: 700; padding: .45em .8em; background: var(--grain), var(--sheet); color: var(--ink); border-left: .4em solid var(--accent); border-radius: 3px; box-shadow: var(--lift); }

/* Phone, while the TV plays a scene: nothing to do but look up. */
.watchtv { min-height: 70vh; margin: 1em; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6em; border-top: .4em solid var(--pc); text-align: center; }
.watchtv .pname { font-size: 1.2em; font-weight: 800; }
.watchtv h1 { margin: 0; font-size: 2.2em; }

/* ================= The table view (every game; from the start with no TV) =================
   On the phone: the table view is the TV's page for the room in a frame over
   the phone's own page, shown by the You / Table switch by the talk bar. */
.tableview { position: fixed; inset: 0; z-index: 35; visibility: hidden; opacity: 0; background: #140f2a; transition: opacity .3s, visibility 0s .3s; }
.tableview iframe { display: block; width: 100%; height: 100%; border: 0; }
body.table-on .tableview { visibility: visible; opacity: 1; transition: opacity .3s; }
body.table-on { overflow: hidden; }
body.table-on .talkbar { z-index: 36; }
body.has-table .talkbar > .latest { padding-right: 9.5em; }
.viewswitch { position: fixed; right: .5em; bottom: .45em; z-index: 37; display: flex; border-radius: 99px; box-shadow: 0 .14em 0 var(--paper-edge), .05em .28em .12em #0b081a55; }
.viewswitch button { font: inherit; font-weight: 800; padding: .45em .85em; margin: 0; box-shadow: none; transform: none; border-radius: 0; }
.viewswitch button:first-child { border-radius: 99px 0 0 99px; }
.viewswitch button:last-child { border-radius: 0 99px 99px 0; }
.viewswitch button[aria-pressed="true"] { background: var(--grain), linear-gradient(175deg, #ffd866 0 50%, #f0bb34 50%); color: var(--ink); }
body:has(.talkbar.open) .viewswitch { display: none; }
/* the lobby and the join form */
.invite { --text: var(--ink); --muted: var(--ink-soft); color: var(--ink); display: flex; align-items: center; gap: .8em; text-align: left; background: var(--sheet); box-shadow: var(--lift); border-radius: 2px; padding: .6em; }
.invite svg.qr { width: 7.5em; height: 7.5em; flex: none; }
.invite p { margin: 0; display: flex; flex-direction: column; gap: .2em; }
.invite .url { font-weight: 800; word-break: break-all; }
.tvhint { margin: .5em 0 0; font-size: .9em; }
.tvhint .url { color: var(--text); word-break: break-all; }
.hostline { display: flex; flex-direction: column; gap: .5em; border-top: 1px dashed var(--line); padding-top: 1em; text-align: center; }
.hostline p { margin: 0; color: var(--muted); }
/* The join form's saved games (phone.ts): each opens on its seats. */
.hostline.savedgames ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .4em; }
.hostline.savedgames a.button { display: flex; flex-direction: column; align-items: flex-start; gap: .1em; text-align: left; text-decoration: none; }
.hostline.savedgames a.button b { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hostline.savedgames a.button small { color: var(--ink-soft); font-weight: 600; }

/* The table view itself (tv.ts with ?remote): the board, then the players,
   then the feed and the titles, one after another down a phone's screen. */
body.tv.remote { font-size: 15px; overflow: auto; }
.remote .board { height: auto; overflow: visible; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: .45em; padding: .5em .5em 4.6em; }
.remote .board > *, .remote .side > .corner { grid-column: 1 / -1; min-width: 0; }
.remote .side { display: contents; font-size: 1em; }
.remote .side > .pcard { grid-column: auto; order: 3; font-size: .9em; min-width: 0; overflow: hidden; align-self: stretch; }
.remote .side > .corner { order: 4; margin: 0; font-size: 1em; }
.remote .side > .corner.titles { order: 5; }
.remote .topbar { position: static; order: 0; flex-wrap: wrap; gap: .3em .6em; padding: .1em 0; }
.remote .topbar .round { font-size: 1.15em; }
.remote .topbar .phase { font-size: 1.2em; }
.remote .topbar .phases li:not(.phase) { display: none; }
.remote .topbar .goal { font-size: 1em; }
.remote .mapwrap { position: static; order: 1; }
.remote .mapwrap svg.map { flex: none; height: auto; max-height: 70vh; }
.remote .mapwrap .legend { display: none; }
.remote .board > .offers { position: static; order: 2; transform: none; max-width: none; font-size: 1em; }
.remote .pcard .phead { flex-wrap: wrap; white-space: normal; }
.remote .pcard .doing { white-space: normal; }
.remote .tvdragon b, .remote .tvdragon span { white-space: normal; flex-wrap: wrap; }
.remote .feedbox ul.feed { max-height: none; }
.remote .feedbox .said { display: block; -webkit-line-clamp: none; line-clamp: none; }
/* the big moments, sized for a phone and scrolled if they don't fit */
.remote .overlay { overflow-y: auto; align-items: flex-start; padding: .6em .5em 4.6em; }
.remote .overlay > * { margin: auto 0; }
.remote .overlay.raid { background-color: #140f2a; }
.remote :is(.production, .result, .endbox) { min-width: 0; width: 100%; padding: .8em .9em; }
.remote .endbox { padding: 0 0 1em; }
.remote :is(.production, .result, .endbox) h1 { font-size: 1.6em; }
.remote .production .pstage { font-size: 1.3em; }
/* a resource's dice wrap under each other when the row runs out of room;
   a faint line between resources keeps each one's dice together */
.remote .production .prow { gap: .35em; padding: .35em 0; }
.remote .production .prow + .prow { border-top: 1px solid color-mix(in srgb, var(--pc) 30%, transparent); }
.remote .production .parts { flex: 1; min-width: 0; }
.remote .production .dice { flex: 1; min-width: 0; gap: .3em .2em; }
.remote .production .die { width: 1.9em; height: 1.9em; margin: 0; }
.remote .production .parts i, .remote .production .eq > i { margin: 0 .1em; }
.remote .production .ptotal { font-size: .85em; }
/* Production's dragon step (#447): one player under another, at the phone's
   own size; a row's lines wrap rather than run into the next card. */
.remote .tending .tend { grid-template-columns: minmax(0, 1fr); justify-content: stretch; gap: .45em; font-size: 1em; }
.remote .tending :is(.tname, .tline) { white-space: normal; flex-wrap: wrap; row-gap: .1em; }
.remote .endbox svg.scene { height: 8em; }
.remote .endbox .standings { font-size: 1.1em; margin: .5em .6em; }
.remote .endbox .endbody { margin: 0; }
.remote .endbox :is(button, a.button) { font-size: 1.1em; }
.remote .endbox .endactions { flex-wrap: wrap; padding: 0 .6em; }
/* The summary on a phone: the race over what happened, one above the other. */
.remote .summary { width: 100%; padding: .6em .8em 3.6em; }
.remote .summary h1 { font-size: 1.6em; }
.remote .summary .sumbody { grid-template-columns: minmax(0, 1fr); gap: .8em; min-height: 0; }
.remote .summary .told { font-size: 1em; }
.remote .summary > button { right: .8em; bottom: .8em; }
.remote .summary.points-step { width: 100%; padding-bottom: 3.6em; }
.remote .summary .growth { grid-template-columns: minmax(0, 1fr); gap: .6em; }
.remote .summary .growth figcaption { font-size: 1.1em; }
.remote .summary.points-step .breakdown { font-size: 1.05em; }
.remote .raidbox { width: 100%; max-height: none; overflow: visible; }
.remote .raidbox h1 { font-size: 1.7em; }
.remote .target { min-width: 0; width: 100%; padding: .6em .8em; }
.remote .target h2 { font-size: 1.25em; }
.remote .target .foes { font-size: 1em; }
.remote .candidates.vote { grid-template-columns: repeat(auto-fill, minmax(min(100%, 19em), 1fr)); gap: .8em; width: 100%; }
:is(.remote, body.phone) .cand { padding: .7em .9em; font-size: .78em; }
:is(.remote, body.phone) .cand h2 { font-size: 1.9em; }
.remote .target .loot { font-size: 1.15em; }
.remote .target .num { font-size: 1.1em; }
.remote .status { font-size: 1.1em; }
.remote .arena { flex-direction: column; gap: .6em; }
.remote .arena .vs { display: none; }
.remote .raiders { font-size: 1em; min-width: 0; width: 100%; }
.remote .balance { font-size: 1em; gap: .3em .5em; margin-bottom: .6em; grid-template-columns: 1fr 1fr; grid-template-areas: "bar bar" "us foe"; }
.remote .balance .bbar { grid-area: bar; }
.remote .balance .bside { grid-area: us; align-items: flex-start; justify-self: start; text-align: left; }
.remote .balance .bside.foe { grid-area: foe; align-items: flex-end; justify-self: end; text-align: right; }
.remote .arena.deciding .raiders { grid-template-columns: auto auto 1fr auto; }
.remote .arena.deciding .raider { column-gap: .5em; padding: .3em .5em; }
.remote .arena.deciding .raider .power { justify-self: end; }
.remote .choice { min-width: 4.5em; }
.remote .fhead { top: 1vh; flex-wrap: wrap; gap: .4em; padding: 0 .5em; }
.remote .fhead h2 { font-size: 1.2em; max-width: none; }
.remote .fhead .bvs b { font-size: 1.4em; }
.remote .battle { left: 2vw; right: 2vw; top: 36vh; bottom: 17vh; gap: 3vw; --k: clamp(.3em, min(calc(40vw / var(--sl)), calc(40vw / var(--sr)), calc(36vh / var(--mx))), 3em); }
.remote .backrow { bottom: 9vh; }
/* A screen held upright: each side stands its figures one above another, in
   columns of up to four (tv.ts), the first column nearest the other side.
   Every column of a side has its rows (--rl, --rr) of the same height, so a
   row lines up. Each side's --k is as big as lets it fit across (--sl, --sr)
   and its rows (--hl, --hr, plus each figure's bar and name) fit up. */
.battle.stack { top: 20vh; bottom: 17vh; align-items: stretch; --up: 63vh; }
.battle.stack .bl { --rows: var(--rl); --k: clamp(.3em, min(calc(36vw / var(--sl)), calc((var(--up) - var(--rl) * 3.4em) / var(--hl))), 3em); }
.battle.stack .br { --rows: var(--rr); --k: clamp(.3em, min(calc(36vw / var(--sr)), calc((var(--up) - var(--rr) * 3.4em) / var(--hr))), 3em); }
/* A boss stands over its side's columns (tv.ts), in the top 26vh; the
   columns share what's left below it. */
.battle.stack .br.bossed { --up: calc(63vh - 26vh - 3.4em); flex-direction: column; align-items: stretch; }
.battle.stack .boss { display: flex; justify-content: center; }
.battle.stack .boss .fig-body { width: min(42vw, calc(26vh * var(--a))); }
.battle.stack .bcols { flex: 1; display: flex; gap: .6em; }
.battle.stack .bside { display: flex; flex-wrap: nowrap; align-items: stretch; gap: .6em; }
.battle.stack .bl { flex-direction: row-reverse; justify-content: flex-start; }
.battle.stack .br { justify-content: flex-start; }
.battle.stack .bcol { display: grid; grid-template-rows: repeat(var(--rows), 1fr); align-items: end; justify-items: center; }
/* A column is as wide as its names; each figure keeps its own size in it. */
.battle.stack .fig { width: auto; min-width: 5.2em; }
.battle.stack .fig-body { width: calc(var(--s) * var(--k)); }
.battle.stack .fig-name { max-width: 6em; }
.remote .bside { gap: .3em .4em; }
.remote .fig-name { font-size: .7em; max-width: max(100%, 5em); }
.remote .fig .dmg { font-size: .7em; }
.remote .fightscene .outcome { top: 13vh; min-width: 0; width: 94vw; padding: .2em .6em .6em; font-size: .85em; }
.remote .spoils { font-size: 1.15em; flex-wrap: wrap; gap: .5em 1em; }
.remote .outcome .boon { font-size: 1em; }
.remote .outcome .score { font-size: 1.1em; flex-wrap: wrap; }
/* On a phone, whoever held back share lines, and stay on the screen; the
   fighters stand above them (tv.ts). */
.remote .backrow { right: 1.5vw; flex-direction: row; flex-wrap: wrap; align-items: flex-end; }
.remote .heldback { font-size: .9em; padding: .2em .4em; gap: .3em; flex-wrap: wrap; }
.remote .heldback svg { width: 1.9em; height: 1.9em; }
/* A dragon in the roost is a button: tap it for its card. */
.dtap { background: none; box-shadow: none; padding: .15em .2em; text-align: left; color: inherit; font-weight: inherit; }
.dtap:active:not(:disabled) { transform: translateY(.08em); box-shadow: none; }
/* A hatched dragon's card: where it is now, and its stage's row marked. */
.card .dnow { display: inline-flex; align-items: center; gap: .3em; font-weight: 700; }
.card .dnow .grow { color: #6a5d52; letter-spacing: -.05em; }
.drow.now { background: color-mix(in oklab, var(--kc) 22%, transparent); border-radius: 2px; box-shadow: inset .2em 0 0 var(--kc); }

/* Discarding: the cards picked to go, face up above the button, and a place for each still to pick. */
.discardtray { display: flex; flex-wrap: wrap; justify-content: center; gap: .5em; }
.discardtray .card, .discardtray .slot { width: 5.4em; font-size: .9em; }
.discardtray .card { animation: zoomin .2s ease-out; } /* laid down as it's picked (only then: phone.ts updates in place) */
.discardtray .card .cname { font-size: .72em; margin: -7px -6px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.discardtray .card .ccost { display: none; }
.discardtray .card .ckind { width: 16px; height: 16px; }
.discardtray .card .ckind svg { width: 10px; height: 10px; }
.discardtray .card.picked::before { width: 20px; height: 20px; top: -7px; right: -7px; font-size: .8em; }
.discardtray .slot { aspect-ratio: 5 / 5.4; border: 2px dashed #fff5; border-radius: 4px; }

/* Nothing on the phone cuts (phone.ts, morph.ts): the page updates in place,
   a new screen rises in while the last one fades away above it, the hand slides
   away down the bottom edge, and an open card fades as it closes. */
.screen { animation: enter .3s ease-out; }
.leaving { position: fixed !important; right: auto !important; bottom: auto !important; margin: 0 !important; transform: none !important; box-sizing: border-box; pointer-events: none; }
.leaving.leave-up { z-index: 4; overflow: hidden; animation: leave .3s ease-in forwards; }
.leaving.leave-down { z-index: 14; animation: handout .3s ease-in forwards; }
.leaving.leave-fade { z-index: 30; animation: out .15s ease-in forwards; }
@keyframes handout { to { translate: 0 3em; opacity: 0; } }
/* The phone's open panels come in rather than appear. */
.pbody > :is(.panel, .offer) { animation: enter .25s ease-out; }
/* The vote on a phone-sized card (the table view, the phone): loot down the right, so a wide card isn't half empty. */
:is(.remote, body.phone) .cand { display: grid; grid-template-columns: auto 1fr; grid-template-areas: "name name" "fight loot" "worth worth" "voters voters"; align-items: center; gap: .3em .8em; }
:is(.remote, body.phone) .cand h2 { grid-area: name; }
:is(.remote, body.phone) .cand .cand-fight { grid-area: fight; flex-wrap: nowrap; }
:is(.remote, body.phone) .cand .loot { grid-area: loot; justify-self: end; flex-direction: column; align-items: flex-end; gap: .1em; }
:is(.remote, body.phone) .cand .loot .chip { margin-right: 0; }
/* what a scoring kingdom is worth: a row of its own under the fight and the loot */
:is(.remote, body.phone) .cand .loot.worth { grid-area: worth; justify-self: start; flex-direction: row; align-items: center; gap: .1em .3em; }
:is(.remote, body.phone) .cand .voters { grid-area: voters; }
/* The hex tapped while placing a beast or an upgrade: whose building it is and what it does, before the confirm. */
.pchosen { margin: 0; min-height: 3.6em; }
.pchosen p { margin: .1em 0; line-height: 1.35; }
.pchosen .pchead { font-size: 1.05em; }
.pchosen .pcto { color: var(--accent); font-weight: 700; } /* an upgrade's before → after */
.pchosen .pcdelta > .nobr { margin-left: 1em; } /* the name, then each change, spaced on one line */
/* a name on the last-round banner, darkened to read on its yellow */
:is(.topbar .goal.last, .lastround) .ptag { color: color-mix(in oklab, var(--pc) 50%, #1a1218); }

/* The live fight (board3d.ts, FightStage): the scene fills the screen, its
   fighters standing on the place's ground, and each one's name and bar
   pinned over its model (tv.ts sets each .fig's box to the model's, and
   --foot to the lowest of it): a plate at its feet, as on a miniature's
   base, its name over its health. */
.fightscene .stagebox { position: absolute; inset: 0; }
.fightscene .stage3d { display: block; }
.fightscene .battle.live { inset: 0; display: block; pointer-events: none; }
.fightscene .battle.live .fig { position: absolute; display: block; min-width: 0; }
.fightscene .battle.live .fig-body { position: absolute; inset: 0; transform: none; animation: none; }
.fightscene .battle.live .fig-body::after { display: none; }
.fightscene .battle.live .fig-name { position: absolute; left: 50%; top: var(--foot); translate: -50% .2em; margin: 0; width: max-content; max-width: 6.5em; text-align: center; font-size: .85em; padding-bottom: .75em; }
.fightscene .battle.live .fig .hpbar { position: absolute; z-index: 1; left: 50%; top: var(--foot); translate: -50% calc(var(--plate, 1.5em) - .3em); width: clamp(3em, 60%, 5em); height: .45em; margin: 0; box-shadow: none; }
.fightscene .battle.live .fig-crown { top: 0; }
.remote .fightscene .battle.live .fig-name { font-size: .7em; max-width: 6em; }
/* End turn tapped once (#417): its confirm, in the same place. */
.endask { margin-top: .4em; }
.endask .hint { margin: 0 0 .2em; text-align: center; }
