/* Your Elf Skot — clean, minimal, dark. The photo is the hero; chrome is quiet. */

:root {
  --bg: #0d1014;
  --panel: #161b22;
  --ink: #e6edf3;
  --muted: #8b949e;
  --accent: #f5a623; /* elf-shot amber */
  --hit: #ff4d4d;
  --hot: #ff7043;
  --cold: #4f9bff;
  --border: #2a313a;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

/* The whole UI toggles state via the `hidden` attribute (overlays, HUD, panel,
   reload). Components set their own `display`, which would otherwise beat the UA
   `[hidden]` rule and leave elements stuck visible — so enforce it globally. */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
}

/* The viewer fills the screen. */
#osd {
  position: fixed;
  inset: 0;
  background: #000;
  cursor: crosshair;
  transition: filter 0.5s ease; /* smooth snap-into-focus after the countdown */
}

/* Out-of-focus during the get-ready countdown. */
#osd.blurred {
  filter: blur(22px);
}

/* ---- get-ready countdown ---- */
.countdown {
  position: fixed;
  inset: 0;
  z-index: 35; /* above the HUD, below the win/name overlays */
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 7, 10, 0.35); /* light — the blurred map shows through */
  pointer-events: none; /* purely a visual gate */
}

#countdown-num {
  font-size: clamp(6rem, 22vw, 14rem);
  font-weight: 800;
  line-height: 1;
  color: var(--ink);
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.7);
}

/* ---- overlays (name prompt + win) ---- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(5, 7, 10, 0.82);
  backdrop-filter: blur(4px);
}

.card {
  width: 100%;
  max-width: 26rem;
  padding: 2rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.card h1 {
  margin: 0 0 0.25rem;
  font-size: 1.9rem;
  letter-spacing: -0.02em;
}

.tagline {
  margin: 0 0 1rem;
  color: var(--accent);
  font-weight: 600;
}

.hint {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
  margin: 0 0 1.4rem;
}

.card label {
  display: block;
  text-align: left;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.card input {
  width: 100%;
  padding: 0.7rem 0.85rem;
  margin-bottom: 1rem;
  font-size: 1rem;
  color: var(--ink);
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.card input:focus {
  outline: none;
  border-color: var(--accent);
}

button {
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  color: #1a1300;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  padding: 0.7rem 1.1rem;
}

button:hover {
  filter: brightness(1.08);
}

.win-time {
  color: var(--muted);
  margin: 0.5rem 0 1.4rem;
}
.win-time strong {
  color: var(--ink);
  font-size: 1.3rem;
}

/* ---- HUD ---- */
#hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 1rem;
  background: linear-gradient(rgba(5, 7, 10, 0.85), rgba(5, 7, 10, 0));
  pointer-events: none;
}

#hud > * {
  pointer-events: auto;
}

.hud-left {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.hud-left strong {
  font-size: 1rem;
}

.hud-tag {
  font-size: 0.72rem;
  color: var(--muted);
}

#change-name,
#board-toggle {
  background: rgba(22, 27, 34, 0.9);
  color: var(--ink);
  border: 1px solid var(--border);
}
#change-name {
  margin-left: auto; /* group both utility buttons at the right edge */
  color: var(--muted); /* quieter — it's a secondary action */
}

/* ---- shot feedback pill ---- */
.feedback {
  flex: 1;
  text-align: center;
  font-weight: 700;
  font-size: 1rem;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.15s, transform 0.15s;
}

.feedback.show {
  opacity: 1;
  transform: none;
}

.fb-hit {
  color: var(--hit);
}
.fb-boiling,
.fb-warm {
  color: var(--hot);
}
.fb-cold,
.fb-freezing,
.fb-miss {
  color: var(--cold);
}
.fb-warn {
  color: var(--muted);
}

/* Reload countdown — its own pill so it never clobbers the temperature hint. */
.reload {
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--accent);
}

/* ---- leaderboard panel ---- */
.panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 25;
  width: min(22rem, 90vw);
  background: var(--panel);
  border-left: 1px solid var(--border);
  padding: 1rem 1.2rem;
  overflow-y: auto;
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.4);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.panel-head h2 {
  margin: 0;
  font-size: 1.2rem;
}

#board-close {
  background: none;
  color: var(--muted);
  font-size: 1.4rem;
  line-height: 1;
  padding: 0.2rem 0.5rem;
}

.board-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.board-list li {
  display: grid;
  grid-template-columns: 1.6rem 1fr auto;
  grid-template-areas: "rank who time" "rank who shots";
  align-items: center;
  gap: 0 0.6rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
}

.board-list .rank {
  grid-area: rank;
  color: var(--accent);
  font-weight: 700;
}
.board-list .who {
  grid-area: who;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.board-list .time {
  grid-area: time;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
.board-list .shots {
  grid-area: shots;
  font-size: 0.75rem;
  color: var(--muted);
  text-align: right;
}

.board-empty {
  color: var(--muted);
  font-size: 0.9rem;
}
