:root {
  --ink: #eaf2ff;
  --ink-dim: #aebfda;
  --navy: #0a1730;
  --panel: rgba(12, 24, 48, 0.82);
  --panel-2: rgba(20, 38, 66, 0.7);
  --line: rgba(140, 180, 240, 0.22);
  --aurora: #5ce6b0;
  --aurora-2: #7aa6ff;
  --ember: #ff7a3d;
  --gold: #ffd27a;
  --bad: #ff6b6b;
  --good: #45e08a;
  --font: 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--navy); font-family: var(--font); color: var(--ink); }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
button { font-family: inherit; }

/* ---- Boot splash --------------------------------------------------------- */
.boot { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; background: radial-gradient(120% 120% at 50% 30%, #142847 0%, #0a1730 70%); transition: opacity .5s; }
.boot.gone { opacity: 0; pointer-events: none; }
.boot-dog { font-size: 54px; animation: bob 1.1s ease-in-out infinite; }
.boot-text { color: var(--ink-dim); letter-spacing: .12em; text-transform: uppercase; font-size: 13px; }
@keyframes bob { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-10px) } }

/* ---- Overlays ------------------------------------------------------------ */
.overlay { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center;
  padding: 24px; text-align: center; }
.overlay.hidden { display: none; }
.tag { color: var(--gold); letter-spacing: .22em; text-transform: uppercase; font-size: 12px; font-weight: 700; }

.btn { cursor: pointer; border: none; border-radius: 14px; padding: 14px 30px; font-size: 18px; font-weight: 800; color: #2a1605;
  background: linear-gradient(180deg, #ffe6b0, var(--ember)); box-shadow: 0 7px 0 #9c4418, 0 14px 24px #0008; transition: transform .08s, box-shadow .08s; }
.btn:active { transform: translateY(5px); box-shadow: 0 2px 0 #9c4418, 0 6px 14px #0007; }
.btn-big { font-size: 22px; padding: 16px 40px; }
.btn-ghost { background: var(--panel-2); color: var(--ink); box-shadow: 0 6px 0 #0b1c34, 0 10px 18px #0006; }
.btn-ghost:active { box-shadow: 0 2px 0 #0b1c34; }

.keys { color: var(--ink-dim); font-size: 13px; margin-top: 4px; }
.keys kbd { background: #1b2c4c; border: 1px solid var(--line); border-bottom-width: 3px; border-radius: 7px; padding: 2px 9px; margin: 0 1px; color: var(--ink); font-size: 12px; }

/* ---- Title --------------------------------------------------------------- */
.title-overlay { align-items: flex-end; justify-content: flex-start; padding: 0; }
.title-inner { margin: 0 0 6vh 6vw; text-align: left; max-width: min(560px, 88vw);
  display: flex; flex-direction: column; gap: 14px; align-items: flex-start;
  background: linear-gradient(180deg, transparent, rgba(8,18,38,.35)); }
.game-title { margin: 2px 0; font-size: clamp(46px, 11vw, 104px); line-height: .86; font-weight: 900; letter-spacing: -.02em;
  color: #fff; text-shadow: 0 4px 30px rgba(90,160,255,.5); }
.game-title span { display: block; font-size: .52em; letter-spacing: .04em;
  background: linear-gradient(90deg, var(--aurora), var(--aurora-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.title-sub { color: var(--ink-dim); font-size: clamp(14px, 2.2vw, 17px); line-height: 1.55; margin: 0; max-width: 460px; }
.credit { color: #7e93b8; font-size: 12.5px; font-style: italic; }

/* ---- Draft --------------------------------------------------------------- */
.draft-overlay { flex-direction: column; align-items: stretch; justify-content: space-between; padding: 18px clamp(12px, 3vw, 34px);
  background: linear-gradient(180deg, rgba(8,16,34,.78), rgba(8,16,34,.32) 30%, rgba(8,16,34,.32) 70%, rgba(8,16,34,.82)); }
.draft-head h2 { margin: 0; font-size: clamp(20px, 3.4vw, 30px); }
.draft-sub { color: var(--ink-dim); font-size: 13.5px; margin-top: 2px; }
.draft-cols { flex: 1; display: grid; grid-template-columns: minmax(190px, 240px) 1fr minmax(250px, 320px); gap: 14px; min-height: 0; margin: 12px 0; }
.draft-stage { min-width: 0; } /* transparent window to the 3D husky */

.draft-roster, .draft-editor { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 14px;
  backdrop-filter: blur(7px); overflow-y: auto; max-height: 64vh; }
.panel-title { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); margin-bottom: 10px; }

.dog-chip { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 11px; cursor: pointer;
  background: var(--panel-2); border: 1px solid transparent; margin-bottom: 8px; transition: border-color .12s, transform .08s; }
.dog-chip:hover { transform: translateX(2px); }
.dog-chip.active { border-color: var(--aurora); box-shadow: 0 0 0 1px var(--aurora) inset; }
.dog-chip.lead { background: linear-gradient(90deg, rgba(255,210,122,.16), var(--panel-2)); }
.chip-swatch { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #ffffff44; flex: none; }
.chip-name { flex: 1; text-align: left; font-weight: 700; font-size: 14px; }
.chip-badge { font-size: 9px; font-weight: 800; letter-spacing: .1em; color: var(--gold); border: 1px solid var(--gold); border-radius: 5px; padding: 1px 5px; }
.chip-x { background: none; border: none; color: var(--ink-dim); cursor: pointer; font-size: 13px; padding: 2px 4px; border-radius: 6px; }
.chip-x:hover { color: var(--bad); background: #ffffff14; }
.add-dog { width: 100%; padding: 10px; border-radius: 11px; border: 1px dashed var(--line); background: transparent; color: var(--aurora);
  cursor: pointer; font-weight: 700; font-size: 13.5px; }
.add-dog:hover { background: #ffffff0c; }

.field-lbl { display: block; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-dim); margin: 12px 0 6px; }
.name-input { width: 100%; padding: 9px 11px; border-radius: 10px; border: 1px solid var(--line); background: #0c1a33; color: var(--ink); font-size: 15px; font-weight: 700; }
.name-input:focus { outline: none; border-color: var(--aurora); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 34px; height: 34px; border-radius: 9px; border: 2px solid #ffffff33; cursor: pointer; padding: 0; transition: transform .08s; }
.swatch.eye { border-radius: 50%; width: 28px; height: 28px; }
.swatch:hover { transform: scale(1.08); }
.swatch.on { border-color: #fff; box-shadow: 0 0 0 2px var(--aurora); }

.lock-note { background: rgba(255,210,122,.1); border: 1px solid rgba(255,210,122,.3); color: var(--gold); border-radius: 10px;
  padding: 10px 12px; font-size: 13px; line-height: 1.45; }

.stats-head { display: flex; justify-content: space-between; align-items: baseline; margin: 16px 0 8px; font-size: 12px;
  letter-spacing: .08em; text-transform: uppercase; color: var(--ink-dim); }
.pts { font-weight: 800; color: var(--ink); }
.pts.done { color: var(--good); }
.pts.over { color: var(--bad); }
.stat-row { display: grid; grid-template-columns: 96px 1fr 30px; align-items: center; gap: 8px; margin-bottom: 9px; }
.stat-name { font-size: 12.5px; color: var(--ink); }
.stat-val { text-align: right; font-weight: 800; font-size: 14px; }
.stat-range { -webkit-appearance: none; appearance: none; height: 7px; border-radius: 5px; background: #16294a; outline: none; }
.stat-range::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: linear-gradient(180deg, #fff, var(--aurora)); border: 2px solid #0a1730; cursor: pointer; }
.stat-range::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--aurora); border: 2px solid #0a1730; cursor: pointer; }
.stat-row.locked .sbar { height: 8px; background: #16294a; border-radius: 5px; overflow: hidden; }
.sbar-fill { height: 100%; background: linear-gradient(90deg, var(--aurora-2), var(--aurora)); }

.draft-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.foot-hint { color: var(--ink-dim); font-size: 12.5px; max-width: 60%; text-align: left; }

/* ---- Race HUD ------------------------------------------------------------ */
.race-hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; color: var(--ink); user-select: none;
  text-shadow: 0 2px 8px #0009; }
.rh-top { position: absolute; top: 14px; left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-start; padding: 0 18px; gap: 12px; }
.rh-progress { flex: 1; max-width: 620px; }
.rp-route { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 5px; }
.rp-from, .rp-to { font-weight: 800; }
.rp-cargo { color: var(--gold); }
.rp-track { position: relative; height: 8px; background: rgba(10,22,44,.7); border: 1px solid var(--line); border-radius: 6px; }
.rp-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--aurora-2), var(--aurora)); border-radius: 6px; }
.rp-sled { position: absolute; top: -11px; left: 0; transform: translateX(-50%); font-size: 18px; }
.rh-stats { display: flex; gap: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 11px; padding: 6px 12px; text-align: center; min-width: 78px; }
.stat-lbl { font-size: 10px; letter-spacing: .12em; color: var(--ink-dim); }
.stat-num { font-size: 18px; font-weight: 800; }
.stat-num.hot { color: var(--ember); text-shadow: 0 0 12px rgba(255,122,61,.6); }

.rh-bars { position: absolute; left: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; width: min(300px, 60vw); }
.bar-wrap { }
.bar-lbl { font-size: 11px; color: var(--ink-dim); margin-bottom: 3px; }
.bar { height: 12px; background: rgba(10,22,44,.7); border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.bar-fill { height: 100%; width: 100%; transition: width .12s linear; }
.bar-fill.stam { background: linear-gradient(90deg, #ffd27a, #ffe6b0); }
.bar-fill.stam.low { background: linear-gradient(90deg, #ff7a3d, #ff5252); }
.bar-fill.cargo { background: linear-gradient(90deg, #45e08a, #8af0b8); }
.bar-fill.cargo.low { background: linear-gradient(90deg, #ff6b6b, #ffa36b); }

.rh-warn { position: absolute; top: 70px; left: 50%; transform: translateX(-50%); background: rgba(120,30,30,.7);
  border: 1px solid #ff9a9a55; color: #ffdede; padding: 8px 18px; border-radius: 999px; font-size: 15px; font-weight: 700;
  opacity: 0; transition: opacity .15s; white-space: nowrap; }
.rh-warn.show { opacity: 1; }
.rh-toast { position: absolute; top: 20%; left: 50%; transform: translateX(-50%) scale(.9); background: var(--panel);
  border: 1px solid var(--line); padding: 10px 22px; border-radius: 14px; font-size: 20px; font-weight: 800; opacity: 0;
  transition: opacity .2s, transform .2s; }
.rh-toast.show { opacity: 1; transform: translateX(-50%) scale(1); }
.rh-toast.bad { color: #ffd0d0; border-color: #ff6b6b66; }
.rh-toast.good { color: #c9ffe2; border-color: #45e08a66; }

/* Mute toggle */
.hud-mute { position: absolute; bottom: 18px; right: 18px; pointer-events: auto; width: 38px; height: 38px;
  border-radius: 10px; background: rgba(14, 28, 54, .8); border: 1px solid var(--line); color: var(--ink);
  font-size: 18px; line-height: 1; cursor: pointer; }
.hud-mute:hover { filter: brightness(1.25); }
@media (pointer: coarse) { .hud-mute { bottom: auto; top: 58px; right: 14px; } }

/* Touch controls (mobile) */
.touch-controls { position: absolute; bottom: 16px; right: 16px; display: none; gap: 10px; align-items: flex-end; pointer-events: auto; }
.tbtn { pointer-events: auto; border: 1px solid var(--line); background: rgba(14,28,54,.82); color: var(--ink); border-radius: 14px;
  font-weight: 800; width: 64px; height: 64px; font-size: 22px; }
.tbtn-b { width: 84px; height: 64px; font-size: 14px; background: linear-gradient(180deg,#ffe6b0,var(--ember)); color: #2a1605; border: none; }
.tbtn:active { filter: brightness(1.2); }
@media (pointer: coarse) { .touch-controls { display: flex; } .rh-bars { width: 50vw; } }

/* ---- Result -------------------------------------------------------------- */
.result-overlay { background: rgba(6, 14, 30, 0.74); backdrop-filter: blur(6px); }
.result-body { background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 30px 34px; max-width: 460px;
  display: flex; flex-direction: column; align-items: center; gap: 12px; }
.result-title { margin: 2px 0; font-size: clamp(28px, 6vw, 44px); }
.result-title.win { color: var(--good); }
.result-title.lose { color: var(--bad); }
.result-stars { font-size: 34px; color: var(--gold); letter-spacing: 6px; }
.result-flavor { color: var(--ink-dim); margin: 0; font-size: 14.5px; line-height: 1.5; }
.result-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; width: 100%; margin: 6px 0; }
.rstat { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px; text-align: center; }
.rstat-v { font-size: 22px; font-weight: 800; }
.rstat-l { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-dim); }
.result-btns { display: flex; gap: 12px; margin-top: 4px; flex-wrap: wrap; justify-content: center; }
.next-note { color: #7e93b8; font-size: 12px; font-style: italic; margin-top: 2px; }

@media (max-width: 760px) {
  .draft-cols { grid-template-columns: 1fr 1fr; grid-auto-rows: min-content; }
  .draft-stage { display: none; }
  .draft-roster, .draft-editor { max-height: 50vh; }
  .title-inner { margin: 0 0 4vh 5vw; }
  .foot-hint { display: none; }
}
