*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --gold: #f5c518;
  --gold-dim: #b8940f;
  --red: #e63946;
  --bg: #0a0a0a;
  --panel: #141414;
  --text: #f4f4f5;
  --text-muted: #a1a1aa;
  --font-display: "Bebas Neue", sans-serif;
  --font-body: "DM Sans", system-ui, sans-serif;
}

html {
  scrollbar-width: thin;
  scrollbar-color: var(--gold-dim) var(--panel);
}

body {
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
}

.game-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 1.25rem 1rem 0.75rem;
  border-bottom: 1px solid rgba(245, 197, 24, 0.15);
}

.game-header__back {
  align-self: flex-start;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}

.game-header__back:hover {
  color: var(--gold);
}

.game-header__title {
  font-family: var(--font-display);
  font-size: clamp(3.5rem, 14vw, 5.5rem);
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: 0.04em;
  color: var(--gold);
  text-shadow: 0 0 40px rgba(245, 197, 24, 0.35);
}

.game-stage {
  display: flex;
  justify-content: center;
  padding: 1.5rem 1rem 2rem;
}

.game-panel {
  position: relative;
  width: min(100%, 22.5rem);
}

.game-hud {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.game-hud strong {
  color: var(--text);
  font-weight: 700;
}

#game {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid rgba(245, 197, 24, 0.25);
  border-radius: 0.5rem;
  background: #1a0a0a;
  cursor: none;
  touch-action: none;
}

.game-hint {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  text-align: center;
  color: var(--text-muted);
}

.game-overlay {
  position: absolute;
  inset: 2.5rem 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 10, 0.82);
  border-radius: 0.5rem;
  backdrop-filter: blur(4px);
}

.game-overlay[hidden] {
  display: none;
}

.game-overlay__box {
  text-align: center;
  padding: 1.5rem;
}

.game-overlay__label {
  font-family: var(--font-display);
  font-size: 2.25rem;
  letter-spacing: 0.05em;
  color: var(--gold);
}

.game-overlay__score {
  margin: 0.5rem 0 1.25rem;
  font-size: 1rem;
  color: var(--text-muted);
}

.game-overlay__score span {
  color: var(--text);
  font-weight: 700;
}

.score-form {
  margin-bottom: 1rem;
  text-align: left;
}

.score-form__label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.score-form__input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.65rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(245, 197, 24, 0.25);
  border-radius: 0.35rem;
}

.score-form__input:focus {
  outline: none;
  border-color: var(--gold);
}

.score-form__error {
  margin-bottom: 0.65rem;
  font-size: 0.8rem;
  color: var(--red);
}

.game-overlay__saved {
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gold);
}

.game-overlay__btn {
  padding: 0.65rem 1.5rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--bg);
  background: var(--gold);
  border: none;
  border-radius: 0.35rem;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.game-overlay__btn:hover {
  background: #ffe566;
}

.game-overlay__btn:active {
  transform: scale(0.97);
}

.game-overlay__btn--ghost {
  margin-top: 0.25rem;
  color: var(--gold);
  background: transparent;
  border: 1px solid rgba(245, 197, 24, 0.35);
}

.game-overlay__btn--ghost:hover {
  background: rgba(245, 197, 24, 0.1);
}

.leaderboard {
  margin-top: 1.5rem;
  padding: 1rem;
  background: var(--panel);
  border: 1px solid rgba(245, 197, 24, 0.15);
  border-radius: 0.5rem;
}

.leaderboard__title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  letter-spacing: 0.06em;
  color: var(--gold);
  margin-bottom: 0.75rem;
  text-align: center;
}

.leaderboard__list {
  list-style: none;
  counter-reset: rank;
}

.leaderboard__list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.9rem;
}

.leaderboard__list li:last-child {
  border-bottom: none;
}

.leaderboard__list li::before {
  counter-increment: rank;
  content: counter(rank) ".";
  min-width: 1.5rem;
  font-weight: 700;
  color: var(--gold-dim);
}

.leaderboard__nick {
  flex: 1;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard__points {
  font-weight: 700;
  color: var(--gold);
}

.leaderboard__empty {
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.leaderboard__empty::before {
  content: none;
}
