:root {
  --ink: #191711;
  --soft-ink: #5f594b;
  --paper: #eee6d4;
  --paper-deep: #dfd3bb;
  --red: #8e2f28;
  --red-dark: #64201c;
  --gold: #a58b55;
  --line: rgba(39, 34, 24, .18);
  --shadow: 0 24px 70px rgba(32, 24, 12, .2);
  font-family: "Noto Serif TC", "Songti TC", "PMingLiU", serif;
}

* { box-sizing: border-box; }

html { background: #17150f; color: var(--ink); }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 10%, rgba(255,255,255,.08), transparent 32rem),
    linear-gradient(135deg, #29241b 0%, #17150f 62%, #211a14 100%);
}

button { font: inherit; }
button:focus-visible { outline: 3px solid #d1aa62; outline-offset: 3px; }
[hidden] { display: none !important; }

.birth-dialog { width: min(540px, calc(100vw - 24px)); max-height: 92svh; overflow-y: auto; padding: 24px; border: 1px solid var(--gold); border-radius: 18px; color: var(--ink); background: radial-gradient(ellipse at top, #fff7df, var(--paper)); box-shadow: var(--shadow); text-align: center; }
.birth-dialog::backdrop { background: rgba(15, 13, 9, .8); backdrop-filter: blur(5px); }
.birth-dialog h2 { margin: .3rem 0; font-size: clamp(1.4rem, 5vw, 2rem); }
.birth-status { min-height: 2.5em; font-size: .86rem; line-height: 1.6; color: var(--soft-ink); }
.birth-wheel-frame { --wheel-size: min(70vw, 280px); position: relative; width: var(--wheel-size); height: var(--wheel-size); margin: 20px auto; }
.birth-wheel { position: absolute; inset: 0; border-radius: 50%; border: 6px double #987848; background: repeating-conic-gradient(from -7.2deg, #f0e2be 0deg 14.4deg, #dac39b 14.4deg 28.8deg); box-shadow: 0 8px 24px #68523138; }
.birth-wheel > span { position: absolute; left: 50%; top: 50%; width: 62px; font-size: 11px; line-height: 1; white-space: nowrap; transform: translate(-50%, -50%) rotate(var(--sector-angle)) translateY(calc(var(--wheel-size) * -.36)) rotate(90deg); }
.birth-wheel.spinning { animation: birth-spin 4.8s cubic-bezier(.12,.72,.16,1) forwards; }
.birth-wheel-hub { position: absolute; inset: 37%; display: grid; place-items: center; border-radius: 50%; border: 4px double #c5a56a; color: #f9e6bd; background: var(--red-dark); font-size: 1.7rem; box-shadow: 0 3px 12px #251d1740; }
.birth-pointer { position: absolute; z-index: 2; top: -9px; left: calc(50% - 12px); width: 24px; height: 31px; background: var(--red-dark); clip-path: polygon(0 0, 100% 0, 50% 100%); }
.birth-dialog.revealed .birth-wheel-frame { --wheel-size: min(55vw, 180px); margin: 12px auto; }
.birth-dialog.revealed .birth-wheel > span { font-size: 8px; width: 47px; }
.birth-result { padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff8e944; text-align: left; }
.birth-child { display: flex; align-items: center; justify-content: center; gap: 14px; }
.birth-child .chibi { width: 76px; height: 76px; flex: 0 0 76px; }
.birth-child h3 { margin: .25rem 0; font-size: 1.5rem; }
.birth-child p, .birth-child span { margin: 0; font-size: .78rem; }
.birth-result dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 12px 0 0; }
.birth-result dt { color: var(--soft-ink); font-size: .7rem; }
.birth-result dd { margin: 3px 0 0; font-size: .88rem; overflow-wrap: anywhere; }
.birth-note { font-size: .74rem; line-height: 1.6; color: var(--soft-ink); }
.birth-buttons { position: sticky; bottom: -24px; padding: 12px 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; background: var(--paper); }
@keyframes birth-spin { from { transform: rotate(0deg); } to { transform: rotate(var(--birth-turn)); } }
@media (prefers-reduced-motion: reduce) { .birth-wheel.spinning { animation: none; } }

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .12;
  mix-blend-mode: screen;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.42'/%3E%3C/svg%3E");
}

.start-screen {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 5rem 1.5rem;
  color: var(--paper);
  text-align: center;
  overflow: hidden;
}

.start-screen::before {
  content: "";
  position: absolute;
  width: min(78vw, 830px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid rgba(238, 230, 212, .08);
  box-shadow: 0 0 0 80px rgba(238,230,212,.025), 0 0 0 160px rgba(238,230,212,.018);
}

.seal {
  position: relative;
  width: 4.25rem;
  height: 4.25rem;
  display: grid;
  place-items: center;
  margin-bottom: 2.25rem;
  border: 2px solid #b84b3f;
  color: #c86155;
  font-weight: 800;
  letter-spacing: .18em;
  writing-mode: vertical-rl;
  transform: rotate(-3deg);
}

.eyebrow, .section-kicker, .event-kind {
  margin: 0 0 .75rem;
  color: var(--gold);
  font-family: system-ui, sans-serif;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
}

.start-screen h1 {
  position: relative;
  margin: 0;
  font-size: clamp(5.5rem, 18vw, 11rem);
  font-weight: 500;
  letter-spacing: .18em;
  line-height: .95;
  text-indent: .18em;
  text-shadow: 0 12px 35px rgba(0,0,0,.35);
}

.lede {
  position: relative;
  margin: 2rem 0 2.5rem;
  color: rgba(238,230,212,.74);
  font-size: clamp(1rem, 2vw, 1.2rem);
  line-height: 2;
  letter-spacing: .14em;
}

.start-actions { position: relative; display: grid; gap: .8rem; min-width: min(20rem, 80vw); }

.primary-btn, .secondary-btn, .text-btn, .choice-button {
  border: 0;
  cursor: pointer;
  transition: transform .18s ease, background .18s ease, color .18s ease, border-color .18s ease;
}

.primary-btn {
  padding: .95rem 1.5rem;
  background: var(--red);
  color: #fff8e9;
  font-weight: 700;
  letter-spacing: .12em;
  box-shadow: 0 10px 24px rgba(95, 28, 22, .28);
}

.primary-btn:hover { background: var(--red-dark); transform: translateY(-2px); }
.secondary-btn { padding: .9rem 1.3rem; border: 1px solid var(--line); background: transparent; color: var(--ink); }
.text-btn { padding: .65rem 1rem; background: transparent; color: inherit; text-decoration: underline; text-underline-offset: .35rem; }
.start-note { position: relative; margin-top: 2rem; color: rgba(238,230,212,.4); font: .72rem/1.6 system-ui, sans-serif; letter-spacing: .08em; }
.corner-link { position: absolute; right: 1.5rem; bottom: 1.5rem; border: 0; background: transparent; color: rgba(238,230,212,.62); cursor: pointer; }

.game-shell {
  width: min(1480px, calc(100% - 2rem));
  min-height: calc(100vh - 2rem);
  margin: 1rem auto;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.game-header {
  min-height: 4.5rem;
  padding: .8rem 1.4rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.brand-button { justify-self: start; border: 0; background: transparent; color: var(--red); font-size: 1.6rem; font-weight: 800; cursor: pointer; letter-spacing: .16em; }
.time-mark { text-align: center; }
.time-mark span { display: block; color: var(--soft-ink); font: .68rem system-ui, sans-serif; letter-spacing: .2em; }
.time-mark strong { display: block; margin-top: .15rem; font-weight: 600; letter-spacing: .08em; }
.quiet-button { justify-self: end; border: 0; background: transparent; color: #77705f; font: .72rem system-ui, sans-serif; }

.world-strip {
  display: grid;
  grid-template-columns: minmax(120px, .5fr) minmax(220px, 1fr) minmax(120px, .5fr);
  align-items: center;
  gap: 1.5rem;
  padding: .75rem 1.5rem;
  border-bottom: 1px solid var(--line);
  color: var(--soft-ink);
  background: rgba(255,255,255,.16);
  font: .72rem/1.4 system-ui, sans-serif;
}

.world-strip > div { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: .65rem; }
.world-strip p { margin: 0; text-align: center; }
.thin-meter { height: 3px; background: rgba(25,23,17,.12); }
.thin-meter i { display: block; height: 100%; width: 30%; background: var(--red); transition: width .5s ease; }
.thin-meter.famine i { background: #8b743e; }

.life-toolbar {
  min-height: 4.25rem;
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(160px, 1fr) auto minmax(130px, 1fr);
  align-items: center;
  gap: 1rem;
  padding: .65rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: #272118;
  color: var(--paper);
  font-family: system-ui, sans-serif;
}
.life-toolbar span { display: block; color: rgba(238,230,212,.58); font-size: .65rem; letter-spacing: .12em; }
.life-toolbar strong { display: block; margin-top: .15rem; font-size: .88rem; letter-spacing: .04em; }
.career-mark { text-align: center; }
.force-mark { text-align: right; }
.management-button { padding: .7rem 1.4rem; border: 1px solid #bd9a5c; background: transparent; color: #f1d89d; cursor: pointer; font-weight: 700; letter-spacing: .12em; }
.management-button:hover { background: rgba(241,216,157,.1); }
.life-clock { min-height: 3.2rem; display: grid; grid-template-columns: auto minmax(155px, auto) minmax(120px, 1fr) auto auto; align-items: center; gap: .85rem; padding: .55rem 1.5rem; border-bottom: 1px solid var(--line); background: #f3ead5; font-family: system-ui, sans-serif; }
.clock-toggle { padding: .48rem .75rem; border: 1px solid rgba(142,47,40,.36); background: transparent; color: var(--red-dark); cursor: pointer; font-size: .72rem; font-weight: 700; }
.clock-toggle:hover { background: rgba(142,47,40,.07); }
.clock-readout span, .clock-countdown { display: block; color: var(--soft-ink); font-size: .64rem; letter-spacing: .04em; }
.clock-readout strong { display: block; margin-top: .08rem; font-size: .75rem; }
.clock-track { height: 5px; overflow: hidden; background: rgba(25,23,17,.12); }
.clock-track i { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--red), var(--gold)); transition: width .18s linear; }
.life-clock.paused .clock-track i { background: #807765; }
.life-clock.major .clock-track i { background: var(--red); }
.clock-countdown { min-width: 7.5rem; text-align: right; }
.clock-speeds { display: flex; border: 1px solid var(--line); }
.clock-speeds button { min-width: 2.2rem; padding: .4rem .5rem; border: 0; border-right: 1px solid var(--line); background: transparent; color: var(--soft-ink); cursor: pointer; font-size: .68rem; }
.clock-speeds button:last-child { border-right: 0; }
.clock-speeds button.active { background: #272118; color: #f1d89d; }

.game-grid { display: grid; grid-template-columns: 260px minmax(0, 1fr) 310px; min-height: calc(100vh - 11.7rem); }
.identity-panel, .chronicle-panel { padding: 2rem 1.4rem; background: rgba(255,255,255,.15); }
.identity-panel { border-right: 1px solid var(--line); }
.chronicle-panel { border-left: 1px solid var(--line); }
.identity-panel h2, .chronicle-panel h2 { margin: 0; font-size: 1.35rem; font-weight: 700; }
.muted { margin: .55rem 0 0; color: var(--soft-ink); font-size: .9rem; line-height: 1.6; }
.age-display { margin: 1.8rem 0; display: flex; align-items: baseline; gap: .45rem; }
.age-display strong { font: 500 3.8rem/.9 Georgia, serif; }
.age-display span { color: var(--soft-ink); }

.stat-list { display: grid; gap: .85rem; margin: 0; }
.stat-row { display: grid; grid-template-columns: 2.5rem 1fr 2rem; align-items: center; gap: .5rem; }
.stat-row dt { font-size: .78rem; color: var(--soft-ink); }
.stat-row dd { margin: 0; }
.stat-row output { text-align: right; color: var(--soft-ink); font: .72rem system-ui, sans-serif; }
.stat-meter { height: 5px; background: rgba(25,23,17,.1); overflow: hidden; }
.stat-meter i { display: block; height: 100%; background: var(--ink); transition: width .4s ease; }
.aside-section { margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.aside-section h3 { margin: 0 0 .8rem; color: var(--soft-ink); font-size: .78rem; letter-spacing: .12em; }
.tag-list { display: flex; flex-wrap: wrap; gap: .4rem; }
.tag-list span { padding: .3rem .5rem; background: rgba(142,47,40,.09); color: var(--red-dark); font: .72rem system-ui, sans-serif; }
.empty-text { background: transparent !important; color: #8a8375 !important; padding: 0 !important; }
.relation-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .65rem; }
.relation-list li { display: flex; justify-content: space-between; gap: .75rem; font-size: .8rem; }
.relation-list b { color: var(--soft-ink); font: 600 .7rem system-ui, sans-serif; }

.story-panel { position: relative; padding: clamp(2rem, 5vw, 5rem); display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.story-panel { padding: 1.5rem; justify-content: flex-start; gap: 1.5rem; }
.operations-panel { order: 0; min-width: 0; }
.operations-heading { display: flex; align-items: center; justify-content: space-between; gap: .7rem; }
.operations-heading h2 { margin: .3rem 0; font-size: 1.45rem; }
.operations-heading > span { color: var(--soft-ink); font: .72rem system-ui, sans-serif; }
.operations-goal { padding: .8rem; background: #e8dfc8; border-left: 3px solid var(--gold); font-size: .88rem; line-height: 1.7; }
.operations-summary { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .6rem; margin-bottom: 1rem; }
.operations-summary div { padding: .6rem; border: 1px solid var(--line); }
.operations-summary span, .operations-summary strong { display: block; font: .72rem/1.6 system-ui,sans-serif; overflow-wrap: anywhere; }
.operations-summary span { color: var(--soft-ink); }
.operations-summary strong { font-weight: 700; }
.operations-settings { display: flex; flex-wrap: wrap; gap: .65rem; align-items: end; }
.operations-settings label { display: grid; gap: .3rem; font: .72rem system-ui,sans-serif; }
.operations-settings select { padding: .4rem; border: 1px solid var(--line); color: var(--ink); background: var(--paper); max-width: 100%; }
.operations-settings .repeat-setting { display: flex; align-items: center; padding: .4rem 0; }
.operations-hint { font: .7rem/1.7 system-ui,sans-serif; color: var(--soft-ink); }
.operations-active { padding: .8rem; border: 1px solid #85764c; background: #f6eedb; }
.operations-active strong, .operations-active small { display: block; line-height: 1.7; }
.operations-active small { color: var(--soft-ink); font-size: .72rem; }
.job-progress { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .6rem; margin-top: .65rem; }
.job-progress > div { height: 5px; background: #ddd3bb; }
.job-progress i { display: block; height: 100%; background: #627650; }
.job-progress span { font: .7rem system-ui,sans-serif; min-width: 5rem; text-align: right; }
.operations-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .5rem; margin-top: .75rem; max-height: 280px; overflow-y: auto; padding: .1rem; }
.operations-actions button { border: 1px solid var(--line); background: #f3ead6; color: var(--ink); text-align: left; padding: .8rem; cursor: pointer; }
.operations-actions button:hover:not(:disabled) { border-color: var(--red); background: #fff4dc; }
.operations-actions button:disabled { opacity: .55; cursor: default; }
.operations-actions strong, .operations-actions span, .operations-actions small { display: block; line-height: 1.6; }
.operations-actions strong { font-size: .85rem; }
.operations-actions span { color: var(--soft-ink); font-size: .72rem; }
.operations-actions small { color: var(--red-dark); margin-top: .3rem; font-size: .7rem; }
.operations-message, .operations-pending { font: .75rem/1.7 system-ui,sans-serif; color: var(--soft-ink); }
.operations-message { color: #47623b; }
.operations-businesses { display: grid; gap: .75rem; }
.business-card { padding: .9rem; border: 1px solid var(--line); background: #f2e8d0; }
.business-card h3 { margin: 0 0 .3rem; font-size: 1rem; }
.business-card span, .business-card small, .business-card p { font: .72rem/1.6 system-ui,sans-serif; }
.business-card small { color: var(--soft-ink); }
.business-buttons { display: flex; flex-wrap: wrap; gap: .4rem; margin: .8rem 0; }
.business-buttons button { padding: .5rem; border: 1px solid var(--line); color: var(--ink); background: var(--paper); cursor: pointer; }
.business-buttons button:disabled { opacity: .5; cursor: default; }
.event-stage { order: 1; }
.event-stage.major-pending { order: -1; }
.story-panel .event-stage h2 { font-size: clamp(1.5rem, 3vw, 2.3rem); }
.story-panel .event-text { font-size: .95rem; margin: 1rem 0; line-height: 1.8; }
.story-panel .content-count { order: 2; margin: 0; }
@media (max-width: 680px) {
  .story-panel { padding: 1rem !important; }
  .operations-heading { align-items: start; }
  .operations-actions { max-height: 310px; }
  .operations-settings { gap: .5rem; }
  .clock-speeds button { padding: .35rem !important; min-width: 1.7rem !important; }
}
.event-stage { max-width: 720px; width: 100%; margin: 0 auto; transition: padding .25s ease, background .25s ease, box-shadow .25s ease; }
.event-stage.major-event { padding: clamp(1.2rem, 3vw, 2rem); background: rgba(142,47,40,.055); box-shadow: inset 4px 0 0 var(--red); }
.event-kind { color: var(--red); }
.event-clock-note { display: inline-flex; margin: .45rem 0 1rem; padding: .32rem .55rem; border: 1px solid rgba(69,57,37,.18); color: var(--soft-ink); background: rgba(255,255,255,.25); font: .66rem/1.4 system-ui, sans-serif; }
.major-event .event-clock-note { border-color: rgba(142,47,40,.35); color: var(--red-dark); background: rgba(142,47,40,.08); font-weight: 700; }
.event-stage h2 { margin: 0; font-size: clamp(2rem, 5vw, 4rem); font-weight: 500; line-height: 1.22; letter-spacing: .06em; }
.event-text { margin: 1.7rem 0 2rem; color: #403b31; font-size: clamp(1rem, 1.8vw, 1.18rem); line-height: 2; text-align: justify; }
.event-source { margin: -1rem 0 1.7rem; color: #7c725f; font: .72rem/1.6 system-ui, sans-serif; letter-spacing: .03em; }
.event-source::before { content: "史料底本｜"; color: var(--red); font-weight: 700; }
.event-source.fiction-source::before { content: "故事註記｜"; }
.choices { display: grid; gap: .75rem; }
.choice-button { position: relative; width: 100%; padding: 1rem 3.2rem 1rem 1.15rem; border: 1px solid var(--line); background: rgba(255,255,255,.2); color: var(--ink); text-align: left; line-height: 1.5; }
.choice-button::after { content: "→"; position: absolute; right: 1.1rem; color: var(--red); }
.choice-button:hover { border-color: rgba(142,47,40,.55); background: rgba(255,255,255,.55); transform: translateX(4px); }
.outcome { padding-top: 1.2rem; border-top: 1px solid var(--line); }
.outcome p { line-height: 1.8; }
.delta-line { color: var(--red-dark); font: .78rem/1.7 system-ui, sans-serif; }
.content-count { margin: 3rem auto 0; color: #8b8374; font: .7rem system-ui, sans-serif; letter-spacing: .06em; }

.chronicle-head { display: flex; justify-content: space-between; align-items: start; gap: .75rem; }
.ledger-state { margin: .35rem 0 0; color: #587047; font: .65rem system-ui, sans-serif; }
.ledger-state.paused { color: #837258; }
.ledger-state.major { color: var(--red); font-weight: 700; }
.icon-button { width: 2rem; height: 2rem; border: 1px solid var(--line); background: transparent; cursor: pointer; }
.timeline { position: relative; list-style: none; margin: 1.8rem 0 0; padding: 0 0 2rem 1.2rem; display: grid; gap: 1.25rem; max-height: calc(100vh - 15rem); overflow-y: auto; }
.timeline::before { content: ""; position: absolute; left: 3px; top: .4rem; bottom: 0; border-left: 1px solid var(--line); }
.timeline li { position: relative; }
.timeline li::before { content: ""; position: absolute; left: -1.2rem; top: .45rem; width: 7px; height: 7px; border-radius: 50%; background: var(--paper); border: 1px solid var(--red); }
.timeline time { display: block; color: var(--red); font: .68rem system-ui, sans-serif; }
.timeline p { margin: .3rem 0 0; color: var(--soft-ink); font-size: .8rem; line-height: 1.55; }
.timeline-badge { display: inline-block; margin-right: .35rem; padding: .12rem .32rem; border: 1px solid var(--line); color: var(--soft-ink); font: .58rem system-ui, sans-serif; vertical-align: .08rem; }
.timeline-result, .timeline-delta { display: block; margin-top: .32rem; font: .66rem/1.55 system-ui, sans-serif; }
.timeline-result { color: var(--ink); }
.timeline-delta { color: var(--red-dark); }
.timeline li.major-entry::before { width: 9px; height: 9px; left: calc(-1.2rem - 1px); background: var(--red); border-color: var(--red); }
.timeline li.major-entry .timeline-badge { border-color: rgba(142,47,40,.35); color: var(--red-dark); }

dialog { color: var(--ink); }
.paper-dialog, .death-dialog { width: min(560px, calc(100% - 2rem)); border: 0; background: var(--paper); box-shadow: var(--shadow); }
.paper-dialog { padding: 2.4rem; }
.paper-dialog::backdrop, .death-dialog::backdrop { background: rgba(12,10,7,.78); backdrop-filter: blur(5px); }
.paper-dialog h2 { margin: 0 0 1rem; font-size: 2rem; }
.paper-dialog p, .paper-dialog li { line-height: 1.8; }
.dialog-close { position: absolute; top: 1rem; right: 1rem; border: 0; background: transparent; font-size: 1.8rem; cursor: pointer; }
.death-dialog { padding: 0; overflow: visible; background: transparent; }
.epitaph-card { padding: 3rem; background: var(--paper); text-align: center; border: 8px double rgba(74,62,42,.28); }
.epitaph-card h2 { margin: 0; font-size: 2.2rem; }
.death-years { margin: .6rem 0 1.4rem; color: var(--soft-ink); }
.death-cause { font-size: 1.12rem; color: var(--red-dark); }
.death-summary { margin: 1.4rem 0; line-height: 1.85; text-align: left; }
.death-stats { display: flex; justify-content: center; flex-wrap: wrap; gap: .8rem; padding-top: 1.2rem; border-top: 1px solid var(--line); font: .72rem system-ui, sans-serif; }
.death-scars { margin-top: 1rem; color: var(--soft-ink); font-size: .8rem; }
.death-actions { margin-top: .8rem; display: grid; gap: .6rem; color: var(--paper); }
.death-actions .secondary-btn { border-color: rgba(238,230,212,.35); color: var(--paper); }

.management-dialog {
  width: min(1160px, calc(100% - 2rem));
  max-height: min(92vh, 920px);
  padding: 0;
  border: 0;
  background: var(--paper);
  box-shadow: var(--shadow);
  overflow: auto;
}
.management-dialog::backdrop { background: rgba(12,10,7,.82); backdrop-filter: blur(6px); }
.management-head { position: relative; display: flex; justify-content: space-between; gap: 2rem; padding: 1.8rem 2rem 1.35rem; border-bottom: 1px solid var(--line); }
.management-head h2 { margin: 0; font-size: 2.2rem; font-weight: 600; }
.management-head .muted { max-width: 720px; }
.management-tabs { position: sticky; top: 0; z-index: 4; display: grid; grid-template-columns: repeat(5, 1fr); background: #272118; }
.management-tabs button { padding: .9rem; border: 0; border-right: 1px solid rgba(255,255,255,.08); background: transparent; color: rgba(238,230,212,.65); cursor: pointer; letter-spacing: .1em; }
.management-tabs button.active { color: #f2d899; box-shadow: inset 0 -3px 0 var(--gold); background: rgba(255,255,255,.05); }
.management-summary { display: grid; grid-template-columns: repeat(8, 1fr); border-bottom: 1px solid var(--line); }
.summary-cell { padding: .85rem 1rem; border-right: 1px solid var(--line); text-align: center; }
.summary-cell:last-child { border-right: 0; }
.summary-cell span { display: block; color: var(--soft-ink); font: .65rem system-ui, sans-serif; }
.summary-cell strong { display: block; margin-top: .25rem; font-size: .9rem; }
.management-pane { padding: 1.7rem 2rem 2.2rem; }
.pane-intro { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin-bottom: 1.4rem; }
.pane-intro h3, .force-locked h3, .force-banner h3 { margin: 0; font-size: 1.45rem; }
.pane-intro > p, .force-locked > p { max-width: 560px; margin: 0; color: var(--soft-ink); font-size: .82rem; line-height: 1.7; }
.action-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; }
.action-card { min-height: 118px; padding: 1rem; border: 1px solid var(--line); background: rgba(255,255,255,.27); text-align: left; cursor: pointer; color: var(--ink); }
.action-card:hover:not(:disabled) { border-color: rgba(142,47,40,.55); background: rgba(255,255,255,.6); transform: translateY(-2px); }
.action-card:disabled { cursor: not-allowed; opacity: .46; }
.action-card strong { display: block; color: var(--red-dark); font-size: .98rem; }
.action-card span { display: block; margin-top: .35rem; color: var(--soft-ink); font: .72rem/1.55 system-ui, sans-serif; }
.action-card small { display: block; margin-top: .6rem; color: #7d673b; font: 600 .65rem system-ui, sans-serif; }
.spending-overview { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; margin-bottom: 1.35rem; }
.spending-overview > div { padding: .9rem 1rem; border: 1px solid var(--line); background: rgba(255,255,255,.25); }
.spending-overview span { display: block; color: var(--soft-ink); font: .65rem system-ui, sans-serif; }
.spending-overview strong { display: block; margin-top: .25rem; color: var(--red-dark); font-size: 1.08rem; }
.spending-groups { display: grid; gap: 1.3rem; }
.spending-group h4, .spending-ledger-wrap h4 { margin: 0 0 .65rem; color: var(--red-dark); font-size: .9rem; }
.spending-ledger-wrap { margin-top: 1.5rem; padding-top: 1.15rem; border-top: 1px solid var(--line); }
.spending-ledger { display: flex; flex-wrap: wrap; gap: .5rem; }
.spending-ledger span { padding: .45rem .65rem; border: 1px solid var(--line); background: rgba(255,255,255,.28); color: var(--soft-ink); font: .7rem system-ui, sans-serif; }
.career-picker { display: grid; grid-template-columns: minmax(180px, .7fr) 2fr auto auto; align-items: stretch; gap: .75rem; }
.career-picker label { padding: .8rem; border: 1px solid var(--line); color: var(--soft-ink); font: .72rem system-ui, sans-serif; }
.career-picker select { display: block; width: 100%; margin-top: .45rem; padding: .55rem; border: 1px solid var(--line); background: #f7f0df; font: inherit; }
.career-detail { padding: .85rem 1rem; border: 1px solid var(--line); font-size: .82rem; line-height: 1.6; }
.career-detail strong { color: var(--red-dark); }
.career-tree { display: grid; grid-template-columns: repeat(6, 1fr); gap: .35rem; margin-top: 1.2rem; }
.career-node { position: relative; padding: .75rem .55rem; border: 1px solid var(--line); color: var(--soft-ink); text-align: center; font-size: .72rem; }
.career-node.current { border-color: var(--red); background: rgba(142,47,40,.09); color: var(--red-dark); font-weight: 700; }
.career-node:not(:last-child)::after { content: "›"; position: absolute; right: -.32rem; top: 50%; z-index: 2; transform: translateY(-50%); color: var(--gold); }
.asset-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; }
.asset-card { display: grid; grid-template-columns: 1fr auto; gap: .55rem; padding: 1rem; border: 1px solid var(--line); background: rgba(255,255,255,.25); }
.asset-card h4 { margin: 0; color: var(--red-dark); }
.asset-card p { margin: .35rem 0 0; color: var(--soft-ink); font: .72rem/1.55 system-ui, sans-serif; }
.asset-card .asset-count { align-self: start; color: var(--gold); font: 700 1.25rem Georgia, serif; }
.asset-condition { grid-column: 1 / -1; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .5rem; color: var(--soft-ink); font: .65rem system-ui, sans-serif; }
.asset-condition i { display: block; height: 5px; overflow: hidden; background: rgba(69,57,37,.15); }
.asset-condition i::after { content: ""; display: block; width: var(--condition); height: 100%; background: linear-gradient(90deg, var(--red), var(--gold)); }
.asset-actions { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, 1fr); gap: .4rem; }
.asset-card button { padding: .62rem .45rem; border: 1px solid var(--line); background: transparent; cursor: pointer; font-size: .72rem; }
.asset-card button[data-buy-asset] { border-color: rgba(142,47,40,.38); color: var(--red-dark); }
.asset-card button[data-finance-asset] { grid-column: 1 / -1; }
.asset-card button:disabled { opacity: .4; cursor: not-allowed; }
.force-locked { padding: 1rem 0; }
.force-locked .action-grid { margin-top: 1.2rem; }
.force-banner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.1rem 1.25rem; color: var(--paper); background: linear-gradient(110deg, #54211d, #282117); }
.force-banner p { margin: .35rem 0 0; color: rgba(238,230,212,.66); font-size: .78rem; }
.season-seal { width: 5rem; height: 5rem; display: grid; place-content: center; border: 1px solid rgba(238,230,212,.35); text-align: center; }
.season-seal span { font-size: 1.7rem; }
.season-seal small { color: rgba(238,230,212,.58); font: .6rem system-ui, sans-serif; }
.force-stats { display: grid; grid-template-columns: repeat(8, 1fr); margin: .9rem 0 1.3rem; border: 1px solid var(--line); }
.force-stat { padding: .7rem .4rem; border-right: 1px solid var(--line); text-align: center; }
.force-stat:nth-child(8n) { border-right: 0; }
.force-stat span { display: block; color: var(--soft-ink); font: .62rem system-ui, sans-serif; }
.force-stat strong { display: block; margin-top: .25rem; font-size: .82rem; }
.force-columns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.force-columns > section { min-width: 0; }
.force-columns h4 { margin: 0 0 .65rem; padding-bottom: .5rem; border-bottom: 1px solid var(--line); color: var(--red-dark); }
.action-grid.compact { grid-template-columns: 1fr; gap: .5rem; }
.action-grid.compact .action-card { min-height: 94px; }
.management-log { padding: 1.2rem 2rem 1.8rem; border-top: 1px solid var(--line); background: rgba(255,255,255,.2); }
.management-log h3 { margin: 0; font-size: .85rem; color: var(--soft-ink); }
.management-log ol { margin: .75rem 0 0; padding-left: 1.4rem; display: grid; gap: .35rem; color: var(--soft-ink); font: .72rem/1.5 system-ui, sans-serif; }

@media (max-width: 980px) {
  .game-grid { grid-template-columns: 220px 1fr; }
  .chronicle-panel { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); }
  .timeline { max-height: 280px; grid-template-columns: repeat(2, 1fr); }
  .life-clock { grid-template-columns: auto minmax(140px, auto) 1fr auto; }
  .clock-countdown { display: none; }
  .action-grid, .asset-list { grid-template-columns: repeat(2, 1fr); }
  .career-picker { grid-template-columns: 1fr 2fr; }
  .career-picker .primary-btn, .career-picker .secondary-btn { width: 100%; }
  .management-summary { grid-template-columns: repeat(4, 1fr); }
  .force-stats { grid-template-columns: repeat(4, 1fr); }
  .force-stat:nth-child(4n) { border-right: 0; }
  .force-columns { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .game-shell { width: 100%; min-height: 100svh; margin: 0; }
  .game-header { padding: .65rem .9rem; }
  .world-strip { grid-template-columns: 1fr 1fr; gap: .6rem 1rem; padding: .65rem .9rem; }
  .world-strip p { grid-column: 1 / -1; grid-row: 2; font-size: .68rem; }
  .life-toolbar { grid-template-columns: 1fr 1fr; padding: .7rem .9rem; }
  .life-clock { grid-template-columns: auto 1fr auto; gap: .55rem; padding: .55rem .9rem; }
  .life-clock .clock-track { grid-column: 1 / -1; grid-row: 2; }
  .clock-speeds button { min-width: 2rem; padding: .38rem .42rem; }
  .career-mark { text-align: right; }
  .management-button { order: 3; }
  .force-mark { order: 4; }
  .game-grid { display: flex; flex-direction: column; }
  .identity-panel { border-right: 0; border-bottom: 1px solid var(--line); padding: 1.2rem .9rem; }
  .identity-panel .section-kicker, .identity-panel h2, .identity-panel .muted, .age-display { display: inline-flex; margin-right: .45rem; }
  .age-display { float: right; margin: 0; }
  .age-display strong { font-size: 2.4rem; }
  .stat-list { clear: both; margin-top: 1rem; grid-template-columns: repeat(5, 1fr); gap: .45rem; }
  .stat-row { grid-template-columns: 1fr; gap: .2rem; }
  .stat-row output { display: none; }
  .aside-section { display: none; }
  .story-panel { padding: 2.4rem 1.15rem 3rem; min-height: 58vh; }
  .event-stage h2 { font-size: 2.35rem; }
  .event-text { text-align: left; }
  .chronicle-panel { padding: 1.6rem 1rem; }
  .timeline { grid-template-columns: 1fr; }
  .paper-dialog { padding: 2rem 1.4rem; }
  .epitaph-card { padding: 2rem 1.3rem; }
  .management-dialog { width: 100%; max-height: 100svh; }
  .management-head, .management-pane, .management-log { padding-left: 1rem; padding-right: 1rem; }
  .management-head h2 { font-size: 1.7rem; }
  .management-tabs button { padding: .8rem .3rem; font-size: .78rem; }
  .management-summary { grid-template-columns: repeat(2, 1fr); }
  .summary-cell:nth-child(2n) { border-right: 0; }
  .pane-intro { display: block; }
  .pane-intro > p { margin-top: .65rem; }
  .action-grid, .asset-list { grid-template-columns: 1fr; }
  .spending-overview { grid-template-columns: 1fr; }
  .career-picker { grid-template-columns: 1fr; }
  .career-tree { grid-template-columns: repeat(2, 1fr); }
  .career-node::after { display: none; }
  .force-stats { grid-template-columns: repeat(3, 1fr); }
  .force-stat:nth-child(4n) { border-right: 1px solid var(--line); }
  .force-stat:nth-child(3n) { border-right: 0; }
}

.holdings-panel { padding-bottom: 1.3rem; }
.holdings-top { display: flex; align-items: center; justify-content: space-between; gap: .8rem; }
.holdings-top h2 { margin: 0; font-size: 1.55rem; }
.version-chip { padding: .35rem .65rem; border: 1px solid var(--line); border-radius: 20px; color: var(--red-dark); font: .65rem system-ui, sans-serif; white-space: nowrap; }
.holding-picker { display: grid; gap: .4rem; margin: 1rem 0; font-size: .8rem; }
.holding-picker select, .holding-expansion select { width: 100%; min-height: 44px; padding: .6rem; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--paper); font: inherit; }
.holding-scene { display: flex; justify-content: center; gap: .5rem; padding: .8rem; border-radius: 14px; background: #30261f; overflow: hidden; }
.holding-scene figure { flex: 1; min-width: 0; max-width: 180px; margin: 0; text-align: center; }
.holding-scene figcaption { padding: .5rem .2rem .2rem; font-size: .72rem; color: #f3dec0; }
.chibi { width: 100%; aspect-ratio: 1; background: url("assets/characters-chibi-v1.png") no-repeat; background-size: 300% 200%; border-radius: 12px; }
.chibi-child { background-position: 0 0; }
.chibi-mother { background-position: 50% 0; clip-path: inset(0 4% 4% 8% round 12px); }
.chibi-potter { background-position: 100% 0; clip-path: polygon(0 0, 100% 0, 100% 100%, 18% 100%, 18% 80%, 0 80%); }
.chibi-merchant { background-position: 0 100%; }
.chibi-refugee { background-position: 50% 100%; }
.chibi-guard { background-position: 100% 100%; }
.chibi-merchant, .chibi-refugee, .chibi-guard { clip-path: inset(6% 0 0 0 round 12px); }
.demo-banner { padding: .7rem 1rem; text-align: center; background: #794831; color: #fff2d5; font: .8rem/1.7 system-ui, sans-serif; }
.demo-banner a { color: #fff2d5; margin-left: 1rem; }
.demo-link { margin-top: .65rem; color: var(--red-dark); font-size: .85rem; }
.holding-order { margin: 1rem 0; padding: 1rem; border: 1px solid #b79b6d; border-left: 4px solid var(--red); border-radius: 8px; background: rgba(255,255,255,.28); }
.holding-order h3 { font-size: 1rem; margin: .4rem 0; }
.holding-order p { font-size: .8rem; line-height: 1.7; }
.holding-order button { width: 100%; min-height: 44px; padding: .65rem; background: var(--red-dark); color: var(--paper); border: 0; border-radius: 6px; cursor: pointer; }
.holding-order button:disabled { opacity: .45; cursor: not-allowed; }
.holding-order small { display: block; margin-top: .5rem; font-size: .7rem; line-height: 1.6; }
.holding-progress { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .6rem; margin: .8rem 0; font: .7rem system-ui, sans-serif; }
.holding-progress > div { height: 7px; overflow: hidden; border-radius: 5px; background: #d2c5ac; }
.holding-progress i { display: block; height: 100%; background: #7e8b58; }
.holding-expansion { padding: .7rem 0; font-size: .76rem; line-height: 1.7; }
.holding-expansion summary, .personal-work > summary { cursor: pointer; min-height: 38px; align-content: center; }
.holding-expansion label { display: grid; gap: .5rem; margin-top: .6rem; }
.personal-work { border-top: 1px solid var(--line); padding-top: .7rem; }
.personal-work > summary { font-weight: 700; margin-bottom: .7rem; }
.personal-work > summary span { font-weight: 400; font-size: .72rem; color: var(--soft-ink); }
#martial-panel { margin: 1rem 0; border: 1px solid var(--line); border-radius: 8px; padding: 1rem; }
#martial-panel > summary { cursor: pointer; font-size: 1.1rem; font-weight: 700; min-height: 44px; align-content: center; }
#martial-title { color: var(--red-dark); font-size: .85rem; }
#sect-name-label { display: grid; gap: .5rem; margin: .75rem 0; }
#sect-name { width: 100%; min-width: 0; padding: .6rem; border: 1px solid var(--line); border-radius: 4px; background: var(--paper); color: var(--ink); font: inherit; }
@media (max-width: 680px) {
  .holdings-top { align-items: start; }
  .holdings-top h2 { font-size: 1.3rem; }
  .version-chip { font-size: .55rem; }
  .holding-progress { grid-template-columns: 1fr; }
  .holding-scene { padding: .4rem; gap: .25rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

@media (max-width: 680px) {
  .life-clock { grid-template-columns: auto minmax(0, 1fr); }
  .clock-speeds { grid-column: 1 / -1; grid-row: 2; width: max-content; }
  .life-clock .clock-track { grid-row: 3; }
}

.morning-options { display: flex; flex-wrap: wrap; gap: 8px; }
.morning-options button { min-height: 44px; padding: 8px 12px; }
.morning-options small { display: block; font-size: 12px; }
.morning-options button[aria-pressed="true"] { border-color: var(--red); }
.skills-compact { margin: 12px 0; }
.skill-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 20px; }
.skill-list strong { float: right; }
.skill-list meter { display: block; width: 100%; height: 7px; }

.children-dialog { width: min(700px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); overflow-y: auto; box-sizing: border-box; }
.children-list { display: grid; gap: 16px; }
.child-card { padding: 18px; border: 1px solid rgba(74,62,42,.25); border-radius: 14px; min-width: 0; }
.child-card h3 { margin: 0 0 8px; }
.child-card p { margin: 8px 0; }
.child-vitals { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; }
.child-plans { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin: 12px 0; }
.child-plans button, .child-talk { min-height: 44px; padding: 10px; border: 1px solid var(--ink); background: transparent; color: var(--ink); border-radius: 8px; font: inherit; }
.child-plans button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.child-plans button:disabled, .child-talk:disabled { opacity: .55; cursor: not-allowed; }
.child-plans small { display: block; margin-top: 4px; font-size: 12px; }
.child-skills { margin: 14px 0; font-size: 14px; }
.child-history { font-size: 13px; padding-left: 20px; line-height: 1.8; }
#heir-select { min-height: 44px; max-width: 100%; font: inherit; padding: 8px; }
.death-actions .muted { color: var(--paper); }
