/* Liquidated — visual kin of candlestick.gg, with margin-call menace. */
:root {
  --bg: #0b1020;
  --panel: #121a30;
  --panel-2: #182240;
  --ink: #e8ecf6;
  --ink-dim: #8fa0c2;
  --up: #2fbf9b;
  --down: #ef5350;
  --amber: #f5b942;
  --line: #223052;
  --danger: #ff3b30;
  --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;
}
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }

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(--down); text-shadow: 0 0 12px rgba(239, 83, 80, .55); }
.head-right { display: flex; gap: 8px; }
.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); }

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;
}
#puzzle-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;
}

#chart-wrap {
  position: relative;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 8px; height: 44vh; min-height: 270px; max-height: 420px;
  transition: box-shadow .25s;
}
#chart { width: 100%; height: 100%; display: block; }
#chart-wrap.glow-long { box-shadow: inset 0 0 22px rgba(47, 191, 155, .28), 0 0 14px rgba(47, 191, 155, .18); }
#chart-wrap.glow-short { box-shadow: inset 0 0 22px rgba(239, 83, 80, .28), 0 0 14px rgba(239, 83, 80, .18); }
#chart-wrap.pulse { animation: borderpulse 0.83s ease-in-out infinite; }
@keyframes borderpulse {
  0%, 100% { border-color: var(--line); }
  50% { border-color: var(--danger); box-shadow: inset 0 0 30px rgba(255, 59, 48, .35), 0 0 22px rgba(255, 59, 48, .3); }
}
#chart-wrap.shake { animation: shake .4s linear; }
@keyframes shake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-7px, 3px); }
  40% { transform: translate(6px, -4px); }
  60% { transform: translate(-5px, 2px); }
  80% { transform: translate(4px, -2px); }
}
#vig {
  position: absolute; inset: 0; border-radius: var(--radius); pointer-events: none;
  opacity: 0; transition: opacity .5s;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(180, 20, 20, .5) 100%);
}
#chart-wrap.vignette #vig { opacity: 1; }
#stamp, #banner {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  pointer-events: none; font-weight: 900; letter-spacing: 6px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
#stamp {
  color: #fff; font-size: clamp(26px, 8vw, 44px); transform: rotate(-8deg);
  text-shadow: 0 0 10px var(--danger), 0 0 30px rgba(255, 59, 48, .8);
}
#stamp.slam { animation: slam .4s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes slam {
  0% { transform: scale(2.8) rotate(-8deg); opacity: 0; }
  55% { transform: scale(.92) rotate(-8deg); opacity: 1; }
  100% { transform: scale(1) rotate(-8deg); opacity: 1; }
}
#banner {
  color: #fff; font-size: clamp(22px, 6.5vw, 36px);
  text-shadow: 0 0 10px rgba(255, 255, 255, .6), 0 0 26px rgba(47, 191, 155, .7);
  animation: bannerin .5s ease-out;
}
@keyframes bannerin { from { opacity: 0; transform: scale(.7); } to { opacity: 1; transform: scale(1); } }

#flash {
  position: fixed; inset: 0; pointer-events: none; z-index: 40; opacity: 0;
  box-shadow: inset 0 0 60px 18px rgba(255, 59, 48, .75);
}
#flash.go { animation: edgeflash .32s ease-out; }
@keyframes edgeflash { 0% { opacity: 0; } 25% { opacity: 1; } 100% { opacity: 0; } }
#flash.go-soft { animation: edgeflashsoft .3s ease-out; }
@keyframes edgeflashsoft { 0% { opacity: 0; } 25% { opacity: .35; } 100% { opacity: 0; } }

#lock-summary {
  text-align: center; margin-top: 10px; font-size: 13px; font-weight: 700;
  color: var(--ink-dim); letter-spacing: 1px;
}

.ask { text-align: center; margin: 14px 0 10px; font-size: 15px; color: var(--ink-dim); }
.ask b { color: var(--ink); }
.dir-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dir-btn {
  padding: 13px 0; font-size: 16px; font-weight: 800; letter-spacing: 3px;
  border-radius: 10px; cursor: pointer; background: var(--panel); color: var(--ink);
  border: 1px solid var(--line);
  transition: border-color .15s, box-shadow .15s, transform .06s;
}
.dir-btn:active { transform: scale(.97); }
.dir-btn.long.picked { border-color: var(--up); box-shadow: 0 0 0 1px var(--up), 0 0 14px rgba(47, 191, 155, .4); color: var(--up); }
.dir-btn.short.picked { border-color: var(--down); box-shadow: 0 0 0 1px var(--down), 0 0 14px rgba(239, 83, 80, .4); color: var(--down); }
.dir-btn:disabled { opacity: .5; cursor: default; }
.scoring-note { text-align: center; font-size: 11.5px; color: var(--ink-dim); margin-top: 8px; }

#lever-block { margin-top: 14px; }
.lev-row {
  display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px;
}
#lev-big { font-size: 30px; font-weight: 800; }
#lev-liq { font-size: 15px; font-weight: 700; color: var(--danger); }
#lev {
  -webkit-appearance: none; appearance: none; width: 100%; height: 34px;
  background: transparent; cursor: pointer; touch-action: pan-y;
}
#lev::-webkit-slider-runnable-track {
  height: 10px; border-radius: 6px; border: 1px solid var(--line);
  background: linear-gradient(90deg, #2fbf9b 0%, #f5b942 40%, #ef5350 70%, #ff3b30 100%);
}
#lev::-moz-range-track {
  height: 10px; border-radius: 6px; border: 1px solid var(--line);
  background: linear-gradient(90deg, #2fbf9b 0%, #f5b942 40%, #ef5350 70%, #ff3b30 100%);
}
#lev::-webkit-slider-thumb {
  -webkit-appearance: none; width: 28px; height: 28px; border-radius: 50%;
  margin-top: -10px; background: var(--ink); border: 3px solid var(--bg);
  box-shadow: 0 0 0 1px var(--line), 0 2px 8px rgba(0, 0, 0, .6);
}
#lev::-moz-range-thumb {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--ink); border: 3px solid var(--bg);
  box-shadow: 0 0 0 1px var(--line), 0 2px 8px rgba(0, 0, 0, .6);
}
#lev:disabled { opacity: .45; cursor: default; }
.lev-scale { display: flex; justify-content: space-between; font-size: 10px; color: var(--ink-dim); margin-top: 2px; }
.lock-btn {
  display: block; width: 100%; margin-top: 12px; padding: 13px 0;
  font-size: 16px; font-weight: 900; letter-spacing: 4px; border-radius: 10px;
  background: var(--danger); color: #fff; border: none; cursor: pointer;
  box-shadow: 0 0 16px rgba(255, 59, 48, .35);
}
.lock-btn:active { transform: scale(.98); }
.lock-btn:disabled { opacity: .4; box-shadow: none; cursor: default; }

#result-panel { margin-top: 14px; text-align: center; }
#result-verdict { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
#result-verdict .mono { font-size: 26px; }
#result-detail { font-size: 14px; color: var(--ink-dim); margin-bottom: 10px; }
#teach {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; font-size: 12.5px; text-align: left; margin-bottom: 10px;
  overflow-x: auto;
}
.teach-row { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; white-space: nowrap; }
.teach-row .k { color: var(--ink-dim); }
.teach-row .v { color: var(--ink); font-weight: 600; }
.teach-row .v .up { color: var(--up); }
.teach-row .v .dn { color: var(--down); }
#result-reveal {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; font-size: 14.5px; color: var(--ink-dim);
}
#result-reveal b { color: var(--ink); }
#result-reveal .fact { color: var(--amber); font-size: .9em; display: inline-block; margin-top: 6px; }
#result-reveal .prov { display: block; margin-top: 8px; font-size: 10.5px; color: var(--ink-dim); opacity: .75; }
#strip-row { margin-top: 10px; }
.strip-legend { text-align: center; font-size: 10.5px; line-height: 1.6; margin-bottom: 4px; }
.toy-rules { margin-top: 10px; font-size: 11px; color: var(--ink-dim); text-align: left; }
.toy-rules b { color: var(--ink-dim); }
.result-actions { display: flex; gap: 8px; justify-content: center; margin: 14px 0 6px; }
button.primary {
  background: var(--amber); color: #1a1408; border: none; font-weight: 800;
  border-radius: 10px; padding: 10px 22px; font-size: 15px; cursor: pointer;
}
#btn-see-stats, .modal-card button:not(.primary):not(.modal-close) {
  background: var(--panel); color: var(--ink); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 16px; font-size: 14px; cursor: pointer;
}
#countdown { font-size: 12.5px; color: var(--ink-dim); }

#season-over { margin-top: 24px; text-align: center; }
#season-over h2 { font-size: 20px; letter-spacing: 2px; margin-bottom: 8px; }
#season-over p { font-size: 14px; color: var(--ink-dim); max-width: 400px; margin: 0 auto; }
#btn-season-stats {
  background: var(--panel); color: var(--ink); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 16px; font-size: 14px; cursor: pointer;
}

.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; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.stat { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 4px; text-align: center; }
.stat b { display: block; font-size: 20px; }
.stat small { font-size: 10.5px; color: var(--ink-dim); }
.grid-row { font-size: 20px; letter-spacing: 2px; text-align: center; margin: 8px 0; }
.fine { font-size: 12px; color: var(--ink-dim); }

#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); line-height: 1.7;
}
footer a { color: var(--ink-dim); }
footer .fine { font-size: 10.5px; opacity: .8; }

@media (prefers-reduced-motion: reduce) {
  #chart-wrap.pulse, #chart-wrap.shake, #stamp.slam, #banner, #flash.go, #flash.go-soft { animation: none; }
}
@media (max-width: 400px) {
  #lev-big { font-size: 26px; }
  #stamp { letter-spacing: 3px; }
}
