:root {
  --bg: #0a0d10;
  --panel: rgba(13, 17, 21, .78);
  --line: rgba(255, 255, 255, .09);
  --ink: #f3efe7;
  --muted: #9aa7a0;
  --gold: #d9a441;
  --green: #2f6b46;
  --radius: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}
#scene:active { cursor: grabbing; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(16px) saturate(1.1);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .35);
}

.hud {
  position: fixed;
  top: calc(18px + env(safe-area-inset-top));
  left: calc(18px + env(safe-area-inset-left));
  width: min(330px, calc(100vw - 36px));
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.hud > * { pointer-events: auto; }

.panel { padding: 16px 16px 12px; }

.eyebrow {
  font-size: 10.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.hero { display: flex; align-items: baseline; gap: 7px; }
.hero-num {
  font-size: 44px;
  font-weight: 650;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.hero-unit { font-size: 14px; color: var(--muted); }
.hero-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px 12px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .k { font-size: 10.5px; color: var(--muted); }
.stat .k i { font-style: italic; }
.stat .v {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  font-weight: 560;
}

.chart-wrap { margin-top: 12px; }
#chart { width: 100%; height: 54px; display: block; overflow: visible; }
.chart-cap {
  display: flex; justify-content: space-between;
  font-size: 10px; color: var(--muted); margin-top: 4px;
}

.note {
  padding: 11px 13px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted);
}
.note b { color: var(--ink); font-weight: 600; }
.note .sep { opacity: .5; }

.controls {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(18px + env(safe-area-inset-bottom));
  width: min(760px, calc(100vw - 36px));
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.row { display: flex; gap: 14px; }
.row-actions { align-items: center; flex-wrap: wrap; }

.ctl { flex: 1; display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.ctl-k { font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; }
.ctl-k b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.ctl-k i { font-style: italic; }

.range-wrap { position: relative; }
.tick {
  position: absolute;
  top: 16px;
  width: 2px;
  height: 6px;
  margin-left: -1px;
  border-radius: 1px;
  background: var(--gold);
  opacity: .75;
  pointer-events: none;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 22px;
  background: transparent;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, .16);
}
input[type="range"]::-moz-range-track {
  height: 3px; border-radius: 3px; background: rgba(255,255,255,.16);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--ink);
  border: 2px solid var(--gold);
  margin-top: -6px;
}
input[type="range"]::-moz-range-thumb {
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--ink); border: 2px solid var(--gold);
}
input[type="range"]:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }

.btn {
  font: inherit;
  font-size: 12.5px;
  color: var(--ink);
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
  white-space: nowrap;
}
.btn:hover { background: rgba(255, 255, 255, .11); }
.btn:disabled { opacity: .4; cursor: default; }
.btn:disabled:hover { background: rgba(255, 255, 255, .06); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.btn-primary {
  background: var(--gold);
  color: #17130a;
  border-color: transparent;
  font-weight: 650;
}
.btn-primary:hover { background: #e7b455; }

.btn-toggle .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(255, 255, 255, .25);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .06);
  transition: background .15s ease, box-shadow .15s ease;
}
.btn-toggle[aria-pressed="true"] { border-color: rgba(217, 164, 65, .55); }
.btn-toggle[aria-pressed="true"] .dot {
  background: var(--gold);
  box-shadow: 0 0 0 3px rgba(217, 164, 65, .18);
}

.verdict {
  font-size: 13px;
  font-weight: 650;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-left: auto;
  min-width: 72px;
  text-align: right;
  opacity: 0;
  transition: opacity .2s ease;
}
.verdict.show { opacity: 1; }
.verdict.goal { color: #7fd6a2; }
.verdict.miss { color: #e88b7a; }

.credit {
  position: fixed;
  right: 16px;
  bottom: 16px;
  font-size: 10.5px;
  color: rgba(243, 239, 231, .34);
  pointer-events: none;
  text-align: right;
}

#veil {
  position: fixed;
  inset: 0;
  background: var(--bg);
  pointer-events: none;
  opacity: 1;
  transition: opacity .6s ease;
}
#veil.hide { opacity: 0; }

@media (max-width: 780px) {
  .hud { top: calc(10px + env(safe-area-inset-top)); left: calc(10px + env(safe-area-inset-left)); width: calc(100vw - 20px); }
  .panel { padding: 12px 13px 10px; }
  .hero-num { font-size: 34px; }
  .stats { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .stat .v { font-size: 13px; }
  .stat .k { font-size: 9px; }
  .chart-wrap { display: none; }
  .note { display: none; }
  .controls { bottom: calc(10px + env(safe-area-inset-bottom)); width: calc(100vw - 20px); padding: 10px 11px; }
  .row { gap: 10px; }
  .btn { font-size: 11.5px; padding: 8px 10px; }
  .credit { display: none; }
  .verdict { min-width: 0; font-size: 11px; }
}

@media (max-width: 460px) {
  .row-actions .btn { flex: 1 1 auto; justify-content: center; }
  .verdict { flex-basis: 100%; text-align: center; margin-left: 0; }
}
