:root {
  --bg: #0e0b09; --ink: #e9dcc3; --muted: #8b7b64; --dim: #4a3f33; --gold: #d9a441;
  --left: #6fb1e6; --right: #e2735c; --danger: #d54b3d;
  --display: 'Cinzel', 'Trajan Pro', Georgia, serif;
  --body: 'Crimson Pro', Georgia, 'Times New Roman', serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 18px; }
body { background: radial-gradient(ellipse at 50% 30%, #1a1410 0%, var(--bg) 70%); }
a { color: var(--gold); text-decoration: none; }
a.text, button.text { font: inherit; font-family: var(--display); font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); background: none; border: 0; padding: 6px 10px; cursor: pointer; }
a.text:hover, button.text:hover { color: var(--gold); }
a.text.big, button.text.big { color: var(--gold); font-size: 1rem; }
button.text:disabled { opacity: .4; cursor: wait; }

.stage { min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 18px clamp(12px, 3vw, 40px) 12px; gap: 14px; overflow-x: hidden; }
.tiny { margin-top: auto; }

/* crown line */
.crown { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; position: relative; }
.crown .title { font-family: var(--display); font-weight: 700; font-size: 1.6rem; letter-spacing: .3em; color: var(--gold); text-transform: uppercase; }
.crown .ruler { font-family: var(--display); font-size: .95rem; letter-spacing: .1em; }
.crown .sep { color: var(--dim); margin: 0 .5em; }
.crown .nature { color: var(--muted); font-style: italic; max-width: 60ch; }
.crown #new-reign { position: absolute; right: 0; top: 0; }
.crown .links { position: absolute; left: 0; top: 0; display: flex; gap: 4px; }
.crown .links a { display: block; padding: 6px; color: var(--muted); line-height: 0; }
.crown .links a:hover, .crown .links a:focus-visible { color: var(--gold); }
.crown .links svg { width: 20px; height: 20px; fill: currentColor; }

/* meters */
.meters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px; width: min(900px, 100%); }
.meter { display: flex; flex-direction: column; gap: 6px; }
.meter .name { display: flex; justify-content: space-between; font-family: var(--display); font-size: .72rem; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.meter .delta { font-family: var(--body); font-size: .9rem; letter-spacing: 0; text-transform: none; }
.meter .delta.up { color: #9ccf8f; } .meter .delta.down { color: #f0a08f; }
.meter .track { position: relative; height: 4px; background: var(--dim); }
.meter .fill { position: absolute; inset: 0 auto 0 0; background: var(--ink); transition: width .7s cubic-bezier(.2,.8,.2,1); }
.meter.danger .fill { background: var(--danger); }
.meter .ghost-mark { position: absolute; top: -5px; bottom: -5px; width: 2px; opacity: 0; transition: left .5s, opacity .3s; }
.meter .ghost-mark.l { background: var(--left); } .meter .ghost-mark.r { background: var(--right); }
.meter .ghost-mark.on { opacity: 1; }

/* table */
.table { display: grid; grid-template-columns: 1fr minmax(0, 500px) 1fr; align-items: center; gap: 28px; width: min(1000px, 100%); margin-top: 10px; }
.option { display: flex; flex-direction: column; gap: 4px; font-family: var(--display); font-size: .95rem; letter-spacing: .06em; min-height: 3em; justify-content: center; }
.option.left { text-align: right; align-items: flex-end; color: var(--left); }
.option.right { text-align: left; align-items: flex-start; color: var(--right); }
.option .verdict { font-size: .65rem; letter-spacing: .18em; text-transform: uppercase; color: var(--gold); opacity: 0; transition: opacity .4s; }
.option .verdict.on { opacity: 1; }
.card { background: linear-gradient(165deg, #f1e3c4 0%, #e2ceA4 100%); color: #2a2116; padding: 30px 34px; min-height: 210px; box-shadow: 0 30px 50px rgba(0,0,0,.6), inset 0 0 0 1px rgba(0,0,0,.1), inset 0 0 0 6px #ead9b6, inset 0 0 0 7px rgba(0,0,0,.15); transition: transform .6s cubic-bezier(.2,.8,.2,1); }
.card .speaker { font-family: var(--display); font-size: .7rem; letter-spacing: .2em; text-transform: uppercase; color: #6b5637; margin-bottom: 12px; }
.card .message { margin: 0; font-size: 1.3rem; line-height: 1.4; }
.card.swipe-left { transform: translateX(-10px) rotate(-1.5deg); }
.card.swipe-right { transform: translateX(10px) rotate(1.5deg); }
.card.thinking { animation: hover 1.2s ease-in-out infinite; }
@keyframes hover { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-5px) } }

/* decide */
.decide { display: grid; grid-template-columns: 3ch minmax(0, 520px) 3ch; align-items: center; gap: 14px; width: min(1000px, 100%); justify-content: center; }
.decide .pct { font-family: var(--display); font-size: .8rem; color: var(--muted); text-align: center; }
.decide .bar { position: relative; height: 6px; background: var(--right); }
.decide .fill { position: absolute; inset: 0 auto 0 0; width: 50%; background: var(--left); transition: width .8s cubic-bezier(.2,.8,.2,1); }
.decide .mid { position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--ink); opacity: .5; }
.readout { font-family: var(--display); font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); text-align: center; min-height: 1.2em; }

/* hand */
.hand { display: flex; justify-content: center; align-items: flex-start; width: 100%; padding: 6px 0 30px; }
.hand-card { width: 190px; height: 236px; margin: 0 -2px; padding: 16px 16px 12px; background: linear-gradient(165deg, #f1e3c4 0%, #e2cea4 100%); color: #2a2116; border: 0; text-align: left; font: inherit; display: flex; flex-direction: column; gap: 6px; cursor: pointer; box-shadow: 0 12px 24px rgba(0,0,0,.55), inset 0 0 0 1px rgba(0,0,0,.12); transform-origin: 50% 120%; transition: transform .2s, box-shadow .2s; position: relative; }
.hand-card:nth-child(1) { transform: rotate(-4deg) translateY(10px); }
.hand-card:nth-child(2) { transform: rotate(-2deg) translateY(3px); }
.hand-card:nth-child(3) { transform: rotate(0deg); }
.hand-card:nth-child(4) { transform: rotate(2deg) translateY(3px); }
.hand-card:nth-child(5) { transform: rotate(4deg) translateY(10px); }
.hand-card:hover:not(:disabled) { transform: translateY(-14px) rotate(0) scale(1.05); z-index: 5; box-shadow: 0 30px 40px rgba(0,0,0,.7), inset 0 0 0 1px rgba(0,0,0,.12); }
.hand-card:disabled { cursor: wait; filter: brightness(.7); }
.hand-card.exploit { box-shadow: 0 12px 24px rgba(0,0,0,.55), inset 0 0 0 2px var(--gold); }
.hand-card .speaker { font-family: var(--display); font-size: .6rem; letter-spacing: .16em; text-transform: uppercase; color: #6b5637; }
.hand-card .message { font-size: .88rem; line-height: 1.3; flex: 1; display: -webkit-box; -webkit-line-clamp: 5; max-height: calc(5 * 1.3 * .88rem); -webkit-box-orient: vertical; overflow: hidden; }
.hand-card .opts { display: flex; flex-direction: column; font-family: var(--display); font-size: .6rem; letter-spacing: .06em; border-top: 1px solid rgba(0,0,0,.15); padding-top: 6px; }
.hand-card .opts span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hand-card .opts .l { color: #1f5f96; } .hand-card .opts .r { color: #9a3a26; text-align: right; }

/* footer */
.tiny { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 12px; font-size: .85rem; color: var(--dim); }
.tiny .credit { color: var(--dim); }
.tiny #mock-banner { color: var(--gold); }

/* overlays */
.overlay { position: fixed; inset: 0; background: rgba(8,6,4,.94); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; gap: 14px; z-index: 10; }
.overlay h2 { font-family: var(--display); font-weight: 500; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); margin: 0; font-size: 1.4rem; }
.overlay .death { max-width: 46ch; font-size: 1.35rem; line-height: 1.45; margin: 0; }
.overlay .score { color: var(--muted); margin: 0; }
.overlay .actions { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.petition { display: flex; flex-direction: column; gap: 14px; width: min(560px, 100%); }
.petition input, .petition textarea { font: inherit; width: 100%; background: none; border: 0; border-bottom: 1px solid var(--dim); color: var(--ink); padding: 8px 2px; }
.petition input:focus, .petition textarea:focus { outline: none; border-bottom-color: var(--gold); }
.petition .two { display: flex; gap: 20px; }
.petition .fine { margin: 0; color: var(--muted); font-style: italic; font-size: .85rem; text-align: center; }
.overlay.raw pre { font: .75rem/1.4 ui-monospace, Menlo, monospace; color: var(--muted); max-height: 70vh; overflow: auto; text-align: left; width: min(720px, 100%); margin: 0; }

/* narrow */
@media (max-width: 760px) {
  html { font-size: 16px; }
  .crown #new-reign { position: static; }
  .crown .links { position: static; }
  .meters { gap: 14px; }
  .table { grid-template-columns: 1fr; gap: 10px; }
  .option.left, .option.right { align-items: center; text-align: center; min-height: 0; }
  .option.left { order: 2; } .card { order: 1; } .option.right { order: 3; }
  .card { padding: 22px; min-height: 0; }
  .card .message { font-size: 1.1rem; }
  .hand { justify-content: flex-start; overflow-x: auto; gap: 12px; padding: 10px 12vw 14px; scroll-snap-type: x mandatory; scroll-padding: 0 12vw; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .hand::-webkit-scrollbar { display: none; }
  .hand-card, .hand-card:nth-child(n) { transform: none; margin: 0; flex: 0 0 76vw; max-width: 320px; height: auto; min-height: 200px; scroll-snap-align: center; }
  .hand-card:hover:not(:disabled) { transform: none; }
  .hand-card .message { -webkit-line-clamp: 8; max-height: none; }
  .readout::after { content: ' · swipe the hand'; }
}

/* chronicle (eval page) */
.chronicle { gap: 34px; padding-bottom: 40px; }
.chronicle .crown .nature { max-width: 70ch; }
.chronicle .crown #back { position: absolute; right: 0; top: 0; }
.chronicle .empty { color: var(--gold); font-style: italic; margin: 0; text-align: center; }
.chronicle .no-data .chapter { opacity: .5; }
.ledger { display: flex; flex-wrap: wrap; justify-content: center; gap: 18px 44px; width: min(960px, 100%); }
.tile { text-align: center; min-width: 120px; }
.tile .value { font-family: var(--display); font-size: 2rem; color: var(--ink); line-height: 1.1; }
.tile .label { font-family: var(--display); font-size: .65rem; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.tile .note { font-size: .85rem; color: var(--dim); font-style: italic; }
.chapter { width: min(960px, 100%); display: flex; flex-direction: column; gap: 12px; }
.chapter h2 { font-family: var(--display); font-weight: 500; font-size: 1rem; letter-spacing: .22em; text-transform: uppercase; color: var(--gold); margin: 0; text-align: center; }
.chapter h2::before, .chapter h2::after { content: ' · '; color: var(--dim); }
.chapter .gloss { margin: 0 auto; max-width: 70ch; text-align: center; color: var(--muted); font-style: italic; font-size: .95rem; line-height: 1.45; }
.chapter .gloss em { color: var(--ink); font-style: normal; }
.chapter .sub { font-family: var(--display); font-size: .62rem; letter-spacing: .18em; text-transform: uppercase; color: var(--dim); margin: 4px 0 6px; }
.chapter .none { color: var(--dim); font-style: italic; margin: 0; }
.chapter .dim { color: var(--dim); }
.chapter .ledger { margin: 6px auto 0; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 28px 44px; align-items: start; }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(80px, 200px) 3.5ch; align-items: center; gap: 12px; font-size: .95rem; line-height: 1.3; padding: 3px 0; }
.hbar .track { position: relative; height: 4px; background: var(--dim); }
.hbar .fill { position: absolute; inset: 0 auto 0 0; background: var(--ink); border-radius: 0 2px 2px 0; transition: width .6s cubic-bezier(.2,.8,.2,1); }
.hbar .v { font-family: var(--display); font-size: .8rem; color: var(--muted); text-align: right; }
svg.hist { width: 100%; height: auto; display: block; }
svg.hist rect { fill: var(--ink); }
svg.hist rect:hover { fill: var(--gold); }
svg.hist .base { stroke: var(--dim); stroke-width: 1; }
svg.hist text { font-family: var(--display); font-size: 10px; fill: var(--muted); }
svg.hist .lab { fill: var(--ink); }
.scroll { overflow-x: auto; width: 100%; }
.chapter table { border-collapse: collapse; width: 100%; font-size: .95rem; }
.chapter th, .chapter td { text-align: left; padding: 8px 12px 8px 0; border-bottom: 1px solid #22190f; vertical-align: top; white-space: nowrap; }
.chapter thead th { font-family: var(--display); font-weight: 500; font-size: .6rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); white-space: normal; max-width: 9em; }
.chapter tbody th { font-family: var(--display); font-weight: 500; font-size: .8rem; letter-spacing: .08em; color: var(--ink); }
.chapter td.pet, .chapter .pet { white-space: normal; min-width: 22ch; max-width: 46ch; line-height: 1.35; }
.chapter .who { font-family: var(--display); font-size: .65rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-right: .3em; }
.chapter .opt { font-family: var(--display); font-size: .75rem; letter-spacing: .06em; color: var(--left); }
.chapter .opt.r { color: var(--right); }
.stack { display: flex; height: 10px; gap: 2px; width: 100%; }
.stack .seg { display: block; height: 100%; }
.lv0 { background: #a84a37; } .lv1 { background: var(--right); } .lv2 { background: var(--dim); } .lv3 { background: var(--left); } .lv4 { background: #3f7fb8; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-family: var(--display); font-size: .7rem; letter-spacing: .08em; color: var(--muted); margin-top: 8px; }
.legend .swatch { display: inline-block; width: 10px; height: 10px; margin-right: 6px; vertical-align: -1px; }
.contest { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-bottom: 1px solid #22190f; }
.contest .meta { color: var(--muted); font-size: .9rem; }
/* feed */
.entry { display: flex; flex-direction: column; gap: 5px; padding: 14px 0; border-bottom: 1px solid #22190f; }
.entry.fatal { border-left: 2px solid var(--gold); padding-left: 14px; }
.entry .head { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; font-family: var(--display); font-size: .72rem; letter-spacing: .1em; color: var(--ink); }
.entry .head .dim { font-size: .62rem; letter-spacing: .12em; }
.meters-line { display: flex; flex-wrap: wrap; gap: 4px 14px; font-family: var(--display); font-size: .68rem; letter-spacing: .1em; color: var(--muted); align-items: baseline; }
.meters-line .m.up { color: #9ccf8f; } .meters-line .m.down { color: #f0a08f; } .meters-line .m.danger { color: var(--danger); }
.meters-line .fate { color: var(--gold); text-transform: uppercase; }
.entry .pet { font-size: 1.02rem; }
.verdict-line { display: grid; grid-template-columns: minmax(0, 1fr) minmax(160px, 300px) minmax(0, 1fr); align-items: center; gap: 14px; }
.verdict-line .opt { font-size: .82rem; opacity: .6; text-align: right; }
.verdict-line .opt.r { text-align: left; }
.verdict-line .opt.chosen { opacity: 1; }
.verdict-line .opt.chosen::after { content: ' · chosen'; color: var(--gold); font-size: .62rem; letter-spacing: .16em; text-transform: uppercase; }
.minis { display: flex; flex-direction: column; gap: 3px; }
.mini { display: grid; grid-template-columns: 5ch 1fr 3.5ch; align-items: center; gap: 8px; }
.mini .k { font-family: var(--display); font-size: .58rem; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); text-align: right; }
.mini .track { position: relative; height: 4px; background: var(--right); }
.mini .fill { position: absolute; inset: 0 auto 0 0; background: var(--left); }
@media (max-width: 760px) {
  .chronicle .crown #back { position: static; }
  .two-col { grid-template-columns: 1fr; }
  .hbar { grid-template-columns: minmax(0, 1fr) 80px 3.5ch; font-size: .88rem; }
  .verdict-line { grid-template-columns: 1fr; gap: 6px; }
  .verdict-line .opt, .verdict-line .opt.r { text-align: left; }
  .ledger { gap: 14px 26px; }
  .tile { min-width: 100px; }
  .tile .value { font-size: 1.5rem; }
}

/* chronicle: one turn in full */
body.single .chronicle > .ledger, body.single .chapter:not(#single), body.single .empty { display: none; }
.entry .expand { align-self: flex-start; padding-left: 0; font-size: .65rem; }
.detail { display: flex; flex-direction: column; gap: 18px; margin-top: 8px; padding: 14px 0 6px; border-top: 1px dashed #2c2218; }
.detail .call { display: flex; flex-direction: column; gap: 8px; }
.detail h3 { font-family: var(--display); font-weight: 500; font-size: .8rem; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); margin: 0; }
.detail h3 .dim { font-size: .6rem; letter-spacing: .12em; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 3px 14px; margin: 0; font-size: .92rem; line-height: 1.4; }
.kv dt { font-family: var(--display); font-size: .62rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding-top: .25em; }
.kv dd { margin: 0; color: var(--ink); }
.kv dd .kv { margin-top: 2px; }
.qa { display: flex; flex-direction: column; gap: 4px; }
.qname { font-family: var(--display); font-size: .7rem; letter-spacing: .12em; color: var(--ink); }
.instr { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.4; }
.instr b { color: var(--ink); font-weight: 600; }
.detail .hbar { grid-template-columns: minmax(0, 1fr) minmax(80px, 240px) 3.5ch; }
.detail .opt.chosen { text-decoration: underline; text-underline-offset: 3px; }
.fgrid { display: grid; grid-template-columns: max-content 1fr 1fr; gap: 8px 16px; align-items: end; }
.fgrid .fname { font-family: var(--display); font-size: .62rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding-bottom: 14px; }
.fgrid .fcell { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.fgrid .fnum { font-family: var(--display); font-size: .62rem; letter-spacing: .08em; color: var(--ink); }
.detail details summary { cursor: pointer; list-style: none; font-family: var(--display); font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.detail details summary:hover { color: var(--gold); }
.detail details summary::before { content: '+ '; color: var(--dim); }
.detail details[open] summary::before { content: '− '; }
.detail pre { font: .72rem/1.4 ui-monospace, Menlo, monospace; color: var(--muted); max-height: 60vh; overflow: auto; margin: 6px 0 0; white-space: pre; }
.fate { color: var(--gold); }
.entry .head a { color: var(--muted); }
.entry .head a:hover { color: var(--gold); }
@media (max-width: 760px) {
  .kv { grid-template-columns: 1fr; gap: 0 }
  .detail .hbar { grid-template-columns: minmax(0, 1fr) 64px 3.5ch; }
  .kv dt { padding-top: .6em; }
  .fgrid { grid-template-columns: 1fr 1fr; }
  .fgrid .fname { grid-column: 1 / -1; padding-bottom: 0; }
  .fgrid > div:first-child { display: none; }
}
