:root {
  --void: #05060f;
  --ink: #e8ecff;
  --dim: #7c86b8;
  --glow: #6ea8ff;
  --hot: #ffd166;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--void);
  color: var(--ink);
  font: 16px/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  overflow: hidden;
  /* A touch-controlled game, not readable text — without this, a
     press-and-hold on mobile shows the browser's tap-highlight flash and
     text-selection/callout menu over the canvas mid-flight. */
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.screen {
  position: fixed;
  inset: 0;
}

.hidden {
  display: none !important;
}

#start-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
  text-align: center;
  /* A full 10-entry leaderboard can make the column taller than a short
     laptop viewport; without this the content is centred and clipped with no
     way to reach it, since the body has overflow:hidden. */
  overflow-y: auto;
}

.title {
  margin: 0;
  font-size: clamp(38px, 9vw, 76px);
  letter-spacing: 0.34em;
  text-indent: 0.34em;
  color: var(--ink);
  text-shadow: 0 0 28px rgba(110, 168, 255, 0.55);
}

.tagline {
  margin: 0;
  color: var(--dim);
  letter-spacing: 0.08em;
}

.rotate-hint {
  margin: 0;
  color: var(--hot);
  font-size: 13px;
  letter-spacing: 0.04em;
}

.flights-today {
  margin: 0;
  color: var(--dim);
  font-size: 13px;
  letter-spacing: 0.08em;
}

.name {
  display: flex;
  align-items: center;
  gap: 10px;
}

.name__label {
  color: var(--dim);
  font-size: 13px;
  letter-spacing: 0.2em;
}

.name__input {
  width: 9ch;
  padding: 6px 10px;
  background: rgba(110, 168, 255, 0.07);
  border: 1px solid rgba(110, 168, 255, 0.3);
  border-radius: 6px;
  color: var(--ink);
  font: inherit;
  text-align: center;
  letter-spacing: 0.18em;
  /* The one place body's global selection/callout suppression shouldn't
     apply — it's a real text field, not part of the game surface. */
  -webkit-touch-callout: default;
  -webkit-user-select: text;
  user-select: text;
}

.name__input:focus {
  outline: none;
  border-color: var(--glow);
}

.name__input--invalid {
  border-color: #ff5d5d;
  animation: name-input-shake 0.3s ease;
}

@keyframes name-input-shake {
  25% {
    transform: translateX(-4px);
  }
  75% {
    transform: translateX(4px);
  }
}

.last-run {
  margin: 0;
  color: var(--dim);
  font-size: 14px;
}

.last-run strong {
  color: var(--hot);
}

.board {
  min-width: min(320px, 90vw);
}

.board__heading {
  margin: 0 0 8px;
  color: var(--dim);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.28em;
}

.leaderboard {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 2px;
  /* A full board scrolls internally rather than pushing the start button off
     a short viewport. */
  max-height: 40vh;
  overflow-y: auto;
}

.leaderboard__row {
  display: grid;
  grid-template-columns: 3ch 1fr auto;
  gap: 12px;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 14px;
}

.leaderboard__rank,
.leaderboard__score {
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}

.leaderboard__name {
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard__row--new {
  background: rgba(255, 209, 102, 0.12);
}

.leaderboard__row--new .leaderboard__rank,
.leaderboard__row--new .leaderboard__score,
.leaderboard__row--new .leaderboard__name {
  color: var(--hot);
}

.leaderboard__empty {
  padding: 4px 10px;
  color: var(--dim);
  font-size: 14px;
}

.start {
  margin-top: 6px;
  padding: 16px 34px;
  background: rgba(110, 168, 255, 0.1);
  border: 1px solid var(--glow);
  border-radius: 10px;
  color: var(--ink);
  font: inherit;
  letter-spacing: 0.24em;
  cursor: pointer;
  touch-action: none;
  transition: background 120ms ease, box-shadow 120ms ease;
}

.start:hover {
  background: rgba(110, 168, 255, 0.2);
  box-shadow: 0 0 30px rgba(110, 168, 255, 0.35);
}

#game-screen {
  cursor: none;
  touch-action: none;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.counter {
  position: absolute;
  top: 18px;
  right: 22px;
  font-size: clamp(24px, 4vw, 40px);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
  color: var(--hot);
  text-shadow: 0 0 20px rgba(255, 209, 102, 0.45);
  pointer-events: none;
}
