:root {
  --glaze: #16100c; --glaze-2: #241812; --glaze-3: #33231a;
  --terra: #c4673a; --terra-d: #9a4a28; --terra-l: #e0956a;
  --bone: #eedcb6; --cream: #f3e6c8; --muted: #b9a68a;
  --gold: #d9a441; --ember: #e2582a; --good: #b7c48a; --bad: #e46a4a;
  --display: 'Cinzel', 'Trajan Pro', Georgia, serif;
  --body: 'Alegreya', Georgia, 'Times New Roman', serif;
  --r: 4px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  background: radial-gradient(120% 90% at 50% 45%, #3a2216 0%, #1a100b 55%, #0a0605 100%);
  color: var(--cream); font: 17px/1.4 var(--body); -webkit-font-smoothing: antialiased;
  user-select: none; -webkit-user-select: none; touch-action: none;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; outline: none; }

/* ---------- panels with a Greek key edge ---------- */
.panel, .sheet {
  background: rgba(22, 16, 12, 0.94); border: 1px solid var(--terra-d); border-radius: var(--r);
  box-shadow: 0 10px 40px rgba(0,0,0,.55);
}
.key { position: relative; padding-top: 22px; padding-bottom: 22px; }
.key::before, .key::after {
  content: ''; position: absolute; left: 8px; right: 8px; height: 12px;
  background: url(/img/key.svg) repeat-x center / auto 12px; opacity: .9; pointer-events: none;
}
.key::before { top: 6px; } .key::after { bottom: 6px; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; letter-spacing: .06em; margin: 0; color: var(--terra-l); }
h2 { font-size: 17px; } h3 { font-size: 13px; text-transform: uppercase; color: var(--terra); margin-bottom: 6px; }
.muted { color: var(--muted); margin: 0; font-size: 15px; }

/* ---------- HUD ---------- */
#hud {
  position: fixed; top: 10px; left: 10px; right: 10px; display: flex; gap: 14px; align-items: center; justify-content: space-between;
  padding: 8px 12px; background: rgba(22,16,12,.9); border: 1px solid var(--terra-d); border-radius: var(--r); z-index: 5;
}
.hud-day { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand { font-family: var(--display); font-weight: 900; color: var(--terra); letter-spacing: .08em; white-space: nowrap; }
.day { font-family: var(--display); color: var(--bone); white-space: nowrap; }
.sundial { width: 90px; height: 8px; border-radius: 4px; background: var(--glaze-3); overflow: hidden; display: inline-block; }
.sundial i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--terra)); }
.hud-stats { display: flex; gap: 18px; align-items: center; flex: 1; justify-content: center; min-width: 0; }
.stat { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.stat b { font-family: var(--display); font-size: 18px; color: var(--bone); min-width: 26px; }
.coin { width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #f3d27a, var(--gold) 55%, #8a6420); box-shadow: inset 0 0 0 2px #9b7426; }
.lbl { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-family: var(--display); }
.bar { width: 110px; height: 9px; border-radius: 5px; background: var(--glaze-3); overflow: hidden; display: inline-block; }
.bar i { display: block; height: 100%; width: 0; background: var(--terra); transition: width .3s; }
.meter.gold .bar i { background: var(--gold); }
#unrestFill.warn { background: var(--ember); } #unrestFill.crit { background: #ff3b1f; animation: pulse .6s infinite alternate; }
@keyframes pulse { to { opacity: .55; } }
.hud-ctl { display: flex; gap: 6px; align-items: center; }
.hud-ctl button, .side-body button, .sheet button, .card button {
  background: var(--glaze-2); border: 1px solid var(--terra-d); border-radius: var(--r); padding: 6px 10px; color: var(--bone);
}
.hud-ctl button:hover, .side-body button:hover:not(:disabled), .sheet button:hover:not(:disabled), .card button:hover:not(:disabled) { border-color: var(--terra-l); background: var(--glaze-3); }
.hud-ctl .ic { width: 36px; padding: 6px 0; font-family: var(--display); }
.hud-ctl .spd.on { background: var(--terra); color: var(--glaze); border-color: var(--terra); font-weight: 700; }
.gold-btn { border-color: var(--gold) !important; color: var(--gold) !important; font-family: var(--display); font-weight: 700; }
#btnSound.off { opacity: .5; text-decoration: line-through; }
button:disabled { opacity: .45; cursor: not-allowed; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- judges' bench ---------- */
#bench { position: fixed; left: 10px; bottom: 10px; width: 360px; padding-left: 16px; padding-right: 16px; z-index: 4; }
.bench-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.queue { font-size: 14px; color: var(--muted); }
.card { min-height: 150px; }
.card .who { font-family: var(--display); font-size: 20px; color: var(--bone); }
.card .from { color: var(--muted); font-style: italic; margin-bottom: 8px; }
.card ul { margin: 0 0 10px; padding: 0; list-style: none; }
.card li { padding: 4px 0 4px 18px; position: relative; }
.card li::before { content: ''; position: absolute; left: 2px; top: 12px; width: 7px; height: 7px; background: var(--terra); transform: rotate(45deg); }
.card .obol { font-size: 14px; color: var(--gold); }
.card .obol.none { color: var(--muted); }
.verdicts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.verdicts button { font-family: var(--display); font-weight: 700; padding: 9px 4px; font-size: 14px; }
.v-elysium { border-color: var(--gold) !important; color: var(--gold) !important; }
.v-asphodel { color: var(--bone) !important; }
.v-tartarus { border-color: var(--ember) !important; color: var(--ember) !important; }
.verdicts kbd { display: block; font: 11px var(--body); color: var(--muted); }
.card .empty { color: var(--muted); font-style: italic; padding-top: 30px; text-align: center; }
.card.flash-good { animation: good .5s; } .card.flash-bad { animation: bad .5s; }
@keyframes good { 0% { box-shadow: inset 0 0 0 999px rgba(217,164,65,.18); } }
@keyframes bad { 0% { box-shadow: inset 0 0 0 999px rgba(228,106,74,.25); } }
.toggle { display: flex; gap: 8px; align-items: center; margin-top: 10px; font-size: 15px; color: var(--muted); cursor: pointer; }
.toggle input { accent-color: var(--terra); width: 16px; height: 16px; }

/* ---------- side panel ---------- */
#side { position: fixed; right: 10px; top: 74px; width: 290px; padding-left: 14px; padding-right: 14px; z-index: 4; max-height: calc(100vh - 90px); overflow: auto; }
.side-toggle { display: none; }
.row { padding: 8px 0; border-bottom: 1px solid rgba(196,103,58,.25); }
.row:last-child { border-bottom: 0; }
.meter-line { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 14px; color: var(--muted); }
.meter-line .bar { width: 140px; }
.bar.ember i { background: var(--ember); }
#btnFeed em, .cost { font-style: normal; color: var(--gold); margin-left: 4px; }
#btnFeed em::before, .cost::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--gold); margin-right: 4px; vertical-align: -1px; }
.dlist { list-style: none; margin: 0; padding: 0; }
.dlist li { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; align-items: center; padding: 4px 0; }
.dlist .nm { font-family: var(--display); font-size: 14px; }
.dlist .nm.full { color: var(--bad); }
.dlist .cap { grid-column: 1; height: 6px; border-radius: 3px; background: var(--glaze-3); overflow: hidden; }
.dlist .cap i { display: block; height: 100%; background: var(--bone); }
.dlist button { grid-row: 1 / span 2; grid-column: 2; font-size: 13px; padding: 5px 8px; }

/* ---------- floating labels, ticker ---------- */
#labels { position: fixed; inset: 0; pointer-events: none; z-index: 2; }
.lab {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -100%); white-space: nowrap; text-align: center;
  font-family: var(--display); font-size: 13px; letter-spacing: .08em; color: var(--bone);
  background: rgba(22,16,12,.78); border: 1px solid rgba(196,103,58,.55); padding: 2px 8px; border-radius: 3px;
}
.lab small { display: block; font-family: var(--body); letter-spacing: 0; color: var(--muted); font-size: 12px; }
.lab.full { border-color: var(--bad); }
.lab.full small { color: var(--bad); }
.lab.hungry { border-color: var(--ember); color: var(--ember); }
#ticker { position: fixed; left: 50%; transform: translateX(-50%); bottom: 14px; width: min(520px, 44vw); display: flex; flex-direction: column; gap: 4px; align-items: center; pointer-events: none; z-index: 3; }
.tick { background: rgba(22,16,12,.86); border-left: 3px solid var(--terra); padding: 4px 10px; border-radius: 3px; font-size: 15px; animation: tickIn .25s, tickOut .6s 4.4s forwards; }
.tick.good { border-color: var(--gold); } .tick.bad { border-color: var(--bad); color: #f2c6b6; }
@keyframes tickIn { from { opacity: 0; transform: translateY(6px); } }
@keyframes tickOut { to { opacity: 0; } }
#pausedTag { position: fixed; top: 76px; left: 50%; transform: translateX(-50%); font-family: var(--display); letter-spacing: .3em; color: var(--gold); background: rgba(22,16,12,.85); padding: 4px 16px; border: 1px solid var(--gold); border-radius: 3px; z-index: 3; }

/* ---------- modal sheets ---------- */
.modal { position: fixed; inset: 0; background: rgba(8,5,3,.6); display: grid; place-items: center; z-index: 20; padding: 16px; backdrop-filter: blur(2px); }
.sheet { width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; padding-left: 0; padding-right: 0; }
.sheet h2 { padding: 0 26px; }
#modalBody { overflow: auto; padding: 0 26px 4px; scrollbar-color: var(--terra-d) transparent; scrollbar-width: thin; }
#side { scrollbar-color: var(--terra-d) transparent; scrollbar-width: thin; }
.sheet h2 { font-size: 24px; margin: 8px 0 10px; color: var(--terra-l); }
.sheet p { margin: 0 0 12px; }
.sheet .deeds { margin: 0 0 14px; padding-left: 18px; }
.choices { display: grid; gap: 8px; margin-top: 8px; }
.choices button { text-align: left; padding: 10px 12px; font-size: 16px; }
.choices button .cost { float: right; }
.btn-row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
.btn-row .primary, .choices .primary { background: var(--terra); color: var(--glaze); border-color: var(--terra); font-family: var(--display); font-weight: 700; }
.btn-row .primary:hover { background: var(--terra-l) !important; }
.ledger { width: 100%; border-collapse: collapse; margin: 6px 0 12px; font-size: 16px; }
.ledger td { padding: 4px 2px; border-bottom: 1px solid rgba(196,103,58,.2); }
.ledger td:last-child { text-align: right; font-family: var(--display); color: var(--bone); }
.hades { font-style: italic; color: var(--bone); border-left: 3px solid var(--gold); padding-left: 12px; margin: 10px 0 4px !important; }
.hades-sig { font-family: var(--display); color: var(--gold); font-size: 13px; letter-spacing: .1em; margin-bottom: 4px !important; }
.shop h3 { margin-top: 12px; }
.item { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 8px 0; border-bottom: 1px solid rgba(196,103,58,.18); align-items: center; }
.item .nm { font-family: var(--display); font-size: 15px; color: var(--bone); }
.item .nm small { font-family: var(--body); color: var(--muted); margin-left: 6px; }
.item .ds { grid-column: 1; color: var(--muted); font-size: 14px; }
.item button { grid-row: 1 / span 2; grid-column: 2; min-width: 96px; }
.item .need { font-size: 12px; color: var(--bad); display: block; }
.hint-step { font-family: var(--display); font-size: 12px; color: var(--muted); letter-spacing: .1em; }

/* ---------- title ---------- */
.title { position: fixed; inset: 0; display: grid; place-items: center; z-index: 30; background: radial-gradient(80% 70% at 50% 50%, rgba(22,16,12,.55), rgba(10,6,5,.92)); padding: 20px; }
.title-inner { text-align: center; max-width: 640px; }
.kicker { font-family: var(--display); letter-spacing: .3em; text-transform: uppercase; color: var(--terra); font-size: 13px; margin: 0 0 8px; }
.title h1 { font-size: clamp(48px, 10vw, 104px); font-weight: 900; color: var(--terra); line-height: 1; letter-spacing: .04em; text-shadow: 0 4px 0 #000; }
.title h1 .amp { color: var(--gold); font-weight: 500; }
.title h1::after { content: ''; display: block; height: 16px; margin: 18px auto 0; width: min(420px, 80%); background: url(/img/key.svg) repeat-x center / auto 16px; }
.tag { font-family: var(--display); color: var(--bone); font-size: 20px; margin: 18px 0 8px; letter-spacing: .06em; }
.sub { color: var(--muted); margin: 0 auto 24px; max-width: 520px; }
.title-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
a.big { text-decoration: none; display: inline-block; }
.big { font-family: var(--display); font-weight: 700; font-size: 18px; letter-spacing: .08em; padding: 12px 28px; border-radius: var(--r); background: var(--terra); color: var(--glaze); border: 1px solid var(--terra); }
.big:hover { background: var(--terra-l); }
.big.ghost { background: transparent; color: var(--terra-l); }
.big.ghost:hover { background: rgba(196,103,58,.15); }
.fine { color: var(--muted); font-size: 14px; margin-top: 22px; }

/* ---------- smaller screens ---------- */
@media (max-width: 980px) {
  .brand { display: none; }
  .bar { width: 70px; }
  .hud-stats { gap: 10px; }
  #ticker { width: 90vw; bottom: auto; top: 120px; }
}
@media (max-width: 760px) {
  body { font-size: 15px; }
  #hud { flex-wrap: wrap; top: 6px; left: 6px; right: 6px; padding: 6px 8px; gap: 6px; }
  .hud-day { order: 1; } .hud-ctl { order: 2; } .hud-stats { order: 3; flex-basis: 100%; justify-content: space-between; }
  .hud-ctl .spd[data-speed="3"] { display: none; }
  .hud-ctl button { padding: 5px 7px; } .hud-ctl .ic { width: 30px; }
  .lbl { font-size: 10px; }
  #rank { display: none; }
  .bar { width: 64px; }
  .sundial { width: 60px; }
  #bench { left: 6px; right: 6px; bottom: 6px; width: auto; padding-top: 18px; padding-bottom: 14px; }
  #bench .key::after, #bench::after { display: none; }
  .card { min-height: 0; }
  .card .who { font-size: 17px; }
  .card li { padding: 2px 0 2px 16px; font-size: 14px; }
  .card li::before { top: 9px; }
  .bench-head h2 { font-size: 14px; }
  #bench .toggle { margin-top: 6px; font-size: 13px; }
  #side { right: 6px; left: auto; bottom: auto; top: 122px; width: min(280px, calc(100vw - 12px)); padding: 8px 10px; max-height: calc(100vh - 360px); }
  #side::before, #side::after { display: none; }
  .side-toggle { display: block; width: 100%; background: var(--glaze-2); border: 1px solid var(--terra-d); border-radius: var(--r); padding: 6px; font-family: var(--display); color: var(--terra-l); }
  #side.closed { width: auto; }
  #side.closed .side-body { display: none; }
  .lab { font-size: 11px; padding: 1px 5px; } .lab small { font-size: 10px; }
  #ticker { top: 176px; }
  #pausedTag { top: 176px; }
}
