/* Solvent — visual kinship with candlestick.gg: same dark room, same neon
   accents; its own personality: the amber of chips, the green of a live band,
   the red of a burned stake. */
:root {
  --bg: #0b1020;
  --panel: #121a30;
  --panel-2: #182240;
  --ink: #e8ecf6;
  --ink-dim: #8fa0c2;
  --up: #2fbf9b;
  --down: #ef5350;
  --amber: #f5b942;
  --line: #223052;
  --radius: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

header { border-bottom: 1px solid var(--line); }
.head-inner {
  max-width: 560px; margin: 0 auto; padding: 10px 14px;
  display: flex; align-items: center; justify-content: space-between;
}
h1 { font-size: 20px; letter-spacing: 3px; font-weight: 800; }
h1 span { color: var(--amber); }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--panel); color: var(--ink); border: 1px solid var(--line);
  font-size: 16px; cursor: pointer;
}
.icon-btn:active { transform: scale(.95); }

.acct-strip {
  max-width: 560px; margin: 0 auto; padding: 2px 14px 10px;
  display: flex; align-items: center; gap: 12px;
}
.acct-chips b { font-size: 24px; font-weight: 800; color: var(--amber); }
.acct-chips small { display: block; font-size: 10px; color: var(--ink-dim); letter-spacing: 1px; }
#spark { flex: 1; height: 30px; min-width: 60px; }
.acct-line { font-size: 12px; color: var(--ink-dim); text-align: right; white-space: nowrap; }

main { flex: 1; width: 100%; max-width: 560px; margin: 0 auto; padding: 12px 14px 28px; }

.puzzle-meta {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--ink-dim); margin-bottom: 8px;
}
#day-num { font-weight: 700; color: var(--ink); }
.chip {
  margin-left: auto; background: var(--panel); border: 1px solid var(--line);
  border-radius: 99px; padding: 2px 10px; font-size: 13px;
}

#q-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; text-align: center; margin-bottom: 14px;
  animation: slidein .35s ease-out;
}
@keyframes slidein { from { transform: translateY(-8px); opacity: 0; } }
.era-stamp {
  font-size: 36px; font-weight: 900; letter-spacing: 6px; color: var(--amber);
  text-shadow: 0 0 18px rgba(245, 185, 66, .35);
}
.q-cls { font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: var(--ink-dim); margin: 2px 0 8px; }
.q-text { font-size: 16.5px; }
.unit-chip {
  display: inline-block; margin-top: 8px; font-size: 11px; letter-spacing: 1px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 99px;
  padding: 2px 12px; color: var(--ink-dim); text-transform: uppercase;
}

.step-label { font-size: 13.5px; color: var(--ink-dim); text-align: center; margin-bottom: 10px; }

#bandbox { position: relative; padding: 0 8px; }
#hist-caption {
  font-size: 10.5px; color: var(--ink-dim); text-align: center;
  margin: 0 0 2px; letter-spacing: .4px;
}
#band-hist { display: block; width: 100%; height: 54px; }
#bandtrack {
  position: relative; height: 44px; margin-top: 2px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  touch-action: none; cursor: pointer;
}
#bandfill {
  position: absolute; top: 0; bottom: 0;
  background: rgba(47, 191, 155, .28);
  border-left: 2px solid var(--up); border-right: 2px solid var(--up);
}
.handle {
  position: absolute; top: 50%; transform: translate(-50%, -50%);
  width: 30px; height: 42px; border-radius: 9px;
  background: var(--up); border: none; cursor: grab;
  box-shadow: 0 2px 8px rgba(0,0,0,.5); z-index: 2; touch-action: none;
}
.handle:focus-visible { outline: 2px solid var(--amber); }
.handle::after { content: "⋮⋮"; color: #06251c; font-size: 11px; letter-spacing: -2px; }
#band-scale {
  display: flex; justify-content: space-between;
  font-size: 10.5px; color: var(--ink-dim); margin-top: 4px;
}
.band-range { text-align: center; font-size: 17px; font-weight: 700; margin: 10px 0 8px; }

.readout { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ro {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 4px; text-align: center;
}
.ro small { display: block; font-size: 10px; color: var(--ink-dim); }
.ro b { font-size: 17px; }
.fine-note { text-align: center; font-size: 12px; color: var(--amber); margin-top: 8px; }

button.primary {
  background: var(--amber); color: #1a1408; border: none; font-weight: 800;
  border-radius: 10px; padding: 12px 22px; font-size: 15px; cursor: pointer;
}
button.primary:active { transform: scale(.97); }
button.primary:disabled { opacity: .4; cursor: not-allowed; }
.wide { display: block; width: 100%; margin-top: 14px; }
.row-2 { display: flex; gap: 8px; margin-top: 14px; }
.row-2 .primary { flex: 1; }
.row-2 button:not(.primary), .result-actions button:not(.primary) {
  background: var(--panel); color: var(--ink); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 16px; font-size: 14px; cursor: pointer;
}

#stake-slider { width: 100%; accent-color: var(--amber); height: 34px; }
.stake-line { text-align: center; font-size: 16px; font-weight: 700; margin: 4px 0 10px; }
.outcomes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.oc {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 4px; text-align: center;
}
.oc small { display: block; font-size: 10.5px; color: var(--ink-dim); }
.oc b { font-size: 19px; }
.oc-win b { color: var(--up); }
.oc-lose b { color: var(--down); }
.warn {
  margin-top: 10px; text-align: center; font-size: 13px; color: var(--down);
  border: 1px solid rgba(239, 83, 80, .5); border-radius: 10px; padding: 8px;
}

#tape-wrap {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 8px; height: 34vh; min-height: 200px; max-height: 320px;
}
#tape { width: 100%; height: 100%; display: block; }
#counter-row { text-align: center; margin: 10px 0 4px; }
#counter { font-size: 42px; font-weight: 900; color: var(--amber); font-variant-numeric: tabular-nums; }
#counter-unit { font-size: 14px; color: var(--ink-dim); margin-left: 8px; }

#stage-result { margin-top: 14px; text-align: center; }
#verdict { font-size: 22px; font-weight: 800; margin-bottom: 10px; }
#verdict .delta-up { color: var(--up); }
#verdict .delta-down { color: var(--down); }
#res-axis-wrap { margin: 0 4px 12px; }
#res-axis {
  position: relative; height: 26px; border-radius: 8px;
  background: var(--panel); border: 1px solid var(--line);
}
#res-band {
  position: absolute; top: 0; bottom: 0;
  background: rgba(47, 191, 155, .3);
  border-left: 2px solid var(--up); border-right: 2px solid var(--up);
}
#res-pin {
  position: absolute; top: -8px; bottom: -4px; width: 3px; margin-left: -1.5px;
  background: var(--amber); box-shadow: 0 0 10px var(--amber);
  animation: pindrop .5s ease-out;
}
@keyframes pindrop { from { transform: translateY(-18px); opacity: 0; } }
#res-axis-labels {
  display: flex; justify-content: space-between;
  font-size: 10.5px; color: var(--ink-dim); margin-top: 3px;
}
#res-detail {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; font-size: 14.5px; color: var(--ink-dim); text-align: left;
}
#res-detail b { color: var(--ink); }
.fact { color: var(--amber); font-size: .92em; display: inline-block; margin-top: 6px; }
#prov { margin-top: 10px; font-size: 12px; color: var(--ink-dim); text-align: left; }
#prov summary { cursor: pointer; }
#prov-body { padding: 8px 2px; word-break: break-all; font-family: ui-monospace, monospace; font-size: 11px; }
#rescue-note { margin-top: 10px; font-size: 13px; color: var(--amber); }
.result-actions { display: flex; gap: 8px; justify-content: center; margin: 14px 0 6px; flex-wrap: wrap; }
#countdown { font-size: 12.5px; color: var(--ink-dim); }

.float-delta {
  position: fixed; z-index: 40; font-weight: 900; font-size: 20px; pointer-events: none;
  animation: floatup 1.3s ease-out forwards;
}
@keyframes floatup { to { transform: translateY(-46px); opacity: 0; } }

#obituary {
  position: fixed; inset: 0; z-index: 25; background: rgba(3, 5, 12, .93);
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
#obit-card {
  background: #0d0a14; border: 1px solid #3a2b2b; border-radius: 16px;
  max-width: 380px; width: 100%; padding: 24px 20px; text-align: center;
  box-shadow: 0 0 60px rgba(239, 83, 80, .15);
}
#obit-skull { font-size: 40px; }
#obit-card h2 { font-size: 18px; letter-spacing: 2px; color: var(--down); margin: 8px 0 14px; }
#obit-spark { width: 100%; height: 80px; }
#obit-text { font-size: 14px; color: var(--ink-dim); margin: 12px 0 16px; }
#obit-text b { color: var(--ink); }
#obit-actions { display: flex; flex-direction: column; gap: 8px; }
#obit-actions button {
  border-radius: 10px; padding: 12px; font-size: 14.5px; cursor: pointer;
  background: var(--panel); color: var(--ink); border: 1px solid var(--line);
}
#obit-actions button.primary { background: var(--amber); color: #1a1408; border: none; font-weight: 800; }

.modal {
  position: fixed; inset: 0; background: rgba(4, 8, 18, .72);
  display: flex; align-items: center; justify-content: center; padding: 18px; z-index: 20;
}
.modal-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  max-width: 440px; width: 100%; max-height: 82dvh; overflow-y: auto;
  padding: 20px; position: relative;
}
.modal-card h2 { font-size: 18px; margin-bottom: 10px; }
.modal-card p { font-size: 14.5px; color: var(--ink-dim); margin-bottom: 10px; }
.modal-card p b { color: var(--ink); }
.modal-card .fine { font-size: 12px; }
.modal-close {
  position: absolute; top: 10px; right: 12px; background: none; border: none;
  color: var(--ink-dim); font-size: 22px; cursor: pointer;
}
.modal-ok { width: 100%; margin-top: 6px; }

.career {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px;
}
.career .stat {
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 4px; text-align: center;
}
.career .stat b { display: block; font-size: 19px; }
.career .stat small { font-size: 10px; color: var(--ink-dim); }
.blot-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 2px; border-bottom: 1px solid var(--line); font-size: 13.5px;
}
.blot-row .bd { color: var(--ink-dim); min-width: 44px; }
.blot-row .bdelta-up { color: var(--up); font-weight: 700; }
.blot-row .bdelta-down { color: var(--down); font-weight: 700; }

#toast {
  position: fixed; bottom: 74px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--bg); border-radius: 10px;
  padding: 9px 16px; font-size: 14px; font-weight: 600; z-index: 30;
}

footer {
  text-align: center; font-size: 12px; color: var(--ink-dim);
  padding: 12px; border-top: 1px solid var(--line);
}
footer a { color: var(--ink-dim); }

@media (max-width: 380px) {
  .era-stamp { font-size: 30px; }
  #counter { font-size: 34px; }
}
