:root {
  --night: #1a110b;
  --panel: #2b1d12;
  --panel-deep: #21160d;
  --line: #4a3522;
  --ink: #e7d8b6;
  --ink-dim: #b19a72;
  --flame: #f2b64b;
  --flame-hot: #ffe9a8;
  --wax: #ece0c3;
  --verdigris: #6c9a88;
  --blood: #b5442f;
  --serif: "Palatino Linotype", "Book Antiqua", Palatino, "Iowan Old Style", Georgia, serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--night); color: var(--ink); font-family: var(--serif); font-size: 16px; line-height: 1.45; }
[hidden] { display: none !important; }
button { font: inherit; color: var(--ink); background: var(--panel-deep); border: 1px solid var(--line); border-radius: 3px; padding: 5px 10px; cursor: pointer; }
button:hover { border-color: var(--flame); }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--flame); outline-offset: 1px; }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: #4a3218; border-color: var(--flame); }
button.quiet { background: transparent; border-color: transparent; color: var(--ink-dim); }
select, input { font: inherit; color: var(--ink); background: var(--panel-deep); border: 1px solid var(--line); border-radius: 3px; padding: 4px 6px; }
h1, h2, h3 { font-weight: normal; margin: 0; }
p { margin: 0 0 .6em; }
.app { display: grid; grid-template-columns: 72px 290px 1fr 270px; grid-template-rows: 48px 1fr; height: 100vh; }
.app.title { grid-template-columns: 72px 1fr; }
.app.title .side, .app.title .bands { display: none; }
.masthead { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 18px; padding: 0 16px; border-bottom: 1px solid var(--line); background: var(--panel-deep); }
.masthead h1 { font-size: 22px; letter-spacing: .04em; color: var(--wax); }
.masthead .days { color: var(--ink-dim); flex: 1; }
.masthead .days strong { color: var(--flame); font-weight: normal; }
.candle-col { border-right: 1px solid var(--line); background: var(--panel-deep); display: flex; flex-direction: column; align-items: center; padding: 10px 0; }
.candle-col svg { width: 56px; height: 100%; }
.stage { display: grid; grid-template-rows: 1fr minmax(120px, 190px); min-height: 0; }
.glass { position: relative; background: #120c07; min-height: 0; overflow: hidden; }
.glass canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: default; }
.glass .caption { position: absolute; left: 12px; top: 10px; color: var(--wax); text-shadow: 0 1px 2px #000; pointer-events: none; }
.glass .caption small { display: block; color: var(--ink-dim); }
.bands { border-left: 1px solid var(--line); background: var(--panel); padding: 6px 0; display: flex; flex-direction: column; gap: 0; overflow-y: auto; min-height: 0; }
.bands .band { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.bands .band:last-child { border-bottom: 0; }
.bands .muted { color: var(--ink-dim); font-size: 14px; }
.bands .band-title { flex-basis: 100%; color: var(--ink-dim); font-size: 15px; margin-bottom: 2px; }
.bands:empty { display: none; }
.journal { border-top: 1px solid var(--line); background: var(--panel-deep); overflow-y: auto; padding: 8px 14px; font-size: 15px; }
.journal p { margin: 0 0 4px; }
.journal p .d { color: var(--ink-dim); margin-right: 8px; }
.journal p:last-child { color: var(--wax); }
.side { border-right: 1px solid var(--line); background: var(--panel); overflow-y: auto; display: flex; flex-direction: column; }
.side section { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.side h2 { font-size: 15px; color: var(--ink-dim); margin-bottom: 6px; }
.member { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 5px 6px; border-radius: 3px; cursor: pointer; border: 1px solid transparent; }
.member:hover, .member.selected { border-color: var(--line); background: var(--panel-deep); }
.member.selected { border-color: var(--flame); }
.member .name { color: var(--wax); }
.member .name small { color: var(--ink-dim); margin-left: 6px; }
.member .down { color: var(--blood); }
.member .away { color: var(--verdigris); }
.bar { grid-column: 1 / -1; height: 5px; background: #0d0905; border-radius: 2px; overflow: hidden; display: flex; }
.bar i { display: block; height: 100%; }
.bar .hp { background: var(--blood); }
.bar .en { background: var(--verdigris); }
.bar + .bar { margin-top: 2px; }
.ledger p { margin: 0 0 4px; color: var(--ink-dim); }
.ledger p b { color: var(--wax); font-weight: normal; }
.purse { display: flex; justify-content: space-between; }
.purse span b { color: var(--flame); font-weight: normal; }
.items span { display: inline-block; margin: 0 8px 4px 0; color: var(--wax); }
.items span.want { color: var(--ink-dim); opacity: .6; }
.items span.have::before { content: '\2713\00a0'; color: var(--flame); }
.sheet { position: absolute; inset: 0; background: rgba(18, 12, 7, .96); overflow-y: auto; padding: 18px 24px; }
.sheet h2 { font-size: 20px; color: var(--wax); margin-bottom: 8px; }
.sheet table { border-collapse: collapse; margin: 6px 0 12px; }
.sheet tr.done td { color: var(--ink-dim); }
.sheet .have { color: var(--flame); }
.sheet .want { color: var(--ink-dim); }
.sheet .muted { color: var(--ink-dim); }
.sheet td, .sheet th { text-align: left; padding: 3px 12px 3px 0; font-weight: normal; color: var(--ink-dim); }
.sheet td:first-child { color: var(--ink); }
.title { position: absolute; inset: 0; display: grid; place-items: center; background: radial-gradient(ellipse at 50% 70%, #3b2612 0%, #120c07 65%); text-align: center; padding: 24px; }
.title .flame-big { width: 120px; height: 200px; }
.title h1 { font-size: 44px; color: var(--wax); letter-spacing: .06em; margin: 8px 0 2px; }
.title p.sub { color: var(--ink-dim); max-width: 520px; margin: 0 auto 18px; }
.title .choices { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-bottom: 14px; }
.title .choices button { padding: 10px 14px; text-align: left; max-width: 220px; }
.title .choices button small { display: block; color: var(--ink-dim); }
.title .choices button.on { border-color: var(--flame); background: #4a3218; }
.title .row { display: flex; gap: 10px; align-items: center; justify-content: center; margin-bottom: 8px; }
.notice { color: var(--flame); }
.error { color: var(--blood); }
.field-log { max-height: 84px; overflow-y: auto; font-size: 14px; color: var(--ink-dim); width: 100%; }
.field-log p { margin: 0; }
.flame { transform-origin: 50% 100%; animation: flicker 1.6s ease-in-out infinite alternate; }
@keyframes flicker { from { transform: scaleY(1) scaleX(1); opacity: .95; } to { transform: scaleY(1.12) scaleX(.92); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .flame { animation: none; } }
@media (max-width: 1100px) {
  .app { grid-template-columns: 48px 1fr; grid-template-rows: auto 1fr auto auto; }
  .masthead { flex-wrap: wrap; gap: 4px 12px; padding: 6px 10px; align-items: center; }
  .masthead h1 { font-size: 17px; }
  .masthead .days { flex-basis: auto; order: 5; width: 100%; font-size: 14px; }
  .masthead .quiet { padding: 2px 6px; font-size: 14px; }
  .stage { grid-column: 2; grid-row: 2; grid-template-rows: minmax(38vh, 1fr) minmax(60px, 100px); }
  .candle-col { grid-row: 2 / span 3; }
  .candle-col svg { width: 36px; }
  .bands { grid-column: 2; grid-row: 3; border-left: 0; border-top: 1px solid var(--line); flex-direction: row; flex-wrap: wrap; padding: 4px 8px; max-height: 24vh; }
  .bands .band { border-bottom: 0; border-right: 1px solid var(--line); padding: 4px 8px; }
  .bands .band-title { flex-basis: auto; margin: 0 4px 0 0; }
  .side { grid-column: 2; grid-row: 4; border-right: 0; border-top: 1px solid var(--line); max-height: 26vh; }
}
