:root {
  --bg: #0b0c12;
  --panel: #13141d;
  --panel-2: #1a1b26;
  --line: #2b2c3a;
  --text: #d9d4c7;
  --muted: #8a8698;
  --bone: #e8e1cf;
  --soil: #a08566;
  --essence: #8fd6b4;
  --candle: #f2b54a;
  --blood: #b4534a;
  --stone: #8d8a9a;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 var(--serif); }
body { min-height: 100vh; background: radial-gradient(ellipse at 50% 0%, #1a1c2c 0%, var(--bg) 60%); }
h1, h2, h3 { font-weight: normal; letter-spacing: 0.06em; margin: 0; }
h1 { font-size: 1.4rem; font-variant: small-caps; color: var(--bone); }
h2 { font-size: 1.1rem; font-variant: small-caps; color: var(--bone); margin-bottom: 0.6rem; border-bottom: 1px solid var(--line); padding-bottom: 0.3rem; }
h3 { font-size: 0.95rem; font-variant: small-caps; color: var(--muted); margin: 1rem 0 0.4rem; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); }
.short { color: var(--blood); }
.error { color: var(--blood); }

button {
  font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 4px; padding: 0.35rem 0.7rem; cursor: pointer;
}
button:hover:not(:disabled) { border-color: var(--candle); }
button:focus-visible { outline: 2px solid var(--candle); outline-offset: 2px; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.danger { color: var(--blood); }

.top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 0.8rem 1.2rem; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: baseline; gap: 0.8rem; flex-wrap: wrap; }
.owner { font-size: 0.82rem; color: var(--muted); font-style: italic; }
.menu { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.menu button { font-size: 0.85rem; padding: 0.2rem 0.6rem; }

.layout { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(360px, 1.7fr) minmax(280px, 1.1fr); gap: 1rem; padding: 1rem 1.2rem; max-width: 1500px; margin: 0 auto; align-items: start; }
@media (max-width: 1050px) { .layout { grid-template-columns: 1fr 1fr; } .center { grid-column: 1 / -1; order: -1; } }
@media (max-width: 680px) { .layout { grid-template-columns: 1fr; padding: 0.6rem; } .center { order: 0; } }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 0.9rem; }

/* Resources */
.resources { list-style: none; margin: 0 0 0.8rem; padding: 0; }
.res { display: grid; grid-template-columns: 1.4rem 1fr auto; grid-template-rows: auto auto; column-gap: 0.4rem; padding: 0.25rem 0; border-bottom: 1px dotted var(--line); }
.res .glyph { grid-row: 1 / 3; align-self: center; text-align: center; font-size: 1.1rem; }
.res .rval { text-align: right; font-variant-numeric: tabular-nums; font-size: 1.05rem; }
.res .rrate { grid-column: 3; text-align: right; font-size: 0.78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.res-bones .glyph, .res-bones .rval { color: var(--bone); }
.res-soil .glyph, .res-soil .rval { color: var(--soil); }
.res-essence .glyph, .res-essence .rval { color: var(--essence); }
.res-candles .glyph, .res-candles .rval { color: var(--candle); }

.dig {
  position: relative; display: block; width: 100%; padding: 0.9rem; font-size: 1.15rem; font-variant: small-caps; letter-spacing: 0.08em;
  background: linear-gradient(#262535, #1a1926); border-color: #3c3a4e; user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
.dig:active { transform: translateY(1px); }
.dig small { display: block; font-size: 0.75rem; color: var(--muted); font-variant: normal; letter-spacing: 0; }
.float { font-variant: normal; letter-spacing: 0; position: absolute; top: 0.2rem; transform: translateX(-50%); pointer-events: none; z-index: 5; color: #f3ecda; background: #0b0a10e6; border: 1px solid #ffffff22; border-radius: 4px; padding: 0.15rem 0.5rem; font-size: 0.9rem; line-height: 1.3; white-space: nowrap; box-shadow: 0 2px 8px #000a; animation: rise 0.75s ease-out forwards; }
@keyframes rise { 0% { opacity: 0; transform: translate(-50%, 0.3rem); } 15% { opacity: 1; transform: translate(-50%, 0); } 70% { opacity: 1; } 100% { transform: translate(-50%, -1.4rem); opacity: 0; } }

.float.warn { color: #ffb0a3; border-color: #b4534a88; }
.float.corpse { color: var(--candle); }
.float.big { color: #b8f0d4; border-color: #8fd6b466; animation-duration: 1.1s; }
.dig-bar { display: block; height: 4px; margin: 0.35rem 0 0.2rem; background: #0e0d14; }
.dig-bar .fill { display: block; background: linear-gradient(90deg, var(--soil), var(--bone)); transition: width 0.08s linear; }

/* Current goal */
.goal { display: flex; gap: 1rem; align-items: center; max-width: 1500px; margin: 1rem auto 0; padding: 0.7rem 1rem; width: calc(100% - 2.4rem); background: var(--panel); border: 1px solid #4a3f2a; border-left: 3px solid var(--candle); border-radius: 6px; }
.goal-head { display: flex; gap: 0.8rem; align-items: baseline; flex-wrap: wrap; }
.goal-step { font-size: 0.78rem; color: var(--candle); font-variant: small-caps; letter-spacing: 0.06em; }
.goal-title { font-size: 1.15rem; color: var(--bone); font-variant: small-caps; letter-spacing: 0.05em; }
.goal-why { margin: 0.2rem 0 0.45rem; color: var(--text); font-size: 0.92rem; }
.goal-bar { height: 6px; margin: 0; }
.goal-bar .fill { background: linear-gradient(90deg, #8a5a1f, var(--candle)); }
.goal-unlocks { margin: 0.35rem 0 0; font-size: 0.8rem; color: var(--muted); }
.goal.fresh { animation: goalin 1.2s ease; }
@keyframes goalin { from { border-color: var(--candle); box-shadow: 0 0 18px #f2b54a55; } }
@media (max-width: 680px) { .goal { width: calc(100% - 1.2rem); margin-top: 0.6rem; } }

.raise-as { margin: 0.2rem 0 0.4rem; font-size: 0.85rem; display: flex; gap: 0.3rem; align-items: center; flex-wrap: wrap; }
.seg { font-size: 0.8rem; padding: 0.15rem 0.5rem; }
.seg.on { border-color: var(--essence); color: var(--essence); }
.grave-actions { display: flex; gap: 0.4rem; }
.hint { font-size: 0.75rem; margin: 0.3rem 0 0; }
b.ready { color: var(--essence); }
.mission-bar .fill { background: linear-gradient(90deg, #3d6b56, var(--essence)); }
.res-corpses .glyph, .res-corpses .rval { color: #c9a9a0; }
.light { margin: 0.7rem 0; font-size: 0.85rem; color: var(--muted); }
.light b { color: var(--candle); font-weight: normal; }

/* Cards */
.list { display: flex; flex-direction: column; gap: 0.5rem; }
.card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 5px; padding: 0.55rem 0.65rem; margin-top: 0.5rem; }
.list .card { margin-top: 0; }
.card-head { display: flex; justify-content: space-between; gap: 0.5rem; }
.card .name { color: var(--bone); font-variant: small-caps; letter-spacing: 0.04em; }
.card .count { color: var(--candle); font-variant-numeric: tabular-nums; font-size: 0.9rem; }
.card .desc { margin: 0.15rem 0 0.35rem; font-size: 0.83rem; color: var(--muted); }
.card .meta:empty { display: none; }
.card .info { font-size: 0.8rem; color: var(--muted); }
.card .actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.card.owned { opacity: 0.6; }
.card.owned .count { color: var(--essence); }
.card.active { border-color: var(--essence); box-shadow: 0 0 10px #8fd6b433; }
.card.sealed { opacity: 0.45; }
.buy { display: flex; flex-direction: column; align-items: flex-start; flex: 1; min-width: 8rem; text-align: left; }
.buy .label { font-variant: small-caps; }
.buy .cost { font-size: 0.76rem; color: var(--muted); }
.buy .c + .c::before { content: "\00b7 "; color: var(--line); }
.buy .c.short { color: var(--blood); }
.buy.secondary { flex: 0 1 auto; }

.bar { height: 5px; background: #2a1d22; border-radius: 3px; overflow: hidden; margin: 0.15rem 0 0.25rem; }
.bar .fill { height: 100%; background: linear-gradient(90deg, #8a8170, var(--bone)); transition: width 0.3s linear; }
.bar.low .fill { background: linear-gradient(90deg, #6e2f2b, var(--blood)); }

/* Scene */
.scene-wrap { position: relative; aspect-ratio: 900 / 500; width: min(100%, calc(66vh * 900 / 500)); margin: 0 auto; border-radius: 4px; overflow: hidden; background: #07080f; }
.scene-wrap svg { display: block; width: 100%; height: 100%; }

/* Built sections: solid stone. Unbuilt: ghost outline (above-ground ones only once the crypt reveals them). */
.section .stone { fill: url(#g-stone); stroke: #2f2d38; stroke-width: 1; }
.section .dark { fill: #0e0d14; stroke: #2f2d38; }
.section .glass { fill: url(#g-glass); }
.section .tracery { fill: none; stroke: #3a3644; stroke-width: 2; }
.section .trim { fill: none; stroke: #5b5867; stroke-width: 1; }
.section { transition: opacity 1.2s ease; }
.section:not(.built) .stone, .section:not(.built) .dark, .section:not(.built) .glass, .section:not(.built) .tracery, .section:not(.built) .trim {
  fill: none; stroke: #c8c6dc; stroke-opacity: 0.22; stroke-width: 1; stroke-dasharray: 3 4;
}
.section.above:not(.built) { opacity: 0; }
#scene.revealed .section.above:not(.built) { opacity: 1; animation: ghost 6s ease-in-out infinite; }
.section.built { animation: raise 1.6s ease-out; }
@keyframes ghost { 50% { opacity: 0.55; } }
@keyframes raise { from { opacity: 0; transform: translateY(6px); } }
#sec-rose.built .glass { filter: drop-shadow(0 0 6px #f4c86a88); }

#graves .grave.lit { cursor: pointer; }
#graves .hit { fill: transparent; }
#graves .stone-h { fill: #2c2a33; stroke: #3d3a46; stroke-width: 0.6; }
#graves .lit .stone-h { fill: #5d5966; stroke: #77727f; }
#graves .lit:hover .stone-h { fill: #78737f; }
#graves .halo { fill: url(#g-flame); opacity: 0.22; }
#graves .wick { fill: #e8e1cf; }
#graves .flame { fill: url(#g-flame); animation: flicker 1.8s ease-in-out infinite; transform-box: fill-box; transform-origin: center bottom; }
#graves .grave:nth-child(3n) .flame { animation-delay: -0.6s; }
#graves .grave:nth-child(3n+1) .flame { animation-delay: -1.2s; }
#graves .pit, #graves .mound, #graves .soul, #graves .pbar, #graves .pbar-bg { display: none; }
#graves .pit { fill: #050407; stroke: #8a7150; stroke-width: 1.1; }
#graves .mound { fill: #4a3d2c; }
#graves .soul { fill: #8fd6b4; filter: drop-shadow(0 0 3px #8fd6b4); animation: soul 1.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
#graves .pbar-bg { fill: #0b0a0f; }
#graves .pbar { fill: var(--bone); }
#graves .st-sealed .pbar, #graves .st-sealed .pbar-bg { display: inline; }
#graves .st-sealed .pbar { fill: var(--soil); }
#graves .st-empty .pit { display: inline; }
#graves .st-resting .mound, #graves .st-resting .pbar, #graves .st-resting .pbar-bg { display: inline; }
#graves .st-ready .mound, #graves .st-ready .soul { display: inline; }
#graves .st-ready .mound { fill: #3e5a4c; }
@keyframes soul { 50% { transform: translateY(-3px) scale(1.15); opacity: 0.7; } }
@keyframes flicker { 50% { transform: scale(0.82, 1.12); opacity: 0.8; } }
#scene.haste #graves .flame { fill: #8fd6b4; }

#fog { pointer-events: none; }
.fog { animation: drift 24s ease-in-out infinite alternate; }
.fog.f2 { animation-duration: 31s; }
.fog.f3 { animation-duration: 19s; }
@keyframes drift { to { transform: translateX(40px); } }

.epitaph { min-height: 3.2em; margin: 0.7rem 0; padding: 0.5rem 0.8rem; border-left: 2px solid var(--line); font-style: italic; color: var(--bone); }
.epitaph.stone { border-left-color: var(--stone); }
.epitaph.event { border-left-color: var(--candle); }
.epitaph.fresh { animation: fadein 1.4s ease; }
@keyframes fadein { from { opacity: 0; } }
.sections { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.5rem; }
.sections .card { margin: 0; }

/* Chronicle */
.chronicle { list-style: none; margin: 0; padding: 0; max-height: 22rem; overflow-y: auto; font-size: 0.85rem; }
.chronicle li { padding: 0.4rem 0; border-bottom: 1px dotted var(--line); color: var(--muted); }
.chronicle li:first-child { color: var(--text); }
.chronicle li.stone::before { content: "\2020  "; color: var(--stone); }
.chronicle li.event::before { content: "\2727  "; color: var(--candle); }

/* Goal box + the Guide */
.goal-main { flex: 1; min-width: 0; }
.goal.studyable { border-color: var(--essence); box-shadow: 0 0 14px #8fd6b433; }
.goal.studyable .goal-unlocks { color: var(--essence); }
.book-btn { position: relative; display: flex; flex-direction: column; align-items: center; gap: 0.1rem; padding: 0.5rem 0.9rem; font-variant: small-caps; letter-spacing: 0.05em; border-color: #6a5326; }
.book-glyph { font-size: 1.4rem; line-height: 1; color: var(--candle); }
.badge { position: absolute; top: -0.45rem; right: -0.45rem; min-width: 1.3rem; height: 1.3rem; border-radius: 0.65rem; background: var(--essence); color: #07120d; font-size: 0.75rem; display: grid; place-items: center; font-variant: normal; }
.goal.studyable .book-btn { border-color: var(--essence); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 16px #8fd6b488; } }
@media (max-width: 680px) { .goal { flex-direction: column; align-items: stretch; } .book-btn { flex-direction: row; justify-content: center; gap: 0.5rem; } }

.book-overlay { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 1rem; background: #05060bd9; }
.book-card { width: min(40rem, 100%); max-height: calc(100vh - 2rem); overflow-y: auto; background: linear-gradient(#2a2418, #1d1910); color: #e9dfc6; border: 1px solid #5a4a2a; border-radius: 4px 10px 10px 4px; box-shadow: inset 6px 0 0 #120f09, 0 12px 40px #000c; padding: 1rem 1.4rem 1rem 1.8rem; }
.book-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; border-bottom: 1px solid #5a4a2a; padding-bottom: 0.4rem; }
.book-name { font-variant: small-caps; letter-spacing: 0.06em; color: var(--candle); }
.book-tabs { display: flex; flex-wrap: wrap; gap: 0.25rem; margin: 0.6rem 0; }
.book-tabs button { font-size: 0.75rem; padding: 0.1rem 0.45rem; background: #15120b; border-color: #4a3d22; color: #b8a77f; min-width: 2.2rem; }
.book-tabs button.cur { border-color: var(--candle); color: var(--candle); }
.book-tabs button.new { border-color: var(--essence); color: var(--essence); }
.book-tabs button.locked { opacity: 0.35; }
.page { min-height: 16rem; }
.page-num { font-size: 0.8rem; color: #a8946a; letter-spacing: 0.1em; }
.page-title { font-size: 1.3rem; border: 0; margin: 0.1rem 0 0.6rem; color: #f0e4c6; }
.page-text { font-size: 1.05rem; line-height: 1.6; margin: 0 0 0.8rem; }
.page-text .cx { color: #8c7a55; }
.page-note { font-family: "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive; color: #9fc4e0; transform: rotate(-1deg); border-left: 2px solid #9fc4e055; padding-left: 0.6rem; margin: 0 0 0.8rem; }
.page-learn { font-size: 0.9rem; color: var(--essence); margin-bottom: 0.6rem; }
.page-status { font-size: 0.85rem; color: #b8a77f; margin: 0 0 0.6rem; }
.study-btn { width: 100%; padding: 0.6rem; font-variant: small-caps; letter-spacing: 0.06em; border-color: var(--essence); color: var(--essence); background: #10180f; }
.book-nav { display: flex; justify-content: space-between; margin-top: 0.8rem; }
.book-nav button { background: #15120b; border-color: #4a3d22; color: #d6c59c; }
.page.learned-anim .page-note, .page.learned-anim .page-learn { animation: fadein 1.2s ease; }
.card.fresh, .dig.fresh, #grave-ctl.fresh { animation: freshglow 2s ease-in-out 3; }
@keyframes freshglow { 50% { box-shadow: 0 0 0 2px var(--essence), 0 0 18px #8fd6b466; } }

/* Intro */
.intro { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 1rem; background: radial-gradient(ellipse at 50% 30%, #1a1c2cee 0%, #05060bf8 70%); }
.intro-card { width: min(36rem, 100%); background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--candle); border-radius: 6px; padding: 1.4rem 1.6rem 1rem; box-shadow: 0 10px 40px #000a; }
.intro-card.turn { animation: fadein 0.7s ease; }
.intro-card h2 { font-size: 1.3rem; border: 0; margin-bottom: 0.4rem; }
.intro-card p { margin: 0 0 0.8rem; }
.intro-card i { color: var(--bone); }
.intro-card .book { display: block; text-align: center; font-variant: small-caps; letter-spacing: 0.06em; font-size: 1.2rem; color: var(--candle); font-weight: normal; margin-top: 0.4rem; }
.intro-card .book-sub { display: block; text-align: center; font-size: 0.8rem; color: var(--muted); }
#intro-name { width: 100%; font: inherit; font-size: 1.1rem; padding: 0.5rem 0.7rem; margin: 0.2rem 0 0.6rem; background: var(--bg); color: var(--bone); border: 1px solid var(--line); border-radius: 4px; }
#intro-name:focus { outline: 2px solid var(--candle); }
.intro-actions { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.intro-actions #intro-next { margin-left: auto; padding: 0.5rem 1.1rem; border-color: #6a5326; font-variant: small-caps; letter-spacing: 0.05em; }
button.link { background: none; border: 0; color: var(--muted); text-decoration: underline; padding: 0.3rem 0; }
.intro-dots { display: flex; justify-content: center; gap: 0.4rem; margin-top: 0.8rem; }
.intro-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.intro-dots span.on { background: var(--candle); }

/* Dialog */
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 6px; max-width: min(34rem, 92vw); padding: 1.1rem 1.3rem; }
dialog::backdrop { background: #000a; }
dialog textarea { width: 100%; font: 0.75rem/1.3 ui-monospace, monospace; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 4px; padding: 0.4rem; word-break: break-all; }
dialog menu { display: flex; justify-content: flex-end; gap: 0.5rem; margin: 0.8rem 0 0; padding: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  #scene.revealed .section.above:not(.built) { opacity: 0.6; }
}

/* Dev panel (only with ?dev) */
button.dev { color: #e0b0ff; border-color: #6b4a80; }
.dev-panel { position: fixed; top: 3.4rem; right: 1rem; z-index: 60; width: min(30rem, calc(100vw - 2rem)); background: #17121d; border: 1px solid #6b4a80; border-radius: 6px; padding: 0.7rem; box-shadow: 0 8px 30px #000b; font-size: 0.85rem; }
.dev-row { display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; margin-bottom: 0.45rem; }
.dev-row b { width: 4.8rem; color: #e0b0ff; font-weight: normal; font-variant: small-caps; }
.dev-row button { font-size: 0.78rem; padding: 0.15rem 0.5rem; }
.dev-row button.on { border-color: #e0b0ff; color: #e0b0ff; }
.dev-row select { font: inherit; font-size: 0.8rem; background: var(--bg); color: var(--text); border: 1px solid var(--line); max-width: 15rem; }
.dev-row code { color: #e0b0ff; }

/* Bank, jobs, gems */
#bank .corpse { cursor: pointer; }
#bank .hit { fill: transparent; }
#bank .shroud { fill: #b9ad94; stroke: #6d6350; stroke-width: 0.8; }
#bank .head { fill: #8f8673; }
#bank .corpse:hover .shroud { fill: #e2d6ba; }
.float.gem, .res-gems .glyph, .res-gems .rval { color: #c99bff; }
.jobs { display: flex; flex-direction: column; gap: 0.2rem; margin: 0.35rem 0 0.2rem; }
.job { display: grid; grid-template-columns: 7.2rem auto 1.6rem auto 1fr; gap: 0.3rem; align-items: center; font-size: 0.82rem; }
.job-name { color: var(--text); }
.job-n { text-align: center; font-variant-numeric: tabular-nums; color: var(--candle); }
.job-out { color: var(--muted); font-size: 0.75rem; }
.pm { padding: 0 0.45rem; line-height: 1.3; font-size: 0.9rem; }
.info b.idle { color: var(--candle); font-weight: normal; }
.book-btn.glow { border-color: var(--essence); color: var(--essence); animation: pulse 1.6s ease-in-out infinite; }
.menu .book-btn { flex-direction: row; gap: 0.4rem; padding: 0.2rem 0.7rem; font-size: 0.95rem; }
.menu .book-glyph { width: 20px; height: 20px; }
.book-tabs button.read { color: #e9dfc6; }
.chronicle li.guide::before { content: "\2766  "; color: var(--essence); }
.epitaph.guide { border-left-color: var(--essence); }

/* Collapsible groups */
details.group { margin-top: 0.8rem; }
details.group > summary { cursor: pointer; list-style: none; font-size: 0.95rem; font-variant: small-caps; letter-spacing: 0.06em; color: var(--muted); padding: 0.2rem 0; border-bottom: 1px dotted var(--line); margin-bottom: 0.5rem; user-select: none; }
details.group > summary::-webkit-details-marker { display: none; }
details.group > summary::before { content: "\25BE"; display: inline-block; width: 1rem; color: var(--candle); transition: transform 0.15s; }
details.group:not([open]) > summary::before { transform: rotate(-90deg); }
details.group > summary:hover { color: var(--text); }

/* Economy */
.at-work { background: #1d2430; border: 1px solid #3c5a80; border-radius: 5px; padding: 0.5rem 0.7rem; margin-bottom: 0.7rem; font-size: 0.85rem; color: #b8cff0; position: relative; }
.at-work.hiding { background: #2a1d1d; border-color: #80423c; color: #f0c0b8; }
body.working #btn-dig, body.working #bank-actions .buy, body.working #grave-actions .buy { opacity: 0.4; }
.res-money .glyph, .res-money .rval { color: #9fd08a; }
.res.debt .glyph, .res.debt .rval { color: var(--blood); }
.res-meat .glyph, .res-meat .rval { color: #c9786a; }

/* Resource tooltips */
.res { cursor: help; }
.res:focus-visible { outline: 1px solid var(--candle); outline-offset: 2px; }
.res-tip { position: absolute; z-index: 30; background: #0f0e16; border: 1px solid #4a4760; border-radius: 6px; padding: 0.55rem 0.7rem; font-size: 0.82rem; box-shadow: 0 8px 24px #000c; pointer-events: none; }
.res-tip b { color: var(--bone); font-variant: small-caps; letter-spacing: 0.05em; font-weight: normal; }
.res-tip .tip-h { margin-top: 0.35rem; color: var(--candle); font-size: 0.75rem; font-variant: small-caps; letter-spacing: 0.06em; }
.res-tip ul { margin: 0.1rem 0 0; padding-left: 1rem; color: var(--text); }
.res-tip li { margin: 0.1rem 0; }

/* Stone: the ruins become clickable once quarrying is learned */
#scene.quarry #ruins { cursor: pointer; }
#scene.quarry #ruins path:hover { fill: #57535f; }
.res-stone .glyph, .res-stone .rval { color: #b9b4c8; }
#stone-slot { margin: 0.5rem 0; }

/* Buy amount switch */
.buy-mode { display: inline-flex; align-items: center; gap: 0.15rem; margin-right: 0.4rem; font-size: 0.8rem; }
.buy-mode .muted { margin-right: 0.25rem; }
.buy-mode button { font-size: 0.78rem; padding: 0.15rem 0.45rem; }
.buy-mode button.on { border-color: var(--candle); color: var(--candle); }

.build-bar .fill { background: linear-gradient(90deg, #6b6680, #c8c4d8); }
#scene .section.building { transition: opacity 2s linear; }

/* Necromancy tree (in the Guide) */
.book-card { width: min(56rem, 100%); }
.book-modes { display: flex; gap: 0.3rem; margin: 0.6rem 0 0.2rem; }
.book-modes button { background: #15120b; border-color: #4a3d22; color: #b8a77f; font-variant: small-caps; letter-spacing: 0.05em; }
.book-modes button.on { border-color: var(--candle); color: var(--candle); }
.book-modes button.glow { border-color: #c99bff; color: #c99bff; }
.tree-branches { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 0.7rem; }
.branch h3 { color: #f0e4c6; margin: 0; }
.branch-desc { font-size: 0.78rem; margin: 0.1rem 0 0.4rem; color: #a8946a; }
.branch .card { background: #15120b; border-color: #4a3d22; }
.branch .card .name { color: #f0e4c6; }
.branch .card .desc { color: #b8a77f; }
.branch .card.locked { opacity: 0.45; }
.branch .card.locked .info { color: #c99bff; }
.repeat { font-size: 0.78rem; color: var(--muted); display: flex; gap: 0.3rem; align-items: center; }

.res.full .rval { color: var(--candle); }
.res.full .rrate { color: var(--candle); }

.mission-opts { display: flex; gap: 0.4rem; flex-wrap: wrap; width: 100%; }

/* Bank duty animation */
#haul-anim { pointer-events: none; }
.hauler .skel { fill: none; stroke: #e8e1cf; stroke-width: 0.9; stroke-linecap: round; }
.hauler .skel circle { fill: #e8e1cf; stroke: none; }
.hauler .shroud { fill: #b9ad94; stroke: #6d6350; stroke-width: 0.6; }
.hauler .head { fill: #8f8673; }

/* The yard */
.station text { font: 7px/1 var(--serif); fill: #8a8698; text-anchor: middle; font-variant: small-caps; letter-spacing: 0.04em; }
.station .heap { fill: #4a3d2c; stroke: #6d5a40; stroke-width: 0.8; transform-box: fill-box; transform-origin: center bottom; transition: transform 1s; }
.station .table { fill: #5a4632; stroke: #7a6248; stroke-width: 0.6; }
.station .legs, .station .sign { fill: none; stroke: #6a5640; stroke-width: 1.2; }
.station .sign { fill: #3b3226; }
.station .block { fill: #8d8a9a; stroke: #5b5867; stroke-width: 0.5; }
.station .shroud { fill: #b9ad94; stroke: #6d6350; stroke-width: 0.5; }
.station .head { fill: #8f8673; }
/* Crew figures */
#crew { pointer-events: none; }
.worker .w { fill: none; stroke: #e8e1cf; stroke-width: 0.9; stroke-linecap: round; animation: toil 1.1s ease-in-out infinite; transform-box: fill-box; transform-origin: center bottom; }
.worker .w circle { fill: #e8e1cf; stroke: none; }
.worker.ghoul .w { stroke: #9fc4a0; } .worker.ghoul .w circle { fill: #9fc4a0; }
.worker.wraith .w { stroke: #8fd6b4; opacity: 0.6; } .worker.wraith .w circle { fill: #8fd6b4; }
@keyframes toil { 50% { transform: rotate(-8deg) translateY(1px); } }
.worker .tool { stroke: #a08566; stroke-width: 1.1; }
.worker .load ellipse { fill: #b9ad94; stroke: #6d6350; stroke-width: 0.4; }
.worker.job-dig .w { animation: shovel 0.9s ease-in-out infinite; }
@keyframes shovel { 0%, 100% { transform: rotate(0deg); } 40% { transform: rotate(14deg) translateY(1px); } }
.worker.job-quarry .w { animation: pick 0.8s ease-in-out infinite; }
@keyframes pick { 0%, 100% { transform: rotate(0deg); } 30% { transform: rotate(-16deg); } }
/* Carriers walk pile -> station (loaded) and back (empty): --dx/--dy set per figure. */
.worker.job-carry .w { animation: ferry 6s linear infinite; }
.worker.job-carry .load { animation: load 6s linear infinite; animation-delay: inherit; animation-duration: inherit; }
@keyframes ferry { 0% { transform: translate(0, 0); } 45% { transform: translate(var(--dx), var(--dy)); } 50% { transform: translate(var(--dx), var(--dy)); } 95% { transform: translate(0, 0); } 100% { transform: translate(0, 0); } }
@keyframes load { 0%, 45% { opacity: 1; } 46%, 100% { opacity: 0; } }
.worker.job-haul .w { animation: wait 2.4s ease-in-out infinite; }
@keyframes wait { 50% { transform: translateY(-1px); } }

/* The map: a full-width strip above the panels */
.map { max-width: 1500px; margin: 0.8rem auto 0; padding: 0 1.2rem; }
.map .epitaph { margin: 0.5rem auto 0; max-width: 60rem; }
@media (max-width: 680px) { .map { padding: 0 0.6rem; } }

.job.nostation .job-name { color: var(--muted); }
.job.nostation .job-name::after { content: " (no station)"; font-size: 0.72rem; color: var(--blood); }

/* Workstations in the foreground */
.ws { cursor: pointer; }
.ws .hit { fill: transparent; }
.station .lv { font-size: 6px; fill: var(--candle); }
.station .face { fill: #4b4856; stroke: #6a6676; stroke-width: 0.8; }
.station .rope, .station .wire { fill: none; stroke: #a08566; stroke-width: 0.7; }
.station .cleaver { fill: #9aa0a8; }
.station .vice { fill: #6a6676; }
.station .plank { fill: #5a4632; stroke: #7a6248; stroke-width: 0.6; }
.station .wheel { fill: none; stroke: #7a6248; stroke-width: 1; }
.station .plot { fill: #2a231a; stroke: #4a3d2c; stroke-width: 0.6; }
.station.unbuilt .obj * { fill: none !important; stroke: #c8c6dc; stroke-opacity: 0.35; stroke-dasharray: 2 2; }
.station.unbuilt text:not(.lv) { fill: #6a6680; }
.station.building .obj { opacity: 0.55; }
.station.building .obj::after { content: ''; }
.station.building { filter: drop-shadow(0 0 4px #f2b54a66); }
.station .lv { pointer-events: none; }

/* ===== Layout v2: map on top, sticky resources, tabs + pinned dock ===== */
.layout { grid-template-columns: minmax(0, 1fr) minmax(280px, 340px) !important; align-items: start; }
@media (max-width: 1050px) { .layout { grid-template-columns: 1fr !important; } .side-panel { order: 1; } }
.main-panel { min-height: 50vh; }
.side-panel { position: sticky; top: 3.4rem; max-height: calc(100vh - 4rem); overflow-y: auto; }
@media (max-width: 1050px) { .side-panel { position: static; max-height: none; } }
.side-panel h2 { margin-bottom: 0.5rem; }

/* Resource bar */
.resbar { position: sticky; top: 0; z-index: 20; background: #0b0c12ee; backdrop-filter: blur(4px); border-bottom: 1px solid var(--line); margin-top: 0.6rem; }
.resbar .resources { display: flex; flex-wrap: wrap; gap: 0.3rem 0.5rem; max-width: 1500px; margin: 0 auto; padding: 0.4rem 1.2rem; }
.resbar .res { display: inline-flex; align-items: baseline; gap: 0.35rem; padding: 0.2rem 0.55rem; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); border-bottom: 1px solid var(--line); grid-template-columns: none; }
.resbar .res .glyph { font-size: 0.95rem; }
.resbar .res .rname { font-size: 0.8rem; color: var(--muted); }
.resbar .res .rval { font-size: 0.95rem; }
.resbar .res .rrate { font-size: 0.72rem; }
.resbar .res.full { border-color: #8a6a2a; }
@media (max-width: 680px) { .resbar .res .rname { display: none; } .resbar .resources { padding: 0.35rem 0.6rem; } }
.resbar .omen, .resbar .ticker { max-width: 1500px; margin-left: auto; margin-right: auto; padding: 0 1.2rem; box-sizing: border-box; }
.resbar .ticker { padding-bottom: 0.3rem; }
@media (max-width: 680px) { .resbar .omen, .resbar .ticker { padding: 0 0.6rem; } }
.banners { max-width: 1500px; margin: 0.5rem auto 0; padding: 0 1.2rem; }
.banners .at-work { margin-bottom: 0; }

/* Tabs */
.tabs { display: flex; gap: 0.3rem; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: 0.5rem; margin-bottom: 0.8rem; }
.tabs button { position: relative; font-variant: small-caps; letter-spacing: 0.05em; padding: 0.35rem 0.9rem; }
.tabs button.on { border-color: var(--candle); color: var(--candle); background: #1f1c16; }
.tabs button.new::after { content: ''; position: absolute; top: 4px; right: 4px; width: 7px; height: 7px; border-radius: 50%; background: var(--essence); box-shadow: 0 0 6px var(--essence); }
.tabs kbd { font: 0.68rem ui-monospace, monospace; color: var(--muted); margin-left: 0.3rem; border: 1px solid var(--line); border-radius: 3px; padding: 0 0.25rem; }
@media (max-width: 680px) { .tabs kbd { display: none; } .tabs button { flex: 1; padding: 0.35rem 0.4rem; } }

/* Card grids instead of long columns */
.list.grid, .tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 0.6rem; align-items: start; }
.tiles > .card, .list.grid > .card { margin: 0; }
.tile-slot > .card { margin: 0; }
.tile .dig { margin-top: 0.4rem; }
#land-slot { display: contents; }

/* Pins */
.card-head { align-items: baseline; }
.pin { margin-left: 0.4rem; padding: 0 0.35rem; font-size: 0.85rem; line-height: 1.2; background: none; border-color: transparent; color: var(--muted); opacity: 0.55; }
.card:hover .pin, .pin:focus-visible { opacity: 1; }
.pin[aria-pressed="true"] { color: var(--candle); opacity: 1; }
.pinned { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.6rem; }
.pinned .card { margin: 0; }
.pinned-card { border-color: #5a4a2a; }
.pin-sample { color: var(--candle); }

/* Map: caption overlay, size toggle */
.scene-wrap .epitaph { position: absolute; left: 0; right: 0; bottom: 0; margin: 0; min-height: 0; padding: 1.6rem 1rem 0.55rem; border: 0; font-size: 0.9rem; line-height: 1.35;
  background: linear-gradient(transparent, #05060be6 45%); color: var(--bone); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; pointer-events: none; }
.scene-wrap .epitaph.event { color: #f3e2b8; } .scene-wrap .epitaph.guide { color: #c8f0dc; }
.map-size { position: absolute; top: 0.5rem; left: 0.5rem; z-index: 3; font-size: 0.72rem; padding: 0.15rem 0.5rem; background: #0b0c12cc; }
body.map-small .scene-wrap { width: min(100%, calc(30vh * 900 / 500)); }
.map .epitaph:not(.scene-wrap .epitaph) { display: none; }
/* Header menu */
.menu-more { position: relative; }
.menu-more > summary { list-style: none; cursor: pointer; border: 1px solid var(--line); border-radius: 4px; padding: 0.2rem 0.6rem; font-size: 0.85rem; background: var(--panel-2); }
.menu-more > summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 0.3rem); z-index: 70; display: flex; flex-direction: column; gap: 0.3rem; padding: 0.5rem; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 8px 24px #000b; min-width: 9rem; }
.menu-pop button { text-align: left; }

/* Map + Chronicle side by side */
.map { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 340px); gap: 1rem; align-items: start; }
.map .scene-wrap { width: 100%; max-height: 55vh; }
body.map-small .map .scene-wrap { width: 100%; max-height: 32vh; }
.scene-wrap svg { height: 100%; }
.chron-panel { display: flex; flex-direction: column; padding: 0.7rem 0.8rem; height: var(--map-h, 60vh); min-height: 14rem; }
.chron-panel .chronicle { flex: 1; max-height: none; overflow-y: auto; }
@media (max-width: 900px) { .map { grid-template-columns: 1fr; } .chron-panel { height: 13rem; } }
/* With the Chronicle beside the map, the caption over the map is redundant. */
@media (min-width: 901px) { .scene-wrap .epitaph { display: none; } }
.map .scene-wrap { max-height: 56vh; }

/* The Fen country */
.fen { display: grid; grid-template-columns: 1fr; gap: 0.8rem; align-items: start; }   /* map full width (Doro, Nov 2026: beside the details its labels were ~4 px) */
.fen-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0.8rem; align-items: start; }
@media (max-width: 900px) { .fen { grid-template-columns: 1fr; } }
.fen-svg { width: 100%; height: auto; display: block; border: 1px solid var(--line); border-radius: 6px; }
.fen-bg { fill: #1a1d17; }
.fen-svg .water { fill: #1d2a2c; }
.fen-svg .reeds path { stroke: #3a4a32; stroke-width: 1.2; }
.fen-svg .road { fill: none; stroke: #4a4030; stroke-width: 2; stroke-dasharray: 5 4; }
.fen-svg .lot path { fill: #5d5966; stroke: var(--candle); stroke-width: 1.2; }
.fen-svg text { font: 15px var(--serif); fill: #b8b2c4; text-anchor: middle; }
.fen-svg .outpost { cursor: pointer; }
.fen-svg .outpost .ring { fill: none; stroke: #6a6676; stroke-width: 1.2; }
.fen-svg .outpost .core { fill: #2a2733; stroke: #8a8698; }
.fen-svg .outpost .def { font-size: 13px; fill: #f0c0b8; }
.fen-svg .outpost .lbl { font-size: 15px; }
.fen-svg .outpost.sel .ring { stroke: var(--candle); stroke-width: 2; }
.fen-svg .outpost.held .core { fill: #24402f; stroke: var(--essence); }
.fen-svg .outpost.held .def { fill: var(--essence); }
.fen-svg .outpost.raiding .ring { stroke: #c99bff; stroke-dasharray: 3 3; animation: spin 4s linear infinite; transform-box: fill-box; transform-origin: center; }
@keyframes spin { to { transform: rotate(360deg); } }
.fen-detail .squad { display: flex; gap: 0.4rem; align-items: center; margin: 0.4rem 0; }
.fen-detail .win { color: var(--essence); }

.fen-detail .squad .who { min-width: 8.5rem; }
.forge-card { margin-top: 0.6rem; }
.forge-card .seg small { color: var(--muted); }

/* The muster: gathering, marching out, coming home */
#muster { pointer-events: none; }
#muster .banner .pole { stroke: #c8bfa8; stroke-width: 1; }
#muster .banner .flag { fill: #6b2a2a; stroke: #3a1414; stroke-width: 0.5; animation: flutter 1.4s ease-in-out infinite; transform-box: fill-box; transform-origin: left center; }
#muster .banner.torn .flag { fill: #3a2a2a; }
@keyframes flutter { 50% { transform: scaleX(0.8) skewY(4deg); } }
#muster.gathering .worker { animation: gather 0.6s ease-out; }
@keyframes gather { from { opacity: 0; } }
#muster.marching.out { animation: marchOut 6s ease-in forwards; }
@keyframes marchOut { 0%, 25% { transform: translate(0, 0); opacity: 1; } 100% { transform: translate(calc(-1 * var(--march, 520px)), -40px); opacity: 0; } }
#muster.marching.home { animation: marchHome 7s ease-out forwards; }
@keyframes marchHome { 0% { transform: translate(calc(-1 * var(--march, 520px)), -40px); opacity: 0; } 15% { opacity: 1; } 70% { transform: translate(0, 0); opacity: 1; } 100% { transform: translate(0, 0); opacity: 0; } }
#muster.marching .worker .w { animation: toil 0.5s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { #muster.marching { animation: none; opacity: 0; } }

/* The map grows west with bought land and scrolls sideways when it no longer fits */
.scene-scroll { position: absolute; inset: 0; overflow: hidden; }
.scene-scroll svg { display: block; height: 100%; max-width: none; }
.scene-scroll.scrolls { cursor: default; }
#lots .lot-star { fill: #c9c6d8; opacity: 0.6; }
#lots .lot-fence { stroke: #4a4033; stroke-width: 1.2; fill: none; }
#lots .lot-stake path { stroke: #6b5a3c; stroke-width: 0.8; fill: #2a241b; }
#lots .lot-stake text { font-size: 4.5px; fill: #b8a98a; text-anchor: middle; font-family: Georgia, serif; }
#lots .for-sale path { stroke: #8a7350; stroke-width: 1; fill: #3a2f1f; }
#lots .for-sale text { font-size: 6.5px; fill: #f2c46a; text-anchor: middle; font-family: Georgia, serif; letter-spacing: 0.06em; }
#lots .for-sale { cursor: pointer; }
#lots .for-sale .hit { fill: transparent; }

/* Land in the fog, the muster ground, the forge, drag-to-pan */
#lots .lot-fog rect { fill: #0b0c12; opacity: 0.88; }
#lots .lot-fog .edge { fill: url(#g-fogedge); opacity: 1; }
#lots .lot-fog .bank { fill: #b9bfd0; opacity: 0.045; animation: drift 26s ease-in-out infinite alternate; }
#lots .lot-fog .bank.b1 { animation-duration: 33s; opacity: 0.035; } #lots .lot-fog .bank.b2 { animation-duration: 21s; }
#lots .muster-ground ellipse { fill: #2b251b; stroke: #3d3426; stroke-dasharray: 3 3; }
#lots .muster-ground text { font-size: 7px; fill: #8b8170; text-anchor: middle; font-family: Georgia, serif; letter-spacing: 0.08em; text-transform: uppercase; }
#st-forge .anvil { fill: #cfc6b0; stroke: #6b6355; stroke-width: 0.6; }
#st-forge .fire { fill: #7fd6c0; opacity: 0.85; animation: forgefire 1.6s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: bottom center; }
#st-forge .legs { stroke: #3a3328; stroke-width: 2; }
@keyframes forgefire { to { transform: scaleY(0.82); opacity: 0.6; } }
.scene-scroll.dragging { cursor: grabbing; }
.scene-scroll.dragging svg { pointer-events: none; }
.scene-scroll svg { user-select: none; -webkit-user-select: none; }
.chronicle li.idea::before { content: "\2753  "; color: var(--candle); }
.chronicle li.idea { font-style: italic; }

/* Suggested next */
.advice { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin: 0.4rem auto 0; max-width: 1500px; padding: 0.35rem 0.8rem; border: 1px solid #5a4a2a; border-radius: 6px; background: #17140e; font-size: 0.88rem; }
.advice-label { color: var(--candle); font-variant: small-caps; letter-spacing: 0.05em; }
.advice #advice-why { flex: 1 1 18rem; }
.advice button { font-size: 0.8rem; padding: 0.15rem 0.55rem; }
.advice .link { background: none; border: 0; color: var(--muted, #8a8698); cursor: pointer; }
.flash-target { animation: flashtarget 0.7s ease-in-out 3; }
@keyframes flashtarget { 50% { box-shadow: 0 0 0 2px var(--candle), 0 0 22px #f2b54a77; } }

/* Demons, the circle, nave windows, towers */
.worker.demon circle, .worker.demon path { stroke: #e0583c; }
.worker.demon circle { fill: #3a0f0a; }
.worker.demon .horns { stroke: #f2b54a; stroke-width: 1; fill: none; }
#scene .circle-glow { fill: none; stroke: transparent; stroke-width: 1.5; }
#scene.circle-lit #sec-towerS.built .circle-glow { stroke: #e0583c; animation: circleglow 2.4s ease-in-out infinite; }
@keyframes circleglow { 50% { stroke: #f2b54a; opacity: 0.6; } }
#scene[data-windows="1"] #sec-nave.built .nave-win { fill: #3b4a63; }
#scene[data-windows="2"] #sec-nave.built .nave-win { fill: url(#g-glass); opacity: 0.8; }
#scene[data-windows="3"] #sec-nave.built .nave-win { fill: url(#g-glass); stroke: #c9c3b0; stroke-width: 1.2; }
.group h3.sub { font-size: 0.9rem; margin: 0.9rem 0 0.4rem; color: var(--candle); font-variant: small-caps; letter-spacing: 0.04em; }

/* The belfry, the far fen, fortified outposts */
.fen-svg .outpost.far .core { fill: #331a1a; stroke: #b0594a; }
.fen-svg .outpost.perm .ring { stroke: var(--candle); stroke-width: 2.4; stroke-dasharray: none; }
.belfry-card { margin-bottom: 0.8rem; }

/* The road in from the fen, and outpost convoys */
#lots .road { fill: none; stroke: #2e271c; stroke-width: 9; stroke-linecap: round; opacity: 0.85; }
#convoys { pointer-events: none; }
#convoys .tray { fill: #5a4632; stroke: #7a6248; stroke-width: 0.6; }
#convoys .wheel { fill: #2a241b; stroke: #8a7350; stroke-width: 0.8; }
#convoys .handles { stroke: #7a6248; stroke-width: 0.9; fill: none; }
#convoys .shroud { fill: #b9ad94; stroke: #6d6350; stroke-width: 0.4; }
#convoys .block { fill: #8d8a9a; stroke: #5b5867; stroke-width: 0.4; }
#convoys .meat { fill: #8a3a34; stroke: #5a2420; stroke-width: 0.4; }
#convoys .sack { fill: #7a6a4a; stroke: #4a3f2a; stroke-width: 0.5; }
#convoys .worker .w { animation: convoywalk 0.6s ease-in-out infinite; }
#convoys .unloading .worker .w { animation: none; }
@keyframes convoywalk { 50% { transform: translateY(-1.2px); } }
@media (prefers-reduced-motion: reduce) { #convoys { display: none; } }

/* The crypt is underground: draw it as a see-through cutaway */
#sec-crypt.built .stone { opacity: 0.55; }
#sec-crypt.built .dark { opacity: 0.7; }
#sec-crypt .earth { fill: #1c1915; opacity: 0; pointer-events: none; }
#sec-crypt.built .earth { opacity: 0.35; }
#sec-crypt .cut { fill: none; stroke: transparent; }
#sec-crypt.built .cut { stroke: #6d5a40; stroke-width: 1.4; stroke-dasharray: 5 4; }

/* The path to the abbey, its lanterns */
#lots .abbey-path { fill: #2e271c; opacity: 0.75; }
#lots .lantern .post { stroke: #3a3328; stroke-width: 1.2; }
#lots .lantern .lamp { fill: #f2b54a; }
#lots .lantern .glow { fill: url(#g-flame); opacity: 0.55; animation: lanternglow 3.2s ease-in-out infinite alternate; }
#lots .lantern:nth-child(odd) .glow { animation-duration: 2.6s; }
@keyframes lanternglow { to { opacity: 0.3; } }
/* Omens */
#omens { pointer-events: none; }
#omens .flash { fill: #dfe6ff; opacity: 0; }
#omens .bolt { fill: none; stroke: #e8eeff; stroke-width: 1.6; opacity: 0; }
#omens .crows { opacity: 0; transition: opacity 3s; }
#omens .crow path { fill: none; stroke: #050508; stroke-width: 1.3; stroke-linecap: round; }
#omens .crow { transform-box: view-box; transform-origin: 450px 80px; animation: circling 22s linear infinite; }
#omens .crow path { transform-box: fill-box; transform-origin: center; animation: flap 0.5s ease-in-out infinite alternate; }
#omens .crow.c1 { animation-delay: 0s; } #omens .crow.c2 { animation-delay: -4s; animation-duration: 26s; }
#omens .crow.c3 { animation-delay: -9s; } #omens .crow.c4 { animation-delay: -13s; animation-duration: 30s; } #omens .crow.c5 { animation-delay: -17s; animation-duration: 19s; }
@keyframes circling { from { transform: rotate(0deg) translateX(var(--r, 80px)) rotate(0deg) scaleY(0.45); } to { transform: rotate(360deg) translateX(var(--r, 80px)) rotate(-360deg) scaleY(0.45); } }
@keyframes flap { to { transform: scaleY(-0.6); } }
#omens .c2 { --r: 110px; } #omens .c3 { --r: 60px; } #omens .c4 { --r: 140px; } #omens .c5 { --r: 95px; }
#scene[data-dread="1"] #omens .crows, #scene[data-dread="2"] #omens .crows, #scene[data-dread="3"] #omens .crows, #scene[data-dread="4"] #omens .crows { opacity: 1; }
#scene[data-dread="1"] #omens .c4, #scene[data-dread="1"] #omens .c5 { display: none; }
#moon-blood { opacity: 0; transition: opacity 8s; }
#scene[data-dread="3"] #moon-blood, #scene[data-dread="4"] #moon-blood { opacity: 0.72; }
#scene[data-dread="3"] #moon-halo, #scene[data-dread="4"] #moon-halo { fill: #9b2a1c; opacity: 0.1; }
#scene[data-dread="4"] #omens .flash { animation: flash 23s linear infinite; }
#scene[data-dread="4"] #omens .bolt { animation: bolt 23s linear infinite; }
@keyframes flash { 0%, 91% { opacity: 0; } 91.5% { opacity: 0.18; } 92% { opacity: 0.02; } 92.6% { opacity: 0.12; } 94%, 100% { opacity: 0; } }
@keyframes bolt { 0%, 91% { opacity: 0; } 91.5% { opacity: 0.9; } 92% { opacity: 0.1; } 92.6% { opacity: 0.7; } 93.5%, 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { #omens .crow, #omens .crow path, #omens .flash, #omens .bolt { animation: none !important; } }

/* Random events */
.event-card { margin: 0.4rem auto 0; max-width: 1500px; padding: 0.5rem 0.8rem; border: 1px solid #6b2a2a; border-radius: 6px; background: #1a0f10; font-size: 0.9rem; line-height: 1.4; }
.event-card b { color: #f0c0b8; font-variant: small-caps; letter-spacing: 0.04em; }
.event-choices { display: inline-flex; gap: 0.4rem; margin-left: 0.5rem; flex-wrap: wrap; }
.event-choices button { font-size: 0.82rem; padding: 0.15rem 0.6rem; }
.event-card.done { border-color: #5a4a2a; background: #17140e; }

/* Statistics */
table.stats { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.stats td { padding: 0.15rem 0.4rem; border-bottom: 1px solid #23202c; }
table.stats td.num { text-align: right; color: var(--bone); }
table.stats th { text-align: left; padding: 0.6rem 0.4rem 0.2rem; color: var(--candle); font-variant: small-caps; font-weight: normal; }

/* Construction in stages */
.section.ghost-copy { pointer-events: none; }
#scene .scaffold path { fill: none; stroke: #8a7350; stroke-width: 2; opacity: 0.85; }
#scene .section.building { opacity: 1; }

/* Prestige: boss, oddities, skins, goblin */
.fen-svg .outpost.boss .core { fill: #3a2a10; stroke: #f2b54a; }
.fen-svg .outpost .crown { fill: #f2b54a; stroke: #7a5a20; stroke-width: 0.8; }
.fen-svg .outpost.boss.held .core { fill: #222; stroke: #666; }
#moon2 { display: none; }
#scene[data-odd="twomoons"] #moon2 { display: inline; }
#scene[data-odd="purple"] #sky { filter: hue-rotate(55deg) saturate(2.4) brightness(1.15); }
#scene[data-odd="greenmoon"] #moon { filter: hue-rotate(70deg) saturate(4); }
#scene[data-odd="redriver"] #river { fill: #3a1716; }
#scene[data-odd="fog"] .fog { opacity: 0.22 !important; }
.hat { display: none; stroke-width: 0.9; }
#scene[data-skin="pumpkin"] .skeleton .hat-pumpkin { display: inline; fill: #e07a24; stroke: #6a3a10; }
#scene[data-skin="tophat"] .skeleton .hat-tophat { display: inline; fill: #111; stroke: #111; }
#scene[data-skin="party"] .skeleton .hat-party { display: inline; fill: #d04aa0; stroke: #f2d94a; }
#scene[data-skin="crown"] .skeleton .hat-crown { display: inline; fill: #f2c94a; stroke: #8a6a20; }
#scene[data-skin="hivis"] .skeleton .hat-hivis { display: inline; fill: #d8f03a; stroke: #9ab020; opacity: 0.9; }
.goblin-card { margin-bottom: 0.8rem; border-color: #4a6a3a; }
.goblin-row { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; font-size: 0.9rem; }

/* Lair raids, the mob, chapters, the goblin's queue */
.lair-warn { border-color: #8a2a1a !important; background: #241010 !important; }
#convoys .living circle, #convoys .living path { stroke: #d9c7a8; }
#convoys .living circle { fill: #3a2a20; }
#convoys .torch { stroke: #6a4a2a !important; stroke-width: 1.2; }
#convoys .flame { fill: #f2a93b !important; stroke: none !important; animation: torchflick 0.3s ease-in-out infinite alternate; }
@keyframes torchflick { to { opacity: 0.6; } }
#hellglow { opacity: 0; pointer-events: none; }
#scene[data-chapter="2"] #hellglow { opacity: 0.18; }
#scene:not([data-chapter="1"]):not([data-chapter="2"]) #hellglow { opacity: 0.32; }
#deadtrees { display: none; fill: none; stroke: #0a090c; stroke-width: 2; stroke-linecap: round; }
#scene:not([data-chapter="1"]):not([data-chapter="2"]) #deadtrees { display: inline; }
.goblin-queue { margin: 0.3rem 0 0.2rem 1.2rem; padding: 0; font-size: 0.88rem; }
.goblin-queue li { margin: 0.1rem 0; }
#goblin-add { max-width: 14rem; }

.hourglass { margin: 0.3rem 0 0 0.5rem; font-size: 0.82rem; padding: 0.15rem 0.6rem; border-color: #5a4a2a; }
.hourglass.on { background: #3a2f18; color: var(--candle); }
.chronicle li.feat::before { content: "\2605  "; color: var(--candle); }
.chronicle li.feat { color: #f3e2b8; }
ul.collection { list-style: none; padding: 0; margin: 0 0 0.8rem; font-size: 0.86rem; max-height: 14rem; overflow-y: auto; }
ul.collection li { padding: 0.12rem 0; }
ul.collection li.no { opacity: 0.55; }
ul.collection li.got b { color: var(--candle); }
.omen { margin: 0.25rem 0 0; font-size: 0.8rem; color: #b8b2c4; }
.omen b { color: #c9a0d8; font-weight: normal; font-variant: small-caps; }
.omen .watched { color: #8fd6b4; }
.goblin-row.gob { padding: 0.2rem 0; border-bottom: 1px solid #23202c; }
.quirk { font-size: 0.75rem; padding: 0.05rem 0.4rem; border-radius: 3px; }
.quirk.good { background: #1f3a2a; color: #8fd6b4; }
.quirk.bad { background: #3a1f1f; color: #f0a0a0; }

/* You */
#player { pointer-events: none; transition: transform 0.8s linear; }
/* Accessories and a carried corpse move with the body (same animations, started together). */
#player .p-body, #player .p-acc, #player .p-load { animation: playerbob 3s ease-in-out infinite; }
#player.walking .p-body, #player.walking .p-acc, #player.walking .p-load { animation: playerwalk 0.45s ease-in-out infinite; }
#player.walking.skating .p-body, #player.walking.skating .p-acc, #player.walking.skating .p-load { animation: playerglide 0.6s ease-in-out infinite; }
@keyframes playerglide { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }
@keyframes playerbob { 50% { transform: translateY(-0.4px); } }
@keyframes playerwalk { 50% { transform: translateY(-1.2px); } }
#player .p-legs, #player .p-arms path, #player .p-staff { stroke: #d8cdb8; stroke-width: 1.3; stroke-linecap: round; fill: none; }
#player .p-arms path { stroke: var(--top, #5a6070); } #player .p-hand { fill: var(--skin, #d8b898); }
#player .p-legs { stroke: var(--legs, #2a3a5a); }
#player[data-stage="2"] .p-arms path, #player[data-stage="3"] .p-arms path { stroke: var(--cloak, #1e1a26); }
#player[data-stage="4"] .p-arms path, #player[data-stage="5"] .p-arms path { stroke: var(--robe, #241830); }
#player .p-topx { display: none; } #player[data-stage="0"] .p-topx, #player[data-stage="1"] .p-topx { display: inline; }
#player .p-head { fill: var(--skin, #d8b898); }
#player .p-hair { fill: var(--hair, #3a2a20); display: none; }
#player[data-look="0"] .h0, #player[data-look="1"] .h1, #player[data-look="2"] .h2 { display: inline; }
#player .p-hoodie { fill: var(--top, #5a6070); }
#player .p-cloak { fill: var(--cloak, #1e1a26); stroke: #3a3448; stroke-width: 0.6; }
#player .p-robe { fill: var(--robe, #241830); stroke: var(--robe-trim, #8a5ac8); stroke-width: 0.5; }
#player .p-hood { fill: var(--cloak, #1a1622); }
#player .p-eyes { fill: #8fd6b4; }
#player .p-glow { fill: #8fd6b4; opacity: 0.35; animation: eyeglow 1.8s ease-in-out infinite alternate; }
@keyframes eyeglow { to { opacity: 0.12; } }
#player .p-wisps circle { fill: #b8f0d4; opacity: 0.8; animation: wisp 4s ease-in-out infinite; }
#player .p-wisps .w2 { animation-delay: -1.3s; animation-duration: 4.6s; } #player .p-wisps .w3 { animation-delay: -2.6s; animation-duration: 5.2s; }
@keyframes wisp { 0%, 100% { transform: translate(0, 0); opacity: 0.8; } 50% { transform: translate(1.2px, -3px); opacity: 0.25; } }
#player .p-phone { fill: #8fc8f0; }
#player .p-book { fill: #6b2a2a; stroke: #b8a080; stroke-width: 0.4; }
#player .p-staff { stroke: #6a5640; stroke-width: 1.4; }
#player .p-skull { fill: #e9e4d4; }
#player .p-aura { fill: #8fd6b4; opacity: 0.12; animation: aura 2.6s ease-in-out infinite alternate; }
@keyframes aura { to { opacity: 0.04; } }
#player .p-arms.up { display: none; }
#player .p-spark { fill: #8fd6b4; opacity: 0.9; }
#player.cast .p-arms.up { display: inline; } #player.cast .p-arms.down { display: none; }
#player.cast .p-spark { animation: spark 0.5s ease-out 2; }
@keyframes spark { from { r: 0.5; opacity: 1; } to { r: 5; opacity: 0; } }
#player.dig .p-body, #player.dig .p-acc { animation: dig 0.35s ease-in-out 2; }
@keyframes dig { 50% { transform: rotate(14deg) translateY(1px); } }
/* What shows at which stage */
#player .p-phone, #player .p-book, #player .p-hoodie, #player .p-cloak, #player .p-robe, #player .p-hood, #player .p-eyes, #player .p-glow, #player .p-wisps, #player .p-staff, #player .p-skull, #player .p-aura { display: none; }
#player[data-stage="0"] .p-phone, #player[data-stage="0"] .p-hoodie, #player[data-stage="1"] .p-hoodie, #player[data-stage="1"] .p-book, #player[data-stage="2"] .p-book { display: inline; }
#player[data-stage="2"] .p-cloak, #player[data-stage="3"] .p-cloak { display: inline; }
#player[data-stage="3"] .p-hood, #player[data-stage="4"] .p-hood, #player[data-stage="5"] .p-hood,
#player[data-stage="3"] .p-staff, #player[data-stage="4"] .p-staff, #player[data-stage="5"] .p-staff { display: inline; }
#player[data-stage="3"] .p-hair, #player[data-stage="4"] .p-hair, #player[data-stage="5"] .p-hair { display: none !important; }
#player[data-stage="4"] .p-robe, #player[data-stage="5"] .p-robe, #player[data-stage="4"] .p-eyes, #player[data-stage="5"] .p-eyes,
#player[data-stage="4"] .p-skull, #player[data-stage="5"] .p-skull { display: inline; }
/* The last stage: no crown (testers did not like it), but the glow of what you have become: eyes, aura, wisps */
#player[data-stage="5"] .p-glow, #player[data-stage="5"] .p-wisps, #player[data-stage="5"] .p-aura { display: inline; }
#player[data-stage="5"] .p-eyes { fill: #c8ffe4; }
#player[data-stage="5"] .p-aura { opacity: 0.2; }
@media (prefers-reduced-motion: reduce) { #player, #player .p-body, #player .p-acc, #player .p-load { transition: none; animation: none !important; } }

/* One drawing per stage of you (art/player-N); only the current one shows */
#player .p-stage { display: none; }
#player[data-stage="0"] .p-stage-0, #player[data-stage="1"] .p-stage-1, #player[data-stage="2"] .p-stage-2, #player[data-stage="3"] .p-stage-3, #player[data-stage="4"] .p-stage-4, #player[data-stage="5"] .p-stage-5 { display: inline; }

.glyph .icon { width: 1.05em; height: 1.05em; vertical-align: -0.15em; overflow: visible; }

/* Wardrobe */
.wardrobe { display: grid; grid-template-columns: 9rem 1fr; gap: 1rem; align-items: start; }
.wardrobe-preview { width: 9rem; height: 14rem; background: #1c1915; border-radius: 6px; }
.wardrobe p { margin: 0.4rem 0; }
.swatch { width: 1.4rem; height: 1.4rem; border-radius: 50%; padding: 0; border: 2px solid #333; margin-right: 0.2rem; vertical-align: middle; }
.swatch.on { border-color: var(--candle); }
.wardrobe .seg[disabled] { opacity: 0.45; }

/* Hood down: show the hair again */
#player.no-hood .p-hood { display: none !important; }
#player.no-hood[data-look="0"] .h0, #player.no-hood[data-look="1"] .h1, #player.no-hood[data-look="2"] .h2 { display: inline !important; }

.changelog { max-height: 60vh; overflow-y: auto; }
.changelog ul { margin: 0.2rem 0 0.8rem 1.1rem; padding: 0; font-size: 0.9rem; }
.changelog li { margin: 0.25rem 0; }

/* Unbind: well apart from the tree button, and clearly a reset */
#btn-respec.respec { display: block; margin-top: 1.6rem; border-color: #6b2a2a; }
#btn-respec.respec .label { color: #f0a0a0; }

/* Job rows: one bordered row each; what they are doing on the right; the description under it */
.jobs { gap: 0; }
.job { padding: 0.35rem 0; border-bottom: 1px solid #2a2733; row-gap: 0.15rem; }
.job:last-child { border-bottom: 0; }
.job .job-out { color: var(--bone); }
.job .job-desc { grid-column: 1 / -1; font-size: 0.74rem; color: #8a8698; line-height: 1.3; }

/* News ticker */
.ticker { display: flex; align-items: center; gap: 0.6rem; overflow: hidden; margin: 0.2rem 0 0; font-size: 0.8rem; color: #b8b2c4; white-space: nowrap; }
.ticker-label { color: var(--candle); font-variant: small-caps; letter-spacing: 0.05em; flex: none; }
.ticker-track { overflow: hidden; flex: 1; position: relative; height: 1.2em; }
#ticker-text { position: absolute; left: 100%; animation: tick 24s linear infinite; }
@keyframes tick { to { transform: translateX(calc(-100% - 100vw)); } }
@media (prefers-reduced-motion: reduce) { #ticker-text { animation: none; left: 0; } }
body.no-ticker .ticker { display: none; }
/* Settings */
.settings-list { display: grid; grid-template-columns: auto auto; gap: 0.5rem 1rem; align-items: center; }
.settings-list button { justify-self: start; }

.res-tip .tip-now { margin: 0.3rem 0 0.1rem; padding-left: 0; list-style: none; }
.res-tip ul.tip-now li { font-size: 0.82rem; }
.res-tip .plus { color: #8fd6b4; } .res-tip .minus { color: #f0a0a0; }

/* Secrets: some things can be clicked */
#omens .crow { pointer-events: auto; cursor: pointer; }
#player .p-body { pointer-events: auto; cursor: pointer; }
[data-art="moon"] { cursor: pointer; }

/* Habits: on/off switch */
.auto-toggle { font-size: 0.85em; }
.auto-toggle.off { opacity: 0.6; }

/* Chapter goals */
.goals { margin-top: 0.4em; font-size: 0.9em; }
.goal.met { color: var(--good, #8fd6b4); }
.goal.failed { opacity: 0.5; text-decoration: line-through; }

/* Choosing the next lot */
.loc-pick { border: 1px solid var(--line); border-radius: 6px; padding: 0.4rem 0.7rem; margin: 0.5rem 0; }
.loc-opt { display: block; padding: 0.35rem 0; border-bottom: 1px solid #ffffff10; font-size: 0.9rem; }
.loc-opt:last-child { border-bottom: 0; }
.loc-opt.locked { opacity: 0.55; font-style: italic; }

/* The lifetime tree (Guide: The margins): a big map of soul-lights you pan and zoom */
#book.wide .book-card { width: min(84rem, 100%); }
.life-wrap { position: relative; }
.life-svg { display: block; width: 100%; height: min(68vh, 44rem); touch-action: none; cursor: grab; user-select: none;
  background: radial-gradient(circle at 50% 50%, #1b2a20 0%, #0c0e10 65%, #08090b 100%); border: 1px solid #4a3d22; border-radius: 8px; }
.life-svg:active { cursor: grabbing; }
.life-svg .vein { stroke: #3a3529; stroke-width: 3; stroke-linecap: round; }
.life-svg .vein.reach { stroke: #7a6a40; stroke-dasharray: 2 5; }
.life-svg .vein.path { stroke: #e8c46a; stroke-dasharray: 6 4; }
.life-svg .vein.lit { stroke: #7fd6a4; stroke-width: 3.5; filter: drop-shadow(0 0 4px #4fd08a); }
.life-svg .soul { cursor: pointer; }
.life-svg .soul .halo { fill: #7fd6a4; opacity: 0; }
.life-svg .soul .orb { fill: #16181c; stroke: #4a4436; stroke-width: 2; }
.life-svg .soul.notable .orb { stroke-width: 3; }
.life-svg .soul.keystone .orb { stroke-width: 4; fill: #1d1418; }
.life-svg .soul .glyph { fill: #5a5446; }
.life-svg .br-grave .orb { stroke: #6e5a3a; }
.life-svg .br-host .orb { stroke: #56685a; }
.life-svg .br-book .orb { stroke: #5e4f72; }
.life-svg .br-bridge .orb { stroke: #6a4040; }
.life-svg .soul.far { opacity: 0.55; }
.life-svg .soul.open .orb { stroke: #b8a676; }
.life-svg .soul.ready .orb { stroke: #f0cc70; }
.life-svg .soul.ready .halo { fill: #f0cc70; animation: soulpulse 2.2s ease-in-out infinite; }
.life-svg .soul.onpath .orb { stroke: #f0cc70; stroke-dasharray: 3 2; }
.life-svg .soul.owned .orb { fill: #173826; stroke: #7fd6a4; }
.life-svg .soul.owned .glyph { fill: #c8f5d8; }
.life-svg .soul.owned .halo { opacity: 0.2; }
.life-svg .soul.keystone.owned .orb { fill: #3a1830; stroke: #e88ac8; }
.life-svg .soul.keystone.owned .glyph { fill: #ffd0ee; }
.life-svg .soul.sel .orb { stroke: #fff; stroke-width: 3.5; }
.life-svg .soul:hover .orb { filter: brightness(1.4); }
.life-svg .lname { fill: #d8b0c8; font-size: 12px; text-anchor: middle; font-variant: small-caps; pointer-events: none; }
.life-svg .branch-name { fill: #a8946a; font-size: 22px; text-anchor: middle; font-variant: small-caps; letter-spacing: 0.1em; opacity: 0.8; pointer-events: none; }
.life-svg .core-halo { fill: #7fd6a4; opacity: 0.14; }
.life-svg .core-book { fill: #3a2e1e; stroke: #c9a24a; stroke-width: 1.6; }
.life-svg .core-spine { stroke: #c9a24a; stroke-width: 1.6; }
@keyframes soulpulse { 0%, 100% { opacity: 0.08; } 50% { opacity: 0.4; } }
@media (prefers-reduced-motion: reduce) { .life-svg .soul.ready .halo { animation: none; opacity: 0.25; } }
.life-zoom { position: absolute; top: 0.5rem; right: 0.5rem; display: flex; flex-direction: column; gap: 0.25rem; }
.life-zoom button { width: 2rem; height: 2rem; padding: 0; font-size: 1.1rem; }
.life-detail { position: absolute; left: 0.6rem; bottom: 0.6rem; max-width: min(24rem, 70%); background: #14110bee; border: 1px solid #5a4a2a; border-radius: 6px; padding: 0.55rem 0.8rem; color: #e9dfc6; }
.life-detail h4 { margin: 0 0 0.25rem; color: #f0e4c6; }
.life-detail p { margin: 0 0 0.45rem; font-size: 0.9rem; }

/* The crypt cutaway can be switched off in Settings */
body.no-crypt #sec-crypt { display: none; }

/* Form controls in the game's own colours (no white browser defaults) */
select, input[type="text"], input:not([type]), textarea {
  font: inherit; font-size: 0.88rem; color: var(--text); background: var(--panel-2, #1a1b26);
  border: 1px solid var(--line); border-radius: 4px; padding: 0.15rem 1.6rem 0.15rem 0.45rem;
}
select { appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--candle) 50%), linear-gradient(135deg, var(--candle) 50%, transparent 50%);
  background-position: calc(100% - 0.75rem) 55%, calc(100% - 0.45rem) 55%; background-size: 0.3rem 0.3rem; background-repeat: no-repeat; }
select:hover, select:focus { border-color: var(--candle); outline: none; }
select option { background: #15161f; color: var(--text); }
input:not([type]), input[type="text"], textarea { padding-right: 0.45rem; }
input[type="radio"], input[type="checkbox"] { accent-color: var(--candle); }
/* The 2.5D crypt: shade the vault by face so it reads as a room, not a flat front */
#sec-crypt .vault-side { filter: brightness(0.62); }
#sec-crypt .vault-roof { filter: brightness(0.5); }
#sec-crypt .vault-floor { filter: brightness(0.78); }
#sec-crypt .vault-back { filter: brightness(0.9); }

/* Grouped sidebar (replaces the row of tabs): THE LOT / THE DEAD / WAR / THE BOOK */
.main-panel { display: grid; grid-template-columns: 11.5rem minmax(0, 1fr); gap: 1rem; align-items: start; }
.main-panel > .tabs { position: sticky; top: 7.5rem; flex-direction: column; flex-wrap: nowrap; gap: 0.9rem; border-bottom: 0; border-right: 1px solid var(--line); padding: 0.2rem 0.8rem 0.2rem 0; margin: 0; }
.nav-group { display: flex; flex-direction: column; gap: 0.2rem; }
.nav-head { font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: #8a7a56; padding: 0 0.3rem 0.15rem; border-bottom: 1px solid #2a2618; margin-bottom: 0.15rem; }
.main-panel > .tabs button { display: flex; justify-content: space-between; align-items: center; text-align: left; width: 100%; padding: 0.38rem 0.6rem; border-color: transparent; background: transparent; }
.main-panel > .tabs button:hover { background: #1a1812; border-color: #3a3424; }
.main-panel > .tabs button.on { background: #221d12; border-color: var(--candle); color: var(--candle); }
.main-panel > .tabs kbd { font-size: 0.65rem; opacity: 0.45; }
.main-panel > .tabs button.new::after { top: 50%; right: 1.6rem; transform: translateY(-50%); }
.tab-body { min-width: 0; }
@media (max-width: 760px) {
  .main-panel { grid-template-columns: 1fr; }
  .main-panel > .tabs { position: static; flex-direction: row; overflow-x: auto; gap: 0.6rem; border-right: 0; border-bottom: 1px solid var(--line); padding: 0 0 0.5rem; }
  .nav-group { flex-direction: row; align-items: center; flex: none; }
  .nav-head { border: 0; margin: 0; writing-mode: vertical-rl; transform: rotate(180deg); font-size: 0.6rem; }
  .main-panel > .tabs button { width: auto; white-space: nowrap; }
  .main-panel > .tabs kbd { display: none; }
}

/* Compact cards: static descriptions live in a tooltip on the name (tap to keep one open) */
.card > .desc:not(.live), .job .job-desc { display: none; }
.card.desc-open > .desc:not(.live), .job.desc-open .job-desc { display: block; }
.card:has(> .desc:not(.live)) .card-head .name, .job-name { cursor: help; text-decoration: underline dotted #6a6050; text-underline-offset: 3px; }
.card-tip { position: fixed; z-index: 60; max-width: 22rem; padding: 0.45rem 0.65rem; background: #17140e; color: #e9dfc6; border: 1px solid #5a4a2a; border-radius: 6px; font-size: 0.85rem; line-height: 1.4; box-shadow: 0 6px 20px #000a; pointer-events: none; }
.card { padding: 0.45rem 0.6rem; margin-top: 0.4rem; }
.card .card-head { margin-bottom: 0.2rem; }
.list.grid { gap: 0.45rem; }
#workers.list.grid, #workers-flesh.list.grid { grid-template-columns: repeat(auto-fit, minmax(24rem, 1fr)); }
/* The standing army */
.army-rows { display: flex; flex-direction: column; gap: 0.35rem; }
.army-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.8rem; padding: 0.25rem 0; border-bottom: 1px solid #23202c; font-size: 0.9rem; }
.army-keep { display: inline-flex; align-items: center; gap: 0.25rem; }
.corpse-keep { display: flex; align-items: center; gap: 0.25rem; margin: 0.3rem 0; font-size: 0.85rem; }
.army-fallen { color: #d88a7a; display: inline-flex; align-items: center; gap: 0.35rem; }
#army-card { grid-column: 1 / -1; }
/* New Chronicle entries glow so the story and hints get noticed */
.chronicle li.new-entry { animation: chronnew 4s ease-out; }
@keyframes chronnew { 0% { background: #f2b54a33; box-shadow: inset 3px 0 0 var(--candle); } 100% { background: transparent; box-shadow: inset 3px 0 0 transparent; } }
#h-chronicle.ping { animation: chronping 1.6s ease-out; }
@keyframes chronping { 0%, 40% { color: var(--candle); text-shadow: 0 0 10px #f2b54a; } 100% { text-shadow: none; } }
@media (prefers-reduced-motion: reduce) { .chronicle li.new-entry, #h-chronicle.ping { animation: none; } }
/* The eight-hour skip, in the top bar next to the Guide */
.skip-btn { border-color: #8a6a2a; color: var(--candle); background: #1f1a10; box-shadow: 0 0 10px #f2b54a33; white-space: nowrap; }
.skip-btn:hover { background: #2a2214; box-shadow: 0 0 14px #f2b54a66; }
.job-n.short { color: #d88a7a; }
.work-cap { font-size: 0.85rem; color: #a8b8a0; }
.work-cap.full { color: #e0b070; }
/* Map zoom */
.map-zoom { position: absolute; top: 0.5rem; left: 7.6rem; z-index: 5; display: flex; align-items: center; gap: 0.2rem; background: #0b0c12cc; border: 1px solid var(--line); border-radius: 4px; padding: 0.1rem 0.25rem; font-size: 0.8rem; }
.map-zoom button { padding: 0 0.45rem; font-size: 0.95rem; line-height: 1.3; }
.map-zoom span { min-width: 2.2rem; text-align: center; color: var(--muted); }
.scene-scroll.zoomed { overflow: hidden; }
.life-svg .lname.notable { fill: #c8bfa0; font-size: 10px; }
.life-svg .lstat { fill: #8a8470; font-size: 8px; text-anchor: middle; pointer-events: none; opacity: 0; }
.life-svg.near .lstat { opacity: 1; }
.life-svg .soul.owned .lstat, .life-svg .soul.owned .lname { fill: #a8e0bc; }
/* The wedding scene */
#wedding .wed-carpet { fill: #8a2232; opacity: 0.85; }
#wedding .wed-mover { transition: transform 3.2s ease-in-out; }
#wedding .worker.living .w { stroke: #d8c8b0; }
#wedding .worker.job-wed .w { animation: none; }
#wedding .wed-dance .worker .w, #wedding .wed-dance .wg { animation: weddance 0.55s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center bottom; }
@keyframes weddance { from { transform: translateY(0) rotate(-6deg); } to { transform: translateY(-1.5px) rotate(6deg); } }
#wedding .wed-confetti circle { animation: confetti 3s linear infinite; }
@keyframes confetti { from { transform: translateY(-14px); opacity: 1; } to { transform: translateY(14px); opacity: 0; } }
.wedding-bar { border-color: #8a5a6a; background: #1d1418; }
@media (prefers-reduced-motion: reduce) { #wedding .wed-dance .worker .w, #wedding .wed-confetti circle { animation: none; } #wedding .wed-mover { transition: none; } }
/* Minions wandering the lot */
#minions .minion-walker { cursor: help; }
#minions .minion-walker.walking .mw { animation: playerwalk 0.5s ease-in-out infinite; transform-box: fill-box; transform-origin: center bottom; }
.lunch-bar { border-color: #6a8a4a; background: #141a10; }
@media (prefers-reduced-motion: reduce) { #minions .minion-walker { transition: none !important; } #minions .minion-walker.walking .mw { animation: none; } }
.quirk.mixed { color: #d8b878; border-color: #6a5a3a; }
/* The hourglass lines up with the resource bar, not the window edge */
.resbar .hourglass { margin: 0.1rem 0 0.4rem max(1.2rem, calc((100% - 1500px) / 2 + 1.2rem)); }
@media (max-width: 680px) { .resbar .hourglass { margin-left: 0.6rem; } }
/* Discord link in the menu, styled like the menu buttons */
.menu-pop .menu-link { display: flex; align-items: center; gap: 0.35rem; font-size: 12.75px; white-space: nowrap; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px; padding: 3px 9px; text-decoration: none; }
.menu-pop .discord-link { color: #b8bcf4; border-color: #4a4f8a; }
.menu-pop .discord-link:hover { background: #2a2d50; }
/* Ready graves: a quieter glow, so a big cemetery does not turn into a green blur */
#graves .soul { opacity: 0.6; filter: drop-shadow(0 0 1.5px #8fd6b4); }
#graves .st-ready .mound { fill: #36483e; }

/* Rite of the Unresting: −1 / level / +1 / drain */
.unrest-card .steps { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.unrest-card .steps .step { min-width: 40px; padding: 3px 8px; border: 1px solid var(--line, #444); background: transparent; color: inherit; cursor: pointer; font: inherit; }
.unrest-card .steps .step:disabled { opacity: .4; cursor: default; }
.unrest-card .steps .mid { flex: 1; display: flex; flex-direction: column; align-items: center; line-height: 1.25; }
.unrest-card .steps .drain { color: #c79be0; font-size: .9em; white-space: nowrap; }

/* Changelog spoilers: blurred until clicked */
.changelog .spoiler { background: #222; color: transparent; border-radius: 3px; cursor: pointer; padding: 0 2px; }
.changelog .spoiler.shown { background: transparent; color: inherit; cursor: auto; }

/* First visit: points new players at the controls under the map, until they have scrolled down once. */
.below-hint { position: fixed; right: 1rem; bottom: 1rem; z-index: 60; padding: 0.55rem 1.1rem; border: 1px solid var(--candle, #e8b04a); border-radius: 999px;
  background: #1a1408f0; color: #f3e2b8; font-size: 0.95rem; box-shadow: 0 6px 20px #000c; cursor: pointer; animation: below-bob 1.6s ease-in-out infinite; }
.below-hint[hidden] { display: none; }
@keyframes below-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .below-hint { animation: none; } }
body.early-lot .side-panel { display: none; }
body.early-lot .layout { grid-template-columns: minmax(0, 1fr) !important; }
.below-hint { max-width: min(26rem, calc(100vw - 2rem)); text-align: left; }
#player .p-load { display: none; } #player.carrying .p-load { display: inline; }
#player .p-load .shroud { fill: #d8d2c0; } #player .p-load .head { fill: #c9b99a; }
.grave.unlit { cursor: pointer; } .grave.unlit .hit { fill: transparent; }
/* The Guide on the map */
#map-book { cursor: pointer; }
#map-book .hit { fill: transparent; }
#map-book .lectern { stroke: #5a4a36; stroke-width: 1.4; fill: none; }
#map-book .tome { fill: #6a4a2a; stroke: #2a1e12; stroke-width: 0.5; }
#map-book .aura { fill: #7fe0b8; opacity: 0; }
#map-book .tag { display: none; }
#map-book .tag rect { fill: #0b1a14ee; stroke: #7fe0b8; stroke-width: 0.6; }
#map-book .tag text { fill: #c8f0dc; font-size: 7.2px; text-anchor: middle; font-family: inherit; }
#map-book.ready .tag { display: inline; animation: book-tag 1.6s ease-in-out infinite; }
#map-book.ready .aura { animation: book-aura 1.6s ease-in-out infinite; }
#map-book.ready .tome { fill: #8a6a3a; }
@keyframes book-aura { 0%, 100% { opacity: 0.12; } 50% { opacity: 0.45; } }
@keyframes book-tag { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-1.5px); } }
@media (prefers-reduced-motion: reduce) { #map-book.ready .tag, #map-book.ready .aura { animation: none; } #map-book.ready .aura { opacity: 0.3; } }
/* The bone pit */
.bone-pit { cursor: pointer; } .bone-pit .hit { fill: transparent; }
.bone-pit .rim { fill: #3a3226; stroke: #5a4a36; stroke-width: 0.6; }
.bone-pit .hole { fill: #120f0b; }
.bone-pit .bone { stroke: #e2dac6; stroke-width: 1; stroke-linecap: round; } .bone-pit .knob { fill: #e2dac6; }
body.no-margins .margins-only { display: none !important; }
.page-learn ul { margin: 0.3rem 0 0; padding-left: 1.1rem; } .page-learn li { margin: 0.2rem 0; line-height: 1.35; color: #c8f0dc; }
.page-learn b { font-variant: small-caps; letter-spacing: 0.04em; }
/* First-steps lessons, over the map */
.lesson { position: absolute; left: 50%; top: 0.8rem; transform: translateX(-50%); z-index: 5; max-width: min(34rem, calc(100% - 2rem)); padding: 0.6rem 0.9rem 0.5rem;
  background: #0b1a14f2; border: 1px solid #7fe0b8; border-radius: 6px; color: #c8f0dc; font-size: 0.92rem; box-shadow: 0 8px 24px #000c; animation: fadein 0.6s ease; }
.lesson[hidden] { display: none; }
.lesson b { font-variant: small-caps; letter-spacing: 0.04em; color: #e2fff0; }
.lesson ul { margin: 0.3rem 0 0.4rem; padding-left: 1.1rem; } .lesson li { margin: 0.15rem 0; line-height: 1.35; }
.lesson button { float: right; font-size: 0.8rem; padding: 0.1rem 0.7rem; }
.lesson p { margin: 0.3rem 0 0.35rem; line-height: 1.4; } .lesson small { opacity: 0.75; }
/* Pets */
.pet { cursor: pointer; } .pet .hit { fill: transparent; }
.pet.petted .pw { animation: pet-wiggle 0.6s ease; transform-origin: 0 0; }
@keyframes pet-wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }
.pet .pw { filter: drop-shadow(0 0 0.6px #d8d0c0) drop-shadow(0 0 1.4px #8a8090aa); }
.seg .dot { display: inline-block; width: 0.7em; height: 0.7em; border-radius: 50%; margin-right: 0.3em; vertical-align: -0.05em; border: 1px solid #ffffff33; }
/* Cloak styles: an explicit choice overrides what the story stage shows */
#player .p-cloakx .cl { fill: var(--cloak, #1e1a26); stroke: #3a3448; stroke-width: 0.6; }
#player .p-cloakx .cl.trim { stroke: #8a8070; stroke-width: 0.35; }
#player[data-cloak="none"] .p-cloak, #player[data-cloak="none"] .p-robe, #player[data-cloak="none"] .p-hood, #player[data-cloak="none"] .p-cloakx { display: none !important; }
#player[data-cloak="none"] .p-hoodie, #player[data-cloak="none"] .p-topx, #player[data-cloak="open"] .p-hoodie, #player[data-cloak="open"] .p-topx { display: inline !important; }
#player[data-cloak="open"] .p-cloak, #player[data-cloak="open"] .p-robe,
#player[data-cloak="tattered"] .p-cloak, #player[data-cloak="tattered"] .p-robe, #player[data-cloak="collar"] .p-cloak, #player[data-cloak="collar"] .p-robe,
#player[data-cloak="mantle"] .p-cloak, #player[data-cloak="mantle"] .p-robe, #player[data-cloak="bone"] .p-cloak, #player[data-cloak="bone"] .p-robe { display: none !important; }
#player[data-cloak="cloak"] .p-cloak { display: inline !important; } #player[data-cloak="cloak"] .p-robe { display: none !important; }
#player[data-cloak="robe"] .p-robe { display: inline !important; } #player[data-cloak="robe"] .p-cloak { display: none !important; }
#player[data-cloak="cloak"] .p-hoodie, #player[data-cloak="cloak"] .p-topx, #player[data-cloak="robe"] .p-hoodie, #player[data-cloak="robe"] .p-topx,
#player[data-cloak="tattered"] .p-hoodie, #player[data-cloak="tattered"] .p-topx, #player[data-cloak="collar"] .p-hoodie, #player[data-cloak="collar"] .p-topx,
#player[data-cloak="mantle"] .p-hoodie, #player[data-cloak="mantle"] .p-topx, #player[data-cloak="bone"] .p-hoodie, #player[data-cloak="bone"] .p-topx { display: none !important; }
#player[data-cloak="none"] .p-arms path, #player[data-cloak="open"] .p-arms path { stroke: var(--top, #5a6070) !important; }
#player[data-cloak="cloak"] .p-arms path, #player[data-cloak="tattered"] .p-arms path, #player[data-cloak="collar"] .p-arms path, #player[data-cloak="mantle"] .p-arms path, #player[data-cloak="bone"] .p-arms path { stroke: var(--cloak, #1e1a26) !important; }
#player[data-cloak="robe"] .p-arms path { stroke: var(--robe, #241830) !important; }
#player[data-cloak="none"] .p-hair { display: none; }
#player[data-cloak="none"][data-look="0"] .h0, #player[data-cloak="none"][data-look="1"] .h1, #player[data-cloak="none"][data-look="2"] .h2 { display: inline !important; }
/* Doctrines: the one you follow is lit; the others step back */
.card.doctrine.active { border-color: var(--candle, #e8b04a); box-shadow: 0 0 0 1px #e8b04a55, 0 0 14px #e8b04a22; background: #241c10; }
.card.doctrine.active .count { color: var(--candle, #e8b04a); font-weight: bold; }
.card.doctrine.other { opacity: 0.55; }
.card.doctrine .desc.live { display: block; color: #c8c0b0; }
/* Resource bar: two fixed lines. Materials first; essence, soul gems, candles and infernal gems (the odd ones) below.
   Numbers get fixed widths so nothing jumps from one line to the other as values change. */
.resbar .res-money { order: 1; } .resbar .res-corpses { order: 2; } .resbar .res-bones { order: 3; } .resbar .res-soil { order: 4; }
.resbar .res-meat { order: 5; } .resbar .res-stone { order: 6; }
.resbar .res-break { order: 7; flex-basis: 100%; height: 0; padding: 0; margin: 0; border: 0; list-style: none; }
.resbar .res-essence { order: 8; } .resbar .res-gems { order: 9; } .resbar .res-candles { order: 10; } .resbar .res-infernal { order: 11; }
.resbar .res .rval { min-width: 5.6em; text-align: left; }
.resbar .res .rrate { min-width: 3.6em; }
.resbar .res-gems .rval, .resbar .res-candles .rval, .resbar .res-infernal .rval { min-width: 2.4em; }
/* Fixed grid: every resource keeps its place, whatever the numbers do. */
.resbar .resources { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.resbar .res { min-width: 0; overflow: hidden; white-space: nowrap; }
.resbar .res .rname { overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; min-width: 0; }
.resbar .res .rval, .resbar .res .rrate { min-width: 0; flex: 0 0 auto; }
.resbar .res .rrate { margin-left: auto; }
.resbar .res-break { display: none; }
.resbar .res-essence { grid-column: 1; }
@media (max-width: 900px) { .resbar .resources { grid-template-columns: repeat(3, minmax(0, 1fr)); } .resbar .res-essence { grid-column: auto; } }
/* Worker cards: the count sits by the name */
.card.worker-card > .card-head { justify-content: flex-start; } .card.worker-card > .card-head .pin { margin-left: auto; }
.work-cap[title]:not([title=""]) { cursor: help; }
/* Workstations: cards in a row are the same height, a little more room, a readable upgrade label */
#workstations.list.grid { align-items: stretch; gap: 0.75rem; }
#workstations > .card { display: flex; flex-direction: column; padding-bottom: 0.7rem; }
#workstations > .card > .actions { margin-top: auto; }
#workstations .buy .label { font-size: 1rem; letter-spacing: 0.02em; }
#workstations .buy .cost { font-size: 0.85rem; }
.card.worker-card > .card-head .working { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.92rem; }
.card.worker-card > .card-head .working.full { color: var(--candle, #e8b04a); }
.card.worker-card > .card-head .working + .pin, .card.worker-card > .card-head .pin { margin-left: 0.6rem; }
.card.worker-card .info .waiting { color: #b8a77f; } .card.worker-card .info .idle { color: var(--candle, #e8b04a); }
/* Wild land being cleared */
.wild { cursor: pointer; } .wild .hit { fill: transparent; }
.wild text { font: 9px var(--serif, serif); fill: #c8c0a8; text-anchor: middle; font-variant: small-caps; }
.wild .trees { stroke: #6a5a48; stroke-width: 3; fill: none; stroke-linecap: round; } .wild .stumps { stroke: #8a7458; stroke-width: 4; }
.wild .hill { fill: #5a4a36; stroke: #7a6648; stroke-width: 1; } .wild .cut { fill: none; stroke: #2a2018; stroke-width: 2; }
.wild .chapel { fill: #6a6a72; stroke: #3a3a40; stroke-width: 1; } .wild .water, .wild .bog { fill: #2a3e44; opacity: 0.9; }
.wild .reeds { stroke: #4a5a3a; stroke-width: 1.4; }
.card.worker-card > .card-head .working[title]:not([title='']) { cursor: help; }
/* After the apocalypse: a red, wrong sky */
body.apocalypse #sky { filter: sepia(1) hue-rotate(-35deg) saturate(3.5) brightness(0.75); }
body.apocalypse .res-money { display: none !important; }
.goblin-queue .unq { min-width: 1.7rem; height: 1.5rem; padding: 0 0.4rem; margin-left: 0.3rem; font-size: 1rem; line-height: 1; cursor: pointer; }
.amis-row { margin: 0.45rem 0; } .amis-row .buy { margin-top: 0.25rem; width: 100%; }
/* The battle view */
.battle-box { width: 100%; }
dialog:has(.battle-box) { width: min(62rem, 96vw); max-width: none; }
.battle-cv { display: block; width: 100%; background: #12110e; border: 1px solid var(--line, #333); border-radius: 6px; cursor: grab; touch-action: none; }
.battle-cv:active { cursor: grabbing; }
.bhud { display: flex; justify-content: space-between; font: 0.85rem var(--serif, serif); color: #c8c0a8; }
.bbars { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin: 0.2rem 0 0.4rem; }
.bbars > i { display: block; height: 7px; background: #2a2620; }
.bbars > i > i { display: block; height: 100%; width: 100%; }
#b-us { background: #b8a77f; } #b-them { background: #a04a3a; margin-left: auto; }
.bfoot { display: flex; justify-content: space-between; align-items: center; gap: 1rem; font-size: 0.8rem; margin-top: 0.3rem; }
.bend { text-align: center; font: bold 1.1rem var(--serif, serif); margin: 0.4rem 0 0; min-height: 1.3rem; } .bend.won { color: #9fd08a; } .bend.lost { color: #e07a6a; }
.battle-foot { text-align: center; margin: 0.4rem 0 0; }
/* Raid tactics in the fen card */
.tactics { margin: 0.4rem 0; }
.tactics .tac { font-size: 0.78rem; padding: 0.15rem 0.45rem; margin: 0.1rem 0.15rem 0.1rem 0; }
.tactics .tac.on { border-color: var(--accent, #c9a54a); color: var(--accent, #c9a54a); }
.seg.danger { color: #e08a7a; border-color: #6a3a34; }
.seg.danger:hover { background: #3a1a18; }
/* A minion is murdered on the map */
.murder-fx { pointer-events: none; }
.murder-fx .murder-flash { fill: #7a0a0a; opacity: 0; animation: murderflash 1.1s ease-out 0.6s forwards; }
.murder-fx .scythe { transform-box: fill-box; transform-origin: 0% 100%; transform: rotate(-110deg); opacity: 0; animation: scythe 0.5s cubic-bezier(.6,0,.9,.6) 0.25s forwards, fadeout 0.6s ease-out 1.1s forwards; }
.murder-fx .victim { transform-box: fill-box; transform-origin: 50% 100%; animation: victim 2.6s ease-in forwards; }
.murder-fx .blood .drop { fill: #a01818; opacity: 0; animation: drop 0.9s ease-out forwards; }
.murder-fx .soul { opacity: 0; animation: soul 2.6s ease-out 1s forwards; }
.murder-fx .grave { opacity: 0; animation: grave 5s ease-out 1.4s forwards; }
@keyframes murderflash { 0% { opacity: 0.32; } 100% { opacity: 0; } }
@keyframes scythe { 0% { opacity: 0.95; transform: rotate(-110deg); } 100% { opacity: 1; transform: rotate(35deg); } }
@keyframes fadeout { to { opacity: 0; } }
@keyframes victim { 0%, 22% { transform: none; } 25% { transform: translateX(-0.6px); } 28% { transform: translateX(0.6px); } 31% { transform: none; } 45% { transform: rotate(-88deg); opacity: 1; } 85% { transform: rotate(-88deg); opacity: 0.9; } 100% { transform: rotate(-88deg); opacity: 0; } }
@keyframes drop { 0% { opacity: 1; transform: translate(0, 0); } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)); } }
@keyframes soul { 0% { opacity: 0; transform: translate(0, 0); } 20% { opacity: 0.9; } 100% { opacity: 0; transform: translate(4px, -26px); } }
@keyframes grave { 0% { opacity: 0; } 15%, 75% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .murder-fx * { animation-duration: 0.01s !important; } }
/* Phones: the resource pills fit (smaller numbers, the rate tucked under), and the sticky bar stays
   short: tonight's omen on one line (tap it for the rest), the Fen Gazette ticker hidden. */
@media (max-width: 680px) {
  .resbar .resources { gap: 0.25rem 0.3rem; }
  .resbar .res { padding: 0.15rem 0.45rem; gap: 0.25rem; flex-wrap: wrap; row-gap: 0; line-height: 1.15; }
  .resbar .res .rval { font-size: 0.82rem; flex: 1 0 auto; }
  .resbar .res .rrate { font-size: 0.6rem; flex-basis: 100%; margin-left: 1.15rem; text-align: left; min-width: 0; }
  .resbar .res .rrate:empty { display: none; }
  .resbar .omen { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.75rem; margin: 0.15rem 0; cursor: pointer; }
  .resbar .omen.open { white-space: normal; }
  .resbar .ticker { display: none; }
}
.card .count { white-space: nowrap; }   /* '2 / 3' never splits over two lines */
/* The ending film */
.ending { position: fixed; inset: 0; z-index: 1000; background: #000; display: grid; place-items: center; animation: endin 1.2s ease-out; transition: opacity 0.7s; }
.ending.out { opacity: 0; }
.ending canvas { display: block; }
.ending-cap { position: absolute; left: 50%; bottom: 7%; transform: translateX(-50%); width: min(46rem, 88vw); margin: 0; padding: 0.7rem 1.2rem; box-sizing: border-box; background: rgba(6, 4, 6, 0.72); border-radius: 6px; text-align: center; font: italic clamp(1rem, 2.6vw, 1.6rem)/1.4 Georgia, serif; color: #f0e6cc; text-shadow: 0 2px 8px #000, 0 0 2px #000; opacity: 0; }
.ending-cap.in { animation: capin 1.4s ease-out 0.9s forwards; }
.ending-title { position: absolute; left: 0; right: 0; top: 14%; text-align: center; color: #f0e6cc; text-shadow: 0 2px 10px #000; animation: capin 2.5s ease-out forwards; }
.ending-title h1 { font: small-caps clamp(2.4rem, 8vw, 5rem) Georgia, serif; letter-spacing: 0.2em; margin: 0; }
.ending-title p { font: clamp(0.8rem, 2vw, 1.05rem) Georgia, serif; color: #d8c8a8; margin: 0.6rem auto 0; width: min(40rem, 86vw); }
.ending-skip { position: absolute; right: 1rem; top: 1rem; opacity: 0.55; }
.ending-skip.ready { right: auto; left: 50%; top: 33%; transform: translateX(-50%); opacity: 1; }
@keyframes endin { from { opacity: 0; } } @keyframes capin { from { opacity: 0; } to { opacity: 1; } }
.omen .seg { font-size: 0.72rem; padding: 0.05rem 0.4rem; margin-left: 0.3rem; } .omen-heeded { color: var(--candle); }
.tip-eta { float: right; margin-left: 1rem; color: var(--candle); font-size: 0.85em; } .tip-eta.full { color: #e08a7a; } .tip-eta.empty { color: #e08a7a; }

.role-guide { margin-top: 0.6rem; font-size: 0.85rem; }
.role-guide summary { cursor: pointer; color: #b8b2c8; }
.role-guide dt { font-weight: bold; margin-top: 0.4rem; }
.role-guide dd { margin: 0.1rem 0 0 0.8rem; color: #8a8698; }

.res.falling .rrate { color: #d0705a; }

/* Twists: notables that change how something works (lifetime tree) */
.life-svg .soul.twist .orb { stroke: #8fe3b0; stroke-dasharray: 3 2; }
.life-svg .soul.twist .lname { fill: #8fe3b0; }

/* Animation budget (Menu: Animations): stilled figures stand in their pose. */
#scene .worker.still .w, #scene .worker.still .load, #scene .worker.still .tool { animation: none !important; }
#graves .grave.still .flame, #graves .grave.still .soul { animation: none !important; }
#graves .grave.still .soul { filter: none; opacity: 0.85; }
body.anim-off #scene, body.anim-off #scene * { animation-play-state: paused !important; }
/* ...but a one-off entrance must not freeze on its first frame: a built section starts invisible (Doro, Nov 2026:
   with animations off her whole cathedral was missing). */
body.anim-off #scene .section.built, body.anim-off #muster.gathering .worker { animation: none !important; }
body.anim-off #below-hint { animation-play-state: paused !important; }
/* The ticker cannot just pause: a new headline comes at the end of each pass. With animations off it stands
   still and the headline changes every 20 s instead (Wilkes: 'fen gazette stopped moving'). */
body.anim-off #ticker-text { animation: none !important; left: 0; }
body.anim-off #minions .minion-walker { transition: none !important; }

/* The chapter path (side panel) */
.path { margin-bottom: 1rem; }
.path-strip { display: flex; flex-wrap: wrap; gap: 0.25rem; margin: 0.3rem 0 0.5rem; }
.path-strip .ph { font-size: 0.72rem; padding: 0.1rem 0.4rem; border: 1px solid #3a3644; border-radius: 3px; color: #6e6a7a; }
.path-strip .ph.past { color: #8a8698; border-color: #4a4656; }
.path-strip .ph.on { color: #f2c24a; border-color: #b8902e; }
.path-goals { list-style: none; padding: 0; margin: 0; font-size: 0.86rem; }
.path-goals li { margin: 0.25rem 0; color: #a8a2b8; }
.path-goals li.done { color: #6e6a7a; text-decoration: line-through; }
.path-goals li.next { color: #e8e1cf; }
.path-goals .tick { display: inline-block; width: 1.1em; color: #8fe3b0; }
.path-goals .pbar { display: block; height: 3px; background: #2a2734; margin: 0.15rem 0 0 1.1em; }
.path-goals .pbar i { display: block; height: 100%; background: #b8902e; }
.res-tip ul.tip-now li.tip-net { font-weight: 600; border-bottom: 1px solid rgba(255,255,255,.08); padding-bottom: 2px; margin-bottom: 2px; }
/* The armory */
.armory-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin: 0.3rem 0; }
.armory-table th { text-align: left; font-weight: normal; color: var(--candle); font-variant: small-caps; padding: 0.15rem 0.4rem 0.15rem 0; }
.armory-table td { padding: 0.2rem 0.4rem 0.2rem 0; border-top: 1px solid #ffffff12; vertical-align: top; }
.armory-table td.short { color: #d88a7a; }
@media (max-width: 680px) { .armory-table { font-size: 0.78rem; } }
/* The palisade on the map (grows with its level) */
#lots .palisade .wall { fill: #54412d; stroke: #1a130c; stroke-width: 0.6; }
#lots .palisade .wall.low { fill: #3f3022; }
#lots .palisade .planks { fill: none; stroke: #1c150e; stroke-width: 0.5; opacity: 0.8; }
#lots .palisade .tip { fill: #d9d0bb; }
#lots .palisade .rail { fill: none; stroke: #b8ad92; stroke-width: 1.1; opacity: 0.85; }
#lots .palisade .gate-post { fill: #3e2f20; stroke: #120d08; stroke-width: 0.6; }
#lots .palisade .lintel { fill: none; stroke: #d9d0bb; stroke-width: 2.2; stroke-linecap: round; }
#lots .palisade .door { fill: #241a12; stroke: #4a3a28; stroke-width: 0.5; }
#lots .palisade .skull circle { fill: #e6dfcc; } #lots .palisade .skull .eye { fill: #1a1410; }
#lots .palisade .spike { stroke: #d9d0bb; stroke-width: 1; stroke-linecap: round; }
#lots .palisade .torch path { stroke: #5a4430; stroke-width: 1.2; } #lots .palisade .torch .flame { fill: #f2b54a; } #lots .palisade .torch .glow { fill: #f2b54a; opacity: 0.18; }
.warn-soft { color: #e0b36a; }
