:root {
  --bg: #14120f;
  --panel: #1e1b17;
  --panel-2: #262119;
  --line: #3a332a;
  --ink: #ece5d8;
  --ink-dim: #9d9382;
  --accent: #c8a04a;
  --accent-ink: #1a1611;
  --danger: #b4553f;
  --ok: #6f9159;

  --blue: #2b6ea8;
  --red: #b23a34;
  --green: #4a7f42;
  --yellow: #d8ac2e;
  --purple: #6f4a96;

  /* Card geometry is driven from JS so the splay offsets stay in step. */
  /* Icon colours, as on the printed cards. Used wherever an icon is "yours". */
  --icon-castle: #6e7c8b;
  --icon-crown: #b58f2e;
  --icon-leaf: #5b8a48;
  --icon-bulb: #7d64a6;
  --icon-factory: #a6463c;
  --icon-clock: #3c6f9c;
  --icon-avatar: #a85a8a;
  /* The same colours washed into the parchment of the card backs: the icon tiles. */
  --tile-castle: #9c9f9c;
  --tile-crown: #c8ab62;
  --tile-leaf: #90a873;
  --tile-bulb: #a590ad;
  --tile-factory: #be7d6b;
  --tile-clock: #7d97a7;
  --tile-avatar: #c08a9b;

  --card-w: 288px;
  --card-h: 192px;
  --fx-scale: 1;
  --card-scale: 1;
}

* { box-sizing: border-box; }

/* Private capture mode expands scrolling regions so both hands, all board
   columns, and the log are included in the diagnostic image. */
html[data-report-capture] #app { height: auto; min-height: 100vh; }
html[data-report-capture] #table, html[data-report-capture] aside { overflow: visible; }
html[data-report-capture] .board { flex-wrap: wrap; overflow: visible; }
html[data-report-capture] #log { max-height: none; overflow: visible; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

button {
  font: inherit;
  color: inherit;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 5px 10px;
  cursor: pointer;
}
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .38; cursor: default; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.danger:hover { border-color: var(--danger); color: #e79c8a; }

input, select {
  font: inherit; color: inherit;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px 8px;
}

/* ----------------------------------------------------------------- layout */

#app { display: grid; grid-template-rows: auto 1fr; height: 100%; }

header.bar {
  display: flex; align-items: center; gap: 14px;
  padding: 8px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
header.bar h1 { font-size: 15px; margin: 0; letter-spacing: .04em; font-weight: 600; }
header.bar .code { font-family: ui-monospace, monospace; color: var(--accent); }
header.bar .spacer { flex: 1; }
.split-button { display: inline-flex; position: relative; flex: 0 0 auto; }
.split-button > button:first-child { border-radius: 7px 0 0 7px; }
.split-button > .split-toggle { border-radius: 0 7px 7px 0; margin-left: -1px; padding-inline: 9px; }
.split-button > button:focus-visible { position: relative; z-index: 1; }
.split-menu {
  position: absolute; top: calc(100% + 5px); right: 0; z-index: 190;
  min-width: 100%; width: max-content; padding: 4px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 7px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
}
.split-menu a {
  display: block; padding: 7px 10px; border-radius: 4px;
  color: var(--ink); text-decoration: none; white-space: nowrap;
}
.split-menu a:hover, .split-menu a:focus-visible { background: var(--line); color: var(--accent); }
.turnchip {
  padding: 3px 10px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--line);
}
.turnchip.mine { border-color: var(--accent); color: var(--accent); }
.pips { letter-spacing: 2px; color: var(--accent); }

main {
  display: grid;
  grid-template-columns: 1fr 320px;
  min-height: 0;
}
@media (max-width: 1100px) { main { grid-template-columns: 1fr; } }

#table { overflow-y: auto; padding: 10px 14px 24px; min-height: 0; }
aside {
  border-left: 1px solid var(--line);
  background: var(--panel);
  overflow-y: auto;
  padding: 10px 12px 24px;
  min-height: 0;
}

/* ------------------------------------------------------------ player areas */

.player {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  padding: 10px 12px 14px;
  margin-bottom: 12px;
}
.player.active { border-color: var(--accent); }
.player > .head {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  margin-bottom: 8px;
}
.player .who { font-weight: 600; font-size: 15px; }
.player .who .you { color: var(--accent); font-weight: 500; font-size: 12px; }
.stat { color: var(--ink-dim); font-size: 12.5px; }
.stat b { color: var(--ink); font-weight: 600; }

.tally { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.tally .t { display: inline-flex; align-items: center; gap: 3px; font-variant-numeric: tabular-nums; }
.tally .t.zero { opacity: .3; }
.tally svg { width: 26px; height: 26px; }
/* Only an icon you have dominion in shows its full colour; the rest sit muted. */
.tally .t:not(.dominant) svg { filter: grayscale(.85) brightness(.8); opacity: .7; }

/* ---------------------------------------------------------------- the board */

.board {
  display: flex; gap: 11px; align-items: flex-start;
  /* Five colour columns always read as one row; scroll rather than wrap. */
  flex-wrap: nowrap;
  overflow-x: auto;
  padding: 5px 2px 6px;
}
.board::-webkit-scrollbar { height: 7px; }
.board::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
.stack { flex: 0 0 auto; }

.stack { position: relative; }
.stack .slot {
  width: var(--card-w);
  height: var(--card-h);
  border: 1px dashed var(--line);
  border-radius: 9px;
  display: grid; place-items: center;
  color: var(--ink-dim); font-size: 11px;
  opacity: .5;
}
.stack .pile { position: relative; }
.stack .splaytag {
  position: absolute; top: -7px; right: -4px; z-index: 40;
  font-size: 10px; padding: 1px 5px; border-radius: 4px;
  background: var(--accent); color: var(--accent-ink); font-weight: 700;
}

/* ---------------------------------------------------------------- the card */

/*
 * Laid out like the printed card: one icon top-left beside the name, the age in
 * the top-right corner, the dogma text in the middle, and the remaining three
 * icons along the bottom edge. Keeping the icons in those four spots is what
 * makes a splayed stack readable — the exposed strip shows the real symbols.
 */
.card {
  width: var(--card-w);
  height: var(--card-h);
  flex-shrink: 0;
  border-radius: calc(9px * var(--card-scale));
  position: relative;
  display: flex;
  flex-direction: column;
  padding: calc(5px * var(--card-scale)) calc(6px * var(--card-scale));
  border: calc(1px * var(--card-scale)) solid rgba(0, 0, 0, .55);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .13);
  cursor: pointer;
  overflow: hidden;
  user-select: none;
  color: var(--card-ink, #f6f2ea);
  background-image: linear-gradient(160deg, rgba(255, 255, 255, .10), rgba(0, 0, 0, .16));
}
.card.blue   { background-color: var(--blue); }
.card.red    { background-color: var(--red); }
.card.green  { background-color: var(--green); }
.card.purple { background-color: var(--purple); }
.card.yellow { background-color: var(--yellow); --card-ink: #241d0b; --fx-bg: rgba(0,0,0,.13); --fx-line: rgba(0,0,0,.30); }
.card.selected { outline: 2px solid var(--accent); outline-offset: 1px; z-index: 60; }
/* Keep the demand edge visible during hover without covering a card's text
   or replacing the separate outline used for the selected card. */
.card.demand-ready { border-color: #f0c674; }
.card.demand-ready::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  box-shadow: inset 0 0 0 2px #f0c674; pointer-events: none;
}
.demand-ready-label {
  color: #f0c674; background: #c8a04a1a; border: 1px solid #c8a04a66;
  border-radius: 4px; padding: 1px 6px; font-size: 11px; font-weight: 600;
  white-space: nowrap;
}

.card .top { display: flex; align-items: center; gap: calc(5px * var(--card-scale)); flex: 0 0 auto; }
.card .nm {
  flex: 1; min-width: 0;
  font-size: calc(12px * var(--card-scale)); font-weight: 700; line-height: 1.1;
  letter-spacing: .01em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card .age {
  font-size: calc(15px * var(--card-scale)); font-weight: 800; line-height: 1;
  opacity: .95; font-variant-numeric: tabular-nums;
}

/* The dogma text. Font size is picked per card from its own length. */
.card .body {
  flex: 1 1 auto;
  margin: calc(4px * var(--card-scale)) 0 calc(3px * var(--card-scale));
  display: flex; flex-direction: column; gap: calc(3px * var(--card-scale));
  overflow: hidden;
}
/* Applied only when the text genuinely overflows, so cards that fit stay crisp.
   The full text is always one click away in the action rail. */
.card .body.clipped {
  mask-image: linear-gradient(to bottom, #000 calc(100% - 13px), transparent 100%);
}
.card .fx {
  display: flex; align-items: flex-start; gap: calc(4px * var(--card-scale));
  background: var(--fx-bg, rgba(0, 0, 0, .26));
  border-radius: calc(4px * var(--card-scale));
  padding: calc(3px * var(--card-scale)) calc(4px * var(--card-scale));
  font-size: calc(var(--fx-base, 10px) * var(--fx-scale));
  line-height: 1.24;
}
/* A demand reads differently on the printed card, so it should here too. */
.card .fx.demand {
  background: rgba(80, 0, 0, .40);
  box-shadow: inset 2px 0 0 #e8836c;
}
.card.yellow .fx.demand { background: rgba(120, 20, 0, .22); box-shadow: inset 2px 0 0 #a33; }
.card .fxicon { flex: 0 0 auto; width: calc(18px * var(--card-scale)); height: calc(18px * var(--card-scale)); margin-top: 0; opacity: .95; }
.card .fx .ic-inline { width: calc(13px * var(--card-scale)); height: calc(13px * var(--card-scale)); vertical-align: calc(-4px * var(--card-scale)); }
.card .fx b { font-weight: 800; }

.card.t1 { --fx-base: 11px; }
.card.t2 { --fx-base: 10px; }
.card.t3 { --fx-base: 9px; }
.card.t4 { --fx-base: 8px; }

.card .bot { display: flex; align-items: center; flex: 0 0 auto; height: calc(32px * var(--card-scale)); }
.card .bot .slotL { flex: 0 0 auto; }
.card .bot .slotM { flex: 1; display: flex; justify-content: center; }
.card .bot .slotR { flex: 0 0 auto; }
.card .ic { width: calc(32px * var(--card-scale)); height: calc(32px * var(--card-scale)); opacity: .96; }
.card .ic.blank { opacity: 0; }

.card.facedown {
  background: repeating-linear-gradient(45deg, #3b332a, #3b332a 7px, #453c31 7px, #453c31 14px);
  color: var(--ink-dim);
  display: grid; place-items: center; font-size: 11px;
}

/*
 * A covered card in a splayed stack shows only a narrow strip of itself. Its
 * symbols are the whole point of splaying; its name and text would just be
 * sliced-up fragments, so they are hidden while the layout is preserved.
 */
.card.covered .nm,
.card.covered .body { visibility: hidden; }
.card.covered { filter: brightness(.94); }

/* Splayed stacks: the offset direction matches which edge the rules expose. */
.pile .card { position: absolute; }

/* -------------------------------------------------------------------- hand */

.hand { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 10px; }
.zonelabel {
  font-size: 11px; text-transform: uppercase; letter-spacing: .09em;
  color: var(--ink-dim); margin: 12px 0 5px;
}

/* ------------------------------------------------------------- action rail */

#rail {
  position: sticky; bottom: 0; z-index: 80;
  background: var(--panel-2);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 9px 11px;
  margin-top: 10px;
  display: none;
}
#rail.open { display: block; }
#rail .title { font-weight: 600; margin-bottom: 3px; }
#rail .text { color: var(--ink-dim); font-size: 12.5px; margin-bottom: 8px; white-space: pre-line; }
#rail .acts { display: flex; gap: 6px; flex-wrap: wrap; }

/* ------------------------------------------------------------- side panels */

.panel { margin-bottom: 14px; }
.panel > h2 {
  font-size: 11px; text-transform: uppercase; letter-spacing: .09em;
  color: var(--ink-dim); margin: 0 0 6px; font-weight: 600;
}
.row { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; flex-wrap: wrap; }
/* Decks as small card backs, the junk pile beside them. */
.decks { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.deck {
  position: relative; aspect-ratio: 3 / 4; border-radius: 5px; overflow: hidden;
  border: 1px solid #5a4a33; background: #e6d8b8; color: #2a2016;
}
.deck .art { position: absolute; inset: 0 0 15px 0; background-size: cover; background-position: center; opacity: .9; }
.deck b {
  position: absolute; left: 4px; top: 0;
  font: 700 17px/1.2 Georgia, "Times New Roman", serif; text-shadow: 0 1px 0 rgba(255,255,255,.55);
}
.deck .n {
  position: absolute; left: 0; right: 0; bottom: 0; height: 15px;
  background: #2b241d; color: #f4ecdc; font: 600 10.5px/15px Georgia, serif; text-align: center; letter-spacing: .04em;
}
.deck.empty { opacity: .32; filter: grayscale(1); }
.deck.junk {
  background: repeating-linear-gradient(45deg, #3b332a, #3b332a 5px, #453c31 5px, #453c31 10px);
  border-color: var(--line); color: var(--ink);
}
.deck.junk b {
  left: 0; right: 0; top: 26%; text-align: center; text-shadow: none;
  font: 700 10px/1 ui-sans-serif, system-ui, sans-serif; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-dim);
}

/* Age achievements as chips: the number, the price, and who has it once taken. */
#achievements { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.achip {
  position: relative; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2);
  padding: 5px 3px 4px; text-align: center; line-height: 1.1;
}
.achip b { display: block; font: 700 16px/1.15 Georgia, "Times New Roman", serif; }
.achip small { display: block; font-size: 10px; color: var(--ink-dim); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.achip.taken { opacity: .42; }
.achip.taken small { color: var(--ink); }
.achip.met { border-color: var(--ok); }
.achip.met small { color: var(--ok); }
.achip.go { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); cursor: pointer; }
.achip.go small { color: var(--accent-ink); }
.achip .junk {
  position: absolute; top: -7px; right: -7px; width: 18px; height: 18px; padding: 0; border-radius: 50%;
  font-size: 10px; line-height: 16px; background: var(--danger); border-color: var(--danger); color: #fff;
}

/* Special achievements: name and progress; the printed condition unfolds on a click. */
.sp { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; font-size: 12.5px; flex-wrap: wrap; }
.sp .lbl { flex: 1; min-width: 0; cursor: pointer; }
.sp .hint { font-size: 11px; color: var(--ink-dim); }
.sp .hint.met { color: var(--ok); }
.sp.taken { opacity: .45; }
.sp .cond { display: none; flex-basis: 100%; font-size: 11.5px; color: var(--ink-dim); padding: 0 0 4px; }
.sp.open .cond { display: block; }

.sizes { gap: 8px; }
.sizes button { flex: 1; }

#log {
  font-size: 12px; line-height: 1.4;
  max-height: 340px; overflow-y: auto;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel-2); padding: 7px 9px;
}
#log .e { margin-bottom: 4px; }
#log .e .who { color: var(--accent); }
#log .e.turn { border-top: 1px solid var(--line); padding-top: 5px; margin-top: 6px; color: var(--ink-dim); }
#log .e.dogma { color: #e2cf9c; }
#log .e.system { color: var(--ok); }
#log .e.note { font-style: italic; }

/* ------------------------------------------------------------------ modals */

.overlay {
  position: fixed; inset: 0; background: rgba(8,7,6,.82);
  display: grid; place-items: center; z-index: 200; padding: 20px;
}
.sheet {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 20px; max-width: 460px; width: 100%;
  max-height: calc(100dvh - 40px); overflow: auto; box-sizing: border-box;
}
.sheet h2 { margin: 0 0 4px; font-size: 17px; }
.sheet p { color: var(--ink-dim); margin: 0 0 14px; }
.sheet .opts { display: grid; gap: 8px; }

.share-dialog { color: var(--ink); width: min(420px, calc(100vw - 40px)); }
.share-dialog::backdrop { background: rgba(8,7,6,.82); }
.share-dialog label { display: grid; gap: 5px; margin: 16px 0; }
.share-dialog input, .share-dialog select { width: 100%; min-width: 0; }
.share-dialog .row { justify-content: flex-end; }
.share-qr svg { display: block; width: 220px; height: 220px; max-width: 100%; margin: 20px auto; }

/* A decision can step aside into a pill so the table underneath can be studied. */
.overlay .pill {
  display: none; position: fixed; top: 54px; left: 50%; transform: translateX(-50%);
  max-width: min(760px, 92vw); z-index: 210; pointer-events: auto; cursor: pointer;
  background: var(--panel-2); color: var(--ink); border: 1px solid var(--accent);
  border-radius: 12px; padding: 8px 16px; font-size: 13px; line-height: 1.4; text-align: center;
  box-shadow: 0 6px 20px rgba(0,0,0,.5);
}
.overlay.peeking { background: transparent; pointer-events: none; }
.overlay.peeking .sheet { display: none; }
.overlay.peeking .pill { display: block; }

#toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 18px; z-index: 300; max-width: min(720px, 92vw); text-align: center;
  background: var(--panel-2); color: var(--ink); border: 1px solid var(--accent);
  padding: 8px 14px; border-radius: 8px;
  opacity: 0; transition: opacity .2s; pointer-events: none;
}
#toast.show { opacity: 1; }

.detail { font-size: 12.5px; }
.detail .eff { margin: 5px 0; padding-left: 9px; border-left: 2px solid var(--line); }
.detail .eff.demand { border-left-color: var(--danger); }

.ic-inline { vertical-align: -4px; }

/* Narrow screens: shrink the cards rather than wrapping the board to shreds. */
@media (max-width: 780px) {
  header.bar { gap: 8px; padding: 6px 8px; }
  #table { padding: 8px; }
}
.scorepile .card { opacity: .92; }

.opening {
  border: 1px solid var(--accent);
  border-radius: 9px;
  background: var(--panel-2);
  padding: 9px 12px;
  margin-bottom: 12px;
  font-size: 12.5px;
}

/* Cards lift slightly under the cursor so it is obvious they are all clickable.
   Only where there is a cursor: a finger has no hover, and on a touch screen
   the lift would stick to whichever card was tapped last. */
.card { transition: transform .09s ease, box-shadow .09s ease; }
@media (hover: hover) {
  .hand .card:hover,
  .pile .card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 12px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .16);
    z-index: 70;
  }
  .card.covered:hover { transform: none; }
}
/* A long press peeks at a card on touch; it must not select its text instead. */
.card { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }

/* While a card effect is being carried out the table is visibly in a different
   mode, because the moves that are legal are completely different. */
body.resolving header.bar { box-shadow: inset 0 -2px 0 var(--accent); }
body.resolving #rail { border-color: var(--accent); }

/* Installed to a home screen there is no browser chrome, so the page has to
   keep itself clear of the notch and the home indicator itself. */
#app {
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}
header.bar { padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }

/* The dogma confirmation: the warnings are the point, so they get the emphasis. */
.sheet .warn { display: grid; gap: 8px; margin: 0 0 14px; font-size: 13px; color: var(--ink); }
.sheet .warn > div { padding: 8px 10px; border-left: 3px solid var(--danger); background: var(--panel-2); border-radius: 0 6px 6px 0; }

/* Decision prompts from the effect interpreter. Cards are shown as cards. */
.sheet.wide { max-width: 900px; }
.choices { display: flex; gap: 10px; flex-wrap: wrap; margin: 6px 0 14px; }
.choices .card.choice { cursor: pointer; }
.choices button.choice { padding: 10px 14px; }
.choices .choice.selected { outline: 2px solid var(--accent); outline-offset: 2px; }

.turnchip.thinking { border-color: var(--accent); color: var(--accent); animation: think 1.2s ease-in-out infinite; }
@keyframes think { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

/* ---------------------------------------------------------------- flights */
/* A card on its way from where it was to where it is now. */
.flight {
  position: fixed; z-index: 500; pointer-events: none; transform-origin: top left;
  box-shadow: 0 16px 36px rgba(0, 0, 0, .65); will-change: transform, opacity;
}
.flight .flight-tag {
  position: absolute; left: 50%; bottom: -13px; transform: translateX(-50%);
  background: var(--accent); color: var(--accent-ink);
  font: 700 10.5px/1 ui-sans-serif, system-ui, sans-serif; letter-spacing: .06em; text-transform: uppercase;
  padding: 5px 9px; border-radius: 999px; white-space: nowrap; box-shadow: 0 3px 10px rgba(0, 0, 0, .5);
}

/* ---------------------------------------------------------------- peek */
#peek {
  position: fixed; z-index: 400; pointer-events: none;
  background: var(--panel); border: 1px solid var(--accent); border-radius: 12px;
  padding: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.6);
  opacity: 0; transform: translateY(4px); transition: opacity .12s ease, transform .12s ease;
  max-width: min(1100px, calc(100vw - 16px));
  max-height: calc(100dvh - 16px); overflow: auto; overscroll-behavior: contain;
  box-sizing: border-box;
}
#peek.show { opacity: 1; transform: none; }
#peek.show.scrollable { pointer-events: auto; }
.peek-close { position: sticky; top: 0; float: right; z-index: 1; min-width: 32px; }
.card.big { flex: 0 0 auto; }
/* Previews share the card layout; only their scale changes. */
.card.big .body.clipped { mask-image: none; }
/* The optional original layout keeps its compact board cards and allows
   hover previews to grow vertically to show the complete effect text. */
:root[data-card-layout="classic"] .card.big { height: auto; }
:root[data-card-layout="classic"] .card.big .body { overflow: visible; gap: 5px; margin: 7px 0 5px; }
:root[data-card-layout="classic"] .card.big .nm { font-size: 17px; }
:root[data-card-layout="classic"] .card.big .age { font-size: 22px; }
:root[data-card-layout="classic"] .card.big .ic { width: 38px; height: 38px; }
:root[data-card-layout="classic"] .card.big .bot { height: 38px; }
:root[data-card-layout="classic"] .card.big .fxicon { width: 25px; height: 25px; margin-top: 1px; }
:root[data-card-layout="classic"] .card.big .fx { padding: 5px 7px; line-height: 1.32; }
.peek-head { font-size: 11px; text-transform: uppercase; letter-spacing: .09em; color: var(--ink-dim); margin: 0 0 8px; }
.peek-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
.peek-item { max-width: 100%; }
.prompt-source-card { margin: 12px auto; }
.selectable-score { cursor: pointer; }
.selectable-score:focus-visible { outline: 3px solid var(--accent); }
.deck.drawable { cursor: pointer; outline: 2px solid var(--accent); }
.deck.drawable:focus-visible { outline-width: 4px; }
#game-result { margin: 12px; padding: 16px 20px; border: 2px solid var(--accent); border-radius: 12px; background: var(--panel); }
#game-result h2 { margin: 0 0 6px; }
#game-result p { margin: 0; }
.peek-item { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.peekable { cursor: help; border-bottom: 1px dotted var(--ink-dim); }

.splay-preview { width: min(420px, calc(92vw - 22px)); font-variant-numeric: tabular-nums; }
.splay-preview table { width: 100%; border-collapse: collapse; table-layout: fixed; text-align: center; }
.splay-preview caption { text-align: left; padding-bottom: 8px; }
.splay-preview caption b { display: block; text-transform: capitalize; font-size: 14px; }
.splay-preview caption span { display: block; margin-top: 3px; color: var(--ink-dim); font-size: 12px; }
.splay-preview th, .splay-preview td { padding: 5px 2px; font-size: 13px; }
.splay-preview th:first-child { width: 62px; text-align: left; font-size: 12px; }
.splay-preview thead svg { width: 24px; height: 24px; }
.splay-preview tbody tr { border-top: 1px solid var(--line); }
.splay-preview .splay-current { color: var(--ink-dim); }
.splay-preview td small { display: block; font-size: 11px; }
.splay-preview .gain { color: #8cdda5; }
.splay-preview .loss { color: #ffad98; }

/* Score pile, folded: a little stack with the values written on it. */
.scorestack {
  display: inline-flex; align-items: center; gap: 14px;
  padding: 8px 12px 8px 10px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel-2); cursor: pointer; margin-top: 6px;
}
.scorestack:hover { border-color: var(--accent); }
.scorestack-cards { position: relative; width: 58px; height: 34px; }
.ministack {
  position: absolute; width: 30px; height: 22px; border-radius: 4px; border: 1px solid #0d0b09;
  box-shadow: 0 1px 2px rgba(0,0,0,.5);
}
.ministack.blue { background: var(--blue); } .ministack.red { background: var(--red); }
.ministack.green { background: var(--green); } .ministack.yellow { background: var(--yellow); }
.ministack.purple { background: var(--purple); }
/* An opponent's score pile: identities unknown, so use the card-back ground. */
.ministack.facedown { background: #e6d8b8; }
.scorestack-text { font-size: 14px; }

/* ---------------------------------------------------- card backs (4th ed.) */
/* Sepia diamond-check ground, the age large, an era band with the achievement
   threshold — the layout of the printed backs. .back-art carries the sketch. */
.card.facedown.back {
  display: block; padding: 0; overflow: hidden; position: relative;
  color: #2a2016;
  background:
    linear-gradient(45deg, rgba(120, 95, 60, .16) 25%, transparent 25%, transparent 75%, rgba(120, 95, 60, .16) 75%),
    linear-gradient(-45deg, rgba(120, 95, 60, .16) 25%, transparent 25%, transparent 75%, rgba(120, 95, 60, .16) 75%),
    #e6d8b8;
  background-size: 22px 22px, 22px 22px, auto;
  border: calc(1px * var(--card-scale)) solid #5a4a33;
}
.card.facedown.back .back-art {
  position: absolute; inset: 0 0 calc(24px * var(--card-scale)) 0;
  background-size: cover; background-position: center; opacity: .9;
}
.card.facedown.back .back-num {
  position: absolute; left: calc(7px * var(--card-scale)); top: calc(2px * var(--card-scale));
  font-family: Georgia, "Times New Roman", serif; font-size: calc(44px * var(--card-scale)); font-weight: 700; line-height: 1;
  color: #2a2016; text-shadow: 0 1px 0 rgba(255,255,255,.5);
}
.card.facedown.back .back-band {
  position: absolute; left: 0; right: 0; bottom: 0; height: calc(24px * var(--card-scale));
  background: #2b241d; color: #f4ecdc;
  display: flex; align-items: center; gap: calc(8px * var(--card-scale)); padding: 0 calc(8px * var(--card-scale));
  font-family: Georgia, serif; font-size: calc(11px * var(--card-scale)); letter-spacing: .06em;
}
.card.facedown.back .back-age { font-weight: 700; }
.card.facedown.back .back-era { flex: 1; font-weight: 700; }
.card.facedown.back .back-th {
  width: calc(18px * var(--card-scale)); height: calc(18px * var(--card-scale)); border-radius: 50%; background: #f4ecdc; color: #2b241d;
  display: grid; place-items: center; font-size: calc(10px * var(--card-scale)); font-weight: 700;
}

/* Per-age back art (sepia engravings), served from /backs/<age>.jpg. */
.card.facedown.back.age1 .back-art { background-image: url("/backs/1.jpg"); }
.card.facedown.back.age2 .back-art { background-image: url("/backs/2.jpg"); }
.card.facedown.back.age3 .back-art { background-image: url("/backs/3.jpg"); }
.card.facedown.back.age4 .back-art { background-image: url("/backs/4.jpg"); }
.card.facedown.back.age5 .back-art { background-image: url("/backs/5.jpg"); }
.card.facedown.back.age6 .back-art { background-image: url("/backs/6.jpg"); }
.card.facedown.back.age7 .back-art { background-image: url("/backs/7.jpg"); }
.card.facedown.back.age8 .back-art { background-image: url("/backs/8.jpg"); }
.card.facedown.back.age9 .back-art { background-image: url("/backs/9.jpg"); }
.card.facedown.back.age10 .back-art { background-image: url("/backs/10.jpg"); }
.card.facedown.back.age11 .back-art { background-image: url("/backs/11.jpg"); }
:root[data-card-layout="classic"] .card.facedown.back.big .back-num { font-size: 68px; left: 10px; top: 4px; }
:root[data-card-layout="classic"] .card.facedown.back.big .back-band { height: 34px; font-size: 15px; padding: 0 12px; }
:root[data-card-layout="classic"] .card.facedown.back.big .back-art { inset: 0 0 34px 0; }
:root[data-card-layout="classic"] .card.facedown.back.big .back-th { width: 26px; height: 26px; font-size: 13px; }

/* Order badge on a chosen card: fat circle, the number is the order of execution. */
.choices .choice { position: relative; }
.ordbadge {
  position: absolute; top: -10px; left: -10px; z-index: 5;
  width: 30px; height: 30px; border-radius: 50%; padding: 0;
  background: var(--accent); color: var(--accent-ink); border: 3px solid var(--panel);
  font-weight: 800; font-size: 15px; line-height: 1; cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,.5);
}
.ordbadge:hover { transform: scale(1.12); }

/* Dominion in the tally: the icon and its count take the icon's own colour. */
.tally .t.dominant { font-weight: 700; }
.tally .t.dominant.icon-castle { color: var(--icon-castle); }
.tally .t.dominant.icon-crown { color: var(--icon-crown); }
.tally .t.dominant.icon-leaf { color: var(--icon-leaf); }
.tally .t.dominant.icon-bulb { color: var(--icon-bulb); }
.tally .t.dominant.icon-factory { color: var(--icon-factory); }
.tally .t.dominant.icon-clock { color: var(--icon-clock); }
.tally .t.dominant.icon-avatar { color: var(--icon-avatar); }
.tally .t.dominant b { color: inherit; }

html[data-report-capture] .table-chat { display: none; }
.chat-status, .voice-status, .voice-warning, .chat-error {
  font-size: 0.75rem;
  color: var(--ink-dim);
  overflow-wrap: anywhere;
  margin: 10px 0;
}
.chat-error {
  color: var(--accent);
}
.chat-messages {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  max-height: 240px;
  overflow: auto;
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}
.chat-messages li {
  margin-bottom: 8px;
  white-space: pre-wrap;
}
.chat-form {
  display: flex;
  gap: 6px;
}
.chat-form input {
  width: 100%;
  min-width: 0;
}
.chat-form input, .chat-form button, .voice-controls button {
  padding: 8px;
  font-size: 0.8rem;
}
.voice-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.table-chat [hidden] { display: none !important; }
.table-chat .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.voice-warning { color: #c9a86a; }
.voice-tones { font-size: 12px; opacity: .8; }
