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

:root {
  --you: #7cff6b;
  --foe: #ff6b81;
  --neu: #8a93a5;
  --bg: #081209;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: #eef7ea;
  -webkit-user-select: none;
  user-select: none;
}

#game {
  position: fixed;
  inset: 0;
  display: block;
  cursor: pointer;
}

/* ---------- HUD ---------- */
#hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px 26px;
  pointer-events: none;
}

.hud-left { text-align: left; }
.hud-right { text-align: right; }

.hud-label {
  font-size: 10px;
  letter-spacing: 3px;
  color: #7fa383;
}

.hud-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--you);
  text-shadow: 0 0 12px rgba(124,255,107,.45);
  font-variant-numeric: tabular-nums;
}

.hud-center { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; margin: 0 30px; }

.balance {
  display: flex;
  width: min(430px, 58vw);
  height: 10px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.04);
}

.bal-seg { height: 100%; transition: width .3s; }
#bal-you { background: linear-gradient(90deg, #3f9e33, var(--you)); }
#bal-neu { background: #565f70; }
#bal-en  { background: linear-gradient(90deg, #ff6b81, #d63d56); }

.center-row {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
}

.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.you-dot { background: var(--you); box-shadow: 0 0 8px var(--you); }
.neu-dot { background: var(--neu); }
.en-dot  { background: var(--foe); box-shadow: 0 0 8px var(--foe); }

.u-val { font-variant-numeric: tabular-nums; color: #cfe2cc; min-width: 34px; }
.u-timer { margin-left: 16px; color: #9db89a; font-variant-numeric: tabular-nums; letter-spacing: 1px; }

.speed-btn {
  margin-left: 12px;
  background: rgba(124,255,107,.08);
  border: 1px solid rgba(124,255,107,.4);
  color: var(--you);
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  cursor: pointer;
  pointer-events: auto;
  letter-spacing: 1px;
}

.speed-btn:hover { background: rgba(124,255,107,.2); }
.speed-btn.fast { background: rgba(124,255,107,.28); }

#wave-flash {
  position: fixed;
  top: 34%;
  left: 50%;
  transform: translateX(-50%);
  font-size: clamp(22px, 4vw, 36px);
  font-weight: 800;
  letter-spacing: 6px;
  text-shadow: 0 0 24px currentColor;
  pointer-events: none;
  z-index: 5;
  animation: flashFade 1.8s ease-out forwards;
}

@keyframes flashFade {
  0%   { opacity: 0; transform: translateX(-50%) scale(.7); }
  18%  { opacity: 1; transform: translateX(-50%) scale(1.05); }
  75%  { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) scale(1); }
}

#hintbar {
  position: fixed;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10.5px;
  letter-spacing: 2px;
  color: #55705a;
  white-space: nowrap;
  pointer-events: none;
}

/* ---------- Overlays ---------- */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
  background: radial-gradient(ellipse at center, rgba(9,20,12,.87) 0%, rgba(8,18,9,.97) 100%);
  z-index: 10;
  padding: 24px;
}

.hidden { display: none !important; }

.game-title {
  font-size: clamp(46px, 9vw, 94px);
  font-weight: 800;
  letter-spacing: 13px;
  line-height: 1;
  color: #f2fff0;
  margin-left: 13px;
}

.game-title span {
  color: var(--you);
  text-shadow: 0 0 28px var(--you), 0 0 70px rgba(124,255,107,.4);
}

.tagline {
  font-size: clamp(14px, 2.2vw, 19px);
  letter-spacing: 5px;
  text-transform: uppercase;
  color: #ffd166;
  text-shadow: 0 0 14px rgba(255,209,102,.45);
}

.rules p { margin: 4px 0; color: #b5cdb0; font-size: clamp(12.5px, 1.65vw, 15px); }
.rules strong { color: var(--you); }
.rules p:nth-child(5) strong { color: var(--foe); }

.sector-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(420px, 92vw);
  margin-top: 4px;
}

.sector-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 18px;
  border: 1px solid rgba(124,255,107,.35);
  border-radius: 12px;
  background: rgba(124,255,107,.05);
  cursor: pointer;
  transition: all .15s;
  font-size: 14px;
  letter-spacing: 2px;
}

.sector-item:hover:not(.locked) {
  background: rgba(124,255,107,.15);
  transform: translateX(5px);
}

.sector-item .s-name { color: #ddffda; font-weight: 600; }
.sector-item .s-meta { color: #7fa383; font-size: 12px; }
.sector-item.locked { opacity: .32; cursor: default; filter: grayscale(.7); }

.best { font-size: 12px; letter-spacing: 2px; color: #ffd166; }

h2 { font-size: clamp(28px, 5.5vw, 46px); letter-spacing: 6px; color: #f2fff0; }

.end-title { color: var(--you); text-shadow: 0 0 26px rgba(124,255,107,.6); }
.end-title.lost { color: var(--foe); text-shadow: 0 0 26px rgba(255,107,129,.6); }

.final-wrap { display: flex; flex-direction: column; gap: 9px; }

.res-row { display: flex; justify-content: space-between; gap: 40px; }
.res-label { font-size: 11px; letter-spacing: 3px; color: #7fa383; align-self: center; }
.res-val { font-size: 19px; font-weight: 700; color: #ffe66d; font-variant-numeric: tabular-nums; }

.btn-row { display: flex; gap: 13px; flex-wrap: wrap; justify-content: center; }

.btn {
  padding: 13px 30px;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--you);
  background: transparent;
  border: 2px solid var(--you);
  border-radius: 40px;
  cursor: pointer;
  transition: all .15s;
}

.btn:hover {
  background: rgba(124,255,107,.12);
  box-shadow: 0 0 22px rgba(124,255,107,.4);
  transform: translateY(-2px);
}

.btn.secondary { color: #9db89a; border-color: rgba(157,184,154,.5); }
.btn.secondary:hover { background: rgba(157,184,154,.09); box-shadow: 0 0 16px rgba(157,184,154,.25); }

.dim { color: #7fa383; }
