:root {
  --ink: #3a2a1c;
  --ink-soft: rgba(58, 42, 28, .68);
  --rust: #8a3b2c;
  --paper-color: #efe3c6;
  --wood: #3a281a;
  --side: clamp(340px, 31vw, 580px);
  --gap: 12px;
  --sc: "Alegreya SC", Alegreya, Georgia, serif;
  --serif: Alegreya, Georgia, serif;
  --hand: Caveat, "Segoe Print", cursive;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--wood); color: var(--ink); font: 500 15px/1.35 var(--serif); overflow: hidden; font-variant-numeric: lining-nums; }
button { font: inherit; color: inherit; cursor: pointer; }
#stage { position: fixed; inset: 0; display: block; touch-action: none; }
#stage-sea { position: fixed; display: block; pointer-events: none; }
#stage-top { position: fixed; inset: 0; display: block; pointer-events: none; }

#hud {
  position: fixed; inset: 0; padding: var(--gap); gap: var(--gap);
  display: grid; grid-template-columns: minmax(0, 1fr) var(--side); grid-template-rows: auto minmax(0, 1fr) auto;
  pointer-events: none;
}
#hud > * { pointer-events: auto; }
#board-area { grid-column: 1; grid-row: 2; pointer-events: none; }

.panel {
  background: var(--paper-color) var(--paper); border-radius: 6px;
  box-shadow: 0 3px 0 #6b5236, 3px 9px 16px rgba(20, 10, 4, .5), inset 0 0 0 1px rgba(255, 248, 230, .45);
}
h3 { margin: 0 0 4px; font: 700 12px/1 var(--sc); letter-spacing: .02em; color: var(--ink-soft); }

/* ---------- top bar ---------- */
#top { grid-column: 1; grid-row: 1; display: flex; gap: var(--gap); align-items: stretch; min-width: 0; height: 146px; }
#top > .panel { overflow: hidden; }
#invader-track { background-color: #d9c49b; background-image: var(--paper-dark); padding: 9px 12px 6px; flex: 0 0 auto; }
#invader-track .row { display: flex; align-items: center; gap: 4px; }
.slot { margin: 0; display: flex; flex-direction: column; align-items: center; width: 58px; }
.slot img { width: 58px; display: block; }
.slot .empty { width: 50px; height: 68px; margin: 3px 4px 5px; border: 1.5px dashed rgba(58, 42, 28, .35); border-radius: 6px;
  display: grid; place-items: center; font: 700 17px var(--hand); color: rgba(58, 42, 28, .4); }
.slot figcaption { font: 700 11.5px/1 var(--sc); color: var(--ink); margin-top: 1px; }
.slot.ravage figcaption { color: var(--rust); }
.slot.deck { margin-left: 8px; }
.slot.discard { margin-right: 6px; opacity: .92; }
.arrow { font: 800 22px var(--serif); color: rgba(138, 59, 44, .7); margin-top: -12px; }

#fear-panel { background-color: #cdbfa6; padding: 9px 12px 6px; flex: 0 1 330px; min-width: 250px; }
#fear-panel .row { display: flex; align-items: center; gap: 10px; }
#fear-panel .dish { width: 88px; height: 70px; flex: none; }
.fear-info { flex: 1; min-width: 0; }
.fear-info .blight-note { display: none; margin: 2px 0 0; font: 700 14px var(--hand); color: var(--ink-soft); }
.fear-info .count { margin: 0; font-size: 14px; color: var(--ink-soft); }
.fear-info .count b { font: 700 25px var(--serif); color: var(--ink); margin-right: 3px; }
.terror { display: flex; gap: 5px; align-items: center; font: 700 11.5px var(--sc); color: var(--ink-soft); }
.terror b { width: 21px; height: 21px; border-radius: 50%; display: grid; place-items: center; border: 1px solid rgba(58, 42, 28, .35); color: rgba(58, 42, 28, .5); font-size: 11px; }
.terror b.on { background: #5a4466; color: #f4e6cf; border-color: #5a4466; }
.terror b.past { color: rgba(58, 42, 28, .3); }
/* The Fear deck as its Terror track (hud.js renderFear): each Terror Level's divider, then a
   pip per card of its stack: resolved (face up, solid), face up now (ringed in gilt), earned
   and face down (the card's back: violet with a gilt edge), still in the deck (an outline). */
.terror.fear-track { gap: 7px; margin: 5px 0 0; }
.fear-track .stack { display: flex; align-items: center; gap: 2px; }
.terror.fear-track b { width: 19px; height: 19px; margin-right: 2px; }
#fear-panel .pip { flex: none; width: 9px; height: 13px; padding: 0; border-radius: 2px; border: 1px solid rgba(90, 68, 102, .45); background: transparent; cursor: default; }
#fear-panel .pip.resolved, #fear-panel .pip.now, #fear-panel .pip.up, #fear-panel .pip.revealed { background: #5a4466; border-color: #5a4466; cursor: pointer; }
#fear-panel .pip.now { box-shadow: 0 0 0 1.5px #e0b24a; }
#fear-panel .pip.earned { background: repeating-linear-gradient(135deg, #8b6f9c 0 2px, #6b5078 2px 4px); border-color: #c99a3c; cursor: help; }
#fear-panel .pip.deck { cursor: help; }
#fear-panel .pip:focus-visible { outline: 2px solid #b8893a; outline-offset: 1px; }
.terror .victory { font-size: 12px; color: rgba(58, 42, 28, .3); margin-left: 1px; }
.terror .victory.on { color: #b8893a; }
.fear-info .blight-note .blight-name { border: none; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; text-decoration: underline dotted; }

/* A Fear or Blight card in words, under its panel (hud.js showTip). */
#card-tip { position: fixed; z-index: 24; width: min(300px, calc(100vw - 12px)); padding: 9px 13px 10px; border-radius: 6px; pointer-events: none;
  background: #f3e7cc; color: var(--ink); box-shadow: 0 6px 18px rgba(20, 10, 4, .45), inset 4px 0 0 #6b4c84; }
#card-tip.blight { box-shadow: 0 6px 18px rgba(20, 10, 4, .45), inset 4px 0 0 #5a5d66; }
#card-tip.pinned { pointer-events: auto; }
#card-tip[hidden] { display: none; }
#card-tip h4 { margin: 2px 0 3px; font: 700 16px var(--serif); }
#card-tip p { margin: 0; font: 500 13.5px/1.32 var(--serif); }
#card-tip p.level { display: flex; gap: 7px; margin-top: 3px; color: rgba(58, 42, 28, .5); font-size: 12.5px; }
#card-tip p.level b { flex: none; width: 22px; font: 700 11px/1.6 var(--sc); color: rgba(58, 42, 28, .4); }
#card-tip p.level.on { color: var(--ink); font-size: 14px; font-weight: 600; }
#card-tip p.level.on b { color: #5a4466; }
#card-tip p.note { color: var(--ink-soft); font-style: italic; }
#card-tip p.note.low { color: #a4472a; font-weight: 700; font-style: normal; }
#card-tip p.rule { margin-bottom: 4px; }
#card-tip p.deck { margin-top: 6px; padding-top: 4px; border-top: 1px solid rgba(90, 68, 102, .2); font: 700 11px/1.3 var(--sc); color: #5a4466; letter-spacing: .03em; }

/* The Earned Fear Cards (face down; the one resolving face up, ringed) and the resolved ones,
   as cards (hud.js renderFear), each labelled like a pocket of the Invader board. */
.fear-piles { display: flex; flex-wrap: wrap; gap: 2px 12px; align-items: center; margin: 4px 0 0; min-width: 0; }
.fear-piles .pile { display: flex; gap: 3px; align-items: center; }
.fear-piles small { font: 700 10.5px/1 var(--sc); color: var(--ink-soft); letter-spacing: .04em; margin-right: 2px; }
#fear-panel .fear-piles .pip { width: 14px; height: 19px; }
.fear-piles .pile.earned { min-width: 0; max-width: 100%; }
.fear-piles .pile.discard { flex: none; }
.fear-piles .now-name { min-width: 0; margin-left: 3px; font: italic 600 13px/1.1 var(--serif); color: #5a4466; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fear-info .blight-note { line-height: 1.1; }

#blight-panel { flex: none; text-align: center; transform: rotate(-1.6deg); align-self: center; }
#blight-panel img { width: 100px; display: block; }
#blight-panel .card { display: block; margin: 0 auto; padding: 0; border: none; background: none; cursor: pointer; }
#blight-panel .card:focus-visible { outline: 2px solid #e0b24a; outline-offset: 2px; border-radius: 6px; }
#blight-panel p { margin: 0; font: 700 17px var(--hand); color: rgba(244, 230, 207, .9); }
#blight-panel b { font-size: 19px; }
/* Low (alerts.js blightAlert): the count in rust on a lit plate, with what running out does. */
#blight-panel.low p { color: #ffd9c8; text-shadow: 0 0 6px rgba(214, 72, 40, .9), 0 1px 2px rgba(0, 0, 0, .7); }
#blight-panel.low b { font-size: 26px; color: #fff1e8; }
/* The plate's glow pulses in its own layer, by opacity alone, four times when the count changes, then stays lit. */
#blight-panel .plate { display: block; position: relative; width: fit-content; }
#blight-panel.low img { box-shadow: 0 0 0 2px #d64828, 0 0 4px 1px rgba(214, 72, 40, .4); border-radius: 6px; }
#blight-panel.low .plate::after { content: ""; position: absolute; inset: 0; border-radius: 6px; pointer-events: none; box-shadow: 0 0 14px 3px rgba(214, 72, 40, .75);
  will-change: opacity; animation: blight-low 1.6s ease-in-out 4; }
@keyframes blight-low { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { #blight-panel.low .plate::after { animation: none; } }
.blight-note.low { color: #a4472a; font-weight: 800; }

#narration { background-color: #efe3c6; padding: 10px 14px; flex: 1 1 260px; min-width: 200px; overflow: hidden; }
#narration h3 { display: flex; justify-content: space-between; gap: 8px; }
#narration .step { font: 600 11px var(--sc); opacity: .7; }
#narration .line { margin: 2px 0 0; font: 600 16px/1.22 var(--serif); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
#narration .line.long { font-size: 14.5px; -webkit-line-clamp: 2; }
#narration .result { margin: 4px 0 0; font: 800 21px var(--sc); }
#narration .result.win { color: #3f6a35; }
#narration .result.loss { color: var(--rust); }
#narration .hand { font: 700 18px var(--hand); color: #7a3a26; margin: 6px 0 0; }
#narration .line.waiting { -webkit-line-clamp: 3; }
#narration .last { margin: 4px 0 0; font: italic 500 13px/1.25 var(--serif); color: var(--ink-soft); overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
#narration .last[hidden] { display: none; }
#narration .last small { font: 700 10.5px var(--sc); letter-spacing: .06em; font-style: normal; }
.explain { margin: 4px 0 0; color: #7a3a26; }
.explain small { font: 700 10.5px var(--sc); color: var(--ink-soft); letter-spacing: .03em; }
.explain ol { margin: 0; padding-left: 18px; font: 600 15px/1.1 var(--hand); }
.explain li:first-child { font-weight: 700; }
.explain li { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#tray { position: absolute; left: 0; right: 0; top: 0; height: 44px; display: flex; align-items: center; gap: 6px; padding: 0 4px; overflow: hidden; }
#tray .who { font: 700 13px var(--sc); color: #f3e6c8; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); padding-right: 4px; white-space: nowrap; }
#tray .who::after { content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 6px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 1.5px #f3e6c8; vertical-align: 1px; }
#tray .token { pointer-events: auto; position: relative; flex: 0 1 auto; min-width: 3em; max-width: 13em; display: flex; align-items: baseline; gap: 5px; padding: 3px 9px 3px 11px;
  border: 0; border-radius: 3px; background: var(--paper-color) var(--paper); color: var(--ink); font: 700 16px/1.15 var(--hand); white-space: nowrap; cursor: pointer;
  transform: rotate(var(--tilt)); box-shadow: inset 4px 0 0 var(--c), 0 2px 5px rgba(20, 10, 4, .4); transition: transform .15s ease, box-shadow .15s ease; }
#tray .token span { overflow: hidden; text-overflow: ellipsis; }
#tray .token i { font: 600 11.5px var(--serif); font-style: normal; color: var(--ink-soft); }
#tray .token.weighed { flex-shrink: 0; }
#tray .token.close i { color: var(--rust); font-weight: 700; }
#tray .token.now { transform: rotate(0deg) translateY(-1px); box-shadow: inset 4px 0 0 var(--c), 0 0 0 2px rgba(255, 214, 140, .85), 0 3px 8px rgba(20, 10, 4, .45); }
#tray .token:hover { transform: rotate(0deg) translateY(-2px); }
#tray .new { animation: token-in .32s cubic-bezier(.2, .9, .3, 1.25) var(--delay, 0ms) both; }
@keyframes token-in { from { opacity: 0; transform: translateY(-14px) rotate(var(--tilt, 0deg)) scale(.9); } }
@media (prefers-reduced-motion: reduce) { #tray .new { animation: none; } }
#tooltip .alts { margin: 4px 0 0; padding-left: 18px; font: 600 15px/1.15 var(--hand); color: #7a3a26; }
#tooltip div.alts { padding: 0; opacity: .7; }
.leaning { margin-left: 6px; font: 600 11px var(--sc); color: var(--ink-soft); font-variant-numeric: tabular-nums; }

/* ---------- Spirit panels ---------- */
#side { grid-column: 2; grid-row: 1 / 3; min-height: 0; display: flex; flex-direction: column; gap: var(--gap); }
#spirits { flex: 0 1 auto; min-height: 120px; overflow-y: auto; display: flex; flex-direction: column; gap: var(--gap); padding: 2px 4px 2px 2px; scrollbar-width: thin; }
.spirit { padding: 12px 14px; position: relative; flex: none;
  background: linear-gradient(135deg, color-mix(in srgb, var(--c0) 14%, transparent), transparent 55%), color-mix(in srgb, var(--c0) 10%, var(--paper-color)) var(--paper); }
.spirit header { display: flex; gap: 10px; align-items: center; }
.spirit .emblem { width: 58px; height: 58px; flex: none; }
.spirit .title { flex: 1; min-width: 0; }
.spirit h2 { margin: 0; font: 700 19px/1.1 var(--sc); }
.spirit .title p { margin: 2px 0 0; font: italic 500 13.5px var(--serif); color: var(--ink-soft); }
.coins { display: flex; gap: 8px; }
.coin { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; position: relative;
  font: 800 18px var(--serif); color: #3b2a10; box-shadow: 0 1.5px 3px rgba(30, 15, 5, .45), inset 0 0 0 1px rgba(60, 30, 10, .5), inset 0 0 0 4px rgba(255, 255, 255, .12);
  background: radial-gradient(circle at 35% 30%, #f6e2a8, #d6a84a 70%, #a77e2c); }
.coin.plays { background: radial-gradient(circle at 35% 30%, #f1e9da, #cbbba0 70%, #9d8b6c); width: 34px; height: 34px; font-size: 16px; }
.coin small { position: absolute; top: 100%; margin-top: 2px; font: 700 10px var(--sc); color: var(--ink-soft); }
.spirit:not(.open) { cursor: pointer; padding: 8px 12px; }
.spirit:not(.open) .emblem { width: 40px; height: 40px; }
.spirit:not(.open) h2 { font-size: 15.5px; }
.spirit:not(.open) .coin { transform: scale(.82); }
.mini { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 6px; }
.mini .els { display: flex; gap: 6px; font: 800 12px var(--serif); }
.mini .els span { display: flex; align-items: center; gap: 1px; }
.mini .els img { width: 16px; }
.mini .chips { display: flex; gap: 4px; align-items: center; }
.card.chip { width: 30px; }
.handcount { font: 700 15px var(--hand); color: var(--ink-soft); }
.handcount i { font-style: normal; }
#spirits.many .spirit:not(.open) { cursor: pointer; }
#spirits.many .spirit:not(.open):hover .handcount { color: var(--ink); text-decoration: underline dotted; }

.tracks { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 4px 16px; }
.track { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.track label { width: auto; }
.track label, .elements label, .cards label, .offer label { width: 70px; flex: none; font: 700 11.5px var(--sc); color: var(--ink-soft); }
.track ol { display: flex; gap: 4px; margin: 0; padding: 0; list-style: none; }
.track li { width: 27px; height: 27px; border-radius: 50%; background: #f6ecd4; box-shadow: inset 0 0 0 1px rgba(58, 42, 28, .5);
  display: grid; place-items: center; position: relative; font: 800 14px var(--serif); }
.track li img { width: 20px; }
.track li small { font: 700 7.5px var(--sc); }
.track li b.plays::after { content: ""; }
.track li .disc { position: absolute; width: 26px; inset: 0 0 0 0; margin: auto; top: -3px; }
.spirit .elements { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 3px; margin-top: 4px; }
.spirit .elements span { display: inline-flex; align-items: center; font: 800 12px var(--serif); flex: none; }
.spirit .elements span.on { margin-right: 3px; }
.spirit .elements span img { width: 18px; height: 18px; }
.spirit .elements span:not(.on) { opacity: .55; }
.spirit .elements em { margin-left: auto; padding-left: 8px; font: italic 500 12.5px var(--serif); color: var(--ink-soft); white-space: nowrap; }
.innates { margin-top: 8px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.innate { min-width: 0; background: rgba(234, 220, 188, .75); border-radius: 5px; box-shadow: inset 0 0 0 1px rgba(58, 42, 28, .3); padding: 5px 8px; }
.innate h4 { margin: 0 0 3px; display: flex; justify-content: space-between; font: 700 12.5px var(--sc); }
.innate h4 span { font-weight: 600; color: var(--ink-soft); font-size: 11px; }
.innate ol { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1px; }
.innate li { display: flex; gap: 8px; align-items: center; font: 500 12px/1.25 var(--serif); color: rgba(58, 42, 28, .55); padding: 1px 3px; border-radius: 3px; }
.innate li.met { background: rgba(226, 167, 46, .28); color: var(--ink); font-weight: 700; }
.innate .req { display: flex; gap: 1px; flex: none; min-width: var(--req, 74px); }
.innate .req img { width: 13px; }
.innate .fx { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cards { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px 18px; }
.cards .group { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cards .group label { width: auto; white-space: nowrap; }
.cards .group.offer { margin: 0; padding: 3px 6px 5px; flex-direction: column; flex-wrap: nowrap; }
.cards .row, .offer { display: flex; align-items: flex-start; gap: 4px; flex-wrap: wrap; }
.offer { margin-top: 8px; padding: 6px; border-radius: 6px; background: rgba(226, 167, 46, .18); box-shadow: inset 0 0 0 1px rgba(226, 167, 46, .5); }
.card { width: 68px; display: block; transition: transform .15s; }
.card:hover { transform: translateY(-4px) rotate(-1deg); }
.card.fast { filter: drop-shadow(0 0 4px rgba(216, 103, 58, .8)); }
.foot { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 16px; margin-top: 4px; }
.piles { margin: 0; font: 700 15px var(--hand); color: var(--ink-soft); }
.piles span + span::before { content: " · "; }
.hand-mat .piles { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.hand-mat .piles span + span::before { content: none; }
.spirit .foot details.special { margin: 0 0 0 auto; border-top: 0; padding-top: 0; }
.spirit .foot details.special[open] { flex-basis: 100%; margin-left: 0; border-top: 1px dashed rgba(90, 62, 36, .3); padding-top: 6px; }
#spirits.many .spirit.open { order: -1; }
#hands { display: none; }
@media (min-width: 1180px) { :root { --side: clamp(480px, 31vw, 580px); } }
#hud.rail { grid-template-rows: auto minmax(0, 1fr) auto auto; }
#hud.rail #side { grid-row: 1 / 4; }
#hud.rail #timeline { grid-row: 4; }
#hud.rail #hands { display: flex; grid-column: 1; grid-row: 3; gap: var(--gap); min-width: 0; }
/* The mat holds a strip that lays out its cards. Cards that do not fit even at the fan's
   deepest overlap (a Draft on a narrow window) scroll sideways in the strip instead of being
   cut off, under the mat's rim and ribbon, which stay put. */
.hand-mat { flex: 1 1 0; min-width: 0; display: flex;
  background: linear-gradient(135deg, color-mix(in srgb, var(--c0) 14%, transparent), transparent 55%), color-mix(in srgb, var(--c0) 10%, var(--paper-color)) var(--paper); }
.hand-mat > .strip { flex: 1 1 auto; min-width: 0; display: flex; align-items: flex-end; gap: 4px 14px; padding: 7px 12px 8px;
  border-radius: inherit; overflow: auto hidden; scrollbar-width: thin; }
.hand-mat .emblem { width: 36px; height: 36px; flex: none; align-self: center; }
.hand-mat .cards { margin: 0; flex: none; flex-wrap: nowrap; }
.hand-mat .row { flex-wrap: nowrap; }
.hand-mat .card { flex: none; position: relative; }
/* A hovered card lifts but stays under the card to its right (the zoom shows it whole):
   raised, it would cover the next card's strip, and a sweep left to right would skip it. */

.hand-mat .piles { margin: 0 0 0 auto; flex: none; align-self: flex-end; }

/* ---------- timeline ---------- */
#timeline { grid-column: 1 / 3; grid-row: 3; display: flex; align-items: center; gap: 14px; padding: 8px 14px; min-height: 56px; }
.transport { display: flex; gap: 6px; align-items: center; }
.transport button { width: 34px; height: 34px; border-radius: 50%; border: 1px solid rgba(58, 42, 28, .45); background: #e2d1ac; display: grid; place-items: center; padding: 0; }
.transport button:hover { background: #ecdcb8; }
.transport svg { width: 16px; height: 16px; fill: var(--ink); }
#btn-play .pause, #btn-play.playing .play { display: none; }
#btn-play.playing .pause { display: inline; }
#ribbon { flex: 1; height: 44px; min-width: 120px; cursor: pointer; touch-action: none; }
.tempo { display: flex; gap: 4px; }
.tempo button, .control button { border-radius: 14px; border: 1px solid rgba(58, 42, 28, .4); background: rgba(58, 42, 28, .07); padding: 4px 11px; font: 700 12.5px var(--sc); }
.tempo button.on { background: var(--ink); color: #f4e6cf; }
#btn-sound { width: 30px; height: 30px; border-radius: 50%; border: 1px solid rgba(58, 42, 28, .4); background: rgba(58, 42, 28, .07); display: grid; place-items: center; padding: 0; }
#btn-sound svg { width: 18px; height: 18px; fill: rgba(58, 42, 28, .6); }
#btn-sound .wave, #btn-sound .mute { fill: none; stroke: rgba(58, 42, 28, .6); stroke-width: 1.6; stroke-linecap: round; }
#btn-sound .wave { display: none; }
#btn-sound.on { background: radial-gradient(circle at 50% 55%, #5a3a1c, #2e2014); box-shadow: 0 0 12px rgba(255, 190, 90, .45); }
#btn-sound.on svg { fill: #ffd27a; }
#btn-sound.on .wave { display: inline; stroke: #ffd27a; }
#btn-sound.on .mute { display: none; }
.control { display: flex; align-items: center; gap: 6px; }
#controller { font: 700 16px var(--hand); color: #7a3a26; white-space: nowrap; }
button.primary { background: var(--rust); color: #f8ead2; border-color: #5a2219; }

/* ---------- floating ---------- */
#decision { flex: 0 0 auto; max-height: 46vh; min-height: 0; display: flex; flex-direction: column; padding: 10px 12px; margin: 0 4px 10px 2px; }
#decision[hidden], #log[hidden] { display: none; }
#decision h3 span { color: var(--ink); }
#decision input { margin: 4px 0 6px; padding: 5px 8px; border-radius: 5px; border: 1px solid rgba(58, 42, 28, .4); background: #fbf4e2; font: inherit; }
#decision ol { margin: 0; padding: 0; list-style: none; overflow-y: auto; display: grid; gap: 3px; }
#decision li button { width: 100%; text-align: left; padding: 5px 9px; border-radius: 5px; border: 1px solid rgba(58, 42, 28, .25); background: rgba(255, 250, 238, .65); font: 600 14px/1.25 var(--serif); }
#decision li button:hover, #decision li button:focus-visible { background: #fff6dc; border-color: var(--rust); outline: none; }
#decision .forfeit { display: block; font: italic 500 12.5px/1.2 var(--serif); color: #8a3b2c; margin-top: 1px; }
#log { position: fixed; right: calc(var(--side) + var(--gap) * 2); bottom: 92px; width: min(440px, 40vw); max-height: 60vh; overflow-y: auto; padding: 10px 12px; z-index: 5; }
#log ol { margin: 0; padding: 0; list-style: none; font: 500 13px/1.3 var(--serif); }
#log li { padding: 2px 4px; border-radius: 3px; cursor: pointer; display: flex; gap: 8px; }
#log li:hover { background: rgba(226, 167, 46, .2); }
#log li.cur { background: rgba(138, 59, 44, .15); font-weight: 700; }
#log li i { color: var(--ink-soft); font-style: normal; min-width: 34px; text-align: right; font-size: 11px; padding-top: 2px; }
#log h4 { margin: 8px 0 2px; font: 700 12px var(--sc); color: var(--ink-soft); }
#card-zoom { position: fixed; z-index: 20; pointer-events: none; filter: drop-shadow(0 10px 18px rgba(20, 10, 4, .5)); }
#card-zoom[hidden], #tooltip[hidden] { display: none; }
#tooltip { position: fixed; z-index: 15; pointer-events: none; background: #f4ead2; border-radius: 5px; padding: 5px 9px; font: 600 13px/1.3 var(--serif);
  box-shadow: 0 4px 10px rgba(20, 10, 4, .45), inset 0 0 0 1px rgba(58, 42, 28, .35); max-width: 260px; }
#tooltip b { font: 700 13px var(--sc); }
#loading { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(40, 26, 16, .82); z-index: 30; transition: opacity .4s; }
#loading p { font: 700 30px var(--hand); color: #f4e6cf; }
#loading.gone { opacity: 0; pointer-events: none; }
/* A static share site's notice (session.js showNotice): its bare address, or a game it lacks. */
#loading.notice p { margin: 0; padding: 16px; max-width: 32em; text-align: center; }

/* ---------- dialog ---------- */
dialog { border: none; border-radius: 8px; padding: 18px 22px; background: var(--paper-color) var(--paper); color: var(--ink);
  box-shadow: 0 3px 0 #6b5236, 4px 14px 30px rgba(10, 5, 2, .7); width: min(620px, 94vw); }
dialog::backdrop { background: rgba(30, 18, 10, .6); }
dialog h2 { margin: 0 0 10px; font: 800 24px var(--sc); }
dialog fieldset { border: none; padding: 0; margin: 0 0 12px; display: flex; gap: 18px; font-weight: 700; }
dialog .seats { display: grid; gap: 6px; margin-bottom: 12px; }
dialog .seat { display: grid; grid-template-columns: 26px 1fr 90px; gap: 8px; align-items: center; }
dialog .seat img { width: 26px; }
dialog .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
dialog label { display: grid; gap: 3px; font: 700 12px var(--sc); color: var(--ink-soft); }
dialog fieldset label { display: flex; gap: 6px; font: 600 15px var(--serif); color: var(--ink); }
dialog select, dialog input { font: 600 14.5px var(--serif); padding: 5px 7px; border-radius: 5px; border: 1px solid rgba(58, 42, 28, .4); background: #fbf4e2; color: var(--ink); min-width: 0; }
dialog .seed { display: flex; gap: 4px; }
dialog .seed input { flex: 1; }
dialog .dice { border-radius: 5px; border: 1px solid rgba(58, 42, 28, .4); background: #e2d1ac; font-size: 18px; line-height: 1; padding: 0 8px; }
dialog .error { color: var(--rust); font-weight: 700; }
dialog menu { display: flex; justify-content: flex-end; gap: 8px; padding: 0; margin: 14px 0 0; }
dialog menu button, #outcome menu button { border-radius: 16px; border: 1px solid rgba(58, 42, 28, .4); background: rgba(58, 42, 28, .07); padding: 6px 16px; font: 700 14px var(--sc); }

/* ---------- narrow screens ---------- */
/* Laptops (1181-1400 px): the top bar is too narrow for all four panels, so
   the Blight card gives way (its count moves into the Fear panel) and the
   Fear panel's dish shrinks beside the count, with the deck and the piles under both;
   the banner takes the rest and never runs under the Spirit panels. */
@media (min-width: 1181px) and (max-width: 1400px) {
  #blight-panel { display: none; }
  #fear-panel { flex: 0 1 230px; min-width: 200px; }
  #fear-panel .row { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 1px 8px; align-items: center; }
  #fear-panel .count { line-height: 1.1; }
  #fear-panel .count b { font-size: 22px; }
  #fear-panel h3 { margin-bottom: 2px; }
  #top #fear-panel { padding-top: 6px; padding-bottom: 3px; }
  #fear-panel .terror.fear-track, #fear-panel .fear-piles { margin-top: 2px; }
  .fear-piles small { white-space: nowrap; }
  #fear-panel .dish { width: 48px; height: 38px; }
  #fear-panel .fear-info { display: contents; }
  #fear-panel .fear-info > :not(.count) { grid-column: 1 / -1; }
  .fear-info .blight-note { display: block; }
  #narration { flex: 1 1 0; min-width: 0; }
}
/* Below that the banner comes first and the bar scrolls sideways for the rest. */
@media (min-width: 761px) and (max-width: 1180px) {
  #top { overflow-x: auto; scrollbar-width: thin; }
  #narration { order: -1; flex: 0 0 clamp(200px, 38%, 320px); min-width: 0; }
  #invader-track, #fear-panel { flex-shrink: 0; }
}
@media (max-width: 1180px) {
  #blight-panel { display: none; }
  .fear-info .blight-note { display: block; }
  #fear-panel { min-width: 220px; }
  #fear-panel .dish { width: 80px; height: 64px; }
}
@media (max-width: 760px) {
  :root { --gap: 6px; }
  body { font-size: 14px; }
  #hud { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(44vh, 1fr) auto auto; padding: 6px; }
  #top { overflow-x: auto; scrollbar-width: none; height: 126px; scroll-snap-type: x mandatory; }
  #top > * { scroll-snap-align: start; }
  #invader-track, #fear-panel, #narration { flex: none; }
  #narration { width: 78vw; }
  #side { grid-column: 1; grid-row: 3; max-height: 34vh; overflow-y: auto; }
  #spirits { flex-direction: row; overflow-x: auto; overflow-y: hidden; min-height: 0; padding: 2px; scroll-snap-type: x mandatory; }
  .spirit { width: 88vw; flex: none; max-height: 30vh; overflow-y: auto; scroll-snap-align: start; }
  #decision { order: -1; max-height: none; margin: 0; }
  #decision:not([hidden]) ~ #spirits .spirit { max-height: 18vh; }
  #timeline { grid-column: 1; grid-row: 4; flex-wrap: wrap; gap: 6px; padding: 6px 8px; }
  .transport button { width: 30px; height: 30px; }
  .tempo button, .control button { padding: 3px 8px; font-size: 11px; }
  #ribbon { order: 5; flex-basis: 100%; }
  #controller { display: none; }
  #log { left: 8px; right: 8px; width: auto; }
}
.pick { cursor: pointer; }
img.card.pick { box-shadow: 0 0 0 2px #ffd36a, 0 0 12px 2px rgba(255, 196, 80, .75); border-radius: 6px; animation: pick-glow 1.4s ease-in-out infinite; }
.track li.pick { box-shadow: inset 0 0 0 1px rgba(58, 42, 28, .5), 0 0 0 2px #ffd36a, 0 0 10px 2px rgba(255, 196, 80, .8); animation: pick-glow 1.4s ease-in-out infinite; }
.track li.pick .disc { animation: pick-lift 1.4s ease-in-out infinite; }
.pick:hover { filter: brightness(1.08); }
@keyframes pick-glow { 50% { box-shadow: 0 0 0 2px #ffe9a8, 0 0 18px 4px rgba(255, 196, 80, .9); } }
@keyframes pick-lift { 50% { transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .pick, .pick .disc { animation: none !important; } }
#decision .history { margin: 2px 0 8px; font: 600 15px var(--hand); color: #7a3a26; }
#board-area { position: relative; }
#outcome { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-.6deg); width: min(500px, 92%); padding: 22px 22px 18px; text-align: center; pointer-events: auto;
  box-shadow: 0 18px 40px rgba(20, 10, 4, .55), inset 0 0 0 1px rgba(58, 42, 28, .35); animation: outcome-in .7s cubic-bezier(.2, .9, .3, 1.2) both; }
:root.finale-wait #outcome { animation-play-state: paused; }
#outcome h2 { margin: 0; font: 700 40px/1 var(--hand); color: var(--ink); }
#outcome.win h2 { color: #3f6b3a; }
#outcome.loss h2 { color: #8a3b2c; }
#outcome .reason { margin: 6px 0 14px; font: 700 14px var(--sc); color: var(--ink-soft); letter-spacing: .02em; }
#outcome .stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 0 0 16px; }
#outcome .stats div { display: flex; flex-direction: column; align-items: center; gap: 2px; }
#outcome .stats b { font: 800 26px/1 var(--serif); font-variant-numeric: lining-nums; }
#outcome .stats span { font: 600 11.5px/1.15 var(--serif); color: var(--ink-soft); }
#outcome menu { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; }
@keyframes outcome-in { from { opacity: 0; transform: translate(-50%, -40%) rotate(-3deg) scale(.92); } }
@media (prefers-reduced-motion: reduce) { #outcome { animation: none; } }
#outcome menu button.primary { background: var(--rust); color: #f8ead2; border-color: #5a2219; }
@media (max-width: 760px) { #outcome .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } #outcome h2 { font-size: 32px; } }

/* ---------- choices ---------- */
#decision .crumbs { margin: 0 0 4px; font: italic 600 13.5px/1.3 var(--serif); color: #6a4a2c; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
#decision .crumbs .back { font: 700 12.5px var(--serif); padding: 1px 7px; border-radius: 10px; border: 1px solid rgba(58, 42, 28, .35); background: #f6ecd2; cursor: pointer; }
#decision .hint { margin: 0 0 6px; font: 500 15px/1.25 var(--hand); color: #7a3a26; }
#decision kbd { display: inline-block; min-width: 1.35em; margin-right: 7px; padding: 0 3px; border-radius: 3px; border: 1px solid rgba(58, 42, 28, .3); background: #efe2c2; font: 700 11px/1.45 var(--serif); text-align: center; color: #6a4a2c; vertical-align: 1px; }
#decision li.done button, #decision li.skip button { background: rgba(232, 220, 196, .55); font-weight: 500; color: #4a3826; }
#decision li.suggested button { border-color: #b8862a; box-shadow: 0 0 0 1px #e9c46a inset, 0 0 10px rgba(233, 196, 106, .55); }
#decision li.suggested button::after { content: " ✦"; color: #b8862a; }
#decision .advice { margin: 7px 0 0; font: 500 13.5px/1.3 var(--serif); color: #4a3826; }
#decision .advice .ask { padding: 3px 10px; border-radius: 12px; border: 1px dashed rgba(122, 58, 38, .55); background: transparent; font: italic 600 13px var(--serif); color: #7a3a26; cursor: pointer; }
#decision .advice .ask:hover { background: #fff2d2; }
#decision .advice.ready { padding: 6px 8px; border-radius: 6px; background: rgba(233, 196, 106, .18); border: 1px solid rgba(184, 134, 42, .35); }
#decision .advice.ready p { margin: 0; }
#decision .advice ol { margin: 3px 0 0 18px; padding: 0; list-style: decimal; display: block; font-size: 12.5px; }
#decision .advice.error { color: #8a3b2c; font-style: italic; }
#decision .spinner { display: inline-block; width: 12px; height: 12px; margin-right: 7px; border-radius: 50%; border: 2px solid rgba(122, 58, 38, .25); border-top-color: #7a3a26; animation: spin 0.9s linear infinite; vertical-align: -1px; }
@keyframes spin { to { transform: rotate(360deg); } }
.spirit .growth { display: flex; align-items: center; gap: 6px; margin: 6px 0 2px; flex-wrap: wrap; }
.spirit .growth label { width: 64px; flex: 0 0 auto; }
.spirit .growth .opt { display: flex; gap: 1px; padding: 2px 4px; border-radius: 7px; border: 1px solid rgba(58, 42, 28, .22); background: rgba(255, 248, 230, .5); }
.spirit .growth .opt img { width: 30px; height: 30px; }
.spirit .growth:not(.live) .opt { opacity: .78; }
.spirit .growth .opt.chosen { border-color: var(--rust); background: #fff2d2; box-shadow: 0 0 0 1px var(--rust) inset; opacity: 1; }
.spirit .innate.pick, .spirit .growth .opt.pick { cursor: pointer; animation: pick-glow 1.6s ease-in-out infinite; border-radius: 7px; }
#decision li[style] button { border-left: 4px solid var(--who); }
#decision .advice ol.weighed li { color: #6a5440; }
#decision .advice ol.weighed li.top { color: #4a3826; font-weight: 700; }

#newgame .recorded .hint { margin: 0 0 8px; font-size: 13px; color: #6a5440; }
#newgame .scripts { list-style: none; margin: 0 0 10px; padding: 0; max-height: 220px; overflow-y: auto; display: grid; gap: 4px; }
#newgame .scripts li.empty { font-style: italic; color: #8a7458; font-size: 13px; }
#newgame .scripts button { width: 100%; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; text-align: left; padding: 4px 8px; }
#newgame .scripts .emblems img { width: 22px; height: 22px; margin-right: -4px; vertical-align: middle; }
#newgame .scripts .won { color: #4f6b2f; font-weight: 700; }
#newgame .scripts .lost { color: #8a3b2c; }
#newgame .file { display: block; font-size: 13px; }

.spirit .drowned { margin: 4px 0 0; font: 400 13px var(--serif); color: #2d5a7f; }
.spirit .drowned b { font: 700 16px var(--sc); margin-right: 3px; }
.spirit details.special { margin-top: 8px; border-top: 1px dashed rgba(90, 62, 36, .3); padding-top: 6px; font: 400 12.5px/1.35 var(--serif); color: var(--ink-soft); }
.spirit details.special summary { cursor: pointer; font: 700 11.5px var(--sc); letter-spacing: .04em; }
.spirit details.special h5 { margin: 6px 0 2px; font: 700 12px var(--sc); color: var(--ink); }
.spirit details.special p { margin: 0 0 4px; }
.coin { position: relative; }
.coin .float { position: absolute; left: 50%; top: -4px; font: 700 15px var(--hand); white-space: nowrap; pointer-events: none; text-shadow: 0 1px 0 #f6ecd4; }
.coin .float.up { color: #3f6b3a; }
.coin .float.down { color: #9a3a26; }
#invader-track .row { perspective: 600px; }
.transport #btn-fwd {
  width: 44px; height: 44px; margin: -5px 0; border: 1px solid #5a2219;
  background: var(--rust); box-shadow: inset 0 0 0 3px var(--rust), inset 0 0 0 4px rgba(248, 234, 210, .55), 0 2px 4px rgba(40, 20, 5, .3);
  transition: transform .12s ease, background .2s ease;
}
.transport #btn-fwd svg { width: 20px; height: 20px; fill: #f8ead2; }
.transport #btn-fwd:hover { background: #9c4433; box-shadow: inset 0 0 0 3px #9c4433, inset 0 0 0 4px rgba(248, 234, 210, .6), 0 2px 4px rgba(40, 20, 5, .3); }
.transport #btn-fwd:active { transform: translateY(1px); }
@media (max-width: 760px) { .transport #btn-fwd { width: 38px; height: 38px; margin: -4px 0; } }

/* ================================================================ skin
   The lamp-lit skin over the layout above: type for the numbers on struck coins,
   then the walnut, vellum and gilt HUD. Its bitmaps come from art/furniture.js as
   CSS variables (--hud-*). */

/* Type for the HUD numbers that sit on struck coins and cards. */
.coin, .track li { font-family: "Alegreya SC", Alegreya, serif !important; font-variant-numeric: lining-nums; }
.coin.energy { color: #3e2508; text-shadow: 0 1px 0 rgba(255, 241, 196, .55); }
/* The card-plays number sits on the glyph set's indigo lacquer card, so it is gilt. */
.coin.plays { color: #f6d77a; text-shadow: 0 1px 1px rgba(10, 8, 30, .9); }
.track li b { font: 800 13px "Alegreya SC", serif; color: #3e2508; text-shadow: 0 1px 0 rgba(255, 241, 196, .5); }
.track li b.plays { color: #f6d77a; text-shadow: 0 1px 1px rgba(10, 8, 30, .9); font-size: 12px; }
.track li .disc { width: 25px; top: -2px; }
.spirit .elements span img { width: 18px; height: 18px; }
.innate .req { gap: 1px; }
.spirit .elements span:not(.on) { opacity: .85; }

/* The HUD skin: material and light, no illustration. Vellum leaves in thin walnut
   mounts with a gilt fillet, lit by the one lamp (upper left): highlights on the
   upper-left bevels, shadows short and to the lower right. The rest is gradients. */
:root {
  --h-ink: #2a1d14;
  --h-ink-soft: rgba(42, 29, 20, .66);
  --h-rubric: #8a3b2c;
  --h-gilt: #b8893a;
  --h-gilt-hi: #f3d68a;
  --h-gilt-lo: #7d5a22;
  --h-walnut: #3b2516;
  --h-vellum: #efe2c6;
  --h-bone: #ece3cf;
  --h-lamp: 255, 214, 150;
  --h-drop: 3px 6px 12px rgba(27, 18, 12, .5), 1px 2px 2px rgba(27, 18, 12, .45);
  --h-label: 700 10.5px/1 var(--sc);
}

/* ---------------------------------------------------------------- the leaf */
.panel, dialog {
  background:
    radial-gradient(120% 90% at 8% 0%, rgba(var(--h-lamp), .28), transparent 60%),
    linear-gradient(160deg, transparent 55%, rgba(60, 38, 24, .10)),
    var(--hud-vellum, none) var(--h-vellum);
  border-radius: 9px;
  box-shadow: var(--h-drop), inset 0 0 14px rgba(120, 84, 44, .16);
}
#invader-track, #fear-panel, #narration, #decision, #timeline, .hand-mat { position: relative; }
.panel::after, dialog::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 3;
  border: 16px solid transparent; border-image: var(--hud-rim) 32 / 16px stretch;
}
h3 { font: var(--h-label); letter-spacing: .14em; color: var(--h-rubric); margin-bottom: 5px; }
#spirits { margin-right: -10px; padding: 2px 14px 12px 2px; }

/* ---------------------------------------------------------------- top bar */
#invader-track { background:
    radial-gradient(120% 90% at 8% 0%, rgba(var(--h-lamp), .22), transparent 60%),
    var(--hud-vellum-deep, none) #e2d0aa; padding: 10px 13px 6px; }
.slot figcaption { font: var(--h-label); letter-spacing: .1em; color: var(--h-ink-soft); margin-top: 3px; }
.slot.ravage figcaption { color: var(--h-rubric); }
.slot .empty { border: 0; background: rgba(60, 38, 24, .13);
  box-shadow: inset 2px 3px 5px rgba(27, 18, 12, .35), inset -1px -1px 0 rgba(255, 248, 230, .55); color: rgba(42, 29, 20, .42); }
.arrow { color: var(--h-gilt); text-shadow: 0 1px 0 rgba(255, 248, 230, .7), 1px 1px 1px rgba(27, 18, 12, .3); font-size: 24px; }

#fear-panel { background:
    radial-gradient(120% 90% at 8% 0%, rgba(var(--h-lamp), .24), transparent 60%),
    linear-gradient(0deg, rgba(90, 68, 102, .10), rgba(90, 68, 102, .10)),
    var(--hud-vellum, none) var(--h-vellum); padding: 9px 13px 5px; }
.fear-info .count { color: var(--h-ink-soft); }
.fear-info .count b { font: 800 26px/1 var(--sc); color: var(--h-ink); text-shadow: 0 1px 0 rgba(255, 250, 235, .8); }
.terror { font: var(--h-label); letter-spacing: .1em; color: var(--h-ink-soft); gap: 6px; }
.terror b { width: 21px; height: 21px; border: 0; font: 800 10.5px var(--sc); color: rgba(42, 29, 20, .45);
  background: rgba(60, 38, 24, .08); box-shadow: inset 1px 1.5px 3px rgba(27, 18, 12, .3), 0 .5px 0 rgba(255, 248, 230, .7); }
.terror b.on { color: #f6e9cf; background: radial-gradient(circle at 35% 30%, #8f74a4, #5a4466 55%, #33243f);
  box-shadow: 1px 2px 2px rgba(27, 18, 12, .45), inset 0 0 0 1.2px #c99a48, inset 0 0 0 2px rgba(255, 238, 190, .35); text-shadow: 0 1px 0 rgba(0, 0, 0, .4); }
.terror b.past { color: rgba(42, 29, 20, .3); }

#narration .step { font: var(--h-label); letter-spacing: .06em; opacity: .7; color: var(--h-ink); }
#narration .line { color: var(--h-ink); }
.explain small { font: var(--h-label); letter-spacing: .12em; color: var(--h-ink-soft); }

#tray .token { background: var(--hud-vellum, none) var(--h-vellum); border-radius: 4px;
  box-shadow: inset 4px 0 0 var(--c), inset 0 0 0 1px rgba(184, 137, 58, .5), 2px 4px 7px rgba(27, 18, 12, .5); }
#tray .token.now { box-shadow: inset 4px 0 0 var(--c), inset 0 0 0 1px rgba(184, 137, 58, .8), 0 0 0 2px rgba(var(--h-lamp), .9), 0 0 14px rgba(var(--h-lamp), .55), 2px 4px 8px rgba(27, 18, 12, .5); }

/* ---------------------------------------------------------------- Spirit panels */
.spirit, .hand-mat { background:
    radial-gradient(120% 70% at 6% 0%, color-mix(in srgb, var(--c0) 9%, rgba(var(--h-lamp), .26)), transparent 60%),
    linear-gradient(160deg, transparent 55%, rgba(60, 38, 24, .10)),
    var(--hud-vellum, none) var(--h-vellum); }
/* the Spirit's colour as a thin lacquer ribbon down the spine of the leaf */
.spirit::before, .hand-mat::before {
  content: ""; position: absolute; left: 8px; top: 12px; bottom: 12px; width: 3px; border-radius: 2px; z-index: 2; pointer-events: none;
  background: linear-gradient(90deg, color-mix(in srgb, var(--c0) 55%, #fff) 0, var(--c0) 45%, color-mix(in srgb, var(--c0) 60%, #1b120c) 100%);
  box-shadow: 1px 1px 1px rgba(27, 18, 12, .35);
}
.spirit { padding: 13px 13px 12px 18px; }
.spirit:not(.open) { padding: 9px 13px 9px 19px; }
.spirit .emblem, .hand-mat .emblem { box-sizing: border-box; padding: 5px; border-radius: 50%;
  background: var(--hud-bezel) center / 100% 100% no-repeat; filter: drop-shadow(2px 3px 2px rgba(27, 18, 12, .4)); }
.spirit .emblem { width: 62px; height: 62px; }
.spirit:not(.open) .emblem { width: 44px; height: 44px; padding: 4px; }
.spirit h2 { font: 800 19px/1.08 var(--sc); color: var(--h-ink); letter-spacing: .01em; text-shadow: 0 1px 0 rgba(255, 250, 235, .75); }
.spirit:not(.open) h2 { font-size: 15.5px; }
.spirit .title p, .spirit .elements em { color: var(--h-ink-soft); }
.coin small { font: var(--h-label); letter-spacing: .1em; color: var(--h-ink-soft); }

.track label, .elements label, .cards label, .offer label, .spirit .growth label {
  font: var(--h-label); letter-spacing: .14em; color: var(--h-rubric); }
.tracks { margin-top: 11px; gap: 6px 12px; }
.track { gap: 4px; }
.spirit .track label { width: auto; white-space: nowrap; padding-left: 6px; }

/* the Presence track: a walnut inlay with gilt lips, one cove-cut socket per space */
.track ol { position: relative; gap: 2px; padding: 4px 5px; }
.track ol::before { content: ""; position: absolute; inset: 0; z-index: 0;
  border: 18px solid transparent; border-image: var(--hud-rail) 36 fill / 18px stretch; }
.spirit .track li { z-index: 1; width: 27px; height: 27px; border-radius: 50%;
  background: var(--hud-socket) center / 100% 100% no-repeat; box-shadow: none; }
.spirit .track li.k-energy:not(.covered) { background: var(--hud-g-coin) center / 128% no-repeat, var(--hud-socket) center / 100% 100% no-repeat; }
.spirit .track li.k-plays:not(.covered) { background: var(--hud-g-card) center / 128% no-repeat, var(--hud-socket) center / 100% 100% no-repeat; }
.spirit .track li.k-reclaim:not(.covered) { background: var(--hud-g-reclaim) center / 92% no-repeat, var(--hud-socket) center / 100% 100% no-repeat; }
.spirit .track li.k-any:not(.covered) { background: var(--hud-g-any) center / 92% no-repeat, var(--hud-socket) center / 100% 100% no-repeat; }
.spirit .track li small { display: none; }
.spirit .track li > img:not(.disc) { width: 24px; height: 24px; }
/* r3: Energy reads at a glance: near-black numerals, as large as the coin's field allows,
   on a paler struck field (furniture.js), with the kit glyph numeral's warm lower lip */
.spirit .track li b { font: 800 15px/1 var(--sc); color: #180c02; text-shadow: .5px .7px 0 rgba(255, 233, 176, .5); }
.spirit .track li b.plays { font-size: 13.5px; color: #f6d77a; text-shadow: 0 1px 1px rgba(10, 8, 30, .9); }
.spirit .coin.energy { background: var(--hud-g-coin38) center / 132% no-repeat !important; color: #180c02; font-size: 21px; text-shadow: .6px .9px 0 rgba(255, 233, 176, .5); }
.spirit .coin.plays { color: #f6d77a; text-shadow: 0 1px 1px rgba(10, 8, 30, .9); font-size: 18px; }
/* covered: the Presence sits in the socket; what it hides peeks out as a tag */
.spirit .track li .disc { width: 25px; top: -2px; left: -1px; right: auto; bottom: auto; inset: auto; position: absolute; margin: 0; z-index: 1; }
.spirit .track li.covered .disc { top: -1px; left: 0; }
/* r3: the hidden value is a pale chip with a dark keyline, so it parts from the dark
   Presence disc by value alone; the numeral is near-black (was 9 px umber on mid gold) */
.spirit .track li.covered > b { position: absolute; z-index: 2; right: -4px; bottom: -3px; min-width: 15px; height: 15px; padding: 0 2px; box-sizing: border-box; border-radius: 8px;
  font: 800 11px/15px var(--sc); text-align: center; color: #180c02; text-shadow: none;
  background: var(--hud-vellum) 3px 5px / 64px, radial-gradient(circle at 40% 34%, #f8e3a4, #e9c270 60%, #cf9f4c); background-blend-mode: multiply; box-shadow: 0 0 0 1.2px #24140a, 1px 1.5px 1.5px rgba(20, 10, 4, .6); }
.spirit .track li.covered > b.plays { border-radius: 2.5px; font-size: 10.5px; background: var(--hud-vellum) 7px 2px / 64px, linear-gradient(150deg, #fffaf0, #eadcb8); background-blend-mode: multiply; box-shadow: 0 0 0 1.2px #24140a, 1px 1.5px 1.5px rgba(20, 10, 4, .6); }
.spirit .track li.covered > img:not(.disc) { position: absolute; z-index: 2; width: 14px; height: 14px; right: -3px; bottom: -2px; filter: drop-shadow(.5px 1px .5px rgba(27, 18, 12, .5)); }
.spirit .track li.covered.k-reclaim::after, .spirit .track li.covered.k-any::after { content: ""; position: absolute; z-index: 2; width: 14px; height: 14px; right: -3px; bottom: -2px;
  background: var(--hud-g-reclaim) center / contain no-repeat; }
.spirit .track li.covered.k-any::after { background-image: var(--hud-g-any); }
/* the space in effect now: a ring of lamp light */
.spirit .track li.now { box-shadow: 0 0 0 1.4px rgba(243, 214, 138, .95), 0 0 9px 2px rgba(var(--h-lamp), .55); }
.spirit .track li.pick { box-shadow: 0 0 0 2px #ffd36a, 0 0 12px 3px rgba(255, 196, 80, .85); }

/* elements this turn */
.spirit .elements { gap: 2px 4px; margin-top: 5px; }
.spirit .elements span { font: 800 12px var(--sc); color: var(--h-ink); }
.spirit .elements span:not(.on) { opacity: .5; }

/* innate powers: a deeper vellum plate with a tooled gilt keyline */
.innates { margin-top: 10px; gap: 7px; }
.innate { background:
    radial-gradient(100% 120% at 0% 0%, rgba(var(--h-lamp), .22), transparent 70%),
    var(--hud-vellum-deep, none) #e6d5b0; border-radius: 6px; padding: 6px 9px 6px;
  box-shadow: inset 0 0 0 1px rgba(184, 137, 58, .7), inset 0 0 0 2.5px rgba(255, 248, 230, .45), inset 0 0 0 3.5px rgba(122, 90, 40, .16), inset 1px 2px 5px rgba(60, 38, 24, .18); }
.innate h4 { font: 800 12.5px var(--sc); color: var(--h-ink); letter-spacing: .02em; margin-bottom: 4px; }
.innate h4 span { display: inline-flex; align-items: center; gap: 3px; font: var(--h-label); letter-spacing: .12em; color: var(--h-ink-soft); }
.innate h4 span::before { content: ""; width: 15px; height: 15px; background: var(--hud-g-slow) center / contain no-repeat; }
.innate h4 span.fast::before { background-image: var(--hud-g-fast); }
.innate li { color: rgba(42, 29, 20, .5); border-radius: 3px; padding: 1px 4px; }
.innate li.met { color: var(--h-ink); font-weight: 700;
  background: linear-gradient(90deg, rgba(232, 184, 96, .42), rgba(232, 184, 96, .12) 70%, transparent);
  box-shadow: inset 2px 0 0 var(--h-gilt); }

/* growth: card-stock chits; the chosen one lit */
.spirit .growth { gap: 6px; margin: 9px 0 2px; }
.spirit .growth label { width: 58px; padding-left: 0; }
.spirit .growth .opt { border: 0; border-radius: 6px; padding: 3px 5px; background:
    radial-gradient(100% 120% at 0% 0%, rgba(255, 252, 240, .7), transparent 70%), var(--hud-vellum, none) #f2e8d2;
  box-shadow: inset 0 0 0 1px rgba(184, 137, 58, .55), 1px 2px 3px rgba(27, 18, 12, .28); }
.spirit .growth .opt.chosen { background: radial-gradient(100% 120% at 30% 0%, rgba(255, 244, 210, 1), rgba(250, 226, 170, .9)), #fbe9c0;
  box-shadow: inset 0 0 0 1.5px var(--h-gilt), 0 0 0 1px rgba(243, 214, 138, .9), 0 0 12px 1px rgba(var(--h-lamp), .7), 1px 2px 3px rgba(27, 18, 12, .3); }
.spirit .growth:not(.live) .opt:not(.chosen) { opacity: .82; }

.spirit details.special, .spirit .foot details.special[open] { border-top-color: rgba(184, 137, 58, .45); }
.spirit details.special summary { font: var(--h-label); letter-spacing: .14em; color: var(--h-rubric); }
.spirit details.special summary::marker { color: var(--h-gilt); }
/* a special rule's effect now (rules.js): a slim plate under the header, keyed in the
   Spirit's colour, lamp-lit while the rule acts */
.spirit .rule-now { display: flex; align-items: baseline; gap: 5px; margin: 7px 0 0; padding: 2px 8px 3px 6px; border-radius: 5px;
  font: 500 12.5px/1.3 var(--serif); color: var(--h-ink);
  background: linear-gradient(90deg, color-mix(in srgb, var(--c0) 20%, transparent), color-mix(in srgb, var(--c0) 5%, transparent) 75%);
  box-shadow: inset 2.5px 0 0 var(--c0); }
.spirit .rule-now + .rule-now { margin-top: 3px; }
.spirit .rule-now img { width: 17px; height: 17px; flex: none; align-self: center; }
.spirit .rule-now b { flex: none; font: var(--h-label); letter-spacing: .1em; color: var(--h-rubric); white-space: nowrap; }
.spirit .rule-now .n { flex: none; font: 800 15px/1 var(--sc); }
.spirit .rule-now.live { box-shadow: inset 2.5px 0 0 var(--c0), 0 0 0 1px rgba(243, 214, 138, .8), 0 0 9px 1px rgba(var(--h-lamp), .5); }
.spirit:not(.open) .rule-now { margin-top: 5px; }
.spirit:not(.open) .rule-now .fx { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.piles { color: var(--h-ink-soft); }
.offer { background: rgba(232, 184, 96, .16); box-shadow: inset 0 0 0 1px rgba(184, 137, 58, .6), 0 0 10px rgba(var(--h-lamp), .3); }
.mini .els { font: 800 12px var(--sc); }

/* the hand: a walnut tray the cards lie in */
.hand-mat > .strip { padding: 8px 14px 9px 21px; }
.hand-mat { background:
    radial-gradient(90% 120% at 10% 0%, rgba(var(--h-lamp), .13), transparent 60%),
    linear-gradient(180deg, rgba(0, 0, 0, 0) 40%, rgba(10, 6, 3, .28)),
    var(--hud-walnut, none) var(--h-walnut);
  box-shadow: var(--h-drop), inset 0 2px 8px rgba(10, 6, 3, .55); }
.hand-mat::after { border-image-source: var(--hud-rim-dark); }
.hand-mat .cards label { color: #d9b56a; text-shadow: 0 1px 1px rgba(10, 6, 3, .6); }
.hand-mat .piles { color: rgba(236, 214, 170, .78); }
.hand-mat .emblem { width: 42px; height: 42px; padding: 4px; }

/* ---------------------------------------------------------------- timeline */
#timeline { background:
    linear-gradient(180deg, rgba(var(--h-lamp), .12), transparent 45%, rgba(10, 6, 3, .3)),
    var(--hud-walnut, none) var(--h-walnut);
  box-shadow: var(--h-drop), inset 0 1px 0 rgba(255, 230, 190, .1); color: var(--h-bone); padding: 8px 16px; }
#timeline::after { border-image-source: var(--hud-rim-dark); }
.transport button, #btn-sound { border: 0;
  background: radial-gradient(circle at 34% 28%, #fffaf0 0, #eadcbc 38%, #bfa478 78%, #8e7148 100%);
  box-shadow: 1px 2px 3px rgba(10, 6, 3, .6), inset 0 0 0 1px rgba(60, 38, 24, .45), inset -1px -2px 2px rgba(60, 38, 24, .25); }
.transport button:hover, #btn-sound:hover { background: radial-gradient(circle at 34% 28%, #fffdf6 0, #f3e6c8 38%, #ccb185 78%, #977a50 100%); }
.transport svg { fill: var(--h-ink); }
.transport #btn-fwd { border: 0; background: radial-gradient(circle at 34% 28%, #e08a6c 0, #a8473a 40%, #7a2e22 80%, #4a1a12 100%);
  box-shadow: 1px 2px 4px rgba(10, 6, 3, .65), inset 0 0 0 1.5px #c99a48, inset 0 0 0 2.5px rgba(255, 228, 170, .35); }
.transport #btn-fwd:hover { background: radial-gradient(circle at 34% 28%, #ea9a7c 0, #b5513f 40%, #842f24 80%, #4a1a12 100%);
  box-shadow: 1px 2px 4px rgba(10, 6, 3, .65), inset 0 0 0 1.5px #e0b45c, inset 0 0 0 2.5px rgba(255, 228, 170, .45), 0 0 10px rgba(var(--h-lamp), .4); }
.transport #btn-fwd svg { fill: #fbeed6; }
.tempo { gap: 0; padding: 2px; border-radius: 15px; background: rgba(10, 6, 3, .45); box-shadow: inset 1px 2px 3px rgba(0, 0, 0, .5), 0 1px 0 rgba(255, 230, 190, .1); }
.tempo button { border: 0; border-radius: 13px; background: transparent; color: rgba(236, 214, 170, .75); font: 700 12px var(--sc); letter-spacing: .04em; padding: 4px 11px; }
.tempo button:hover { color: var(--h-gilt-hi); }
.tempo button.on { color: var(--h-ink); background: linear-gradient(170deg, #fbe7a6, #d9a84c 55%, #9c7230);
  box-shadow: 1px 1px 2px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 250, 230, .6); text-shadow: 0 1px 0 rgba(255, 245, 210, .5); }
#btn-sound svg { fill: rgba(42, 29, 20, .7); }
#btn-sound .wave, #btn-sound .mute { stroke: rgba(42, 29, 20, .7); }
#btn-sound.on { background: radial-gradient(circle at 50% 55%, #6a4420, #2e2014); box-shadow: 0 0 12px rgba(var(--h-lamp), .55), inset 0 0 0 1px #c99a48; }
#controller { color: #e2c58a; }
.control button { border: 0; border-radius: 14px; padding: 5px 13px; font: 700 12px var(--sc); letter-spacing: .03em; color: var(--h-ink);
  background: linear-gradient(170deg, #fbf3df, #e3d1aa 60%, #c4a87a); box-shadow: 1px 2px 3px rgba(10, 6, 3, .55), inset 0 0 0 1px rgba(60, 38, 24, .35); }
.control button:hover { background: linear-gradient(170deg, #fffaf0, #eddcb8 60%, #ceb385); }
.control button.primary, button.primary { color: #fbeed6; background: linear-gradient(170deg, #c0604a, #8a3b2c 55%, #5e2419);
  box-shadow: 1px 2px 3px rgba(10, 6, 3, .55), inset 0 0 0 1px #c99a48, inset 0 1px 0 rgba(255, 220, 190, .3); text-shadow: 0 1px 0 rgba(0, 0, 0, .35); }

/* ---------------------------------------------------------------- floating */
#decision { padding: 12px 14px; }
#decision li button { border: 0; border-radius: 5px; background: rgba(255, 250, 238, .6);
  box-shadow: inset 0 0 0 1px rgba(184, 137, 58, .45), .5px 1px 1.5px rgba(27, 18, 12, .2); }
#decision li button:hover, #decision li button:focus-visible { background: #fff7e2; box-shadow: inset 0 0 0 1.5px var(--h-gilt), 0 0 8px rgba(var(--h-lamp), .6); }
#decision kbd { border: 0; background: linear-gradient(170deg, #fbf3df, #e0cfa8); box-shadow: .5px 1px 1px rgba(27, 18, 12, .45), inset 0 0 0 .6px rgba(122, 90, 40, .5); color: var(--h-ink); }
#decision h3 span { color: var(--h-ink); letter-spacing: .06em; }
#log { padding: 12px 14px; box-shadow: var(--h-drop), inset 0 0 0 3px #4a2e1a, inset 0 0 0 4.2px #c99a48, inset 0 0 0 5px rgba(42, 29, 20, .3), inset 0 0 14px rgba(120, 84, 44, .2); }
#log::after { display: none; }
#log h4 { font: var(--h-label); letter-spacing: .14em; color: var(--h-rubric); }
#log li.cur { background: rgba(232, 184, 96, .3); box-shadow: inset 2px 0 0 var(--h-gilt); }
#tooltip { background: var(--hud-vellum, none) #f4ead2; border-radius: 5px; color: var(--h-ink);
  box-shadow: 2px 5px 10px rgba(27, 18, 12, .55), inset 0 0 0 1px rgba(184, 137, 58, .7), inset 0 0 0 2.5px rgba(255, 248, 230, .5); }

/* the card zoom: large, lifted off the table into the lamp */
#card-zoom { filter: none; }
#card-zoom.big::before { content: ""; position: absolute; inset: -40px -50px -30px -50px; z-index: -1; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(10, 6, 3, .5), rgba(10, 6, 3, .25) 60%, transparent); }
#card-zoom canvas { display: block; }

dialog { padding: 22px 26px; }
dialog h2 { font: 800 24px var(--sc); color: var(--h-ink); text-shadow: 0 1px 0 rgba(255, 250, 235, .75); }
dialog label { font: var(--h-label); letter-spacing: .12em; color: var(--h-rubric); }
dialog fieldset label { letter-spacing: 0; }
dialog select, dialog input { border: 0; background: rgba(255, 250, 238, .7); box-shadow: inset 1px 2px 3px rgba(60, 38, 24, .3), inset 0 0 0 1px rgba(122, 90, 40, .4); }
dialog menu button, #outcome menu button { border: 0; color: var(--h-ink); background: linear-gradient(170deg, #fbf3df, #e3d1aa 60%, #c4a87a);
  box-shadow: 1px 2px 3px rgba(27, 18, 12, .45), inset 0 0 0 1px rgba(60, 38, 24, .35); }
dialog menu button.primary, #outcome menu button.primary { color: #fbeed6; background: linear-gradient(170deg, #c0604a, #8a3b2c 55%, #5e2419);
  box-shadow: 1px 2px 3px rgba(27, 18, 12, .45), inset 0 0 0 1px #c99a48; }
dialog::backdrop { background: radial-gradient(circle at 45% 40%, rgba(27, 18, 12, .45), rgba(27, 18, 12, .8)); }

/* a tooled rule under an open Spirit's header: a gilt hairline over its own shadow */
.spirit.open > header { padding-bottom: 7px; background:
  linear-gradient(90deg, transparent, rgba(184, 137, 58, .7) 12%, rgba(184, 137, 58, .7) 88%, transparent) left calc(100% - 1px) / 100% 1px no-repeat,
  linear-gradient(90deg, transparent, rgba(255, 250, 235, .8) 12%, rgba(255, 250, 235, .8) 88%, transparent) left 100% / 100% 1px no-repeat; }
.spirit.open .tracks { margin-top: 8px; }

/* ---------- follow mode: the table's notes and Claude's questions (session.js) ---------- */
#btn-switch[hidden] { display: none; }
/* The panel has a column of its own, left of the board, so it covers none of
   the island: the top bar spans it and the board, and the board lays out in
   what is left. Folded, it is a slim strip and the board takes the space. On
   a phone it is a row under the board. */
#hud.following { --follow: clamp(280px, 25vw, 440px); grid-template-columns: var(--follow) minmax(0, 1fr) var(--side); }
#hud.following.follow-folded { --follow: 40px; }
#hud.following #top { grid-column: 1 / 3; }
#hud.following #board-area { grid-column: 2; }
#hud.following.rail #hands { grid-column: 1 / 3; }
#hud.following #side { grid-column: 3; }
#hud.following #timeline { grid-column: 1 / 4; }
/* Nobody at the table (every seat the model's) or a static share site: no
   column, the island takes its room, and the land-name and legal-move
   toggles sit with the timeline's controls (session.js updateBare). */
#hud.following.follow-bare { grid-template-columns: minmax(0, 1fr) var(--side); }
#hud.following.follow-bare #top, #hud.following.follow-bare #board-area, #hud.following.follow-bare.rail #hands { grid-column: 1; }
#hud.following.follow-bare #side { grid-column: 2; }
#hud.following.follow-bare #timeline { grid-column: 1 / 3; }
#hud.following.follow-bare #follow { display: none; }
.control .hints, .control .names { font-family: var(--serif); font-style: italic; letter-spacing: 0; text-transform: none; white-space: nowrap; }
/* below 1180 px the timeline's controls leave the ribbon too little: it takes a row of its own */
@media (max-width: 1180px) {
  #hud.following.follow-bare #timeline { flex-wrap: wrap; row-gap: 6px; }
  #hud.following.follow-bare #ribbon { order: 5; flex-basis: 100%; }
}
#follow { grid-column: 1; grid-row: 2; position: relative; min-height: 0; min-width: 0; overflow: hidden;
  display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; }
#follow.folded { padding: 10px 0; align-items: center; }
#follow.folded h3 { flex-direction: column-reverse; justify-content: flex-end; gap: 10px; writing-mode: vertical-rl; margin: 0; }
#follow.folded .fold { writing-mode: horizontal-tb; }
#follow.folded .status { display: none; }
#follow h3 { display: flex; align-items: center; gap: 8px; }
#follow h3 .title { margin-right: auto; }
#follow .hints, #follow .names { border: 1px solid rgba(58, 42, 28, .3); border-radius: 9px; background: transparent; padding: 0 8px;
  font: italic 600 11.5px/16px var(--serif); letter-spacing: 0; text-transform: none; color: var(--ink-soft); position: relative; z-index: 4; }
#follow .hints[aria-pressed="true"], #follow .names[aria-pressed="true"] { background: rgba(255, 233, 168, .55); color: var(--ink); }
#follow.folded .hints, #follow.folded .names { display: none; }
#follow .fold { border: none; background: none; font: 700 16px/1 var(--serif); color: var(--ink-soft); padding: 0 4px; position: relative; z-index: 4; }
#follow.folded .panes { display: none; }
#follow .status { margin: 0; font: 600 12.5px/1.25 var(--serif); color: var(--ink-soft); }
#follow .status.warn { color: #8a3b2c; }
/* Panes keep their content's height: with a zero basis the auto-height panel
   gave them none, and the panes drew over each other. In a short window the
   panes scroll inside the frame, under a fixed header. */
#follow .panes { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 6px;
  position: relative; z-index: 4; }
#follow .pane { display: flex; flex-direction: column; flex: 0 0 auto; position: relative; }
/* Notes and Questions share what the column has left (each at least four lines); the
   model's view and a Draft offer give way first, each scrolling inside itself. */
#follow .pane:not(.advice) { flex: 1 1 0; }
#follow .pane.advice { flex: 0 1 auto; min-height: 0; }
#follow .pane .answered { margin-left: 8px; border: 1px solid rgba(58, 42, 28, .3); border-radius: 9px; background: transparent; padding: 0 8px;
  font: 600 11.5px/1.5 var(--serif); color: var(--ink-soft); text-transform: none; letter-spacing: 0; cursor: pointer; }
#follow .pane .answered:hover { background: rgba(251, 244, 226, .9); color: var(--ink); }
#follow .pane .answered[hidden] { display: none; }
#follow .pane h4 { margin: 2px 0 3px; font: 700 12px var(--sc); color: var(--ink-soft); }
#follow .pane .state { font: italic 500 12px var(--serif); }
#follow textarea { flex: 1 1 auto; min-height: calc(4 * 1.35em + 14px); resize: vertical; padding: 6px 8px; border-radius: 5px;
  border: 1px solid rgba(58, 42, 28, .35); background: rgba(251, 244, 226, .92); color: var(--ink); font: 500 14px/1.35 var(--serif); }
/* Notes the listener has handled show dimmed: a veil over the textarea
   (session.js markHandled) lays out the same text and shades those lines. */
#follow .field { position: relative; display: flex; flex-direction: column; flex: 1 1 auto; }
#follow .veil { position: absolute; overflow: hidden; pointer-events: none; z-index: 1; padding: 6px 8px; border-radius: 4px;
  font: 500 14px/1.35 var(--serif); white-space: pre-wrap; overflow-wrap: break-word; color: transparent; }
#follow .veil .taken { background: rgba(232, 220, 192, .72); box-shadow: 0 0 0 8px rgba(232, 220, 192, .72); clip-path: inset(-6px -8px 0 -8px);
  border-bottom: 1px dashed rgba(58, 42, 28, .35); }
#follow .handled-note { font: italic 500 12px var(--serif); text-transform: none; letter-spacing: 0; }
#follow textarea:focus { outline: 2px solid rgba(226, 167, 46, .6); outline-offset: 0; }
/* The model's view (session.js, advice.js): the decision, then the ranked
   suggestions with their follow-up choices indented under them. Hidden, it
   shows only its title and the button that opens it. */
#follow .advice h4 { display: flex; align-items: baseline; gap: 8px; }
#follow .advice .hide { margin-left: auto; border: 1px solid rgba(58, 42, 28, .3); border-radius: 9px; background: transparent;
  padding: 0 8px; font: italic 600 11.5px/16px var(--serif); color: var(--ink-soft); cursor: pointer; }
#follow .advice .hide:hover { background: rgba(251, 244, 226, .9); color: var(--ink); }
#follow .advice.hidden .advice-body { display: none; }
#follow .advice-body { max-height: 30vh; min-height: 0; flex: 0 1 auto; overflow: auto; padding: 6px 8px; border-radius: 5px;
  background: rgba(251, 244, 226, .7); border: 1px solid rgba(58, 42, 28, .2); font: 500 13px/1.3 var(--serif); }
#follow .advice-body.stale .decision, #follow .advice-body.stale .tree, #follow .advice-body.stale .error { opacity: .45; }
#follow .advice-body pre { margin: 0; font: 500 11.5px/1.35 ui-monospace, "DejaVu Sans Mono", monospace; white-space: pre; }
#follow .advice-body .note { margin: 6px 0 0; font: italic 500 12px/1.25 var(--serif); color: var(--ink-soft); }
#follow .advice-body .note:first-child { margin-top: 0; }
#follow .advice-body .error { margin: 0; color: var(--rust); }
#follow .advice .decision { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 10px;
  padding-bottom: 4px; margin-bottom: 4px; border-bottom: 1px solid rgba(58, 42, 28, .18); }
#follow .advice .decision .where { margin-left: 8px; font-style: italic; color: var(--ink-soft); }
#follow .advice .now { color: var(--ink-soft); }
#follow .advice .now .val { font-weight: 700; color: var(--ink); }
#follow .advice .row { display: grid; grid-template-columns: 14px 20px 62px minmax(0, 1fr) auto; column-gap: 4px; align-items: baseline;
  padding: 2px 0 2px calc(var(--depth) * 14px); }
#follow .advice .row.top { border-top: 1px dotted rgba(58, 42, 28, .2); padding-top: 3px; }
#follow .advice .row.top:first-child { border-top: none; }
#follow .advice .row.pinned .opt, #follow .advice .row.best .opt { color: var(--rust); }
#follow .advice .twist { width: 14px; padding: 0; border: none; background: none; font: 600 12px/1 var(--serif); color: var(--ink-soft); cursor: pointer; }
#follow .advice .opt { font-weight: 700; text-align: right; }
#follow .advice .share { display: flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--ink-soft); white-space: nowrap; }
#follow .advice .bar { flex: 0 0 30px; height: 6px; border-radius: 3px; background: rgba(58, 42, 28, .14); overflow: hidden; }
#follow .advice .bar i { display: block; height: 100%; background: #7a5a2a; }
#follow .advice .line { min-width: 0; overflow-wrap: anywhere; }
#follow .advice .sep { color: var(--ink-soft); }
#follow .advice .range { font-size: 11.5px; color: var(--ink-soft); }
#follow .advice .stop { margin-left: 6px; padding: 0 5px; border-radius: 7px; background: rgba(58, 42, 28, .1);
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
  font: italic 500 11.5px/1.3 var(--serif); color: var(--ink-soft); }
#follow .advice .val { font-weight: 600; text-align: right; white-space: nowrap; cursor: help; }
/* The key to a hovered card's Range on the island (follow mode, hud.js showRangeKey). */
#range-key { position: fixed; z-index: 30; pointer-events: none; padding: 6px 10px; border-radius: 6px;
  background: rgba(243, 231, 204, .94); box-shadow: 0 2px 8px rgba(20, 10, 4, .35); color: var(--ink);
  font: 600 13px/1.35 var(--serif); }
#range-key[hidden] { display: none; }
#range-key .row { display: flex; align-items: center; gap: 8px; }
#range-key .swatch { flex: 0 0 22px; height: 12px; border-radius: 3px; box-sizing: border-box; }
#range-key .lit .swatch { background: color-mix(in srgb, var(--spirit) 45%, transparent); border: 2px solid #fff3d0; outline: 1px solid rgba(58, 42, 28, .4); }
#range-key .source .swatch { border: 3px dotted var(--spirit); outline: 1px solid rgba(58, 42, 28, .4); }
#range-key .paid .swatch { border: 2px dashed var(--spirit); }
#range-key .risk .swatch { border-radius: 50%; flex-basis: 16px; height: 12px; border: 2.5px dashed #d64828; }
#range-key .cascade .swatch { background: #4a3a30; border-radius: 3px; }
/* A phone, or a portrait tablet: the panel is a row under the board. */
@media (max-width: 760px), (max-width: 1100px) and (orientation: portrait) {
  #hud.following { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(30vh, 1fr) auto auto auto; }
  #hud.following #top { overflow-x: auto; scrollbar-width: thin; }
  #hud.following #top { scroll-snap-type: none; }
  #hud.following #narration { order: -1; }
  #hud.following #top, #hud.following #board-area, #hud.following #follow, #hud.following #side, #hud.following #timeline { grid-column: 1; }
  #hud.following #follow { grid-row: 3; max-height: 32vh; padding: 8px 10px; }
  #hud.following #side { grid-row: 4; max-height: 22vh; }
  #hud.following #timeline { grid-row: 5; flex-wrap: wrap; gap: 6px; }
  #hud.following #ribbon { order: 5; flex-basis: 100%; }
  #follow.folded { padding: 6px 10px; align-items: stretch; }
  #follow.folded h3 { flex-direction: row; justify-content: space-between; writing-mode: horizontal-tb; }
  /* without the column: the board, the Spirits and the timeline, one under the other */
  #hud.following.follow-bare { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(30vh, 1fr) auto auto; }
  #hud.following.follow-bare #top, #hud.following.follow-bare #board-area, #hud.following.follow-bare #side,
  #hud.following.follow-bare #timeline { grid-column: 1; }
  #hud.following.follow-bare #side { grid-row: 3; }
  #hud.following.follow-bare #timeline { grid-row: 4; }
}

/* Follow mode: a card at hand size carries its name, cost and speed (hud.js cardCaption),
   laid over the lower part of its painting so the panel grows no taller. */
figure.card.captioned { margin: 0; width: 72px; position: relative; }
figure.card.captioned img { display: block; width: 100%; }
figure.card.captioned figcaption { position: absolute; left: 3px; right: 7px; bottom: 27%; padding: 1px 2px 2px; border-radius: 3px;
  background: rgba(251, 244, 226, .93); box-shadow: 0 1px 2px rgba(20, 10, 4, .3); font: 600 11px/1.12 var(--serif); color: var(--ink); text-align: center; }
figure.card.captioned figcaption b { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden;
  font-weight: 700; font-size: 10.5px; line-height: 12px; padding-bottom: 1px; overflow-wrap: break-word; }
figure.card.captioned figcaption span { display: block; font-size: 10.5px; color: var(--ink-soft); }
figure.card.captioned figcaption span.fast { color: #a4472a; }

/* Follow mode: the tray holds the move just made (hud.js renderTray), as notes, not buttons. */
#tray.past .who { font-style: italic; }
#tray.past .token { background: rgba(243, 231, 204, .5); box-shadow: inset 3px 0 0 var(--c); font-style: italic; opacity: .85; transform: none; }
#tray.past .token.now { box-shadow: inset 3px 0 0 var(--c); }

/* Follow mode: a Fear card that begins, in a toast (hud.js). */
#fear-toast { position: absolute; z-index: 25; pointer-events: auto; top: 52px; right: 8px; width: min(340px, calc(100% - 16px)); box-sizing: border-box;
  padding: 10px 30px 10px 14px; background: #f3e7cc; color: var(--ink); box-shadow: 0 6px 18px rgba(20, 10, 4, .45), inset 4px 0 0 #6b4c84; }
#fear-toast[hidden] { display: none; }
#fear-toast small { font: 700 11px var(--sc); color: #5a4466; letter-spacing: .05em; }
#fear-toast h4 { margin: 2px 0 2px; font: 700 16px var(--serif); }
#fear-toast p { margin: 0; font: 500 14px/1.35 var(--serif); }
#fear-toast .close { position: absolute; top: 4px; right: 6px; border: none; background: none; font: 700 18px/1 var(--serif); color: var(--ink-soft); cursor: pointer; }

/* Follow mode: what is at stake now, over the top of the island where the tray lies (hud.js showAlerts). */
#alert-strip { position: absolute; z-index: 20; left: 0; right: 0; top: 0; overflow: hidden; display: flex; flex-direction: column;
  gap: 2px; padding: 3px 6px; pointer-events: auto; }
#alert-strip[hidden] { display: none; }
#alert-strip p { margin: 0; padding: 2px 8px; border-radius: 4px; box-shadow: 0 2px 6px rgba(20, 10, 4, .35); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#alert-strip .warn { background: #f6dccf; box-shadow: inset 4px 0 0 #b5452b, 0 2px 6px rgba(20, 10, 4, .35); font: 700 13px/1.3 var(--serif); color: #7a2a18; }
#alert-strip .fear-now { background: #ece2f0; box-shadow: inset 4px 0 0 #6b4c84, 0 2px 6px rgba(20, 10, 4, .35); font: 500 13px/1.3 var(--serif); color: #3a2848; }
#alert-strip .fear-now small { font: 700 10.5px var(--sc); letter-spacing: .04em; }
#alert-strip .warn.loss { white-space: normal; }
#alert-strip p:only-child { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
#tray.under-alerts { visibility: hidden; }

/* In play (hud.js cardBlocks): a ✓ once a card has resolved, "not used" when its phase passed
   without it; a Slow card made Fast shows its caption's Slow struck through (a Fast badge where
   a card has no caption). The same for Innate Powers (hud.js spiritContents). */
figure.card.in-play { margin: 0; position: relative; }
figure.card.in-play img { display: block; width: 100%; }
figure.card.in-play.resolved img, figure.card.in-play.unused img { filter: saturate(.45) brightness(.9); opacity: .78; }
figure.card.in-play.resolved figcaption, figure.card.in-play.unused figcaption { opacity: .8; }
.card.in-play .unused-tag { position: absolute; left: 50%; top: 4px; transform: translateX(-50%); padding: 1px 6px; border-radius: 8px; white-space: nowrap;
  background: #6b5236; color: #f4ead2; font: 700 10.5px/1.2 var(--serif); box-shadow: 0 1px 3px rgba(20, 10, 4, .45); }
.card.in-play .resolved-tick { position: absolute; right: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center;
  background: #5e7f4b; color: #f4ead2; font: 800 12px/1 var(--serif); box-shadow: 0 0 0 1.5px #f4ead2, 0 1px 3px rgba(20, 10, 4, .5); }
.card.in-play:not(.chip) .made-fast { position: absolute; left: 2px; top: -5px; display: inline-flex; align-items: center; gap: 2px; padding: 1px 5px 1px 2px; border-radius: 9px;
  background: #fbe9d2; color: #a4472a; font: 800 10.5px/1.2 var(--sc); letter-spacing: .04em; box-shadow: 0 0 0 1.5px #d8673a, 0 1px 3px rgba(20, 10, 4, .45); }
.card.in-play:not(.chip) .made-fast i { width: 13px; height: 13px; background: var(--hud-g-fast) center / contain no-repeat; }
figure.card.captioned figcaption s, .innate h4 span s { color: var(--ink-soft); text-decoration-thickness: 1.5px; font-weight: 500; }
figure.card.in-play.pick { box-shadow: 0 0 0 2px #ffd36a, 0 0 12px 2px rgba(255, 196, 80, .75); border-radius: 6px; animation: pick-glow 1.4s ease-in-out infinite; }
figure.card.chip { margin: 0; position: relative; }
figure.card.chip img { display: block; width: 100%; }
.card.chip.resolved, .card.chip.unused { opacity: .5; filter: saturate(.5); }
.card.chip .made-fast { position: absolute; left: -4px; top: -5px; width: 15px; height: 15px; padding: 0; border-radius: 50%; display: grid; place-items: center;
  background: #fbe9d2; box-shadow: 0 0 0 1.5px #d8673a; }
.card.chip .made-fast i { width: 11px; height: 11px; background: var(--hud-g-fast) center / contain no-repeat; }
.innate h4 .used-tick { margin-left: auto; margin-right: 8px; font: 800 12px var(--serif); font-style: normal; color: #5e7f4b; }
.innate.used ol { opacity: .7; }
.innate h4 span.fast:has(s) { color: #a4472a; }

/* A land hovered on the island lights the cards whose effects lie on it (app.js effectOrigins). */
.card.effect-hot { box-shadow: 0 0 0 2px #fff3d0, 0 0 10px 3px rgba(255, 214, 140, .9); border-radius: 6px; }
/* The land tooltip's lasting effects (effects.js), each with its card. */
#tooltip ul.effects { margin: 4px 0 0; padding: 0 0 0 14px; font: 600 12.5px/1.25 var(--serif); color: #5a3a1e; }
#tooltip ul.effects li { margin: 1px 0; }

/* A Spirit's Discard and Forgotten counts open the cards in them (hud.js pileButton, #pile-pop):
   on hover, pinned by a click or tap. Under the card zoom (z-index 20), so a card hovered in it
   zooms over it. */
.piles .pile { border: none; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer;
  text-decoration: underline dotted rgba(127, 96, 60, .55); text-underline-offset: 3px; }
.piles .pile:hover, .piles .pile:focus-visible, .piles .pile[aria-expanded="true"] { color: var(--h-rubric, var(--rust)); text-decoration-style: solid; outline: none; }
.hand-mat .piles .pile:hover, .hand-mat .piles .pile:focus-visible, .hand-mat .piles .pile[aria-expanded="true"] { color: #f3d38c; }
.piles button + span::before, .piles span + button::before, .piles button + button::before { content: " · "; display: inline-block; white-space: pre; text-decoration: none; color: var(--h-ink-soft, var(--ink-soft)); }
.hand-mat .piles button + span::before, .hand-mat .piles span + button::before, .hand-mat .piles button + button::before { content: none; }
#pile-pop { position: fixed; z-index: 19; max-width: min(424px, calc(100vw - 12px)); max-height: calc(100vh - 12px); overflow: auto;
  padding: 12px 16px 14px; box-shadow: 0 8px 24px rgba(20, 10, 4, .55); }
#pile-pop[hidden] { display: none; }
#pile-pop h4 { margin: 0 22px 6px 0; font: 700 16px/1.2 var(--serif); }
#pile-pop:focus { outline: none; }
#pile-pop .note { margin: -4px 0 6px; font: italic 500 13px/1.25 var(--serif); color: var(--h-ink-soft, var(--ink-soft)); }
#pile-pop .row { display: flex; flex-wrap: wrap; gap: 6px; }
#pile-pop .card { flex: none; }
#pile-pop[data-pile="forgotten"] .card img { filter: saturate(.55) brightness(.92); }
#pile-pop .close { position: absolute; z-index: 4; top: 8px; right: 10px; border: none; background: none; font: 700 18px/1 var(--serif); color: var(--ink-soft); cursor: pointer; }
/* HUD coins and track spaces as struck coins and cards (art/furniture.js sets the images once
   the fonts have loaded, and the class). Last in the file and of no added specificity, as
   the <style> it set up before was. */
:where(.struck-coins) .coin.energy { background: var(--struck-coin) center / 132% no-repeat !important; box-shadow: none !important; }
:where(.struck-coins) .coin.plays { background: var(--struck-card) center / 132% no-repeat !important; box-shadow: none !important; }
:where(.struck-coins) .track li:has(> b:not(.plays)) { background: var(--struck-coin-small) center / 132% no-repeat; box-shadow: none; }
:where(.struck-coins) .track li:has(> b.plays) { background: var(--struck-card-small) center / 132% no-repeat; box-shadow: none; }
