/* The game's own stylesheet. It is loaded inside the game's shadow root, so nothing here reaches the
   host page and the host page's styles do not reach in. Sizes follow the host element (container
   query units), never the browser window: the game fits whatever box it is mounted in. */
:host {
  --bg: #17120d;
  --panel: #241b13;
  --panel2: #30251a;
  --line: #4a3a27;
  --ink: #f3e9d2;
  --muted: #b9a888;
  --brass: #e3b04b;
  --brass-l: #f7dc8f;
  --brass-d: #9a6f1e;
  --paper: #efdfb4;
  --sepia: #3b2814;
  --red: #b3261e;
  --red-l: #df5a48;
  --red-d: #7a1510;
  --blue: #2456a6;
  --blue-l: #5b8fdc;
  --blue-d: #153a78;
  /* Three faces from the years the game is set in. Titles: a Didone, the type of proclamations and
     title pages around 1800. Labels and numbers: a Clarendon, sturdy enough to read at 9 px on a
     badge. Running text: Georgia, a screen face drawn after the Scotch Romans of the 1810s. */
  --display: "Bodoni Moda", "Bodoni 72", Didot, "Playfair Display", Georgia, "Times New Roman", serif;
  --slab: Besley, Superclarendon, Clarendon, Rockwell, "Roboto Slab", Georgia, serif;
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Times New Roman", serif;
  /* each army's metal: gold for the red army, silver for the blue one */
  --m: #e3b04b; --m-l: #fff0b8; --m-d: #8a5f17; --m-ink: #2b1a05;
  --tilt: -11deg; /* every piece is tipped the same way */
  display: block; position: relative; visibility: visible;
  container: game / size;
  color-scheme: dark; color: var(--ink);
  font: 15px/1.4 var(--serif);
  text-align: left; letter-spacing: normal; text-transform: none;
  -webkit-tap-highlight-color: transparent;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
svg { display: block; width: 100%; height: 100%; }

.stage { position: absolute; inset: 0; overflow: hidden;
  background:
    radial-gradient(110% 60% at 50% -5%, rgba(227,176,75,.13), transparent 60%),
    repeating-linear-gradient(93deg, rgba(255,255,255,.012) 0 3px, transparent 3px 9px),
    linear-gradient(180deg, #211912, var(--bg) 55%, #100c08); }
.app {
  --board: max(264px, min(100cqw - 12px, (100cqh - 190px) * 1.23, 760px));
  height: 100%; overflow: hidden auto; scrollbar-width: none; /* a scrollbar would take width the layout has already counted */
  padding: 6px 6px calc(10px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: center; gap: 7px;
}
.app::-webkit-scrollbar { display: none; }
.app > * { width: var(--board); flex: none; }

/* ---------- top bar ---------- */
.bar { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.crest { flex: none; width: 34px; height: 34px; padding: 6px; border-radius: 50%; color: #3b2a00;
  background: radial-gradient(circle at 35% 28%, #fff0b8, var(--brass) 48%, var(--brass-d)); box-shadow: 0 2px 0 rgba(0,0,0,.5), inset 0 0 0 1.5px rgba(255,255,255,.4); }
.bar-text { flex: 1; min-width: 0; }
.status { margin: 0; font: 700 19px/1.1 var(--display); letter-spacing: .01em; word-spacing: .12em; display: flex; align-items: center; gap: 7px; white-space: nowrap; overflow: hidden; }
.status::before { content: ""; flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--brass); box-shadow: 0 0 0 3px rgba(227,176,75,.2); }
.app[data-phase="play"][data-turn="p"] .status::before { background: var(--red-l); box-shadow: 0 0 0 3px rgba(223,90,72,.22); }
.app[data-phase="play"][data-turn="c"] .status::before { background: var(--blue-l); box-shadow: 0 0 0 3px rgba(91,143,220,.22); animation: blink 1s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .35; } }
/* the hint under the status: up to two lines, and the room for two is always kept so the board never shifts */
.sub { margin: 1px 0 0; font-size: 12.5px; line-height: 1.28; color: var(--muted); min-height: 2.56em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.icon-btn { flex: none; width: 40px; height: 40px; padding: 9px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); cursor: pointer; }
.icon-btn:hover { color: var(--ink); background: var(--panel2); }
.icon-btn.armed { color: #fff; background: var(--red); border-color: var(--red-l); }
.js-sound { color: var(--brass); }
/* the sound sheet: a switch and a volume each for music and for effects */
.sheet.sound-sheet { z-index: 95; }
.sound-sheet .sheet-card { width: min(100%, 340px); gap: 14px; }
.vol { display: grid; grid-template-columns: auto 64px 1fr; align-items: center; gap: 10px; }
.vol label { font: 700 13px/1 var(--slab); letter-spacing: .04em; color: #3b2814; }
.switch { position: relative; width: 44px; height: 26px; padding: 0; border-radius: 13px; border: 1px solid #1f1108; cursor: pointer; background: #8d7a58; box-shadow: inset 0 1px 3px rgba(0,0,0,.5); transition: background .15s; }
.switch::after { content: ""; position: absolute; left: 2px; top: 2px; width: 20px; height: 20px; border-radius: 50%; background: radial-gradient(circle at 35% 28%, #fff0b8, var(--brass) 55%, var(--brass-d)); box-shadow: 0 1px 2px rgba(0,0,0,.6); transition: transform .15s; }
.switch[aria-checked="true"] { background: linear-gradient(180deg, #7d1a14, #5a100c); }
.switch[aria-checked="true"]::after { transform: translateX(18px); }
.vol input[type="range"] { width: 100%; min-width: 0; height: 26px; margin: 0; accent-color: #7d1a14; cursor: pointer; }
.vol input[type="range"]:disabled { opacity: .4; cursor: default; }
.opt { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 10px; font-size: 13.5px; line-height: 1.25; color: #3b2814; }
.wipe { justify-self: start; min-height: 32px; padding: 0 12px; color: #5a100c; background: none; border-color: rgba(90,16,12,.5); font-size: 11.5px; }
.wipe:hover:not(:disabled) { background: rgba(90,16,12,.1); border-color: #5a100c; }
button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }


/* ---------- the war table: a map clamped to a wooden board, with working rails ---------- */
.table {
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "board board" "raill railr";
  border-radius: 12px;
  background:
    repeating-linear-gradient(91deg, rgba(0,0,0,.16) 0 1px, transparent 1px 5px, rgba(255,255,255,.035) 5px 6px, transparent 6px 13px),
    linear-gradient(135deg, #8a5a2c, #5e3a19 40%, #3f2610 72%, #6f4622);
  box-shadow: 0 14px 30px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,220,160,.35), inset 0 -2px 0 rgba(0,0,0,.55), inset 0 0 0 1px rgba(0,0,0,.4);
}
.board-frame { grid-area: board; position: relative; padding: 1.7%; }
.clamp { position: absolute; width: clamp(15px, 6.4%, 34px); aspect-ratio: 1; z-index: 3; pointer-events: none; filter: drop-shadow(0 1px 1px rgba(0,0,0,.65)); }
.clamp::before { content: ""; position: absolute; inset: 0; background: linear-gradient(135deg, #fff0b8, var(--brass) 42%, var(--brass-d)); clip-path: polygon(0 0, 100% 0, 100% 32%, 32% 32%, 32% 100%, 0 100%); }
.clamp::after { content: ""; position: absolute; left: 8%; top: 8%; width: 16%; height: 16%; border-radius: 50%; background: #5a3d0c; box-shadow: inset 0 1px 0 rgba(255,255,255,.55); }
.clamp.tl { left: 0; top: 0; } .clamp.tr { right: 0; top: 0; transform: scaleX(-1); }
.clamp.bl { left: 0; bottom: 0; transform: scaleY(-1); } .clamp.br { right: 0; bottom: 0; transform: scale(-1); }

.rail { display: flex; align-items: center; gap: 6px; min-height: 50px; padding: 2px 8px 7px; min-width: 0; }
.rail-l { grid-area: raill; } .rail-r { grid-area: railr; justify-content: flex-end; }
.plate { display: flex; align-items: center; gap: 6px; min-width: 0; }
.plate.foe { flex: 1 1 auto; }
.plate.mine .pname { display: none; } /* on a narrow strip the red badge speaks for itself */
.badge { position: relative; flex: none; width: 34px; height: 34px; padding: 7px; margin: 0 2px; border-radius: 50%; color: #f6e7c3;
  background: radial-gradient(circle at 35% 28%, var(--c-l), var(--c) 55%, var(--c-d));
  box-shadow: 0 0 0 2px #1a0f05, 0 0 0 4px var(--brass-d), 0 2px 4px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.35); transition: box-shadow .3s; }
/* a painted face: the three enemy commanders and the player's aide */
.who { display: block; background: #2a1c10 center / cover no-repeat; }
.who.wren { background-image: url(img/people/wren.webp); } .who.hale { background-image: url(img/people/hale.webp); }
.who.voss { background-image: url(img/people/voss.webp); } .who.aide { background-image: url(img/people/aide.webp); }
.badge .who { position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.5); }
.badge .stars { position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%); padding: 1px 3px; border-radius: 6px; background: #1a0f05; }
.badge .stars svg { width: 7px; height: 7px; color: var(--brass-l); }
/* a few words from the enemy commander */
.plate.foe { position: relative; }
/* Under the board (the upright layouts) the words come out beside the commander's face, along his
   own strip: over his name for a moment, never over the map, where they would hide the player's back row. */
.say { position: absolute; z-index: 47; left: 50px; top: 50%; translate: 0 -50%; width: max-content; max-width: min(56cqw, 210px); padding: 6px 10px 7px; border-radius: 11px; pointer-events: none;
  font: italic 600 13px/1.25 var(--serif); color: #16233c; background: linear-gradient(175deg, #f6f8fc, #d3dcec); box-shadow: 0 0 0 1.5px var(--blue-d), 0 6px 16px rgba(0,0,0,.55); }
.say::after { content: ""; position: absolute; left: -9px; top: calc(50% - 6px); width: 10px; height: 12px; background: #e4eaf4; clip-path: polygon(100% 0, 100% 100%, 0 50%); filter: drop-shadow(-1.5px 0 0 var(--blue-d)); }.say.go { animation: say-in .28s cubic-bezier(.2,1.4,.4,1); }
@keyframes say-in { from { transform: translateY(8px) scale(.9); opacity: 0; } }
.badge.broken { filter: grayscale(.85) brightness(.6); animation: broke .7s ease-out; }
.badge.broken::after { content: ""; position: absolute; inset: -2px; z-index: 2; border-radius: 50%; background: linear-gradient(112deg, transparent 45%, #0e0804 45.5% 48.5%, transparent 49%), linear-gradient(58deg, transparent 57%, #0e0804 57.5% 60%, transparent 60.5%); }
@keyframes broke { 0% { transform: scale(1.3) rotate(-10deg); filter: brightness(2.4); } 100% { transform: none; } }
.pname { min-width: 0; padding: 4px 4px 3px; border-radius: 3px; font: 700 8.5px/1 var(--slab); letter-spacing: .02em; text-transform: uppercase; color: #f1dfb4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--c-d); box-shadow: inset 0 0 0 1px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.18); }
.app[data-phase="play"][data-turn="p"] .plate.mine .badge,
.app[data-phase="play"][data-turn="c"] .plate.foe .badge { box-shadow: 0 0 0 2px #1a0f05, 0 0 0 4px var(--brass-l), 0 0 14px 2px var(--c-l), inset 0 1px 0 rgba(255,255,255,.35); }
/* the lever leans toward whoever is to move */
.lever { flex: none; position: relative; width: 36px; height: 14px; border-radius: 7px; background: linear-gradient(180deg, #17110c, #3a2d22); box-shadow: inset 0 1px 3px rgba(0,0,0,.85), 0 1px 0 rgba(255,220,170,.22); }
.knob { position: absolute; left: 0; top: -5px; width: 24px; height: 24px; border-radius: 50%; background: radial-gradient(circle at 35% 28%, #fff0b8, var(--brass) 48%, var(--brass-d)); box-shadow: 0 2px 3px rgba(0,0,0,.65), inset 0 0 0 1.5px rgba(255,255,255,.35); transform: translateX(6px); transition: transform .4s cubic-bezier(.3,1.4,.4,1); }
.app[data-phase="play"][data-turn="c"] .knob { transform: translateX(0); }
.app[data-phase="play"][data-turn="p"] .knob { transform: translateX(12px); }
/* strength plaques: the ranks each side still has, added up */
.plaque { flex: none; min-width: 42px; height: 34px; padding: 0 6px; display: grid; place-items: center; clip-path: polygon(13% 0, 87% 0, 100% 50%, 87% 100%, 13% 100%, 0 50%); background: linear-gradient(180deg, var(--c-l), var(--c) 45%, var(--c-d)); }
.plaque b { font: 700 15px/1 var(--slab); color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,.55); font-variant-numeric: tabular-nums; }
.plaque.drop b { animation: drop .8s ease-out; }
@keyframes drop { 0% { transform: translateY(-7px) scale(1.25); color: #ffe08a; } 100% { transform: none; } }
.grave-btn { flex: none; width: 38px; height: 38px; padding: 8px; border-radius: 10px; border: 1px solid #1a0f05; color: #20242a; cursor: pointer; background: linear-gradient(180deg, #dfe3e8, #9aa1aa 55%, #6a717a); box-shadow: 0 2px 0 #2b2f35, inset 0 1px 0 rgba(255,255,255,.65); }
.grave-btn[aria-expanded="true"] { background: linear-gradient(180deg, #fbe7a6, var(--brass) 55%, #cf9a34); color: #2a1d00; }

/* ---------- the map ---------- */
.board { position: relative; aspect-ratio: 5 / 4; container: board / inline-size; border-radius: 2px; user-select: none; -webkit-user-select: none; touch-action: manipulation;
  box-shadow: 0 0 0 1px rgba(30,18,6,.9), 0 2px 8px rgba(0,0,0,.6); }
.terrain, .edge, .reach, .ink, .pieces, .cells, .fx, .dim { position: absolute; inset: 0; }
.terrain { border-radius: 2px; overflow: hidden; }
.ripple { animation: ripple 5s ease-in-out infinite alternate; }
@keyframes ripple { to { transform: translateX(1.2px); opacity: .3; } }
/* the edge of the map glows in the colour of the side to move */
.edge { z-index: 2; pointer-events: none; transition: box-shadow .35s; box-shadow: inset 0 0 0 0 transparent; }
.app[data-phase="play"][data-turn="p"] .edge { box-shadow: inset 0 0 0 .45cqw rgba(196,44,34,.9), inset 0 0 4.5cqw rgba(196,44,34,.5); }
.app[data-phase="play"][data-turn="c"] .edge { box-shadow: inset 0 0 0 .45cqw rgba(36,86,166,.9), inset 0 0 4.5cqw rgba(36,86,166,.5); }
/* where the chosen piece can go: its squares lit as one area, one outline around all of it */
.reach { z-index: 3; width: 100%; height: 100%; pointer-events: none; overflow: visible; transition: opacity .15s; }
.reach.faint { opacity: .55; }
.reach-fill { fill: rgba(252,214,112,.3); }
.reach-home { fill: rgba(59,40,20,.22); }
.reach-glow { fill: none; stroke: #ffe9a8; stroke-width: 2.4; stroke-linejoin: round; filter: url(#reach-blur); animation: reach-pulse 1.5s ease-in-out infinite alternate; }
.reach-edge { fill: none; stroke: #6b4a12; stroke-width: 1.05; stroke-linejoin: round; }
.reach-line { fill: none; stroke: #fde9a6; stroke-width: .5; stroke-linejoin: round; }
.reach.faint .reach-glow { animation: none; opacity: .4; }
.reach-hit { fill: rgba(196,44,34,.32); stroke: #c22a1e; stroke-width: 1.05; stroke-linejoin: round; }
.reach-hit-line { fill: none; stroke: #ffd3c2; stroke-width: .42; stroke-linejoin: round; animation: reach-pulse .8s ease-in-out infinite alternate; }
@keyframes reach-pulse { from { opacity: .4; } to { opacity: 1; } }
.ink { z-index: 4; pointer-events: none; }
.pieces { z-index: 10; pointer-events: none; }
.cells { z-index: 20; display: grid; grid-template: repeat(10, 1fr) / repeat(10, 1fr); }
.fx { z-index: 30; pointer-events: none; }
.dim { z-index: 35; pointer-events: none; background: rgba(20,12,4,.36); opacity: 0; transition: opacity .2s; }
.board.dimmed .dim { opacity: 1; }
.cell { position: relative; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 0; }
.cell.lake { cursor: default; }
.cell.grab { cursor: grab; touch-action: none; }
.cell:focus-visible { outline: 2px solid #1b1206; outline-offset: -2px; z-index: 2; }
.cell.atk::after { content: ""; position: absolute; inset: 3% 2%; border-radius: 50%; transform: rotate(var(--tilt)); border: .6cqw solid #ffe9a8; box-shadow: 0 0 0 .45cqw #c2180c, inset 0 0 1.6cqw rgba(255,60,30,.85), 0 0 2.2cqw rgba(255,60,30,.8); animation: pop .6s ease-in-out infinite alternate; }
.cell.hover::before { content: ""; position: absolute; inset: 0; background: rgba(255,240,170,.45); box-shadow: inset 0 0 0 .5cqw var(--brass); }
@keyframes pop { from { scale: .86; } to { scale: 1; } }
.deploy-plate { display: none; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 18; pointer-events: none; padding: 1.1cqw 1.8cqw; border-radius: .8cqw; text-align: center; white-space: nowrap;
  font: 700 2.1cqw/1.3 var(--slab); letter-spacing: .16em; text-transform: uppercase; color: #2a1d00;
  background: linear-gradient(180deg, #fbe7a6, var(--brass) 55%, #cf9a34); box-shadow: 0 .4cqw 1cqw rgba(0,0,0,.5), inset 0 0 0 .22cqw rgba(90,61,12,.6), inset 0 .2cqw 0 rgba(255,255,255,.5); }
.app[data-phase="setup"] .deploy-plate { display: block; }
.banner { position: absolute; left: 0; right: 0; top: 50%; z-index: 45; pointer-events: none; padding: 2.6cqw 0; text-align: center; transform: translateY(-50%);
  font: 700 8cqw/1 var(--display); letter-spacing: .08em; text-transform: uppercase; color: #f0c665;
  text-shadow: 0 .15cqw 0 #fff3c9, 0 .5cqw 0 #2a1806, 0 1cqw 2.4cqw rgba(0,0,0,.8);
  background: linear-gradient(90deg, transparent, rgba(20,12,4,.8) 18%, rgba(20,12,4,.8) 82%, transparent); }
.banner.go { animation: banner 1.2s ease both; }
@keyframes banner { 0% { opacity: 0; letter-spacing: .4em; } 22% { opacity: 1; letter-spacing: .08em; } 76% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- pieces: round tokens lying on the map, seen at a slant ---------- */
/* 1em is the width of a square; a square is 0.8em high. */
.pc { position: absolute; left: 0; top: 0; width: 10%; height: 10%; font-size: 10cqw;
  transform: translate(calc(var(--x) * 100%), calc(var(--y) * 100%));
  transition: transform .26s cubic-bezier(.25,.8,.3,1); will-change: transform; }
.mine { --c: #c6241b; --c-l: #f4705a; --c-d: #7d150f; --m: #e3b04b; --m-l: #fff0b8; --m-d: #8a5f17; --m-ink: #2b1a05; }
.foe { --c: #2659b3; --c-l: #7fb0f5; --c-d: #123470; --m: #cdd5de; --m-l: #ffffff; --m-d: #6f7b89; --m-ink: #0f1a2b; }
/* the token's own box: a wide oval, a little smaller than its square so the map shows around it */
.tok { position: absolute; left: .06em; right: .06em; top: .04em; bottom: .06em; transition: transform .15s, filter .15s; filter: drop-shadow(0 .045em .03em rgba(50,30,8,.5)); }
/* its thickness: the near edge of the disc */
.tok::before { content: ""; position: absolute; inset: 0; border-radius: 50%; transform: translateY(.034em) rotate(var(--tilt));
  background: linear-gradient(90deg, var(--c-d), #120a05 55%, var(--c-d)); box-shadow: 0 0 0 .008em rgba(12,7,2,.85); }
/* the rim carries the army's colour: enamel between two fine lines of the army's metal */
.rim { position: absolute; inset: 0; border-radius: 50%; transform: rotate(var(--tilt));
  background:
    repeating-conic-gradient(rgba(255,255,255,.06) 0 3deg, rgba(0,0,0,.07) 3deg 6deg),
    radial-gradient(60% 46% at 30% 12%, rgba(255,255,255,.5), transparent 70%),
    linear-gradient(170deg, var(--c-l) 0%, var(--c) 34%, var(--c) 60%, var(--c-d) 100%);
  box-shadow: 0 0 0 .008em rgba(12,7,2,.9), inset 0 0 0 .013em var(--m), inset 0 -.03em .02em rgba(0,0,0,.4); }
/* the window in the rim, and the painting behind it: the window is tipped, the painting stays upright */
.win { position: absolute; inset: .085em; border-radius: 50%; overflow: hidden; transform: rotate(var(--tilt)); background: #2a1c10;
  box-shadow: 0 0 0 .013em var(--m-l), 0 0 0 .022em rgba(12,7,2,.55); }
.win::after { content: ""; position: absolute; inset: 0; border-radius: 50%; pointer-events: none; box-shadow: inset 0 .035em .05em rgba(0,0,0,.55), inset 0 -.012em .02em rgba(255,255,255,.22); }
/* one frame of the army's sprite sheet (12 frames, strongest rank first, then Bomb and Flag) */
.art { position: absolute; inset: -2.5% -1%; transform: rotate(calc(var(--tilt) * -1));
  background: url(img/army-red.webp) calc(var(--i) * 100% / 11) 0 / 1200% 100% no-repeat #2a1c10; }
.foe .art { background-image: url(img/army-blue.webp); }
.hi { position: absolute; inset: 0; background: center / cover no-repeat; }
/* the rank: a small badge of the army's metal, pinned to the low end of the rim */
.num { position: absolute; left: -.24em; bottom: -.3em; z-index: 1; display: grid; place-items: center; box-sizing: border-box; min-width: 1.3em; height: 1.3em; padding: .06em .14em 0; border-radius: .65em;
  font: 700 .25em/1 var(--slab); font-variant-numeric: lining-nums; letter-spacing: -.02em; color: var(--m-ink);
  background: radial-gradient(circle at 34% 26%, var(--m-l), var(--m) 58%, var(--m-d) 130%);
  box-shadow: 0 0 0 .06em rgba(12,7,2,.92), 0 .09em .12em rgba(0,0,0,.55), inset 0 0 0 .06em rgba(255,255,255,.4), inset 0 0 0 .11em rgba(60,36,6,.22); }
.nm { display: none; }
/* face down: enamel in the army's colour, engine-turned, with the army's star */
.back .win { background:
    repeating-conic-gradient(rgba(255,255,255,.12) 0 5deg, rgba(0,0,0,.12) 5deg 10deg),
    radial-gradient(circle at 42% 34%, var(--c-l), var(--c) 52%, var(--c-d)); }
.emblem { position: absolute; left: 50%; top: 50%; width: .34em; height: .34em; margin: -.17em 0 0 -.17em; color: var(--m-l); filter: drop-shadow(0 .012em 0 rgba(0,0,0,.7)); }
/* one of my pieces that the enemy has already seen */
.seen { position: absolute; right: -.01em; top: -.03em; z-index: 1; width: .23em; height: .23em; padding: .03em; border-radius: 50%; background: var(--brass); color: #3b2a00; box-shadow: 0 0 0 .012em rgba(12,7,2,.8), 0 .015em .03em rgba(0,0,0,.6), inset 0 0 0 .01em rgba(255,255,255,.5); display: none; }
.pc.known .seen { display: block; }
.pc.flagged .tok { filter: drop-shadow(0 0 .025em #fff) drop-shadow(0 0 .09em var(--brass-l)) drop-shadow(0 0 .2em var(--brass)); }
.pc.flagged::after { content: ""; position: absolute; inset: -.04em -.03em; border-radius: 50%; transform: rotate(var(--tilt)); border: .03em solid var(--brass-l); box-shadow: 0 0 .12em var(--brass); animation: reach-pulse .9s ease-in-out infinite alternate; pointer-events: none; }
.pc.sel { z-index: 15 !important; }
.pc.sel .tok { transform: translateY(-.1em) scale(1.12); filter: drop-shadow(0 0 .02em #fff) drop-shadow(0 0 .05em var(--brass-l)) drop-shadow(0 0 .11em var(--brass)) drop-shadow(0 .13em .07em rgba(50,30,8,.6)); }
.pc.lunge { z-index: 16 !important; transition-timing-function: cubic-bezier(.5,0,.8,.4); }
.flip .tok { animation: flip .45s ease-out; }
@keyframes flip { 0% { transform: rotateY(90deg) scale(1.1); filter: brightness(1.8); } 60% { transform: rotateY(0) scale(1.1); } 100% { transform: none; } }
.pc.dying { z-index: 14 !important; }
.pc.dying .tok { animation: die .38s ease-in forwards; transform-origin: 50% 100%; }
@keyframes die { 25% { transform: rotate(-8deg); filter: brightness(1.6) saturate(.3); } 100% { transform: rotate(-86deg) translateY(.2em) scale(.8); opacity: 0; filter: saturate(0); } }

@container board (min-width: 520px) {
  .num { font-size: .2em; }
}

.pc.ready .tok { filter: drop-shadow(0 0 .02em rgba(255,238,176,.95)) drop-shadow(0 .045em .03em rgba(50,30,8,.5)); }
.pc.dragging { transition: none; z-index: 18 !important; }
.pc.dragging .tok { transform: scale(1.2); filter: drop-shadow(0 0 .03em #fff) drop-shadow(0 .2em .11em rgba(30,18,6,.6)); }
.pc.nudge .tok { animation: nudge .3s; }
@keyframes nudge { 20% { transform: translateX(-.07em); } 45% { transform: translateX(.07em); } 70% { transform: translateX(-.04em); } }

/* ---------- a fight: both pieces brought forward, the hidden one turned, the verdict held ---------- */
.clash { position: absolute; z-index: 40; transform: translate(-50%, -50%); display: flex; align-items: flex-end; gap: .6cqw; pointer-events: none; }
.clash-pc { position: relative; width: 1em; height: .8em; font-size: 29cqw; animation: clash-in .22s cubic-bezier(.2,1.4,.4,1) both; transition: transform .25s, filter .25s; }
.clash-pc.mine { transform-origin: 100% 100%; } .clash-pc.foe { transform-origin: 0 100%; }
@keyframes clash-in { from { transform: scale(.45); opacity: 0; } }
.clash-pc .num { font-size: .12em; left: -.1em; bottom: -.2em; }
.clash-pc .nm { display: block; position: absolute; left: 50%; bottom: -.035em; z-index: 1; transform: translateX(-50%); padding: .016em .05em .012em; border-radius: .02em; white-space: nowrap;
  font: 700 .058em/1.25 var(--slab); letter-spacing: .14em; text-transform: uppercase; color: var(--m-ink);
  background: linear-gradient(180deg, var(--m-l), var(--m) 70%); box-shadow: 0 0 0 .007em rgba(12,7,2,.9), 0 .012em .02em rgba(0,0,0,.5), inset 0 0 0 .006em rgba(255,255,255,.5); }
.clash-pc.crack::before { content: ""; position: absolute; inset: -18%; z-index: 3; border-radius: 50%; background: radial-gradient(circle, #fff 0%, rgba(255,232,150,.85) 28%, transparent 66%); animation: flash .32s ease-out forwards; }
.clash-pc.won { transform: translateY(-6%) scale(1.09); z-index: 2; }
.clash-pc.won .tok { filter: drop-shadow(0 0 .03em #fff) drop-shadow(0 0 .1em var(--brass)); }
.clash-pc.fell { filter: grayscale(.85) brightness(.82); }
.clash-pc.gone { animation: topple-l .34s ease-in forwards; }
.clash-pc.foe.gone { animation-name: topple-r; }
@keyframes topple-l { to { transform: rotate(-82deg) translateY(.12em) scale(.8); opacity: 0; } }
@keyframes topple-r { to { transform: rotate(82deg) translateY(.12em) scale(.8); opacity: 0; } }
.clash-pc.gone::after { content: ""; position: absolute; inset: -12%; border-radius: 50%; background: radial-gradient(circle, rgba(66,56,50,.9), rgba(66,56,50,.55) 42%, transparent 70%); animation: puff .45s ease-out forwards; }
@keyframes puff { from { transform: scale(.4); opacity: .95; } to { transform: scale(1.5); opacity: 0; } }
/* the verdict in words: always centred on the map, just under the pieces (or above them near the bottom edge) */
.clash-text { position: absolute; left: 50%; z-index: 41; width: max-content; max-width: 88cqw; margin: 0; padding: 1.1cqw 2.6cqw; border-radius: 1cqw; text-align: center; pointer-events: none; text-wrap: balance; transform: translate(-50%, 14.6cqw); font: 700 clamp(13px, 3.2cqw, 21px)/1.25 var(--serif); color: var(--sepia);
  background: linear-gradient(175deg, #f4e6bf, #dcc591); box-shadow: 0 .5cqw 1.6cqw rgba(0,0,0,.55), inset 0 0 0 .18cqw rgba(59,40,20,.5); }
.clash-text.above { transform: translate(-50%, calc(-100% - 14cqw)); }
.board.shake { animation: shake .4s; }
@keyframes shake { 20% { transform: translate(-.6%, .4%); } 40% { transform: translate(.6%, -.5%); } 60% { transform: translate(-.4%, -.3%); } 80% { transform: translate(.3%, .2%); } }

.burst { position: absolute; left: 0; top: 0; width: 10%; height: 10%; transform: translate(calc(var(--x) * 100%), calc(var(--y) * 100%)); }
.burst::before { content: ""; position: absolute; inset: -30%; border-radius: 50%; background: radial-gradient(circle, #fff 0%, #ffe08a 30%, rgba(255,120,40,.7) 55%, transparent 70%); animation: flash .55s ease-out forwards; }
.burst.boom::before { inset: -110%; animation-duration: .85s; background: radial-gradient(circle, #fff 0%, #ffd27a 25%, rgba(230,80,20,.8) 50%, rgba(60,40,30,.5) 62%, transparent 72%); }
.burst.flag::before { background: radial-gradient(circle, #fff 0%, #fff3b0 35%, rgba(227,176,75,.8) 55%, transparent 72%); inset: -130%; animation-duration: 1s; }
.burst i { position: absolute; left: 46%; top: 46%; width: 8%; height: 8%; border-radius: 50%; background: #c2580c; animation: spark .6s ease-out forwards; }
.burst.boom i { background: #3b2814; animation-duration: .85s; }
.burst i:nth-child(1) { --dx: 0; --dy: -1; } .burst i:nth-child(2) { --dx: .7; --dy: -.7; } .burst i:nth-child(3) { --dx: 1; --dy: 0; } .burst i:nth-child(4) { --dx: .7; --dy: .7; }
.burst i:nth-child(5) { --dx: 0; --dy: 1; } .burst i:nth-child(6) { --dx: -.7; --dy: .7; } .burst i:nth-child(7) { --dx: -1; --dy: 0; } .burst i:nth-child(8) { --dx: -.7; --dy: -.7; }
@keyframes flash { from { transform: scale(.2); opacity: 1; } to { transform: scale(1.25); opacity: 0; } }
@keyframes spark { to { transform: translate(calc(var(--dx) * 900%), calc(var(--dy) * 900%)) scale(.2); opacity: 0; } }

/* ---------- side panels ---------- */
.side { display: flex; flex-direction: column; gap: 7px; }
.panel { background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 7px; box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 6px 16px rgba(0,0,0,.3); }
.app[data-phase="setup"] .play-only, .app:not([data-phase="setup"]) .setup-only { display: none; }
.row { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.lbl { margin: 0; font: 700 10px/1.2 var(--slab); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.lbl:not(:first-child) { margin-top: 3px; }
.foes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.foes button { display: grid; grid-template-columns: 40px 1fr; grid-template-rows: auto auto; column-gap: 6px; align-items: center; text-align: left; min-height: 48px; padding: 6px 4px 6px 6px; border-radius: 10px; border: 1px solid var(--line); background: #1a130c; cursor: pointer; color: var(--muted); min-width: 0; }
.foes .who { grid-row: 1 / 3; width: 40px; height: 40px; border-radius: 8px; box-shadow: 0 0 0 1px rgba(20,12,4,.7), 0 1px 3px rgba(0,0,0,.45); filter: saturate(.8) brightness(.92); transition: filter .2s; }
.foes button[aria-checked="true"] .who { filter: none; box-shadow: 0 0 0 1.5px var(--brass-l), 0 2px 5px rgba(0,0,0,.5); }
.foe-name { font: 700 11.5px/1.15 var(--slab); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.foe-lv { display: flex; align-items: center; gap: 4px; font-size: 11px; }
.stars { display: inline-flex; } .stars svg { width: 9px; height: 9px; color: var(--brass); }
.foes button:hover { border-color: var(--brass-d); }
.foes button[aria-checked="true"] { border-color: var(--brass); background: linear-gradient(180deg, #4a3518, #2c200f); box-shadow: 0 0 0 1px var(--brass), 0 3px 8px rgba(0,0,0,.4); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: #1a130c; border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { min-height: 36px; padding: 0 2px; border: 0; border-radius: 7px; background: none; color: var(--muted); font: 700 12.5px/1 var(--slab); letter-spacing: .02em; cursor: pointer; white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button[aria-checked="true"] { color: #2a1d00; background: linear-gradient(180deg, var(--brass-l), var(--brass)); box-shadow: 0 1px 0 rgba(255,255,255,.5) inset, 0 2px 5px rgba(0,0,0,.4); }
.hint { margin: 0; font: italic 12.5px/1.35 var(--serif); color: var(--muted); min-height: 1.35em; }
.wide-only { display: none; }
.btn { min-height: 44px; padding: 0 14px; border-radius: 11px; border: 1px solid var(--line); background: var(--panel2); font: 700 14px/1.1 var(--slab); letter-spacing: .02em; cursor: pointer; }
.btn:hover:not(:disabled) { background: #3d2f20; border-color: var(--brass-d); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.small { min-height: 36px; font-size: 12px; padding: 0 6px; color: var(--ink); }
.btn.small[aria-pressed="true"] { border-color: var(--brass); color: var(--brass-l); }
.btn.primary { color: #2a1d00; border: 0; background: linear-gradient(180deg, #fbe7a6, var(--brass) 55%, #cf9a34); box-shadow: 0 4px 0 var(--brass-d), 0 10px 22px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.6), inset 0 0 0 1px rgba(90,61,12,.5); text-transform: uppercase; letter-spacing: .14em; }
.btn.primary:hover { filter: brightness(1.06); }
/* the plain .btn:hover rule above is more specific than .btn.primary and would paint the gold button dark */
.btn.primary:hover:not(:disabled) { background: linear-gradient(180deg, #fbe7a6, var(--brass) 55%, #cf9a34); border-color: transparent; }
.btn.primary:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--brass-d); }
.btn.big { min-height: 50px; font-size: 15px; margin: 3px 0 4px; }

.guide { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 0 12px; font-size: 13.5px; color: #dccfb4; }
.guide summary { cursor: pointer; padding: 11px 0; font: 700 13px/1.2 var(--slab); letter-spacing: .03em; color: var(--ink); }
.guide ul { margin: 0 0 12px; padding-left: 18px; display: grid; gap: 5px; }


/* the aide's note */
.log { position: relative; margin: 0; min-height: 46px; padding: 7px 11px 7px 52px; display: flex; align-items: center; border-radius: 8px; font: 600 13.5px/1.3 var(--serif); color: var(--sepia);
  background: linear-gradient(175deg, #efdfb6, #dcc591); border-left: 4px solid var(--brass-d); box-shadow: inset 0 0 12px rgba(92,56,16,.35), 0 3px 8px rgba(0,0,0,.3); }
.log p { margin: 0; flex: 1 1 60%; min-width: 0; }
.log p:empty::before { content: "\00a0"; }
.app[data-phase="setup"] .log:not(.tip) { display: none; }
/* a lesson, or a second thought before a costly move */
.log.tip, .log.warn { flex-wrap: wrap; gap: 6px 10px; padding-top: 9px; padding-bottom: 9px; animation: aide-in .3s cubic-bezier(.2,1.3,.4,1); }
.log.tip { box-shadow: 0 0 0 2px var(--brass), 0 0 18px rgba(227,176,75,.45), inset 0 0 12px rgba(92,56,16,.35); }
.log.warn { border-left-color: var(--red); box-shadow: 0 0 0 2px var(--red-l), 0 0 18px rgba(223,90,72,.45), inset 0 0 12px rgba(92,56,16,.35); }
@keyframes aide-in { from { transform: translateY(6px); opacity: 0; } }
.aide-actions { display: flex; align-items: center; gap: 4px 12px; flex-wrap: wrap; }
.aide-actions .btn.small { min-height: 30px; padding: 0 12px; color: #f1dfb4; background: linear-gradient(180deg, #5a3620, #3a2012); border-color: #1f1108; letter-spacing: .06em; text-transform: uppercase; font-size: 10.5px; }
.aide-actions .link { color: #5a3410; padding: 4px 2px; font-size: 11.5px; }
.app.point-grave .grave-btn, .app.point-grave .grave { outline: 2px solid var(--brass-l); outline-offset: 2px; animation: reach-pulse .7s ease-in-out infinite alternate; }
/* the aide's pointer on the map */
.tip-mark { position: absolute; left: 0; top: 0; width: 10%; height: 10%; transform: translate(calc(var(--x) * 100%), calc(var(--y) * 100%)); pointer-events: none; }
.tip-mark::before { content: ""; position: absolute; inset: -5% -3%; border-radius: 50%; transform: rotate(var(--tilt)); border: .45cqw solid var(--brass-l); box-shadow: 0 0 1.6cqw var(--brass), inset 0 0 1cqw rgba(247,220,143,.55); animation: reach-pulse .8s ease-in-out infinite alternate; }
.tip-mark::after { content: ""; position: absolute; left: 50%; top: -30%; width: 2.6cqw; height: 2.1cqw; margin-left: -1.3cqw; background: linear-gradient(180deg, #fff3c4, var(--brass)); clip-path: polygon(0 0, 100% 0, 50% 100%); filter: drop-shadow(0 .25cqw 0 #3a2608); animation: tip-bob .55s ease-in-out infinite alternate; }
@keyframes tip-bob { to { transform: translateY(-.9cqw); } }
/* the aide who writes the notes */
.log::after { content: ""; position: absolute; left: 8px; top: 50%; width: 34px; height: 34px; transform: translateY(-50%); border-radius: 50%; background: #2a1c10 url(img/people/aide.webp) center / cover no-repeat; box-shadow: 0 0 0 1.5px var(--brass-d), 0 1px 3px rgba(0,0,0,.45); }
/* pieces left, rank by rank. A drawer on a phone, a fixed panel on a wide screen. */
.grave { position: absolute; left: 0; right: 0; bottom: 0; z-index: 50; display: grid; gap: 8px; padding: 10px 9px calc(12px + env(safe-area-inset-bottom));
  border: 1px solid var(--line); border-radius: 14px 14px 0 0; background: linear-gradient(180deg, var(--panel2), var(--panel)); box-shadow: 0 -12px 30px rgba(0,0,0,.65);
  transform: translateY(106%); visibility: hidden; transition: transform .28s cubic-bezier(.2,.8,.3,1), visibility 0s .28s; }
.app.grave-open .grave { transform: none; visibility: visible; transition: transform .28s cubic-bezier(.2,.8,.3,1); }
.grave-head { display: flex; align-items: center; justify-content: space-between; }
.mini-btn { width: 30px; height: 30px; padding: 7px; }
.grave-row { display: grid; gap: 4px; }
.grave-who { display: flex; justify-content: space-between; font: 700 10px/1.2 var(--slab); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.grave-who b { color: var(--ink); }
.grave-row ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px; }
.app[data-mode="skirmish"] .grave-row ul { grid-template-columns: repeat(7, 1fr); }
.grave-row li { display: grid; justify-items: center; gap: 5px; padding: 5px 0 4px; min-width: 0; border-radius: 6px; background: rgba(0,0,0,.3); }
.mini { position: relative; width: 36px; max-width: calc(100% - 8px); aspect-ratio: 1.26; }
.mini .win { inset: 3px; box-shadow: 0 0 0 .7px var(--m-l); }
.mini .win::after { display: none; }
.mini .num { left: -4px; bottom: -4px; font-size: 8.5px; box-shadow: 0 0 0 1px rgba(12,7,2,.92), inset 0 0 0 .5px rgba(255,255,255,.4); }
.gc { font: 700 11px/1 var(--slab); font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; }
.gc i { font-style: normal; font-size: 9px; opacity: .55; }
.grave-row li.out { opacity: .36; }
.grave-row li.chg { animation: chg 1.1s; }
@keyframes chg { 0%, 45% { background: var(--brass); } }

/* ---------- result ---------- */
.overlay { position: absolute; inset: 0; z-index: 60; display: grid; place-items: center; padding: 14px; background: rgba(12,8,4,.74); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: fade .35s ease-out; overflow: hidden; }
@keyframes fade { from { opacity: 0; } }
.result-card { position: relative; width: min(100%, 390px); padding: 22px 18px 16px; text-align: center; border-radius: 16px; border: 1px solid var(--brass);
  background: linear-gradient(180deg, #3a2c1c, #1f170f); box-shadow: 0 24px 60px rgba(0,0,0,.75), inset 0 1px 0 rgba(255,255,255,.12), inset 0 0 0 4px rgba(227,176,75,.12); animation: rise .5s cubic-bezier(.2,1.2,.3,1); }
.overlay[data-kind="lose"] .result-card { border-color: #6f8fc4; }
@keyframes rise { from { transform: translateY(26px) scale(.92); opacity: 0; } }
.medal { width: 96px; height: 92px; margin: -4px auto 4px; filter: drop-shadow(0 6px 10px rgba(0,0,0,.5)); animation: medal .8s cubic-bezier(.2,1.4,.3,1) .15s backwards; }
@keyframes medal { from { transform: scale(.3) rotate(-25deg); opacity: 0; } }
.result-card h2 { margin: 0; font: 700 44px/1.05 var(--display); letter-spacing: .02em; color: var(--brass-l); }
.overlay[data-kind="lose"] h2 { color: #a9c4ef; }
.overlay[data-kind="draw"] h2 { color: var(--ink); }
.result-card p { margin: 8px 0 0; color: #dccfb4; font-family: var(--serif); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 16px 0 10px; }
.stats div { background: #1a130c; border: 1px solid var(--line); border-radius: 10px; padding: 8px 2px; }
.stats dt { font: 700 9px/1.2 var(--slab); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.stats dd { margin: 4px 0 0; font: 700 20px/1 var(--slab); font-variant-numeric: tabular-nums; }
.report { margin: 2px 0 10px; padding: 9px 12px 10px; text-align: left; border-radius: 10px; background: #1a130c; border: 1px solid var(--line); }
.report h3 { margin: 0 0 6px; }
.report ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; font: 13px/1.3 var(--serif); color: #e6d9bb; }
.report li { padding-left: 13px; position: relative; }
.report li::before { content: ""; position: absolute; left: 0; top: .5em; width: 5px; height: 5px; background: var(--brass); transform: rotate(45deg); }
.report-line { display: block; width: 100%; padding: 1px 0; border: 0; background: none; text-align: left; font: inherit; color: inherit; cursor: pointer; border-radius: 3px; }
.report-line:hover { color: var(--brass-l); text-decoration: underline; text-underline-offset: 3px; }
.record { font-size: 13px; color: var(--muted) !important; font-style: italic; }
/* medals: a brass disc with a drawing; grey until earned */
.medal-i { flex: none; display: block; width: 30px; height: 30px; padding: 6px; border-radius: 50%; color: #3b2a00; background: radial-gradient(circle at 35% 28%, #fff0b8, var(--brass) 52%, var(--brass-d)); box-shadow: 0 0 0 1.5px #3a2608, 0 2px 4px rgba(0,0,0,.45), inset 0 0 0 1.5px rgba(255,255,255,.35); }
.earned { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 12px; }
.earned li { display: flex; align-items: center; gap: 7px; font: 700 12px/1.1 var(--slab); color: var(--brass-l); animation: medal .7s cubic-bezier(.2,1.4,.3,1) .5s backwards; }
/* replay: a slider and five keys */
.replay-bar { gap: 8px; }
.replay-bar input[type="range"] { width: 100%; height: 24px; margin: 0; accent-color: var(--brass); cursor: pointer; }
.replay-keys { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.replay-keys .btn { min-height: 38px; padding: 9px 0; display: grid; place-items: center; }
.replay-keys svg { width: 18px; height: 18px; }
/* the record book */
.sheet.records-sheet { z-index: 94; }
.records-sheet .sheet-card { width: min(100%, 520px); gap: 10px; }
.records-sheet .lbl { color: #5a3410; margin-top: 4px; }
.rec-foes, .rec-medals, .rec-recent { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rec-foes li { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 9px; font-size: 13.5px; color: #3b2814; }
.rec-foes .who { width: 34px; height: 34px; border-radius: 50%; box-shadow: 0 0 0 1.5px var(--brass-d); }
.rec-foes b, .rec-medals b { font: 700 13px/1.15 var(--slab); color: #2a1806; }
.rec-facts { margin: 0; font-size: 13px; line-height: 1.4; color: #3b2814; }
.rec-medals { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 10px; }
.rec-medals li { display: grid; grid-template-columns: 30px 1fr; column-gap: 8px; align-items: center; font-size: 11.5px; line-height: 1.25; color: #4a321a; }
.rec-medals .medal-i { grid-row: 1 / 3; }
.rec-medals li:not(.got) { opacity: .55; }
.rec-medals li:not(.got) .medal-i { background: #8d7a58; color: #4a3a22; box-shadow: 0 0 0 1.5px #5c4a2e, inset 0 1px 2px rgba(0,0,0,.4); }
.rec-recent li { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; font-size: 13px; color: #3b2814; }
.rec-recent .btn.small { min-height: 30px; padding: 0 12px; color: #f1dfb4; background: linear-gradient(180deg, #5a3620, #3a2012); border-color: #1f1108; }
.title-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 0 16px; }
.war-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.war-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 5px; align-items: center; }
.war-list input { min-width: 0; height: 32px; padding: 0 9px; border-radius: 7px; border: 1px solid rgba(59,40,20,.55); background: rgba(255,250,232,.6); color: #2a1806; font: 700 13px/1 var(--slab); }
.war-list input::placeholder { color: rgba(59,40,20,.55); font-weight: 400; }
.war-list .btn.small { min-height: 32px; padding: 0 9px; color: #f1dfb4; background: linear-gradient(180deg, #5a3620, #3a2012); border-color: #1f1108; font-size: 11.5px; }
.records-sheet .sheet-card > .btn:not(.primary) { color: #f1dfb4; background: linear-gradient(180deg, #5a3620, #3a2012); border-color: #1f1108; }
/* scenarios: a road of ten numbered stops, a briefing, and the aims shown during play */
.rocks { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; pointer-events: none; }
.scen-list { list-style: none; margin: 0; padding: 0 0 0 2px; display: grid; gap: 4px; position: relative; }
.scen-list::before { content: ""; position: absolute; left: 17px; top: 18px; bottom: 18px; border-left: 2px dashed rgba(90,52,16,.5); }
.scen-list button { position: relative; display: grid; grid-template-columns: 32px 1fr auto; align-items: center; gap: 10px; width: 100%; padding: 4px 8px 4px 0; border: 1px solid transparent; border-radius: 8px; background: none; text-align: left; cursor: pointer; color: #3b2814; font: inherit; }
.scen-list button:hover:not(:disabled), .scen-list button[aria-current="true"] { background: rgba(125,26,20,.1); border-color: rgba(90,16,12,.45); }
.scen-list button:disabled { cursor: default; opacity: .5; }
.scen-n { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; font: 700 14px/1 var(--slab); color: #3b2a00; background: radial-gradient(circle at 35% 28%, #fff0b8, var(--brass) 52%, var(--brass-d)); box-shadow: 0 0 0 1.5px #3a2608, 0 2px 4px rgba(0,0,0,.4); }
.scen-list button:disabled .scen-n { background: #8d7a58; }
.scen-t { display: grid; gap: 1px; min-width: 0; font-size: 12px; line-height: 1.25; }
.scen-t b { font: 700 13.5px/1.15 var(--slab); color: #2a1806; }
.scen-s, .stars-row { display: flex; gap: 2px; }
.scen-s i, .stars-row span { display: block; width: 15px; height: 15px; color: rgba(59,40,20,.25); }
.scen-s i.on { color: #9a6f1e; }
.scen-brief { padding: 10px 12px 12px; border-radius: 8px; background: rgba(59,40,20,.1); box-shadow: inset 0 0 0 1px rgba(59,40,20,.4); display: grid; gap: 8px; }
.scen-brief h3 { margin: 0; font: 700 19px/1.1 var(--display); color: #5a100c; }
.scen-brief p { margin: 0; font-size: 13.5px; line-height: 1.4; color: #3b2814; }
.scen-brief ul, .goals ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: 13px; line-height: 1.3; }
.scen-brief li, .goals li { position: relative; padding-left: 20px; }
.scen-brief li::before, .goals li::before { content: ""; position: absolute; left: 2px; top: .22em; width: 11px; height: 11px; border-radius: 2px; box-shadow: inset 0 0 0 1.5px currentColor; opacity: .7; }
.scen-brief li:first-child, .goals li.main { font-weight: 700; }
.goals { gap: 6px; padding: 9px 11px; }
.goals li { color: #dccfb4; }
.goals li.yes { color: #9fd8a4; } .goals li.no { color: #e59a8c; text-decoration: line-through; text-decoration-thickness: 1px; }
.goals li.yes::before { box-shadow: none; opacity: 1; background: #3f9a52; clip-path: polygon(12% 52%, 38% 78%, 88% 16%, 100% 28%, 38% 100%, 0 64%); }
.goals li.no::before { box-shadow: none; opacity: 1; background: #d5604c; clip-path: polygon(14% 0, 50% 36%, 86% 0, 100% 14%, 64% 50%, 100% 86%, 86% 100%, 50% 64%, 14% 100%, 0 86%, 36% 50%, 0 14%); }
.stars-row { justify-content: center; gap: 6px; margin: 4px 0 2px; }
.stars-row span { width: 26px; height: 26px; color: rgba(255,255,255,.14); }
.stars-row span.on { color: var(--brass-l); filter: drop-shadow(0 0 5px rgba(227,176,75,.7)); animation: medal .6s cubic-bezier(.2,1.4,.3,1) backwards; }
.stars-row span.on:nth-child(2) { animation-delay: .25s; } .stars-row span.on:nth-child(3) { animation-delay: .5s; }
.result-actions { display: grid; gap: 8px; margin-top: 14px; }
.result-actions .btn:not(.primary) { font-size: 13.5px; padding: 0 6px; }
.confetti { position: absolute; inset: 0; pointer-events: none; }
.confetti i { position: absolute; top: -12px; width: 8px; height: 13px; border-radius: 2px; animation: fall linear infinite; }
@keyframes fall { to { top: 105%; transform: rotate(720deg) translateX(30px); } }

/* ---------- title screen: a painting, lit like a lamp-lit tent ---------- */
.title-screen { position: absolute; inset: 0; z-index: 80; display: flex; flex-direction: column; align-items: center; justify-content: space-between; overflow: hidden auto; background: #0b0806; transition: opacity .7s ease-in, transform 1.2s cubic-bezier(.5,0,.8,.4); }
.title-screen.leaving { opacity: 0; transform: scale(1.5); pointer-events: none; transform-origin: 50% 55%; }
.scene { position: absolute; inset: 0; overflow: hidden; animation: scene-in 2s ease-out both; }
.scene img { position: absolute; left: -10%; width: 120%; top: -24%; height: 112%; object-fit: cover; object-position: 50% 50%; filter: sepia(.38) saturate(.95) contrast(1.16) brightness(.6); animation: push 38s ease-in-out infinite alternate; }
@keyframes scene-in { from { opacity: 0; } }
@keyframes push { from { transform: scale(1) translateX(-.6%); } to { transform: scale(1.07) translateX(.8%); } }
/* lamp light, then the dark of the tent closing in */
.light { position: absolute; inset: 0; background: radial-gradient(70% 40% at 50% 44%, rgba(255,176,84,.42), rgba(190,90,30,.16) 55%, transparent 78%); mix-blend-mode: soft-light; animation: lamp 4.6s ease-in-out infinite alternate; }
@keyframes lamp { 0% { opacity: .82; } 35% { opacity: 1; } 60% { opacity: .88; } 100% { opacity: .96; } }
.shade { position: absolute; inset: 0; background:
    linear-gradient(180deg, rgba(9,6,4,.92) 0%, rgba(9,6,4,.6) 16%, transparent 34%, transparent 58%, rgba(9,6,4,.8) 80%, #0b0806 100%),
    radial-gradient(120% 90% at 50% 50%, transparent 46%, rgba(6,4,2,.82) 100%); }
.grainy { position: absolute; inset: 0; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='2' seed='9'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .55 -.12'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23g)'/%3E%3C/svg%3E"); opacity: .5; mix-blend-mode: overlay; }
.smoke { position: absolute; left: -30%; right: -30%; top: 22%; height: 40%; opacity: .34; filter: blur(26px); mix-blend-mode: screen;
  background: radial-gradient(28% 40% at 22% 60%, rgba(235,215,185,.8), transparent 70%), radial-gradient(34% 46% at 58% 46%, rgba(215,190,160,.7), transparent 72%), radial-gradient(26% 36% at 84% 66%, rgba(240,220,190,.7), transparent 70%);
  animation: drift 34s ease-in-out infinite alternate; }
.smoke.two { top: 36%; opacity: .26; animation-duration: 47s; animation-direction: alternate-reverse; }
@keyframes drift { from { transform: translateX(-9%); } to { transform: translateX(9%); } }
.title-tools { position: absolute; top: 8px; right: 8px; display: flex; gap: 8px; z-index: 2; }
.title-tools .icon-btn { background: rgba(20,14,10,.6); border-color: rgba(227,176,75,.4); color: var(--paper); }
/* the way to an account, always in sight on the title screen (only where the page offers accounts) */
.acct-chip { height: 40px; padding: 0 15px; border-radius: 20px; border: 1px solid rgba(227,176,75,.7); background: rgba(20,14,10,.72); color: var(--brass-l); cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px; font: 700 12.5px/1 var(--slab); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; box-shadow: 0 2px 10px rgba(0,0,0,.45); }
.acct-chip[hidden] { display: none; }
.acct-chip:hover { background: rgba(70,50,24,.9); border-color: var(--brass-l); color: #fff3d6; }
.acct-chip:focus-visible { outline: 2px solid var(--brass-l); outline-offset: 2px; }
/* signed in: a brass disc with the first letter of the address and a green dot, then the part of the address before the @ */
.acct-chip.in { padding: 0 14px 0 5px; border-color: var(--brass-l); background: rgba(34,24,14,.86); color: #fff3d6; letter-spacing: .02em; text-transform: none; font-size: 13.5px; }
.acct-chip-text { display: block; max-width: 13ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-ava { position: relative; flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; font: 800 15px/1 var(--slab); letter-spacing: 0; text-transform: uppercase;
  color: #2a1806; background: radial-gradient(circle at 34% 28%, #fbe7a6, #e3b04b 58%, #a87420); box-shadow: inset 0 0 0 1px rgba(60,38,8,.55), 0 1px 3px rgba(0,0,0,.45); }
.acct-ava[hidden] { display: none; }
.acct-ava::after { content: ""; position: absolute; right: -2px; bottom: -2px; width: 10px; height: 10px; border-radius: 50%; background: #5fc04a; box-shadow: 0 0 0 2px #1a120b; }
.title-head { position: relative; flex: 0 0 auto; display: grid; justify-items: center; gap: 6px; padding: max(46px, 7cqh) 14px 6px; text-align: center; }
.title-head p, .title-head h1 { margin: 0; }
/* the name, struck in brass */
.wordmark { white-space: nowrap; font: 700 clamp(30px, 11cqw, 96px)/1.06 var(--display); letter-spacing: -.01em; color: #f0c665;
  background: linear-gradient(180deg, #fff6d2 0%, #f3d27c 34%, #b9862a 52%, #f0c665 70%, #8a5f17 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 1px 0 #fff3c9) drop-shadow(0 3px 0 #2a1806) drop-shadow(0 6px 14px rgba(0,0,0,.85)); animation: title-in 1.5s cubic-bezier(.2,.7,.2,1) .8s both; }
.wordmark span { font-style: italic; font-weight: 400; }
@keyframes title-in { from { opacity: 0; letter-spacing: .05em; } to { opacity: 1; letter-spacing: -.01em; } }
.tagline { font: italic clamp(14.5px, 3.9cqw, 20px)/1.3 var(--serif); color: var(--paper); text-shadow: 0 1px 8px #000, 0 0 2px #000; animation: line-in .9s ease-out 1.5s both; }
@keyframes line-in { from { opacity: 0; transform: translateY(8px); } }

/* the orders: parchment in a carved frame with brass corners */
.title-menu { position: relative; flex: none; width: min(100% - 20px, 470px); margin: auto 0 10px; padding: 7px; border-radius: 9px; animation: line-in .9s ease-out 1.9s both;
  background: repeating-linear-gradient(91deg, rgba(0,0,0,.2) 0 1px, transparent 1px 5px, rgba(255,255,255,.04) 5px 6px, transparent 6px 13px), linear-gradient(135deg, #7a4d24, #4a2c12 45%, #2f1b0a 75%, #5e3a19);
  box-shadow: 0 18px 40px rgba(0,0,0,.75), inset 0 1px 0 rgba(255,220,160,.35), inset 0 -2px 0 rgba(0,0,0,.6), 0 0 0 1px #140b04; }
.title-menu::before { content: ""; position: absolute; inset: 0; border-radius: 9px; pointer-events: none; z-index: 2; background:
    radial-gradient(circle at 9px 9px, #fff3c4 0 1.5px, var(--brass) 2px 5px, #5a3d0c 5.5px 6.5px, transparent 7px),
    radial-gradient(circle at calc(100% - 9px) 9px, #fff3c4 0 1.5px, var(--brass) 2px 5px, #5a3d0c 5.5px 6.5px, transparent 7px),
    radial-gradient(circle at 9px calc(100% - 9px), #fff3c4 0 1.5px, var(--brass) 2px 5px, #5a3d0c 5.5px 6.5px, transparent 7px),
    radial-gradient(circle at calc(100% - 9px) calc(100% - 9px), #fff3c4 0 1.5px, var(--brass) 2px 5px, #5a3d0c 5.5px 6.5px, transparent 7px); }
.sheet-paper { position: relative; border-radius: 4px; padding: 22px 12px 12px; display: flex; flex-direction: column; gap: 8px; color: var(--sepia);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='320' height='320'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.035' numOctaves='5' seed='4'/%3E%3CfeColorMatrix values='0 0 0 0 .36 0 0 0 0 .22 0 0 0 0 .07 0 0 0 1.1 -.42'/%3E%3C/filter%3E%3Crect width='320' height='320' filter='url(%23n)'/%3E%3C/svg%3E"), linear-gradient(175deg, #efdfb6, #dcc591 60%, #cdb279);
  box-shadow: inset 0 0 0 1px rgba(59,40,20,.55), inset 0 0 26px rgba(92,56,16,.55), inset 0 0 70px rgba(92,56,16,.25); }
/* leather label, stitched */
.title-menu .lbl { position: absolute; left: 50%; top: -4px; transform: translateX(-50%); z-index: 3; margin: 0; padding: 6px 16px 7px; white-space: nowrap; border-radius: 3px 3px 7px 7px; color: #f1dfb4; opacity: 1; font: 700 10px/1 var(--slab); letter-spacing: .22em;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='2' seed='9'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .55 -.12'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23g)'/%3E%3C/svg%3E"), linear-gradient(180deg, #5a3620, #3a2012); box-shadow: 0 3px 6px rgba(0,0,0,.55), inset 0 0 0 1px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,220,170,.25); outline: 1px dashed rgba(241,223,180,.45); outline-offset: -4px; }
.title-menu .foes button { background: linear-gradient(180deg, rgba(255,250,232,.5), rgba(214,190,140,.35)); border: 1px solid rgba(59,40,20,.5); color: rgba(59,40,20,.8); box-shadow: inset 0 1px 0 rgba(255,255,255,.5); }
.title-menu .foe-name { color: var(--sepia); }
.title-menu .stars svg { color: #9a6f1e; }
.title-menu .foes button[aria-checked="true"] { background: linear-gradient(180deg, #7d1a14, #5a100c); border-color: #2c0705; color: #f1dfb4; box-shadow: 0 0 0 2px var(--brass), 0 4px 10px rgba(40,20,5,.55), inset 0 1px 0 rgba(255,255,255,.25); }
.title-menu .foes button[aria-checked="true"] .foe-name { color: #fff3d6; }
.title-menu .foes button[aria-checked="true"] .stars svg { color: var(--brass-l); }
.title-menu .hint { text-align: center; color: #4a321a; min-height: 2.7em; font-size: 13.5px; }
.title-menu .seg { background: rgba(59,40,20,.14); border-color: rgba(59,40,20,.5); }
.title-menu .seg button { color: #4a321a; min-height: 34px; font-size: 12px; }
.title-menu .seg button:hover { color: #2a1806; }
.title-menu .seg button[aria-checked="true"] { color: #fff3d6; background: linear-gradient(180deg, #7d1a14, #5a100c); box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 2px 5px rgba(40,20,5,.45); }
.title-menu .hint.center { min-height: 0; margin-top: -2px; }
.title-menu .btn:not(.primary):not(.ghost) { color: #f1dfb4; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='2' seed='9'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .55 -.12'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23g)'/%3E%3C/svg%3E"), linear-gradient(180deg, #5a3620, #3a2012); border-color: #1f1108; font-size: 12.5px; letter-spacing: .12em; text-transform: uppercase; }
.btn.ghost:hover:not(:disabled) { background: none; border-color: transparent; color: #2a1806; }
.btn.ghost { background: none; border: 0; color: #5a3410; align-self: center; padding: 0 12px; min-height: 34px; text-decoration: underline; text-underline-offset: 3px; font-family: var(--serif); font-style: italic; font-size: 14px; }
.fine { position: relative; margin: 0 0 calc(10px + env(safe-area-inset-bottom)); text-align: center; font: 700 9.5px/1.2 var(--slab); letter-spacing: .24em; text-transform: uppercase; color: #cdb98c; text-shadow: 0 1px 3px #000; animation: line-in .9s ease-out 2.2s both; }
/* saving progress to an account: one quiet line where it is offered, and its sheet */
/* signed in, that line is one row: dot, "Signed in as", the address in bold (cut short if too long), and the way to the account */
.acct-line.in { display: flex; justify-content: center; align-items: baseline; gap: 8px; max-width: 100%; }
.acct-line.in > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-line.in > span b { font-style: normal; font-weight: 700; color: #2a1806; }
.acct-line.in .btn.ghost { flex: 0 0 auto; }
.acct-dot { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: #3f9a2f; box-shadow: 0 0 0 2px rgba(63,154,47,.22); vertical-align: 1px; }
/* in the account sheet: the mark, "Signed in", and the address on a line of its own */
.acct-id { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; background: rgba(255,250,232,.55); border: 1px solid rgba(59,40,20,.3); min-width: 0; }
.acct-id .acct-ava { width: 44px; height: 44px; font-size: 21px; }
.acct-id .acct-ava::after { width: 12px; height: 12px; right: -1px; bottom: -1px; box-shadow: 0 0 0 2px #f1e3bd; }
.acct-id-text { display: grid; gap: 4px; min-width: 0; justify-items: start; }
.acct-badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 7px; border-radius: 10px; font: 700 10.5px/1 var(--slab); letter-spacing: .14em; text-transform: uppercase; color: #24521a; background: rgba(63,154,47,.16); border: 1px solid rgba(47,110,34,.45); }
.acct-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #3f9a2f; }
.acct-mail { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 700 19px/1.2 var(--slab); color: #2a1806; }
.acct-mail.long { font-size: 16.5px; } .acct-mail.xlong { font-size: 14.5px; }
.acct-line .btn.ghost { min-height: 26px; padding: 0 2px; font-size: inherit; }
.result-card .acct-line { margin-top: -4px; }
.sheet.acct-sheet { z-index: 96; }
.acct-form { display: grid; gap: 9px; }
.acct-form input { width: 100%; height: 44px; padding: 0 12px; border-radius: 7px; border: 1px solid rgba(59,40,20,.55); background: rgba(255,250,232,.7); color: #2a1806; font: 700 16px/1 var(--slab); }
.acct-form input:focus-visible { outline: 2px solid var(--brass); outline-offset: 1px; }
#acct-code, #acct-remove-code { text-align: center; letter-spacing: .32em; font-size: 22px; }
.acct-row { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 14px; }
.acct-row .btn:not(.ghost) { flex: 1 1 130px; }
a.btn { display: inline-grid; place-items: center; text-decoration: none; }
.acct-more { display: grid; gap: 8px; }
.acct-more[hidden] { display: none; }
.acct-or { display: flex; align-items: center; gap: 10px; font: italic 13px/1 var(--serif); color: #6b5334; }
.acct-or::before, .acct-or::after { content: ""; flex: 1; height: 1px; background: rgba(59,40,20,.35); }
/* The "are you a person" check is the page's own element, shown through a slot. It takes no room
   until the visitor is asked to do something. */
.acct-foot { display: grid; justify-items: center; }
.acct-foot ::slotted(*) { display: grid; justify-items: center; width: 100%; max-width: 100%; min-height: 0; overflow: hidden; }
.acct-foot ::slotted([data-human="asking"]) { margin-bottom: 8px; overflow: visible; }
.acct-msg { margin: 0; min-height: 1.35em; text-align: center; font: italic 13px/1.35 var(--serif); color: #5a100c; }
.acct-msg.good { color: #2f5524; }
#acct-remove { justify-self: center; }
/* on parchment: labels and plain buttons in the darker inks the other sheets use */
.acct-sheet .lbl { color: #5a3410; }
.acct-sheet .hint { color: #6b5334; }
.acct-sheet .btn:not(.primary):not(.ghost):not(.wipe) { color: #f1dfb4; background: linear-gradient(180deg, #5a3620, #3a2012); border-color: #1f1108; }
.acct-sheet .btn:disabled { opacity: .55; cursor: default; }
.acct-sheet .btn.wipe { color: #5a100c; background: none; border-color: rgba(90,16,12,.5); }
.acct-sheet a.btn { text-align: center; }
.sheet { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; padding: 14px; background: rgba(10,7,5,.8); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.sheet-card { width: min(100%, 440px); max-height: 100%; overflow-y: auto; padding: 20px 18px 16px; border-radius: 6px; color: var(--sepia); display: grid; gap: 12px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='320' height='320'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.035' numOctaves='5' seed='4'/%3E%3CfeColorMatrix values='0 0 0 0 .36 0 0 0 0 .22 0 0 0 0 .07 0 0 0 1.1 -.42'/%3E%3C/filter%3E%3Crect width='320' height='320' filter='url(%23n)'/%3E%3C/svg%3E"), linear-gradient(175deg, #efdfb6, #dcc591 60%, #cdb279); box-shadow: 0 0 0 1px #140b04, 0 0 0 7px #4a2c12, 0 0 0 8px #140b04, 0 24px 60px rgba(0,0,0,.8), inset 0 0 30px rgba(92,56,16,.5); }
.sheet-card h2 { margin: 0; font: 700 28px/1.1 var(--display); color: #5a100c; text-align: center; }
.sheet-card ul { margin: 0; padding-left: 18px; display: grid; gap: 7px; font-size: 14px; color: #3b2814; }
.foe-line { margin: 0; font-size: 13.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.foe-line b { color: var(--ink); font-family: var(--slab); flex: 1; }
.link { background: none; border: 0; padding: 6px 2px; color: var(--brass); font: 700 12px/1.2 var(--slab); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
button.crest { border: 0; cursor: pointer; }
button.crest:hover { filter: brightness(1.1); }
@container game (min-aspect-ratio: 1/1) { .scene img { left: -14%; width: 128%; top: -40%; height: 128%; } .title-head { padding-top: max(30px, 5cqh); } }
/* A wide screen that is not a phone on its side (that one has a layout of its own, further down).
   The menu card is not pinned to the bottom edge any more: it stands in the space between the
   title and the foot of the screen, nearer the title than the foot. */
@container game (min-width: 900px) and (min-height: 541px) and (min-aspect-ratio: 1/1) {
  .title-menu { margin: auto 0; }
  .title-screen::after { content: ""; flex: 0 1 9cqh; }
}
/* the armies take the field as the title screen lifts */
.deploying .pc .tok { animation: deploy .55s cubic-bezier(.2,1.1,.3,1) both; animation-delay: calc(.25s + var(--y) * 45ms); }
@keyframes deploy { from { opacity: 0; transform: translateY(-.5em) scale(1.25); } }

/* ---------- wide box: rails beside the map, orders on the right ---------- */
@container game (min-width: 1060px) and (min-aspect-ratio: 13/10) {
  .app { --board: max(420px, min((100cqh - 24px) * 1.23, 100cqw - 548px, 1040px)); display: grid; grid-template-columns: auto 330px; grid-template-rows: 70px minmax(0, 1fr); grid-template-areas: "table bar" "table side"; justify-content: center; align-content: center; align-items: start; column-gap: 16px; padding: 10px; overflow: hidden; }
  .app > * { width: auto; }
  .bar { grid-area: bar; align-self: start; gap: 6px; }
  .bar .icon-btn { width: 36px; height: 36px; padding: 8px; }
  .status { white-space: normal; font-size: 16px; word-spacing: .04em; }
  .sub { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .table { grid-area: table; align-self: center; grid-template-columns: 86px var(--board) 86px; grid-template-areas: "raill board railr"; }
  .rail { flex-direction: column; justify-content: center; gap: 16px; min-height: 0; padding: 8px 4px; }
  .plate { flex-direction: column; gap: 9px; }
  .plate.foe { flex: none; }
  .say { left: calc(100% + 10px); top: 8px; translate: none; padding: 7px 11px 8px; border-radius: 3px 11px 11px 11px; max-width: 260px; font-size: 13.5px; }
  .say::after { left: -9px; top: 9px; width: 10px; height: 12px; background: #d3dcec; clip-path: polygon(100% 0, 100% 100%, 0 15%); filter: drop-shadow(-1.5px 0 0 var(--blue-d)); }
  .plate.mine .pname { display: block; }
  .badge { width: 58px; height: 58px; padding: 12px; margin: 0; }
  .badge .stars svg { width: 9px; height: 9px; }
  .pname { max-width: 84px; font-size: 9.5px; }
  .lever { width: 14px; height: 44px; }
  .grave-btn { width: 40px; height: 40px; }
  .knob { left: -5px; top: 0; transform: translateY(10px); }
  .app[data-phase="play"][data-turn="c"] .knob { transform: translateY(0); }
  .app[data-phase="play"][data-turn="p"] .knob { transform: translateY(20px); }
  .plaque { min-width: 62px; height: 44px; } .plaque b { font-size: 19px; }
  .grave-btn, #grave-close { display: none; }
  .side { grid-area: side; align-self: stretch; overflow-y: auto; min-height: 0; }
  .grave { position: static; z-index: auto; transform: none; visibility: visible; transition: none; box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 6px 16px rgba(0,0,0,.3); border-radius: 12px; padding: 12px; }
  .app[data-phase="setup"] .grave { display: none; }
  .wide-only { display: block; }
  .sub { white-space: normal; }
  .panel { padding: 14px; gap: 9px; }
  .foe-name { font-size: 12px; }
}
/* a tall, narrow box has room under the map: keep the tally open there instead of in a drawer */
@container game ((max-width: 1059px) and (min-height: 760px)) or ((min-width: 1060px) and (max-aspect-ratio: 13/10)) {
  .grave { position: static; z-index: auto; transform: none; visibility: visible; transition: none; box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 6px 16px rgba(0,0,0,.3); border-radius: 12px; padding: 9px; }
  .app[data-phase="setup"] .grave { display: none; }
  .grave-btn, #grave-close { display: none; }
}
/* a short, narrow box (a small phone): tighten the orders so that Start battle stays on screen */
@container game (max-width: 1059px) and (max-height: 720px) {
  .app[data-phase="setup"] { --board: max(264px, min(100cqw - 12px, (100cqh - 304px) * 1.23, 760px)); gap: 5px; padding-top: 4px; padding-bottom: calc(6px + env(safe-area-inset-bottom)); }
  .app[data-phase="setup"] .panel { padding: 7px 9px 8px; gap: 5px; }
  .app[data-phase="setup"] #lbl-form { display: none; }
  .app[data-phase="setup"] .foe-line .link { padding: 2px; }
  .app[data-phase="setup"] .btn.big { min-height: 46px; margin: 1px 0 0; }
}
/* ---------- a short, wide box (a phone held sideways): the map takes the full height, both rails
   stack in one narrow strip on its left, and everything else is a column on its right ---------- */
@container game (max-width: 1059px) and (max-height: 540px) and (min-aspect-ratio: 13/10) {
  .app, .app[data-phase="setup"] { --board: max(280px, min((100cqh - 8px) * 1.239, 100cqw - 216px)); display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); grid-template-areas: "table bar" "table side"; align-items: start; align-content: start; justify-content: stretch; gap: 5px 8px; padding: 4px; overflow: hidden; }
  .app > * { width: auto; }
  .table { grid-area: table; align-self: center; grid-template-columns: 50px var(--board); grid-template-rows: auto auto; grid-template-areas: "raill board" "railr board"; }
  .rail { flex-direction: column; justify-content: center; gap: 7px; min-height: 0; padding: 4px 2px; }
  .plate { flex-direction: column; gap: 4px; }
  .plate.foe { flex: none; }
  .say { left: calc(100% + 8px); top: 4px; translate: none; padding: 7px 11px 8px; border-radius: 3px 11px 11px 11px; max-width: 220px; font-size: 12.5px; }
  .say::after { left: -9px; top: 9px; width: 10px; height: 12px; background: #d3dcec; clip-path: polygon(100% 0, 100% 100%, 0 15%); filter: drop-shadow(-1.5px 0 0 var(--blue-d)); }
  .pname { display: none; }
  .lever { width: 14px; height: 36px; }
  .knob { left: -5px; top: 0; transform: translateY(6px); }
  .app[data-phase="play"][data-turn="c"] .knob { transform: translateY(0); }
  .app[data-phase="play"][data-turn="p"] .knob { transform: translateY(12px); }
  .plaque { min-width: 44px; height: 30px; } .plaque b { font-size: 14px; }
  .grave-btn { width: 34px; height: 34px; padding: 7px; }
  /* the bar: buttons on one line, the words under them */
  .bar { grid-area: bar; display: grid; grid-template-columns: auto 1fr auto auto auto; align-items: center; gap: 4px 5px; min-height: 0; }
  .crest { grid-area: 1 / 1; width: 30px; height: 30px; padding: 5px; }
  .bar .js-sound { grid-area: 1 / 4; } .bar #newgame { grid-area: 1 / 5; }
  .bar .icon-btn { width: 32px; height: 32px; padding: 7px; }
  .bar-text { grid-area: 2 / 1 / 3 / -1; }
  .status { white-space: normal; font-size: 15.5px; }
  .sub { min-height: 0; font-size: 12px; -webkit-line-clamp: 3; }
  /* the orders, narrow */
  .side { grid-area: side; align-self: stretch; min-height: 0; overflow-y: auto; scrollbar-width: none; gap: 5px; }
  .side::-webkit-scrollbar { display: none; }
  .panel, .app[data-phase="setup"] .panel { padding: 7px 8px 8px; gap: 6px; }
  .foe-line { font-size: 0; gap: 6px; } /* only the name and "Change": the word "Opponent" is dropped */
  .foe-line b { font-size: 12px; } .foe-line .link { font-size: 11.5px; padding: 2px; }
  #lbl-form { display: none; }
  .seg { grid-auto-flow: row; grid-template-columns: 1fr 1fr; }
  .seg button { min-height: 30px; font-size: 11.5px; }
  .panel .row { grid-auto-flow: row; gap: 5px; }
  .btn.small { min-height: 30px; font-size: 11px; }
  .btn.big, .app[data-phase="setup"] .btn.big { min-height: 42px; padding: 0 6px; font-size: 12px; letter-spacing: .05em; margin: 0; }
  .log { min-height: 40px; padding: 6px 8px 6px 44px; font-size: 12.5px; }
  .log::after { left: 6px; width: 30px; height: 30px; }
  .guide { font-size: 12.5px; padding: 0 9px; } .guide summary { padding: 8px 0; }
  /* the tally: a drawer across the bottom, one line for each army */
  .grave { padding: 7px 9px calc(8px + env(safe-area-inset-bottom)); gap: 5px; }
  .grave-row ul, .app[data-mode="skirmish"] .grave-row ul { grid-template-columns: repeat(12, 1fr); }
  .app[data-mode="skirmish"] .grave-row ul { grid-template-columns: repeat(7, minmax(0, 64px)); }
  .report { margin: 0 0 6px; padding: 6px 10px 7px; } .report ol { font-size: 12px; gap: 2px; } .report li:nth-child(n+4) { display: none; }
  .title-menu .seg button { min-height: 30px; font-size: 11px; }
  /* title: the name on the left, the orders on the right */
  .title-screen { flex-direction: row; align-items: flex-start; justify-content: center; gap: 2cqw; padding: 6px 10px; }
  .title-head { flex: 1 1 0; min-width: 0; margin: auto 0; padding: 0 4px; }
  .wordmark { font-size: clamp(24px, 5.6cqw, 52px); }
  .tagline { font-size: clamp(12.5px, 2.2cqw, 17px); }
  .title-menu { width: min(50%, 400px); margin: auto 0; }
  .sheet-paper { padding: 18px 9px 7px; gap: 5px; }
  .title-menu .hint { min-height: 0; font-size: 12px; }
  .foes button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 5px 3px 4px; text-align: center; }
  .foes .who { width: 40px; height: 40px; margin-bottom: 1px; }
  .foe-name { max-width: 100%; }
  .title-menu .btn { min-height: 36px; }
  .title-menu .btn.big { min-height: 40px; }
  .title-menu .btn.ghost { min-height: 24px; font-size: 13px; }
  .title-tools { right: auto; left: 6px; top: 4px; }
  .title-tools .icon-btn { width: 34px; height: 34px; padding: 7px; }
  .acct-chip { height: 34px; padding: 0 11px; font-size: 11px; }
  .acct-chip.in { padding: 0 3px; font-size: 12px; } .acct-chip.in .acct-chip-text { display: none; } .acct-chip .acct-ava { width: 26px; height: 26px; font-size: 13px; }
  .fine { display: none; }
  /* the result: one compact card */
  .overlay { padding: 6px; overflow-y: auto; }
  .result-card { width: min(100%, 520px); padding: 10px 14px 12px; }
  .medal { width: 54px; height: 52px; margin: -2px auto 0; }
  .result-card h2 { font-size: 30px; }
  .result-card p { margin-top: 4px; font-size: 13.5px; }
  .stats { margin: 8px 0 6px; } .stats div { padding: 5px 2px; } .stats dd { font-size: 17px; margin-top: 2px; }
  .record { font-size: 12px; }
  .result-actions { grid-template-columns: 1fr 1.7fr; gap: 6px; margin-top: 8px; }
  .result-actions .btn { min-height: 42px; }
}
/* very little height (a small phone sideways with the browser's bars showing): drop the hint line */
@container game (max-width: 1059px) and (max-height: 349px) and (min-aspect-ratio: 13/10) {
  .sub { display: none; }
  .panel .row, #war-open { display: none; } /* saving and loading a setup can wait for an upright phone */
}
@container game (max-width: 480px) {
  .status { font-size: 18px; }
  .foes button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 7px 4px 6px; text-align: center; }
  .foes .who { width: 56px; height: 56px; margin-bottom: 2px; }
  .foe-name { font-size: 13.5px; max-width: 100%; }
}
@container game (max-width: 359px) { .seg button { font-size: 12.5px; } .foe-name { font-size: 12px; } .icon-btn { width: 36px; height: 36px; padding: 8px; } .pname { font-size: 10.5px; } }
/* the smallest phones: the corner button a size down, so that it clears the line above the title;
   and on a short screen the card does without its own line about saving (the corner button is there) */
@container game (max-width: 359px) { .acct-chip { height: 34px; padding: 0 11px; font-size: 11px; }
  .acct-chip.in { padding: 0 3px; } .acct-chip.in .acct-chip-text { display: none; } .acct-chip .acct-ava { width: 26px; height: 26px; font-size: 13px; } }
@container game (max-height: 700px) { .title-menu .acct-line { display: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
