:root { color-scheme: dark; --ink: #cfd8d3; --dim: #7d8a85; --blood: #c4303a; --moss: #5f8f78; }
* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(ellipse at top, #10181a, #05080a 70%); color: var(--ink); font: 16px/1.5 Georgia, 'Times New Roman', serif; min-height: 100vh; }
main { max-width: 1280px; margin: 0 auto; padding: 24px 16px 40px; }
h1 { margin: 0; font-size: clamp(1.6rem, 4vw, 2.6rem); letter-spacing: .04em; font-weight: 400; text-shadow: 0 0 18px rgba(95,143,120,.55); }
.tag { margin: 4px 0 18px; color: var(--dim); font-style: italic; }
.stage { position: relative; border: 1px solid #1f2b2d; box-shadow: 0 0 40px rgba(0,0,0,.8), 0 0 80px rgba(95,143,120,.08); }
canvas { display: block; width: 100%; height: auto; background: #05080a; cursor: crosshair; }
.narration { position: absolute; left: 0; right: 0; bottom: 18px; text-align: center; padding: 0 24px; font-size: clamp(1rem, 2.4vw, 1.4rem); font-style: italic; text-shadow: 0 2px 8px #000, 0 0 12px #000; transition: opacity .8s; pointer-events: none; }
.hint { position: absolute; top: 10px; right: 14px; font-size: .8rem; color: var(--dim); pointer-events: none; }
.panel { margin-top: 16px; padding: 14px 16px; background: rgba(12,18,20,.85); border: 1px solid #1f2b2d; }
.row { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; margin: 6px 0; }
label { color: var(--dim); }
input[type=number] { width: 9em; background: #0a1011; color: var(--ink); border: 1px solid #2a3b3d; padding: 6px 8px; font: inherit; }
input[type=range] { flex: 1 1 220px; accent-color: var(--moss); }
button { background: #101a1c; color: var(--ink); border: 1px solid #2f4547; padding: 7px 12px; font: inherit; cursor: pointer; }
a.btn { display: inline-block; background: #101a1c; color: var(--ink); border: 1px solid #2f4547; padding: 7px 12px; text-decoration: none; }
button:hover, button:focus-visible, a.btn:hover, a.btn:focus-visible { border-color: var(--moss); box-shadow: 0 0 10px rgba(95,143,120,.4); outline: none; }
.check { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.meter { flex: 0 0 120px; height: 8px; background: #0a1011; border: 1px solid #2a3b3d; }
.meter i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--moss), var(--blood)); }
.dread { min-width: 7em; color: var(--dim); font-variant-numeric: tabular-nums; }
.stats { margin: 8px 0 0; color: var(--dim); font-size: .85rem; }
footer { margin-top: 18px; color: var(--dim); font-size: .85rem; }
a { color: var(--moss); }
select { background: #0a1011; color: var(--ink); border: 1px solid #2a3b3d; padding: 6px 8px; font: inherit; max-width: 100%; }
select:focus-visible, input:focus-visible, button:focus-visible, a.btn:focus-visible, canvas:focus-visible, summary:focus-visible { outline: 2px solid var(--moss); outline-offset: 2px; }
canvas:focus-visible { outline-offset: -3px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.layout .panel { margin-top: 16px; }
.side .panel:first-child { margin-top: 0; }
.side .panel + .panel { margin-top: 16px; }
@media (min-width: 1100px) { .layout { grid-template-columns: minmax(0, 1fr) 280px; align-items: start; } .side .panel:first-child { margin-top: 0; } }
h2 { margin: 0 0 8px; font-size: 1.1rem; font-weight: 400; letter-spacing: .06em; color: var(--moss); }
.whispers { margin: 0; padding: 0; list-style: none; font-size: .85rem; max-height: 340px; overflow-y: auto; }
.whispers li { padding: 5px 0; border-bottom: 1px solid #1a2527; color: var(--ink); font-style: italic; }
.whispers li.e-omen { color: #d8868b; }
.whispers li.empty { color: var(--dim); }
.keys ul { margin: 8px 0 0; padding: 0; list-style: none; font-size: .85rem; color: var(--dim); }
.keys li { margin: 3px 0; }
kbd { display: inline-block; min-width: 1.6em; padding: 0 5px; text-align: center; border: 1px solid #2f4547; border-bottom-width: 2px; background: #0a1011; color: var(--ink); font: .8rem/1.5 ui-monospace, monospace; }
@media (max-width: 600px) { .row { gap: 8px; } .row button, .row a.btn { flex: 1 1 100%; text-align: center; } input[type=number] { flex: 1 1 6em; } .hint { display: none; } }
@media (prefers-reduced-motion: reduce) { .narration { transition: none; } }
html.reduced .narration { transition: none; }
.campaign .stats { color: var(--ink); }
.campaign .stats em { color: var(--moss); }
input:disabled { opacity: .5; }
label output { color: inherit; }
.whispers li.e-door { color: #e0c48a; }
.building select { max-width: 14em; }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; animation: none !important; } }
@media (forced-colors: active) { button:focus-visible, select:focus-visible, input:focus-visible, canvas:focus-visible { outline: 2px solid Highlight; } }
.story { border-color: var(--moss); }
.story-text { margin: 6px 0 10px; font-size: 1.15rem; font-style: italic; color: #e6eee9; min-height: 3.2em; }
.story[hidden], .title[hidden], .loading[hidden] { display: none; }

.perf-hud { position: absolute; right: 8px; top: 8px; padding: 3px 8px; font: 12px ui-monospace, monospace; background: rgba(0,0,0,.7); color: #bfe6d2; border: 1px solid #1f2b2d; pointer-events: none; }
.perf-hud[hidden], .map[hidden] { display: none; }
.map canvas { display: block; width: 168px; height: 168px; background: #0b1012; border: 1px solid #1f2b2d; }
.legend { list-style: none; margin: 8px 0 0; padding: 0; font-size: 13px; }
.legend li { display: flex; align-items: center; gap: 8px; margin: 2px 0; }
.legend i { display: inline-block; width: 12px; height: 12px; border: 1px solid #000; }

.skip-link { position: absolute; left: 8px; top: -60px; z-index: 20; padding: 8px 14px; background: #e6eee9; color: #05080a; font: inherit; }
.skip-link:focus { top: 8px; }
canvas { touch-action: none; }
.cinema-caption { position: absolute; left: 0; right: 0; top: 16px; text-align: center; padding: 0 32px; font-size: clamp(1.1rem, 2.6vw, 1.7rem); font-style: italic; color: #f1f6f3; text-shadow: 0 2px 10px #000, 0 0 16px #000; pointer-events: none; }
.cinema-exit { position: absolute; right: 12px; bottom: 12px; z-index: 5; min-width: 56px; min-height: 44px; padding: 8px 16px; background: #000b; color: #f1f6f3; border: 1px solid #f1f6f3; border-radius: 6px; font: inherit; display: none; }
html.cinema .cinema-exit:not([hidden]) { display: block; }
.cinema-caption[hidden], .no-caption .cinema-caption { display: none; }
html.cinema header, html.cinema footer, html.cinema .side, html.cinema .hint, html.cinema .skip-link, html.cinema .layout .panel, html.cinema .primary > .panel { display: none; }
html.cinema main { max-width: none; padding: 0; }
html.cinema .layout { display: block; }
html.cinema .narration { display: none; }
html.cinema canvas { max-height: 100vh; object-fit: contain; }
html.cinema .stage { border: 0; box-shadow: none; }
html.cinema body { min-height: 0; }

.codex[hidden], .stitch[hidden] { display: none; }
.codex-list, .stitch-list { list-style: none; margin: 6px 0 10px; padding: 0; font-size: .85rem; }
.codex-list li, .stitch-list li { padding: 5px 0; border-bottom: 1px solid #1a2527; }
.codex-list li.locked { color: var(--dim); }
.codex-list li.earned strong { color: var(--moss); }
.stitch-feeds { color: var(--dim); }
.whispers li.e-codex, .whispers li.e-achievement { color: #9ccfb5; }
/* High-contrast theme: toggled with H, ?contrast=1 or the button; the class lives on <html>. */
html.hc { --ink: #ffffff; --dim: #e6e6e6; --moss: #7dffc0; --blood: #ff6b6b; }
html.hc body { background: #000; }
html.hc .panel, html.hc .title-card { background: #000; border: 2px solid #ffffff; }
html.hc button, html.hc a.btn, html.hc select, html.hc input[type=number] { background: #000; color: #fff; border: 2px solid #fff; }
html.hc button[aria-pressed=true] { background: #fff; color: #000; }
html.hc button:hover, html.hc button:focus-visible, html.hc a.btn:focus-visible, html.hc select:focus-visible, html.hc input:focus-visible, html.hc canvas:focus-visible, html.hc summary:focus-visible { outline: 3px solid #ffeb3b; outline-offset: 2px; box-shadow: none; border-color: #ffeb3b; }
html.hc a { color: #8ecbff; text-decoration: underline; }
html.hc kbd { background: #000; color: #fff; border-color: #fff; }
html.hc .meter { border-color: #fff; background: #000; }
html.hc .whispers li, html.hc .codex-list li, html.hc .stitch-list li { border-bottom-color: #888; }
html.hc .whispers li.e-omen { color: #ff9a9a; }
html.hc .whispers li.e-door { color: #ffe08a; }
html.hc canvas { filter: contrast(1.35) brightness(1.15); }

.jtabs { display: flex; gap: 6px; margin: 4px 0 6px; }
.jtabs [role=tab] { flex: 1; padding: 4px 8px; font-size: .8rem; background: transparent; border: 1px solid #1a2527; color: var(--dim); cursor: pointer; }
.jtabs [role=tab][aria-selected=true] { color: var(--ink); border-color: var(--moss); }
.jtabs [role=tab]:focus-visible { outline: 2px solid var(--moss); outline-offset: 2px; }
.jbadge { display: inline-block; min-width: 1.2em; padding: 0 5px; border-radius: 9px; background: var(--moss); color: #000; font-size: .72rem; font-weight: bold; text-align: center; }
html.hc .jtabs [role=tab] { border-color: #888; color: #fff; }
@media (forced-colors: active) { .jtabs [role=tab][aria-selected=true] { outline: 2px solid Highlight; } }
.jbadge[hidden] { display: none; }

/* About dialog and judge tour */
.about { max-width: 34rem; padding: 22px 26px; border: 1px solid var(--moss); background: #060b0c; color: var(--ink); }
.about::backdrop { background: rgba(2,4,5,.85); }
.about p { font-size: 1rem; }
.tour { position: fixed; left: 50%; bottom: 12px; max-height: calc(100vh - 24px); overflow-y: auto; box-sizing: border-box; transform: translateX(-50%); z-index: 40; width: min(36rem, calc(100vw - 24px)); padding: 14px 18px; background: #060b0c; border: 1px solid var(--moss); box-shadow: 0 0 30px rgba(0,0,0,.9); }
.tour[hidden] { display: none; }
.tour h2 { color: #e6eee9; }
.tour p { margin: 4px 0; }
.tour .stats { margin: 2px 0 8px; }
.tour-target { outline: 3px solid #e0c48a; outline-offset: 3px; }
html.hc .about, html.hc .tour { background: #000; border: 2px solid #fff; }
html.hc .tour .stats { margin: 2px 0 8px; }
.tour-target { outline-color: #ffeb3b; }
@media (forced-colors: active) { .about, .tour { border: 2px solid CanvasText; } .tour .stats { margin: 2px 0 8px; }
.tour-target { outline-color: Highlight; } }

/* opt-in first-person 3D view: sits over the 2D canvas, which is hidden while it is open */
.view3d { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.view3d[hidden] { display: none; }
.view3d-prompt { position: absolute; left: 50%; top: 56%; transform: translateX(-50%); padding: 4px 10px; font-style: italic; text-shadow: 0 2px 8px #000, 0 0 12px #000; pointer-events: none; }
.view3d-prompt::before { content: ""; position: absolute; left: 50%; top: -22px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: rgba(220,230,225,.7); }

.objective { margin: 8px 0; }
.objective-line { margin: 0 0 4px; font-style: italic; letter-spacing: .02em; color: #cfd8d3; }
.ending { max-width: 36rem; }
.ending h2 { font-style: italic; }
.ending .epitaph { font-size: 1.1rem; font-style: italic; }
.ending[open] { animation: endingFade 1.6s ease both; }
@keyframes endingFade { from { opacity: 0; } to { opacity: 1; } }
html.reduced .ending[open] { animation: none; }
@media (prefers-reduced-motion: reduce) { .ending[open] { animation: none; } }

/* ---------- title screen ---------- */
.title { position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; padding: 16px; overflow-y: auto;
  background: radial-gradient(ellipse at 50% 38%, rgba(5,8,10,.2), rgba(2,4,5,.8) 80%), linear-gradient(180deg, rgba(2,4,5,.55), rgba(2,4,5,.15) 40%, rgba(2,4,5,.8));
  animation: titlefade 1.6s ease-out both; }
.title-fog { position: absolute; inset: -20%; pointer-events: none; opacity: .55;
  background: radial-gradient(ellipse 40% 28% at 20% 70%, rgba(95,143,120,.22), transparent 70%), radial-gradient(ellipse 36% 24% at 78% 30%, rgba(120,150,170,.16), transparent 70%), radial-gradient(ellipse 50% 20% at 55% 88%, rgba(95,143,120,.18), transparent 70%);
  animation: titledrift 38s ease-in-out infinite alternate; }
.title-card { position: relative; max-width: 40rem; width: 100%; padding: clamp(20px, 5vw, 44px) clamp(18px, 5vw, 48px); text-align: center; border: 1px solid rgba(95,143,120,.45);
  background: linear-gradient(180deg, rgba(6,11,12,.6), rgba(6,11,12,.78)); box-shadow: 0 0 80px rgba(0,0,0,.85), inset 0 0 60px rgba(95,143,120,.06); backdrop-filter: blur(3px);
  font-family: Georgia, 'Iowan Old Style', 'Palatino Linotype', 'Times New Roman', serif; }
.title-village { margin: 0 0 6px; font-size: .8rem; letter-spacing: .38em; text-transform: uppercase; color: var(--moss); min-height: 1.2em; }
.title-card h2 { margin: 0 0 10px; font-size: clamp(1.7rem, 6.2vw, 3rem); line-height: 1.12; letter-spacing: .03em; color: #eef4f0; text-shadow: 0 0 26px rgba(95,143,120,.6), 0 2px 0 #000; }
.title-pitch { margin: 0 auto 14px; max-width: 30rem; color: var(--ink); font-size: 1.05rem; }
.title-rumor { margin: 0 auto 22px; max-width: 30rem; min-height: 1.5em; color: #aebfb7; font-style: italic; font-size: 1.05rem; }
.title-rumor:not(:empty)::before { content: '\201C'; } .title-rumor:not(:empty)::after { content: '\201D'; }
.title-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin: 0 0 8px; }
.cta { flex: 1 1 14rem; padding: 13px 18px; font-size: 1.1rem; letter-spacing: .04em; background: #0c1517; border: 1px solid #36585a; }
.cta.recommended { background: linear-gradient(180deg, #1c3a33, #12251f); border-color: var(--moss); color: #f1f7f3; box-shadow: 0 0 22px rgba(95,143,120,.35); }
.cta:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.title-reason { margin: 6px 0 10px; min-height: 1.3em; color: #d9b98a; font-size: .9rem; }
.title-extras { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; justify-content: center; margin: 10px 0 4px; }
.title-lang button { padding: 4px 10px; font-size: .85rem; }
.title-lang button[aria-pressed="true"] { border-color: var(--moss); color: #f1f7f3; }
.title .stats { text-align: center; }
@keyframes titlefade { from { opacity: 0; } to { opacity: 1; } }
@keyframes titledrift { from { transform: translate3d(-3%, 1%, 0) scale(1); } to { transform: translate3d(3%, -2%, 0) scale(1.08); } }
/* the stage becomes the full-screen backdrop behind the title (3D fly-through, or the 2D map drifting slowly) */
.title-backdrop .stage { position: fixed; inset: 0; z-index: 5; border: 0; box-shadow: none; }
.title-backdrop .stage canvas { width: 100%; height: 100%; object-fit: cover; }
.title-backdrop .narration, .title-backdrop .hint, .title-backdrop .view3d-prompt { display: none; }
.title-backdrop #view { animation: mapdrift 60s ease-in-out infinite alternate; }
@keyframes mapdrift { from { transform: scale(1.04) translate3d(-1.5%, 0, 0); } to { transform: scale(1.14) translate3d(1.5%, -1.5%, 0); } }
html.reduced .title, html.reduced .title-fog, html.reduced.title-backdrop #view { animation: none; }
@media (prefers-reduced-motion: reduce) { .title, .title-fog, .title-backdrop #view { animation: none; } }
@media (max-width: 480px) { .title { align-items: flex-start; } .cta { flex-basis: 100%; } }
@media (forced-colors: active) { .title-card { border: 2px solid CanvasText; background: Canvas; } .cta.recommended { border: 3px solid Highlight; } }
/* ---------- loading veil ---------- */
.loading { position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; gap: 16px; align-items: center; justify-content: center; background: #05080a; color: var(--dim); font-style: italic; letter-spacing: .06em; }
.loading-ink { width: 34px; height: 34px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #5f8f78, #1b2d27 70%); animation: inkpulse 1.8s ease-in-out infinite; }
@keyframes inkpulse { 0%, 100% { transform: scale(.7); opacity: .5; } 50% { transform: scale(1.1); opacity: 1; } }
html.reduced .loading-ink { animation: none; }
/* ---------- help dialog and control groups ---------- */
.help { max-width: min(46rem, 94vw); max-height: 90vh; overflow-y: auto; }
.help h3 { margin: 14px 0 4px; font-size: .95rem; font-weight: 400; letter-spacing: .08em; color: var(--moss); }
.help ul { margin: 0; padding: 0; list-style: none; font-size: .88rem; color: var(--dim); }
.help li { margin: 3px 0; }
.help-devices { display: flex; flex-direction: column; margin: 6px 0; font-size: .88rem; color: var(--dim); }
.help-devices p { margin: 3px 0; padding-left: 8px; border-left: 2px solid transparent; }
.help-devices p.current { order: -1; color: var(--ink); border-left-color: var(--moss); }
.help-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 0 24px; }
.group { margin-top: 8px; border-top: 1px solid #1a2527; padding-top: 4px; }
.group > summary { cursor: pointer; color: var(--moss); letter-spacing: .05em; padding: 4px 0; }
.group > summary:focus-visible { outline: 2px solid var(--moss); outline-offset: 2px; }
.keys .stats { margin: 0; }
.vigil-lock { margin: 0 0 4px; font-style: italic; color: #b7a88a; }

/* On-screen touch controls (3D view, touch devices or ?touch=1). In normal flow under the view, so they never cover the caption or the objective. */
/* Round 26: investigation board. Cards sit on a fixed grid (board-ui.js sets left/top); strings are SVG lines. Static unless a string carries .board-draw. */
.board-dialog { position: absolute; left: 50%; top: 6%; transform: translateX(-50%); width: min(920px, 96%); max-height: 88%; overflow-y: auto; padding: 14px 16px; background: #1b1713; color: #eadfc6; border: 1px solid #6b5230; box-shadow: 0 0 24px #000; z-index: 8; }
.board-dialog[hidden] { display: none; }
.board-dialog h2 { margin: 0 0 6px; font-size: 1.1rem; color: #e3d3aa; }
.board-dialog h3 { margin: 10px 0 4px; font-size: .95rem; color: #c9b583; }
.board-dialog button { min-height: 32px; background: #3a2610; color: #f2e6c8; border: 1px solid #1c1206; }
.board-scroll { overflow: auto; max-height: 38vh; border: 1px solid #3a2e1e; background: #14110e; }
.board-wrap { position: relative; min-width: 100%; }
.board-lines { position: absolute; left: 0; top: 0; pointer-events: none; }
.board-string { stroke: #b34a3c; stroke-width: 1.5; opacity: .85; }
.board-resolved-string { stroke: #7f9a7a; stroke-width: 1.5; stroke-dasharray: 4 5; fill: none; }
.board-knowledge[data-tier]:not([data-tier="0"]) { border-left: 3px solid #7a6a9a; padding-left: .5rem; }
.board-reality { animation: board-reality-drift 9s ease-in-out infinite alternate; }
@keyframes board-reality-drift { from { opacity: 1; } to { opacity: .82; } }
@media (prefers-reduced-motion: reduce) { .board-reality { animation: none; } }
html.reduced .board-reality { animation: none; }
.board-draw { stroke-dasharray: 600; stroke-dashoffset: 600; animation: board-draw .6s ease-out forwards; }
@keyframes board-draw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .board-draw { animation: none; stroke-dasharray: none; stroke-dashoffset: 0; } }
html.reduced .board-draw { animation: none; stroke-dasharray: none; stroke-dashoffset: 0; }
.board-contradiction-string { stroke: #ff6b6b; stroke-width: 4; stroke-dasharray: 10 5; opacity: 1; }
.board-contradiction-badge { fill: #3a0d0d; stroke: #ff8f8f; stroke-width: 2; }
.board-contradiction-mark { fill: #fff0f0; font-size: 12px; font-weight: bold; }
.board-card { position: absolute; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; padding: 2px 8px; overflow: hidden; text-align: left; background: #2a2118; color: #eadfc6; border: 1px solid #6b5230; font-size: .78rem; line-height: 1.15; }
.board-card-kind { font-size: .66rem; color: #c9b583; text-transform: uppercase; }
.board-card-title { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.board-card-trust { font-size: .62rem; color: #b9ad8f; font-style: italic; }
.board-card-reliability { font-size: .62rem; color: #b9ad8f; letter-spacing: .02em; }
.board-reliability-low { color: #e0a96a; }
.board-reliability-high { color: #9fcfa8; }
.board-trust-1 { color: #e0a96a; }
.board-trust-2 { color: #9fcfa8; }
.villager-trust { font-style: italic; color: #b9ad8f; }
.axis-bars { list-style: none; margin: 0.4rem 0; padding: 0; display: grid; gap: 0.2rem; font-size: 0.85rem; color: #b9ad8f; }
.axis-bars li { display: grid; grid-template-columns: 6rem 1fr; align-items: center; gap: 0.5rem; }
.axis-bars meter { width: 100%; height: 0.6rem; }
.board-card-bars { position: absolute; right: 4px; bottom: 3px; display: flex; align-items: flex-end; gap: 2px; height: 10px; }
.board-bar { display: block; width: 4px; background: #9fcfa8; }
.board-bar-fear { background: #e0a96a; } .board-bar-faith { background: #b9c7ff; } .board-bar-loyalty { background: #c9b583; } .board-bar-obsession { background: #d89cff; } .board-bar-corruption { background: #ff8f8f; }
html.hc .board-bar { background: #fff; }
.board-bars[hidden], .board-theory [hidden] { display: none; }
.board-theory { margin-top: .6rem; border-top: 1px solid #6b5230; padding-top: .4rem; }
.theory-list, .theory-results { list-style: none; margin: .3rem 0; padding: 0; display: grid; gap: .3rem; }
.theory-pick { text-align: left; width: 100%; }
.theory-pick[aria-pressed="true"] { outline: 2px solid #ffe08a; }
.theory-form { margin: .4rem 0; border: 1px solid #6b5230; }
.theory-option, .theory-evidence { display: block; margin: .2rem 0; }
.theory-true { border-left: 4px solid #9fcfa8; padding-left: .4rem; } .theory-partial { border-left: 4px solid #e0a96a; padding-left: .4rem; } .theory-false { border-left: 4px solid #ff8f8f; padding-left: .4rem; }
html.hc .theory-form, html.hc .board-theory { border-color: #fff; }
.chronicle-bars { list-style: none; margin: .2rem 0; padding: 0; }
.board-unknown { opacity: .6; }
.board-contradiction { border-color: #ff6b6b; border-width: 2px; }
.board-invalid .board-card-title { text-decoration: line-through; }
.board-card:focus-visible { outline: 3px solid #ffe08a; outline-offset: 2px; }
.board-timeline { margin: 0; padding-left: 20px; font-size: .85rem; }
.board-detail { min-height: 1.4em; }
html.hc .board-dialog { background: #000; color: #fff; border: 2px solid #fff; box-shadow: none; }
html.hc .board-dialog h2, html.hc .board-dialog h3, html.hc .board-card-kind { color: #fff; }
html.hc .board-dialog button, html.hc .board-card { background: #000; color: #fff; border: 2px solid #fff; }
html.hc .board-scroll { background: #000; border-color: #fff; }
html.hc .board-string { stroke: #fff; opacity: 1; }
html.hc .board-contradiction-string { stroke: #fff; }
html.hc .board-contradiction-badge { fill: #000; stroke: #fff; }
html.hc .board-contradiction-mark { fill: #fff; }
html.hc .board-contradiction { border-color: #ff9a9a; }
html.hc .board-unknown { opacity: 1; border-style: dashed; }

/* ---------- round 29 visual polish: fog-and-lamplight tones, hierarchy, framing, transitions ---------- */
:root { --lamp: #e0b873; --fog: #0c1315; --edge: #26383a; --ink-strong: #e8efeb; --paper: #eadfc6; --paper-dim: #b9ad8f; }
body { background: radial-gradient(ellipse 90% 60% at 50% -10%, #17262a, transparent 70%), radial-gradient(ellipse at top, #10181a, #05080a 70%) fixed; line-height: 1.55; }
main { padding-top: 32px; }
h1 { font-weight: 400; letter-spacing: .05em; color: var(--ink-strong); text-shadow: 0 0 22px rgba(95,143,120,.5), 0 2px 0 #000; }
h1::after { content: ""; display: block; width: 96px; height: 1px; margin-top: 10px; background: linear-gradient(90deg, var(--lamp), transparent); }
.tag { margin: 10px 0 22px; color: #94a39d; }
h2 { letter-spacing: .08em; text-transform: none; padding-bottom: 6px; margin-bottom: 10px; border-bottom: 1px solid #1a2a2c; }
.panel { background: linear-gradient(180deg, rgba(16,24,26,.9), rgba(10,15,17,.9)); border-color: var(--edge); border-radius: 3px; box-shadow: 0 6px 18px rgba(0,0,0,.35), inset 0 1px 0 rgba(224,184,115,.05); }
.stage { border-color: var(--edge); border-radius: 3px; overflow: hidden; }
/* vignette and static film grain over the scene; no animation, so it costs nothing on any quality tier */
.stage::after { content: ""; position: absolute; inset: 0; z-index: 3; pointer-events: none;
  background: radial-gradient(ellipse at 50% 45%, transparent 55%, rgba(0,0,0,.45) 100%),
    repeating-linear-gradient(0deg, rgba(255,255,255,.018) 0 1px, transparent 1px 3px); mix-blend-mode: multiply; }
html.hc .stage::after, html.cinema .stage::after { display: none; }
.narration { text-shadow: 0 2px 10px #000, 0 0 3px #000; }
/* buttons: lamplit hover, strong keyboard focus, contrast above 4.5:1 (ink #cfd8d3 on #101a1c is about 11:1) */
button, a.btn { border-radius: 2px; transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease, color .18s ease; }
button:hover, a.btn:hover { background-color: #162426; color: var(--ink-strong); border-color: var(--lamp); box-shadow: 0 0 12px rgba(224,184,115,.25); }
button:focus-visible, a.btn:focus-visible { border-color: var(--lamp); outline: 2px solid var(--lamp); outline-offset: 2px; color: var(--ink-strong); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .55; cursor: not-allowed; }
.cta { letter-spacing: .06em; }
.title-card { box-shadow: 0 0 0 1px rgba(224,184,115,.12), 0 20px 60px rgba(0,0,0,.7), inset 0 0 60px rgba(0,0,0,.35); }
.title-card h2 { border-bottom: 0; padding-bottom: 0; text-shadow: 0 0 30px rgba(95,143,120,.45), 0 3px 0 #000; }
.title-card h2::after { content: ""; display: block; width: 64px; height: 1px; margin: 14px auto 0; background: linear-gradient(90deg, transparent, var(--lamp), transparent); }
.whispers li { padding: 7px 0; line-height: 1.45; }
/* dialogs: parchment and ink framing, consistent heading rhythm */
.board-dialog, .inv-dialog { background: linear-gradient(180deg, #211b15, #17130f); border: 1px solid #7a5d36; border-radius: 3px; box-shadow: 0 18px 50px rgba(0,0,0,.8), inset 0 0 0 1px rgba(224,184,115,.08); }
.board-dialog h2, .inv-dialog h2 { font-size: 1.2rem; letter-spacing: .08em; color: #ead9ae; border-bottom: 1px solid #4a3a22; }
.board-dialog h3 { margin: 14px 0 6px; font-size: .78rem; letter-spacing: .16em; text-transform: uppercase; color: #c9b583; font-weight: 400; }
.board-dialog button, .inv-dialog button { border-radius: 2px; }
.villager-dialog { background: linear-gradient(180deg, rgba(14,21,23,.95), rgba(7,11,12,.96)); border-radius: 3px; box-shadow: 0 14px 40px rgba(0,0,0,.75); }
.villager-dialog h2 { border-bottom: 1px solid #1f3a34; padding-bottom: 4px; margin-bottom: 6px; }
/* trust and knowledge axis bars: labels aligned, track and fill readable against both parchment and fog */
.axis-bars { gap: .35rem; margin: .6rem 0; font-size: .85rem; color: var(--paper); }
.axis-bars li { grid-template-columns: 7rem 1fr; }
.axis-bars meter { height: .7rem; border-radius: 1px; background: #0d0a07; border: 1px solid #5a4528; }
.axis-bars meter::-webkit-meter-bar { background: #0d0a07; border: 0; height: .7rem; }
.axis-bars meter::-webkit-meter-optimum-value, .axis-bars meter::-webkit-meter-suboptimum-value, .axis-bars meter::-webkit-meter-even-less-good-value { background: linear-gradient(90deg, #5f8f78, var(--lamp)); }
.axis-bars meter::-moz-meter-bar { background: linear-gradient(90deg, #5f8f78, var(--lamp)); }
.board-card { border-radius: 2px; box-shadow: 0 2px 6px rgba(0,0,0,.5); transition: transform .15s ease, box-shadow .15s ease; }
.board-card:hover { transform: translateY(-1px); box-shadow: 0 5px 12px rgba(0,0,0,.6), 0 0 0 1px var(--lamp); }
.board-card:focus-visible { outline: 2px solid var(--lamp); outline-offset: 2px; }
.board-timeline:empty::before, .board-detail:empty::before { content: "\2026"; color: #8a7d60; }
.chronicle .stats, .villagers .stats { color: #9fb0a9; }
.chronicle li, .villagers li { padding: 6px 0; border-bottom: 1px solid #1a2a2c; }
.chronicle li:last-child, .villagers li:last-child { border-bottom: 0; }
.chronicle h3, .villagers h3 { margin: 12px 0 4px; font-size: .75rem; letter-spacing: .16em; text-transform: uppercase; color: var(--paper-dim); font-weight: 400; }
/* panel transitions: each panel eases in when its hidden attribute is removed */
@keyframes panelRise { from { opacity: 0; translate: 0 8px; } to { opacity: 1; translate: 0 0; } }
.panel:not([hidden]), .villager-dialog:not([hidden]), .lore-dialog:not([hidden]), .board-dialog:not([hidden]), .inv-dialog:not([hidden]) { animation: panelRise .26s ease-out both; }
html.reduced .panel, html.reduced .villager-dialog, html.reduced .lore-dialog, html.reduced .board-dialog, html.reduced .inv-dialog, html.reduced .board-card, html.reduced button { animation: none; transition: none; }
@media (prefers-reduced-motion: reduce) { .board-card, button, a.btn { transition: none; } .board-card:hover { transform: none; } }
@media (forced-colors: active) { .axis-bars meter { border-color: CanvasText; } .stage::after { display: none; } }
html.hc .axis-bars { color: #fff; }
html.hc h1::after, html.hc .title-card h2::after { background: #fff; }

.touch-dock { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0; touch-action: none; user-select: none; }
.touch-dock[hidden], html.cinema .touch-dock { display: none; }
.touch-stick, .touch-look { position: relative; flex: 0 0 auto; width: 120px; height: 120px; border-radius: 50%; border: 2px solid #5b6f66; background: #0b1012cc; touch-action: none; display: flex; align-items: center; justify-content: center; color: #9fb3aa; font-size: .8rem; }
.touch-knob { position: absolute; left: 50%; top: 50%; width: 48px; height: 48px; margin: -24px 0 0 -24px; border-radius: 50%; background: #8fb3a3; border: 2px solid #e8f2ed; transform: translate(var(--kx, 0px), var(--ky, 0px)); }
.touch-buttons { order: 3; display: grid; grid-template-columns: repeat(auto-fit, minmax(76px, 1fr)); gap: 8px; flex: 1 0 100%; }
.touch-buttons button { min-width: 44px; min-height: 44px; padding: 8px; }
.touch-buttons button[hidden] { display: none; }
html.hc .touch-stick, html.hc .touch-look { border: 3px solid #fff; background: #000; color: #fff; }
html.hc .touch-knob { background: #fff; border-color: #000; }
@media (forced-colors: active) { .touch-stick, .touch-look { border: 2px solid CanvasText; background: Canvas; color: CanvasText; } .touch-knob { background: Highlight; border-color: CanvasText; forced-color-adjust: none; } }
.villager-dialog { position: absolute; left: 50%; bottom: 8%; transform: translateX(-50%); width: min(460px, 92%); padding: 12px 16px; background: rgba(8,12,14,.92); border: 1px solid #5f8f78; box-shadow: 0 0 24px #000; z-index: 6; }
.villager-dialog[hidden], .villagers[hidden], .chronicle[hidden] { display: none; }
.villager-dialog h2 { margin: 0; font-size: 1.1rem; }
.villager-line { margin: 8px 0; font-style: italic; }
.villager-list { list-style: none; margin: 0; padding: 0; }
.villager-list li { padding: 6px 0; border-bottom: 1px solid #1f2b2d; }
.villager-list .vrole, .villager-list .vwhere { opacity: .75; }
.villager-list button { min-height: 32px; margin-left: 6px; }
.lore-dialog { position: absolute; left: 50%; bottom: 8%; transform: translateX(-50%); width: min(500px, 92%); padding: 16px 20px; background: #d9c79c linear-gradient(180deg, #e3d3aa, #c9b583); color: #2a1d0e; border: 1px solid #6b5230; box-shadow: 0 0 28px #000, inset 0 0 40px rgba(90,60,20,.45); z-index: 7; font-family: Georgia, "Times New Roman", serif; }
.lore-dialog[hidden] { display: none; }
.lore-dialog h2 { margin: 0 0 8px; font-size: 1.15rem; color: #3a2610; }
.lore-page { margin: 8px 0; font-size: 1.05rem; line-height: 1.5; white-space: pre-line; }
.lore-dialog .stats { color: #4a3216; }
.lore-dialog button { min-height: 36px; background: #3a2610; color: #f2e6c8; border: 1px solid #1c1206; }
.inv-dialog { position: absolute; right: 2%; top: 8%; width: min(420px, 92%); max-height: 80%; overflow-y: auto; padding: 14px 16px; background: #1b1713; color: #eadfc6; border: 1px solid #6b5230; box-shadow: 0 0 24px #000; z-index: 7; }
.inv-dialog[hidden] { display: none; }
.inv-dialog h2 { margin: 0 0 6px; font-size: 1.1rem; color: #e3d3aa; }
.inv-dialog h3 { margin: 10px 0 4px; font-size: .95rem; color: #c9b583; }
.inv-list { list-style: none; margin: 0; padding: 0; }
.inv-list li { padding: 5px 0; border-bottom: 1px solid #3a2e1c; }
.inv-count { color: #c9b583; }
.inv-text { display: block; margin-top: 2px; font-size: .85rem; font-style: italic; color: #b8aa8a; }
.inv-dialog button { min-height: 32px; margin: 2px 4px 2px 0; background: #3a2610; color: #f2e6c8; border: 1px solid #1c1206; }
html.hc .inv-dialog { background: #000; color: #fff; border: 2px solid #fff; box-shadow: none; }
html.hc .inv-dialog h2, html.hc .inv-dialog h3, html.hc .inv-count, html.hc .inv-text { color: #fff; }
html.hc .inv-dialog button { background: #000; color: #fff; border-color: #fff; }
.lore-text { margin: 4px 0 0; font-style: italic; white-space: pre-line; }
.chronicle-body { max-height: 70vh; overflow-y: auto; padding-right: 6px; }
.chronicle-body h3 { margin: 14px 0 6px; font-size: 1rem; color: #c9b583; letter-spacing: .04em; }
.chronicle-list { list-style: none; margin: 0; padding: 0; }
.chronicle-list li { padding: 6px 0; border-bottom: 1px solid #1f2b2d; }
.chronicle-rumor { margin: 0; font-style: italic; line-height: 1.45; }
.chronicle-list em { opacity: .75; font-size: .85rem; }
html.hc .lore-dialog { background: #000; color: #fff; border: 2px solid #fff; box-shadow: none; }
html.hc .lore-dialog h2, html.hc .lore-dialog .stats { color: #fff; }
html.hc .lore-dialog button { background: #000; color: #fff; border-color: #fff; }
html.hc .villager-dialog { background: #000; border: 2px solid #ffffff; }

/* Clock chip: phase-tinted so dawn, day, dusk and night read at a glance; text stays high contrast. */
.clock-chip { display: inline-block; margin: 0 0 6px; padding: 2px 10px; border-radius: 999px; font-size: .85rem; letter-spacing: .03em; color: #f1ece4; background: rgba(20, 24, 34, .82); border: 1px solid #5d6a78; }
.district-chip[hidden] { display: none; }
.district-chip { margin-left: 6px; font-variant: small-caps; color: #e6dcc6; border-color: #7a6a52; }
.clock-chip[data-phase="dawn"] { border-color: #d9a0a0; background: rgba(48, 34, 44, .85); }
.clock-chip[data-phase="day"] { border-color: #aab9c4; background: rgba(36, 48, 60, .85); }
.clock-chip[data-phase="dusk"] { border-color: #e0905a; background: rgba(54, 30, 36, .88); }
.clock-chip[data-phase="night"] { border-color: #6c7fb0; background: rgba(12, 16, 32, .9); }
.clock-lanterns { margin-left: 6px; color: #ffcf8a; }
.clock-hint { margin: 0 0 6px; padding: 4px 8px; border-left: 3px solid #e0905a; background: rgba(20, 24, 34, .7); }
.view-setting { display: flex; align-items: center; gap: 8px; margin: 4px 0; font-size: .88rem; }
.view-setting input { flex: 1; min-width: 80px; }
.view-setting output { min-width: 4.5em; text-align: right; color: var(--dim); }
.quality-out, .about p.quality-out { margin: 2px 0 6px; font-size: .8rem; color: var(--dim); }
.settings-note, .about p.settings-note { margin: 0 0 8px; font-size: .8rem; color: var(--dim); }
.view-setting input[type="checkbox"] { flex: 0 0 auto; min-width: 0; }

/* ---------- round 33 Victorian reskin (spec 165): extends the round 29 layer above. Aged paper, maritime brass, dark wood and ink annotations.
   CSS gradients only (no images, no fonts, no inline styles, CSP unchanged). Every colour pair used for text is checked in web/test/victorian-theme.test.js (4.5:1 minimum). ---------- */
:root { --v-wood: #1a1209; --v-wood-hi: #2a1c10; --v-brass: #c9a24d; --v-brass-dim: #8c6d2c; --v-paper: #e6d8b5; --v-paper-deep: #cdb98a;
  --v-ink: #2b1d0e; --v-ink-soft: #5a3f1c; --v-ink-blue: #22365a; --v-ink-red: #7a1f1a; --v-on-wood: #eadfc6; --v-on-wood-dim: #c4b48c;
  --v-serif: Georgia, 'Iowan Old Style', 'Palatino Linotype', 'Book Antiqua', 'Times New Roman', serif; }
/* dark wood grain: fine vertical rules over a warm gradient */
button, a.btn { background-image: repeating-linear-gradient(90deg, rgba(255,230,170,.025) 0 1px, transparent 1px 5px), linear-gradient(180deg, #1c150d, #130e08); border-color: var(--v-brass-dim); color: var(--v-on-wood); }
button:hover, a.btn:hover { background-color: var(--v-wood-hi); border-color: var(--v-brass); }
button:focus-visible, a.btn:focus-visible, .board-card:focus-visible { outline: 3px solid var(--v-brass); outline-offset: 2px; }
.cta.recommended { background-image: linear-gradient(180deg, #3b2a12, #24180a); border-color: var(--v-brass); color: #f6ecd2; box-shadow: 0 0 0 1px #000, inset 0 0 0 1px rgba(201,162,77,.35), 0 0 22px rgba(201,162,77,.25); }
/* title screen: brass-cornered wood plaque with a ruled inner border */
.title-card { background-image: repeating-linear-gradient(90deg, rgba(255,230,170,.02) 0 1px, transparent 1px 6px), linear-gradient(180deg, rgba(34,24,13,.93), rgba(20,14,8,.95)); border: 2px solid var(--v-brass-dim); border-radius: 3px;
  box-shadow: 0 0 0 1px #000, 0 0 0 5px rgba(20,14,8,.9), 0 0 0 6px var(--v-brass-dim), 0 24px 70px rgba(0,0,0,.85), inset 0 0 70px rgba(0,0,0,.45); font-family: var(--v-serif); overflow-wrap: anywhere; hyphens: auto; }
.title-card h2 { color: #f1e6c8; text-shadow: 0 0 24px rgba(201,162,77,.35), 0 2px 0 #000; }
.title-card h2::after { background: linear-gradient(90deg, transparent, var(--v-brass), transparent); }
.title-village { color: var(--v-brass); }
.title-pitch { color: var(--v-on-wood); }
.title-rumor { color: var(--v-on-wood-dim); }
.title-lang button[aria-pressed="true"] { border-color: var(--v-brass); color: #f6ecd2; }
.title-card .stats, .title-reason { color: var(--v-on-wood-dim); }
/* HUD legibility: chips and hints sit on a wood backing, narration gets a dark halo */
.clock-chip, .district-chip { background-color: rgba(26,18,9,.9); color: var(--v-on-wood); border-color: var(--v-brass-dim); }
.clock-hint { background: rgba(26,18,9,.85); border-left-color: var(--v-brass); color: var(--v-on-wood); }
.hint { color: #d6cdb6; text-shadow: 0 1px 4px #000, 0 0 8px #000; }
.narration { color: #f1e8d0; text-shadow: 0 2px 10px #000, 0 0 4px #000, 0 0 14px rgba(0,0,0,.9); }
/* investigation board: pinned paper slips on dark wood, red thread, ink notes */
.board-dialog, .inv-dialog, .villager-dialog { font-family: var(--v-serif); overflow-wrap: anywhere; color: var(--v-on-wood);
  background-image: repeating-linear-gradient(90deg, rgba(255,230,170,.02) 0 1px, transparent 1px 7px), linear-gradient(180deg, #2a1c10, #17100a); border: 2px solid var(--v-brass-dim); box-shadow: 0 0 0 1px #000, 0 18px 50px rgba(0,0,0,.85), inset 0 0 0 1px rgba(201,162,77,.18), inset 0 0 40px rgba(0,0,0,.4); }
.board-dialog h2, .inv-dialog h2, .villager-dialog h2 { color: #f1e6c8; border-bottom: 1px solid var(--v-brass-dim); }
.board-dialog h3, .inv-dialog h3 { color: var(--v-brass); }
.board-scroll { background-color: #1c130b; background-image: repeating-linear-gradient(0deg, rgba(255,230,170,.03) 0 1px, transparent 1px 9px), radial-gradient(ellipse at 30% 20%, #3a2814, #1c130b 80%); border: 3px solid #4b3418; box-shadow: inset 0 0 24px rgba(0,0,0,.7); }
.board-string { stroke: #d4574a; stroke-linecap: round; opacity: .95; }
.board-dialog .board-card { background-color: var(--v-paper); background-image: linear-gradient(180deg, rgba(255,255,255,.18), rgba(120,80,20,.12)); color: var(--v-ink); border: 1px solid #8a6d3a; font-family: var(--v-serif); border-radius: 1px; box-shadow: 1px 3px 6px rgba(0,0,0,.6); overflow-wrap: anywhere; }
.board-dialog .board-card:nth-child(3n+1) { rotate: -.7deg; } .board-dialog .board-card:nth-child(3n+2) { rotate: .5deg; } .board-dialog .board-card:nth-child(3n) { rotate: -.2deg; }
.board-card::before { content: ""; position: absolute; top: 2px; left: 50%; width: 7px; height: 7px; margin-left: -3px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #f0d58a, var(--v-brass-dim)); box-shadow: 0 1px 2px rgba(0,0,0,.6); }
.board-card-kind { color: var(--v-ink-soft); letter-spacing: .08em; }
.board-card-trust { color: var(--v-ink-blue); }
.board-trust-1 { color: #6e3609; } .board-trust-2 { color: #1d5232; }
.board-card-reliability { color: var(--v-ink-blue); } .board-reliability-low { color: #6e3609; } .board-reliability-high { color: #1d5232; }
.board-dialog .board-unknown { background-color: var(--v-paper-deep); border-style: dashed; color: var(--v-ink); opacity: 1; }
.board-unknown .board-card-title { font-style: italic; }
.board-dialog .board-card:hover { box-shadow: 0 5px 12px rgba(0,0,0,.7), 0 0 0 1px var(--v-brass); }
.board-contradiction { border-color: #b32020; }
.board-detail, .board-timeline { color: var(--v-on-wood); }
.board-knowledge[data-tier]:not([data-tier="0"]) { border-left-color: var(--v-brass); }
/* theory builder: a ruled notepad with blue-black ink */
.board-theory { border-top: 1px solid var(--v-brass-dim); }
.theory-form { background-color: var(--v-paper); background-image: repeating-linear-gradient(0deg, transparent 0 1.55rem, rgba(34,54,90,.16) 1.55rem calc(1.55rem + 1px)); color: var(--v-ink); border: 1px solid #8a6d3a; padding: .5rem .7rem; font-family: var(--v-serif); }
.theory-form legend, .theory-form h4 { color: var(--v-ink-blue); }
.theory-form .stats { color: var(--v-ink-soft); }

.board-dialog .theory-form button { background-image: none; background-color: var(--v-ink); color: var(--v-paper); border-color: #000; }
.theory-pick { background-position: left top; }
.theory-results { color: var(--v-on-wood); }
.theory-true { border-left-color: #6fbf86; } .theory-partial { border-left-color: var(--v-brass); } .theory-false { border-left-color: #e0786f; }
/* chronicle: a bound paper ledger. The panel turns in from its spine, entries reveal like fresh ink */
.chronicle { background-color: var(--v-paper); background-image: radial-gradient(ellipse at 0 50%, rgba(90,55,15,.35), transparent 22%), radial-gradient(ellipse at 100% 0, rgba(255,255,255,.35), transparent 50%), linear-gradient(180deg, #e9dcba, #d7c498);
  color: var(--v-ink); border: 2px solid #6b4a1c; border-left-width: 9px; border-radius: 2px 5px 5px 2px; box-shadow: 0 8px 22px rgba(0,0,0,.55), inset 0 0 40px rgba(110,70,20,.28); font-family: var(--v-serif); transform-origin: left center; overflow-wrap: anywhere; hyphens: auto; }
.chronicle h2 { color: var(--v-ink); border-bottom: 1px solid #8a6d3a; }
.chronicle h3, .chronicle-body h3 { color: var(--v-ink-red); }
.chronicle .stats, .chronicle .axis-bars, .chronicle-list em { color: var(--v-ink-soft); opacity: 1; }
.chronicle li { border-bottom: 1px dotted rgba(90,63,28,.55); }
.chronicle .lore-text, .chronicle-rumor { color: var(--v-ink-blue); }
.chronicle .axis-label { color: var(--v-ink); }
.chronicle meter { background: #b9a67a; border-color: #6b4a1c; }
.chronicle a { color: var(--v-ink-blue); }
.chronicle button { background-image: none; background-color: var(--v-ink); color: var(--v-paper); border-color: #000; }
@keyframes inkReveal { from { opacity: 0; clip-path: inset(0 100% 0 0); } to { opacity: 1; clip-path: inset(0 0 0 0); } }
@keyframes pageTurn { from { opacity: 0; transform: perspective(1100px) rotateY(-14deg); } to { opacity: 1; transform: perspective(1100px) rotateY(0deg); } }
.chronicle:not([hidden]) { animation: pageTurn .7s ease-out both; }
.chronicle-body li { animation: inkReveal .9s ease-out both; }
.chronicle-body li:nth-child(2) { animation-delay: .1s; } .chronicle-body li:nth-child(3) { animation-delay: .2s; } .chronicle-body li:nth-child(4) { animation-delay: .3s; }
.chronicle-body li:nth-child(5) { animation-delay: .4s; } .chronicle-body li:nth-child(6) { animation-delay: .5s; } .chronicle-body li:nth-child(n+7) { animation-delay: .6s; }
/* journal pages and lore dialog: aged paper, ink-blue title, ruled lines, drop cap */
.lore-dialog { background-color: var(--v-paper); background-image: repeating-linear-gradient(0deg, transparent 0 1.5rem, rgba(34,54,90,.12) 1.5rem calc(1.5rem + 1px)), linear-gradient(180deg, #e9dcba, #cdb98a); color: var(--v-ink); border: 2px solid #6b4a1c; border-left-width: 8px; box-shadow: 0 0 28px #000, inset 0 0 44px rgba(110,70,20,.4); overflow-wrap: anywhere; font-family: var(--v-serif); }
.lore-dialog h2 { color: var(--v-ink-blue); border-bottom: 1px solid #8a6d3a; padding-bottom: 4px; }
.lore-dialog .stats { color: var(--v-ink-soft); }
.lore-page::first-letter { font-size: 1.9em; line-height: .9; float: left; padding: .05em .1em 0 0; color: var(--v-ink-red); }
.lore-dialog:not([hidden]) .lore-page { animation: inkReveal 1.2s ease-out both; }
.lore-dialog button { background-image: none; background-color: var(--v-ink); color: var(--v-paper); border-color: #000; }
/* inventory and villager dialogs: wood, brass and paper-coloured text */
.inv-text { color: var(--v-on-wood-dim); }
.inv-list li { border-bottom-color: rgba(201,162,77,.3); }
.villager-dialog { border-color: var(--v-brass-dim); }
.villager-line { color: #f3e9cd; }
.villager-list .vrole, .villager-list .vwhere { opacity: 1; color: var(--v-on-wood-dim); }
.board-dialog .axis-bars, .inv-dialog .axis-bars, .villager-dialog .axis-bars { color: var(--v-on-wood); }
.whispers li.e-omen { color: #e69a9e; }
html.reduced .chronicle, html.reduced .chronicle-body li, html.reduced .lore-page { animation: none; }
@media (prefers-reduced-motion: reduce) { .chronicle, .chronicle-body li, .lore-page { animation: none !important; } }
/* high contrast keeps the plain black and white palette; forced colors drops all decoration */
html.hc .chronicle, html.hc .lore-dialog, html.hc .theory-form, html.hc .board-dialog .board-card, html.hc .board-dialog .board-unknown { background: #000; color: #fff; border-color: #fff; box-shadow: none; }
html.hc .chronicle h2, html.hc .chronicle h3, html.hc .chronicle .stats, html.hc .chronicle .lore-text, html.hc .chronicle-rumor, html.hc .chronicle .axis-label, html.hc .lore-dialog h2, html.hc .theory-form legend, html.hc .board-card-kind, html.hc .board-card-trust, html.hc .lore-page::first-letter { color: #fff; }
html.hc .board-dialog, html.hc .inv-dialog, html.hc .villager-dialog, html.hc .title-card, html.hc .board-scroll { background: #000; border-color: #fff; box-shadow: none; }
html.hc .board-card::before { display: none; }
html.hc button, html.hc a.btn { background: #000; color: #fff; border-color: #fff; }
@media (forced-colors: active) { .board-card::before, .lore-page::first-letter { display: none; } .chronicle, .lore-dialog, .board-card, .theory-form { forced-color-adjust: auto; background: Canvas; color: CanvasText; } }

/* Round 34: reality instability badge. Static on purpose (no animation, no flicker), so it needs no reduced-motion override. */
.reality-badge { border: 1px solid currentColor; padding: 0 .4em; font-style: italic; }
.vfalse .vname { font-style: italic; opacity: .85; }

/* round 34 (spec 172): seed share code on the title screen and the chronicle tools */
.title-seed { margin: 0 0 4px; font-size: .95rem; color: #cfd8d3; }
.title-seed strong { letter-spacing: .06em; }
.title-seed-entry { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; margin: 6px 0 2px; }
.title-seed-entry input { min-width: 14rem; padding: 6px 8px; background: #0c1214; color: #e8efe9; border: 1px solid #5a6b64; border-radius: 4px; font: inherit; text-transform: uppercase; }
.title-seed-entry input:focus-visible { outline: 2px solid #d9b98a; outline-offset: 2px; }
.chronicle-tools { gap: 8px; align-items: center; margin-bottom: 8px; }

/* ---------- round 37 (FEAT-003 item 2): CSP is self-only (no inline style attribute, no style element), so what used to be inline lives here ---------- */
.swatch { display: inline-block; width: .8em; height: .8em; margin-right: .4em; vertical-align: baseline; border: 1px solid #000; }
.swatch-d9c27a { background: #d9c27a; } .swatch-b04a6a { background: #b04a6a; } .swatch-4a8fb0 { background: #4a8fb0; } .swatch-8a7a68 { background: #8a7a68; }
.swatch-6f8a68 { background: #6f8a68; } .swatch-4e5a3c { background: #4e5a3c; } .swatch-667075 { background: #667075; }
.page-meshes .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.page-meshes figure { margin: 0; background: #0f1719; border: 1px solid #1f2b2d; padding: 8px; }
.page-meshes figcaption { font-size: .85rem; color: var(--moss); }
.page-meshes canvas { width: 100%; height: auto; display: block; }
.page-selftest table { border-collapse: collapse; width: 100%; font-size: .9rem; }
.page-selftest th, .page-selftest td { text-align: left; padding: 4px 8px; border-bottom: 1px solid #1f2b2d; }
.page-selftest tr.ok td:last-child, .page-selftest p.ok { color: var(--moss); }
.page-selftest tr.bad td, .page-selftest p.bad { color: var(--blood); }

/* ---------- round 37 (FEAT-003 item 2): one panel vocabulary. Board, theory builder, chronicle, journal, inventory, villager dialog, title and HUD share these classes.
   Surfaces set four custom properties (wood is the default, .v-paper overrides it); the classes read them, so a heading, badge, empty state, error and focus ring look alike everywhere.
   web/test/panel-consistency.test.js checks that every panel heading uses them and that no inline style survives. ---------- */
:root { --v-fg: var(--v-on-wood); --v-head: #f1e6c8; --v-rule: var(--v-brass-dim); --v-focus: var(--v-brass); --v-mute: var(--v-on-wood-dim); --v-bad: #e69a9e; --v-space: 10px; }
.v-paper { --v-fg: var(--v-ink); --v-head: var(--v-ink); --v-rule: #8a6d3a; --v-focus: var(--v-ink-blue); --v-mute: var(--v-ink-soft); --v-bad: var(--v-ink-red); }
h2.v-heading { margin: 0 0 var(--v-space); padding-bottom: 6px; font-size: 1.2rem; font-weight: 400; letter-spacing: .08em; color: var(--v-head); border-bottom: 1px solid var(--v-rule); }
.title-card h2.v-heading { border-bottom: 0; padding-bottom: 0; }
.lore-dialog h2.v-heading, .chronicle h2.v-heading { color: var(--v-head); }
h3.v-subheading { margin: calc(var(--v-space) + 4px) 0 6px; font-size: .78rem; font-weight: 400; letter-spacing: .16em; text-transform: uppercase; color: var(--v-accent-h, var(--v-mute)); }
.v-paper h3.v-subheading { --v-accent-h: var(--v-ink-red); }
/* badges: small outlined pills with a text label, never colour alone */
.v-badge { display: inline-block; padding: 0 .5em; border: 1px solid currentColor; border-radius: 9px; font-size: .72rem; line-height: 1.5; letter-spacing: .04em; }
.jbadge.v-badge { border-color: #000; }
/* empty and error states: same indent, same voice (italic, muted); errors add the bad colour and a leading mark */
.v-empty { margin: 6px 0; font-style: italic; color: var(--v-mute); }
li.v-empty { list-style: none; }
.v-error { margin: 6px 0; color: var(--v-bad); }
.v-error::before { content: "! "; font-weight: bold; }
/* one keyboard focus ring for every interactive element in every panel */
:is(button, a, input, select, textarea, summary, [tabindex]:not([tabindex="-1"])):focus-visible { outline: 3px solid var(--v-focus); outline-offset: 2px; }
.title-seed-entry input:focus-visible { outline: 3px solid var(--v-focus); }
html.hc :is(button, a, input, select, textarea, summary, [tabindex]:not([tabindex="-1"])):focus-visible { outline-color: #fff; }
@media (forced-colors: active) { :is(button, a, input, select, textarea, summary, [tabindex]:not([tabindex="-1"])):focus-visible { outline-color: Highlight; } .v-badge { forced-color-adjust: auto; } }
