/* ── AETHERWING · HUD ─────────────────────────────────────────── */

:root {
  --ink: #fff6ec;
  --coral: #ff8e5e;
  --aqua: #7ee8d8;
  --gold: #ffd27f;
  --shadow: rgba(20, 8, 40, 0.55);
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: #1a1038;
  font-family: "Outfit", sans-serif;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
  /* kill the blue flash mobile browsers paint on tap */
  -webkit-tap-highlight-color: transparent;
}

#game {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: pointer;
}

/* atmosphere overlays */
#vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 58%, rgba(15, 5, 35, 0.5) 100%);
}

#flash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: #fff;
  opacity: 0;
}
#flash.boom { animation: boom 0.45s ease-out; }
@keyframes boom {
  0% { opacity: 0.85; }
  100% { opacity: 0; }
}

/* ── HUD frame ── */
#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--ink);
  text-align: center;
}

.hidden { display: none !important; }

/* ── live score ── */
#score {
  position: absolute;
  top: 4vh;
  font-family: "Climate Crisis", system-ui;
  font-size: clamp(3.4rem, 9vw, 6rem);
  line-height: 1;
  color: var(--ink);
  text-shadow:
    0 4px 0 rgba(255, 142, 94, 0.65),
    0 10px 34px var(--shadow);
}
#score.pop { animation: pop 0.32s cubic-bezier(0.2, 2.4, 0.4, 1); }
@keyframes pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.28) rotate(-2deg); }
  100% { transform: scale(1); }
}

/* ── menu ── */
#menu, #gameover {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -54%);
  width: min(92vw, 560px);
}

.kicker {
  font-size: clamp(0.7rem, 1.6vw, 0.9rem);
  font-weight: 700;
  letter-spacing: 0.55em;
  text-transform: uppercase;
  color: var(--gold);
  text-shadow: 0 2px 14px var(--shadow);
  animation: rise 0.7s 0.05s both;
}

.title {
  font-family: "Climate Crisis", system-ui;
  font-size: clamp(2.2rem, 9.4vw, 5.4rem);
  line-height: 0.95;
  /* the headline is wider than the menu column — span the full
     viewport so it stays optically centered instead of spilling right */
  width: 100vw;
  margin: 0.18em 0 0.1em calc(50% - 50vw);
  color: var(--ink);
  text-shadow:
    0 5px 0 rgba(255, 142, 94, 0.7),
    0 12px 0 rgba(126, 232, 216, 0.28),
    0 22px 60px var(--shadow);
  animation: rise 0.7s 0.15s both;
}
.title span { color: var(--aqua); }

.tagline {
  font-weight: 300;
  font-size: clamp(0.95rem, 2.4vw, 1.25rem);
  letter-spacing: 0.34em;
  text-transform: uppercase;
  opacity: 0.9;
  text-shadow: 0 2px 12px var(--shadow);
  animation: rise 0.7s 0.25s both;
}

.chip {
  display: inline-block;
  margin-top: 2.1em;
  padding: 0.5em 1.4em;
  border-radius: 999px;
  background: rgba(255, 246, 236, 0.1);
  border: 1px solid rgba(255, 246, 236, 0.3);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 0.85rem;
  letter-spacing: 0.3em;
  animation: rise 0.7s 0.35s both;
}
.chip strong { color: var(--gold); font-size: 1.05rem; }

.instructions {
  margin-top: 1.6em;
  font-size: clamp(0.85rem, 2vw, 1.05rem);
  font-weight: 500;
  letter-spacing: 0.12em;
  animation: rise 0.7s 0.45s both, breathe 2.4s 1.2s ease-in-out infinite;
}

.key {
  display: inline-block;
  padding: 0.18em 0.65em;
  border-radius: 8px;
  border: 1px solid rgba(255, 246, 236, 0.45);
  border-bottom-width: 3px;
  background: rgba(255, 246, 236, 0.08);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  text-transform: uppercase;
  font-size: 0.85em;
  letter-spacing: 0.18em;
}

.hint {
  margin-top: 1.5em;
  font-weight: 300;
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  opacity: 0.62;
  animation: rise 0.7s 0.55s both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(26px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes breathe {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* ── game over ── */
.panel {
  display: flex;
  justify-content: center;
  gap: 1px;
  margin: 1.4em auto 0;
  width: min(82vw, 380px);
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(255, 246, 236, 0.28);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 24px 60px var(--shadow);
  animation: rise 0.6s 0.15s both;
}

.stat {
  flex: 1;
  padding: 1.3em 0.5em 1.15em;
  background: rgba(26, 16, 56, 0.45);
  display: flex;
  flex-direction: column;
  gap: 0.3em;
}

.stat-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.45em;
  opacity: 0.7;
}

.stat-value {
  font-family: "Climate Crisis", system-ui;
  font-size: clamp(2rem, 6vw, 3rem);
  line-height: 1;
}
.stat-value.gold { color: var(--gold); }

#gameover .instructions { animation-delay: 0.4s; }

.newbest {
  margin-top: 1.1em;
  color: var(--gold);
  font-weight: 700;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  font-size: 0.85rem;
  text-shadow: 0 0 18px rgba(255, 210, 127, 0.8);
  animation: rise 0.5s 0.3s both, breathe 1.6s 1s ease-in-out infinite;
}

/* ── leaderboard ── */
.lb {
  margin: 1.4em auto 0;
  width: min(82vw, 340px);
  padding: 0.9em 1.1em 1em;
  border-radius: 18px;
  border: 1px solid rgba(255, 246, 236, 0.22);
  background: rgba(26, 16, 56, 0.38);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: rise 0.7s 0.4s both;
}

.lb-title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.7em;
}

.lb-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.32em;
  max-height: 168px;
  overflow: hidden;
}

.lb-list li {
  display: grid;
  grid-template-columns: 2ch 1fr auto;
  gap: 0.7em;
  align-items: baseline;
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0.06em;
}

.lb-rank { opacity: 0.55; font-size: 0.75rem; text-align: right; }
.lb-name { text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-score { font-weight: 700; color: var(--aqua); }

.lb-list li.me .lb-name,
.lb-list li.me .lb-rank { color: var(--gold); opacity: 1; }
.lb-list li.me .lb-score { color: var(--gold); }

.lb-empty { opacity: 0.55; font-weight: 300; justify-self: center; display: block; text-align: center; }

/* ── score submission ── */
#submit-row {
  pointer-events: auto;
  display: flex;
  justify-content: center;
  gap: 0.5em;
  margin-top: 1.3em;
  animation: rise 0.6s 0.3s both;
}

#pilot-name {
  width: min(48vw, 220px);
  padding: 0.6em 1em;
  border-radius: 12px;
  border: 1px solid rgba(255, 246, 236, 0.4);
  background: rgba(255, 246, 236, 0.1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--ink);
  font-family: "Outfit", sans-serif;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  outline: none;
}
#pilot-name::placeholder { color: rgba(255, 246, 236, 0.45); }
#pilot-name:focus { border-color: var(--gold); }

#submit-btn {
  pointer-events: auto;
  padding: 0.6em 1.3em;
  border-radius: 12px;
  border: none;
  border-bottom: 3px solid #c75a30;
  background: var(--coral);
  color: #2a1208;
  font-family: "Outfit", sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.12s, filter 0.12s;
}
#submit-btn:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.1); }
#submit-btn:disabled { opacity: 0.5; cursor: default; }

#submit-status {
  margin-top: 0.8em;
  min-height: 1.2em;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  color: var(--gold);
}

/* ── mute toggle ── */
#mute-btn {
  position: absolute;
  top: 2.4vh;
  right: 2.4vw;
  pointer-events: auto;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(255, 246, 236, 0.35);
  background: rgba(26, 16, 56, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--ink);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.12s, filter 0.12s;
}
#mute-btn:hover { transform: scale(1.08); filter: brightness(1.15); }

/* ── credit ── */
#credit {
  position: absolute;
  bottom: 2vh;
  width: 100%;
  font-size: 0.72rem;
  font-weight: 300;
  letter-spacing: 0.22em;
  opacity: 0.55;
}
#credit strong { font-weight: 700; color: var(--aqua); }
