:root {
  --bg: #071018;
  --ink: #e8f6ff;
  --muted: #7ea3b8;
  --accent: #3ee0c5;
  --hot: #ff5d6c;
  --gold: #ffd166;
  --card: rgba(6, 18, 28, 0.86);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Avenir Next", Futura, system-ui, sans-serif;
  user-select: none;
  touch-action: none;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
  position: absolute;
  inset: 0;
  z-index: 0;
}

#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

#hud-left { position: absolute; top: 16px; left: 18px; }

#brand {
  font-weight: 800;
  letter-spacing: 0.32em;
  font-size: 13px;
  color: var(--accent);
}

#you-tag {
  margin-top: 6px;
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

#hud-center {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  min-width: 280px;
}

#clock {
  font-weight: 800;
  letter-spacing: 0.14em;
  font-size: 22px;
  text-shadow: 0 2px 12px #000;
}

#keeps { margin-top: 8px; width: 320px; max-width: 46vw; }

.keep-row {
  display: grid;
  grid-template-columns: 64px 1fr 40px;
  gap: 8px;
  align-items: center;
  font-size: 11px;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.keep-row.them { margin-top: 4px; color: var(--hot); }
.keep-row span:first-child { text-align: right; overflow: hidden; text-overflow: ellipsis; }

.hp-track {
  height: 8px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

#you-hp {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #1d8f78, var(--accent));
}

#them-hp {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #9b2434, var(--hot));
}

#tug { margin-top: 8px; width: 320px; max-width: 46vw; margin-left: auto; margin-right: auto; }

#tug-track {
  height: 8px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.12);
  overflow: hidden;
  position: relative;
}

#tug-track::after {
  content: "";
  position: absolute;
  top: -2px;
  bottom: -2px;
  left: 50%;
  width: 2px;
  background: #fff;
  opacity: 0.7;
}

#tug-fill {
  height: 100%;
  width: 50%;
  background: linear-gradient(90deg, #1d8f78, var(--accent));
}

#toast {
  min-height: 1.2em;
  margin-top: 8px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--gold);
  text-shadow: 0 2px 12px #000;
}

#hud-right {
  position: absolute;
  top: 16px;
  right: 18px;
  text-align: right;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

#bot-style { margin-top: 4px; color: var(--hot); font-weight: 700; }

#tray {
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

#charge-read { text-align: center; }

#charge-n {
  font-weight: 800;
  font-size: 28px;
  min-width: 48px;
  color: var(--accent);
  text-shadow: 0 0 12px rgba(62, 224, 197, 0.5);
  line-height: 1;
}

#charge-n.hot { color: var(--gold); }
#charge-n.dry { color: var(--hot); }
#charge-n.idle { color: var(--muted); font-size: 22px; text-shadow: none; }

#charge-cap {
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--muted);
  margin-top: 4px;
  font-weight: 700;
}

#surge-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

#surge-pips {
  display: flex;
  gap: 4px;
}

#surge-pips i {
  width: 14px;
  height: 18px;
  border: 1px solid rgba(62, 224, 197, 0.35);
  background: rgba(62, 224, 197, 0.08);
  transform: skewX(-12deg);
}

#surge-pips i.on {
  background: linear-gradient(180deg, #9ff7e6, var(--accent));
  box-shadow: 0 0 10px rgba(62, 224, 197, 0.55);
}

#surge-pips i.hot {
  background: linear-gradient(180deg, #ffe29a, var(--gold));
}

#surge-pips i.dry {
  background: linear-gradient(180deg, #ff9aa4, var(--hot));
}

#surge-n {
  font-weight: 800;
  font-size: 20px;
  min-width: 28px;
  color: var(--accent);
  text-shadow: 0 0 12px rgba(62, 224, 197, 0.5);
}

#hint {
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-shadow: 0 2px 8px #000;
}

#splash, #over {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  pointer-events: auto;
  background: radial-gradient(ellipse at 50% 30%, rgba(62, 224, 197, 0.12), transparent 55%),
              rgba(5, 10, 16, 0.78);
}

#over.hidden, #splash.hidden { display: none; }

.splash-card {
  width: min(420px, 90vw);
  padding: 28px 28px 24px;
  background: var(--card);
  border: 1px solid rgba(62, 224, 197, 0.28);
  text-align: center;
  pointer-events: auto;
  position: relative;
  z-index: 11;
}

.kicker {
  letter-spacing: 0.28em;
  font-size: 11px;
  font-weight: 800;
  color: var(--accent);
}

.splash-card h1 {
  font-size: 52px;
  letter-spacing: 0.12em;
  margin: 8px 0 6px;
}

.tag { color: var(--muted); margin-bottom: 18px; }

label {
  display: block;
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--muted);
  margin-bottom: 14px;
}

input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  background: #061018;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--ink);
  font: inherit;
  outline: none;
  pointer-events: auto;
}

button {
  font: inherit;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
}

#play, #again {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: #042018;
  border: 0;
  font-weight: 800;
  letter-spacing: 0.18em;
}

#play:hover, #again:hover { filter: brightness(1.08); }

.fine {
  margin-top: 12px;
  font-size: 11px;
  color: var(--muted);
}

@media (max-width: 720px) {
  #tug, #keeps { width: 240px; }
  .splash-card h1 { font-size: 40px; }
}
