:root {
  --home: #3b82f6;
  --away: #ef4444;
  --gold: #ffd166;
  --ink: #f5f1e8;
  --panel: rgba(12, 14, 22, 0.92);
  --font: "Russo One", "Arial Black", "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: #0b0d14; color: var(--ink);
  font-family: var(--font);
  user-select: none; -webkit-user-select: none;
}
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; }
#scoreboard {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: stretch; gap: 0;
  background: rgba(10, 12, 20, 0.85); border: 2px solid rgba(255,255,255,0.12);
  border-radius: 12px; overflow: hidden; box-shadow: 0 6px 24px rgba(0,0,0,0.45);
}
.sb-team { display: flex; align-items: center; gap: 12px; padding: 8px 16px; font-size: 18px; letter-spacing: 1px; }
.sb-team.home { background: linear-gradient(90deg, rgba(59,130,246,0.55), rgba(59,130,246,0.15)); }
.sb-team.away { background: linear-gradient(270deg, rgba(239,68,68,0.55), rgba(239,68,68,0.15)); }
.sb-score { font-size: 32px; min-width: 44px; text-align: center; }
.sb-mid { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 4px 16px; min-width: 96px; }
#sb-quarter { font-size: 12px; opacity: 0.75; letter-spacing: 2px; }
#sb-clock { font-size: 22px; }
#sb-shot { font-size: 13px; color: var(--gold); background: rgba(255,209,102,0.12); padding: 0 8px; border-radius: 6px; }
#sb-shot.low { color: #ff5d5d; background: rgba(255,93,93,0.18); }

#hints {
  position: absolute; left: 16px; bottom: 14px; font-size: 13px; line-height: 1.7;
  background: rgba(10,12,20,0.6); padding: 8px 12px; border-radius: 10px; max-width: calc(100% - 32px);
}
#hints b { color: var(--gold); font-weight: normal; }
#stamina {
  position: absolute; right: 16px; bottom: 18px; width: 160px; height: 10px;
  background: rgba(255,255,255,0.12); border-radius: 6px; overflow: hidden;
}
#stamina-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #34d399, #a3e635); }
#meter {
  position: absolute; width: 14px; height: 90px; border-radius: 7px;
  background: rgba(10,12,20,0.75); border: 2px solid rgba(255,255,255,0.6); overflow: hidden;
}
#meter-zone { position: absolute; left: 0; right: 0; background: rgba(52, 211, 153, 0.55); }
#meter-fill { position: absolute; left: 0; right: 0; bottom: 0; background: var(--gold); }
#popups { position: absolute; left: 0; right: 0; top: 26%; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.popup {
  font-size: 44px; letter-spacing: 2px; text-shadow: 0 4px 0 rgba(0,0,0,0.5), 0 0 24px rgba(0,0,0,0.5);
  animation: pop 1.3s ease-out forwards;
}
.popup.small { font-size: 26px; }
.popup.good { color: #4ade80; }
.popup.bad { color: #ff6b6b; }
.popup.gold { color: var(--gold); }
.popup.home { color: #7fb0ff; }
.popup.away { color: #ff8a8a; }
@keyframes pop {
  0% { transform: scale(0.4); opacity: 0; }
  15% { transform: scale(1.15); opacity: 1; }
  30% { transform: scale(1); }
  80% { opacity: 1; }
  100% { transform: translateY(-30px); opacity: 0; }
}

/* ---------- Screens ---------- */
.screen {
  position: fixed; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 16px;
}
.screen.dim { background: rgba(5, 6, 12, 0.6); backdrop-filter: blur(3px); }
#title { background: radial-gradient(ellipse at center, rgba(5,6,12,0.15), rgba(5,6,12,0.75)); }
.logo {
  font-size: clamp(56px, 11vw, 124px); line-height: 0.9; letter-spacing: 4px;
  color: #fff; text-shadow: 0 8px 0 #c2410c, 0 14px 30px rgba(0,0,0,0.6);
  display: flex; gap: 0.25em;
}
.logo span { color: #fb923c; text-shadow: 0 8px 0 #7c2d12, 0 14px 30px rgba(0,0,0,0.6); }
.tag { margin: 18px 0 26px; font-size: 18px; opacity: 0.85; letter-spacing: 2px; }
.foot { position: absolute; bottom: 14px; font-size: 13px; opacity: 0.7; text-align: center; padding: 0 16px; }

.panel {
  background: var(--panel); border: 2px solid rgba(255,255,255,0.1); border-radius: 18px;
  padding: 26px 30px; min-width: min(420px, 100%); max-width: 100%; text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6); max-height: 100%; overflow: auto;
}
.panel.wide { width: min(640px, 100%); text-align: left; }
.panel h2 { margin: 0 0 18px; font-size: 34px; letter-spacing: 3px; font-weight: normal; text-align: center; }

.menu { display: flex; flex-direction: column; gap: 8px; align-items: stretch; width: min(380px, 100%); margin: 0 auto; }
.item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 16px; border-radius: 10px; font-size: 18px; letter-spacing: 1px;
  background: rgba(255,255,255,0.07); border: 2px solid transparent; cursor: pointer;
  transition: background 0.1s, border-color 0.1s, transform 0.1s;
}
.item.button { justify-content: center; }
.item.focus { background: rgba(251,146,60,0.22); border-color: #fb923c; transform: scale(1.03); }
.item .val { display: flex; align-items: center; gap: 10px; color: var(--gold); }
.item .arrow { opacity: 0.6; padding: 0 6px; cursor: pointer; }
.item .arrow:hover { opacity: 1; }

#over-score { font-size: 44px; margin-bottom: 22px; display: flex; gap: 16px; justify-content: center; align-items: center; }
#over-score .h { color: #7fb0ff; } #over-score .a { color: #ff8a8a; }
#over-score small { font-size: 14px; display: block; opacity: 0.7; }

.controls { margin-top: 18px; font-size: 13px; line-height: 1.8; opacity: 0.85; text-align: left; }
.controls b, #help-body b { color: var(--gold); font-weight: normal; }
#help-body { font-family: "Segoe UI", system-ui, sans-serif; font-size: 15px; line-height: 1.6; margin-bottom: 18px; }
#help-body h3 { font-family: var(--font); font-weight: normal; margin: 14px 0 4px; color: #fb923c; letter-spacing: 1px; }

@media (max-width: 640px) {
  .sb-team { padding: 6px 8px; font-size: 12px; gap: 6px; }
  .sb-score { font-size: 22px; min-width: 30px; }
  #hints { font-size: 11px; }
  #stamina { width: 90px; bottom: auto; top: 80px; }
}

/* ---------- Online ---------- */
#online-status { font-size: 20px; margin: 6px 0 8px; }
#online-code { font-size: 14px; opacity: 0.75; margin-bottom: 18px; min-height: 18px; font-family: "Segoe UI", system-ui, sans-serif; }
#online-code b { color: var(--gold); letter-spacing: 3px; font-family: var(--font); font-weight: normal; font-size: 18px; }
.spin {
  width: 46px; height: 46px; margin: 4px auto 14px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fb923c, #c2410c);
  box-shadow: inset -6px -6px 0 rgba(0,0,0,0.25);
  animation: bounce 0.7s ease-in infinite alternate;
}
.spin.done { animation: none; opacity: 0.4; }
@keyframes bounce { from { transform: translateY(-10px); } to { transform: translateY(10px) scaleY(0.9); } }
.sb-name.you::after { content: " (YOU)"; font-size: 11px; color: var(--gold); }
#online-input {
  display: block; margin: 0 auto 18px; width: min(260px, 100%); text-align: center;
  font: 34px var(--font); letter-spacing: 8px; text-transform: uppercase;
  background: rgba(255,255,255,0.08); color: var(--gold); border: 2px solid #fb923c; border-radius: 12px; padding: 8px 10px;
  outline: none;
}
#online-input::placeholder { color: rgba(255,255,255,0.25); }
.bigcode { display: block; font-size: 52px !important; letter-spacing: 10px !important; margin: 6px 0 8px; color: var(--gold); }
.menu { gap: 6px; }
.item { padding: 9px 16px; }
@media (max-height: 800px) {
  .logo { font-size: clamp(48px, 8vw, 84px); }
  .tag { margin: 8px 0 12px; font-size: 15px; }
  .item { padding: 7px 14px; font-size: 16px; }
  .foot { bottom: 6px; font-size: 12px; }
}
