@font-face {
  font-family: Gotham;
  src: url('../fonts/GothamPro.woff') format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap
}

@font-face {
  font-family: Gotham;
  src: url('../fonts/GothamPro-Medium.woff') format("woff");
  font-weight: 500;
  font-style: normal;
  font-display: swap
}

@font-face {
  font-family: Gotham;
  src: url('../fonts/GothamPro-Bold.woff') format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap
}

@media (min-width: 1440px) {
  #gameStartScreen,
  #gameOverScreen { width: 600px; }
  #scoreLabel,
  #timeLabel { font-size: 1.4rem; }
}

@media (max-width: 1439px) {
  #gameStartScreen,
  #gameOverScreen { width: 500px; }
  #scoreLabel,
  #timeLabel { font-size: 1.4rem; }
}

@media (max-width: 1279px) {
  #gameStartScreen,
  #gameOverScreen { width: 500px; }
  #scoreLabel,
  #timeLabel { font-size: 1.2rem; }
}

@media (max-width: 1023px) {
  #gameStartScreen,
  #gameOverScreen { width: 400px; }
  #scoreLabel,
  #timeLabel { font-size: 1.1rem; }
}

@media (max-width: 600px) {
  #gameStartScreen,
  #gameOverScreen { width: 80%; }
  #scoreLabel,
  #timeLabel { font-size: 1.05rem; }
}

@media (max-width: 500px) {
  #gameStartScreen,
  #gameOverScreen { width: 90%; }
  #scoreLabel,
  #timeLabel { font-size: 1rem; }
}

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

body {
  font-family: Gotham, Open Sans, Helvetica Neue, arial, sans-serif;
  font-weight: 400;
  font-style: normal;
  text-align: center;
  overflow: hidden;
  background-color: #050914;
  width: 100%;
  height: 100%;
}

canvas { display: block; margin: 0 auto; }
#meteorCanvas { position: fixed; margin: 0; pointer-events: none; z-index: 1; }
#cometCanvas { position: fixed; margin: 0; pointer-events: none; z-index: 1; }
#startPlanetsCanvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 1;
}

#gameCanvas {
  transform-origin: center center;
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
}
.logo { display: flex; justify-content: center; align-items: center; height: 100px; }
.logo img { display: block; height: 100px; max-height: 100%; }

#blackHoleWarning {
  display: none;
  position: fixed;
  top: 48px;
  left: 50%;
  z-index: 7;
  width: max-content;
  max-width: min(92vw, 760px);
  box-sizing: border-box;
  padding: 9px 18px;
  transform: translateX(-50%) translateY(-10px);
  border: 1px solid rgba(134, 196, 255, 0.48);
  border-radius: 999px;
  background: rgba(8, 12, 28, 0.74);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: #dff4ff;
  font: 700 clamp(.78rem, 1.6vw, 1rem)/1.2 Gotham, Open Sans, Helvetica Neue, arial, sans-serif;
  letter-spacing: .02em;
  text-align: center;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 0 0 1px rgba(85, 150, 255, 0.08), 0 0 26px rgba(76, 145, 255, 0.16);
  transition: opacity 180ms ease, transform 260ms cubic-bezier(.22, 1, .36, 1);
}

#blackHoleWarning.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

#blackHoleWarning.is-critical {
  border-color: rgba(190, 216, 255, 0.72);
  box-shadow: 0 0 0 1px rgba(110, 170, 255, 0.12), 0 0 34px rgba(78, 133, 255, 0.24);
}

@media (prefers-reduced-motion: reduce) {
  #blackHoleWarning { transition: none; }
}

@media (max-width: 600px) {
  #blackHoleWarning {
    top: 46px;
    width: max-content;
    max-width: calc(100vw - 24px);
    padding: 8px 12px;
    white-space: normal;
  }
}

#countDownPopup {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 4;
  background-color: rgba(20, 23, 28, 0.5);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 25px 90px -30px rgba(0, 0, 0, 0.8);
  padding: 20px;
  border-radius: 10px;
  text-align: center;
  transform: translate(-50%, -50%);
}
#countdown { display: none; font-size: 4rem; font-weight: 700; color: #fc0; }

#gameStartScreen {
  display: block;
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 4;
  background-color: rgba(20, 23, 28, 0.5);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 25px 90px -30px rgba(0, 0, 0, 0.8);
  padding: 20px;
  border-radius: 10px;
  transform: translate(-50%, -50%);
}
#countdownQuestion,
#startQuestion { color: white; font-size: 1.5rem; font-weight: 700; }
#startButton { display: block; position: relative; top: 0; left: 50%; transform: translate(-50%, 0); }

button {
  -webkit-appearance: none;
  appearance: none;
  vertical-align: middle;
  color: inherit;
  font: inherit;
  background: transparent;
  padding: 0;
  margin: 0;
  border-radius: 0;
  text-align: inherit;
  text-transform: inherit;
  -webkit-tap-highlight-color: transparent;
}
:focus { outline-style: solid; outline-color: transparent; }

.button-style {
  position: relative;
  font-size: 1.4rem;
  color: white;
  text-decoration: none;
  letter-spacing: 1px;
  border: 1px solid white;
  border-radius: 12px;
  padding: 15px;
  margin-block-start: 1em;
  margin-block-end: 1em;
  transition-property: border-color;
  transition-duration: .2s;
  cursor: pointer;
}
.button-style:hover,
.button-style:focus-visible { border-color: transparent; }
.button-style:hover::before,
.button-style:focus-visible::before { opacity: 1; }
.button-style:active::after { opacity: 1; }
.button-style::before,
.button-style::after { content: ''; position: absolute; inset: 0; border-radius: inherit; opacity: 0; transition-property: opacity; }
.button-style::before { box-shadow: 0 0 2px #fff, 0 -2px 6px #f3c523, 2px 0 6px #94c535, -2px 0 6px #ba6ea4, 0 2px 6px #43acc9; transition-duration: .15s; }
.button-style::after { box-shadow: 0 0 8px 4px #fff, 0 -4px 12px 4px #f3c523, 0 4px 12px 4px #43acc9, -4px 0 12px 4px #e6514d, 4px 0 12px 4px #94c535; transition-duration: .2s; }

#scoreLabel,
#timeLabel {
  display: none;
  position: absolute;
  pointer-events: none;
  top: 10px;
  padding: 5px;
  border-radius: 5px;
  background-color: rgba(20, 23, 28, 0.1);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: white;
  font-family: Gotham, Open Sans, Helvetica Neue, arial, sans-serif;
  font-weight: 500;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
  z-index: 2;
}
#scoreLabel { left: 10px; }
#timeLabel { right: 10px; }
.noselect { -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; }

#gameOverScreen {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  background-color: rgba(20, 23, 28, 0.5);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 25px 90px -30px rgba(0, 0, 0, 0.8);
  padding: 20px;
  text-align: center;
  font-size: 1.4rem;
  color: white;
  transform: translate(-50%, -50%);
  border-radius: 10px;
  opacity: 0;
  will-change: transform, opacity;
}

#gameOverScreen.fadeIn {
  animation: gameOverReveal .55s cubic-bezier(.22, 1, .36, 1) forwards;
}

.fadeIn { -webkit-animation: fadeIn .25s ease-in-out alternate; -moz-animation: fadeIn .25s ease-in-out alternate; -o-animation: fadeIn .25s ease-in-out alternate; animation: fadeIn .25s ease-in-out alternate; }
#restartButton { display: none; top: 0; left: 50%; transform: translate(-50%, 0); }
.be-better { color: white; font-size: 1.5rem; font-weight: 700; }
.accordion_container { display: block; position: relative; padding: 25px; }
.accordion { color: white; border: 1px solid white; border-radius: 12px; }
.accordion:not(:last-of-type) { margin-bottom: 10px; }
.accordion_top { position: relative; padding: 15px 25px; font-size: 1.1rem; font-weight: 500; cursor: pointer; }
.accordion_top::after { content: "+"; position: absolute; right: 24px; }
.accordion_top:hover { box-shadow: 0 0 2px #fff, 0 -2px 6px #f3c523, 2px 0 6px #94c535, -2px 0 6px #ba6ea4, 0 2px 6px #43acc9; transition-duration: .15s; border-radius: 12px; }
.accordion_opened>.accordion_top { border-bottom: 2px solid white; }
.accordion_opened>.accordion_top::after { content: "-"; }
.accordion_body { max-height: 0px; overflow: hidden; transition: height ease-out 0.25s, padding ease-out 0.15s; }
.accordion_body ol,
.accordion_body ul { padding: 0 10px; }
.accordion_body ol li:not(:last-child),
.accordion_body ul li:not(:last-child) { margin-bottom: 10px; }
.accordion_opened>.accordion_body { max-height: max-content; text-align: left; line-height: 1.2; padding: 20px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

@keyframes gameOverReveal {
  0% { opacity: 0; transform: translate(-50%, -47%) scale(.92); filter: blur(6px); }
  55% { opacity: 1; transform: translate(-50%, -50%) scale(1.015); filter: blur(0); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1); filter: blur(0); }
}


/* Start-screen rules slider. */
.rules-slider {
  width: 100%;
  box-sizing: border-box;
  padding: 0 25px;
}

.rules-slider-viewport {
  overflow: hidden;
  border-radius: 16px;
  touch-action: pan-y;
}

.rules-slider-track {
  display: flex;
  transition: transform .32s cubic-bezier(.22, 1, .36, 1);
  will-change: transform;
}

.rules-card {
  flex: 0 0 100%;
  box-sizing: border-box;
  padding: 22px 24px 20px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 16px;
  background:
    radial-gradient(circle at 85% 12%, rgba(240,204,251,.10), transparent 34%),
    linear-gradient(145deg, rgba(25,22,38,.88), rgba(12,14,25,.82));
  color: #fff;
  text-align: left;
  align-self: flex-start;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.07), 0 18px 45px rgba(0,0,0,.16);
}


.rules-card-kicker {
  margin: 0 0 7px;
  color: rgba(240,204,251,.76);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.rules-card h2 {
  margin: 0 0 11px;
  color: #fff;
  font-size: 1.25rem;
  line-height: 1.15;
  font-weight: 700;
}

.rules-card p:not(.rules-card-kicker) {
  margin: 0;
  color: rgba(255,255,255,.84);
  font-size: .92rem;
  line-height: 1.45;
}

.rules-card-note {
  margin-top: 15px;
  padding: 11px 12px;
  border-left: 2px solid rgba(240,204,251,.72);
  border-radius: 0 9px 9px 0;
  background: rgba(255,255,255,.045);
  color: rgba(255,255,255,.76);
  font-size: .78rem;
  line-height: 1.4;
}

.rules-card-note strong {
  color: #fff;
}

.rules-card-controls {
  margin-top: 14px;
  color: rgba(255,255,255,.48);
  font-size: .68rem;
  line-height: 1.35;
  letter-spacing: .02em;
}

.rules-slider-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 13px;
}

.rules-slider-arrow {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 9px;
  background: rgba(255,255,255,.05);
  color: rgba(255,255,255,.86);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color .16s ease, background-color .16s ease, opacity .16s ease, transform .16s ease;
}

.rules-slider-arrow:hover:not(:disabled),
.rules-slider-arrow:focus-visible {
  border-color: rgba(240,204,251,.62);
  background: rgba(240,204,251,.08);
  outline: none;
}

.rules-slider-arrow:active:not(:disabled) {
  transform: translateY(1px);
}

.rules-slider-arrow:disabled {
  opacity: .28;
  cursor: default;
}

.rules-slider-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.rules-slider-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.28);
  cursor: pointer;
  transition: transform .2s ease, background-color .2s ease, box-shadow .2s ease;
}

.rules-slider-dot.is-active {
  transform: scale(1.35);
  background: #f0ccfb;
  box-shadow: 0 0 9px rgba(240,204,251,.42);
}

.rules-slider-dot:focus-visible {
  outline: 2px solid rgba(240,204,251,.72);
  outline-offset: 4px;
}

@media (max-width: 600px) {
  .rules-slider {
    padding: 0 8px;
  }

  .rules-card {
    padding: 19px 18px 17px;
  }

  .rules-card h2 {
    font-size: 1.08rem;
  }

  .rules-card p:not(.rules-card-kicker) {
    font-size: .82rem;
  }

  .rules-card-note {
    font-size: .72rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rules-slider-track,
  .rules-slider-arrow,
  .rules-slider-dot {
    transition: none;
  }
}


/* Shared glass UI system for start, countdown, result and recovery surfaces. */
:root {
  --ui-surface: linear-gradient(145deg, rgba(25,22,38,.92), rgba(10,13,24,.88));
  --ui-surface-soft: rgba(18,16,31,.78);
  --ui-border: rgba(255,255,255,.16);
  --ui-border-strong: rgba(240,204,251,.34);
  --ui-highlight: rgba(255,255,255,.07);
  --ui-accent: #f0ccfb;
  --ui-accent-soft: rgba(240,204,251,.14);
  --ui-text: #fff;
  --ui-text-muted: rgba(255,255,255,.68);
  --ui-shadow: 0 24px 70px rgba(0,0,0,.34), 0 0 38px rgba(110,82,145,.10);
  --ui-radius: 18px;
}

#gameStartScreen,
#gameOverScreen,
#countDownPopup {
  box-sizing: border-box;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: linear-gradient(145deg, rgba(25,22,38,.78), rgba(10,13,24,.72));
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  box-shadow: inset 0 1px 0 var(--ui-highlight), var(--ui-shadow);
}

#gameStartScreen {
  padding: 24px;
}

#gameOverScreen {
  padding: 28px 30px 30px;
}

#countDownPopup {
  min-width: 240px;
  padding: 22px 26px 24px;
}

#countdownQuestion {
  margin: 0 0 8px;
  color: var(--ui-text-muted);
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

#countdown {
  color: var(--ui-accent);
  font-size: 4.5rem;
  line-height: .95;
  text-shadow: 0 0 24px rgba(240,204,251,.32);
}

#startQuestion {
  margin: 18px 0 8px;
  color: var(--ui-text-muted);
  font-size: .9rem;
  font-weight: 500;
}

.be-better {
  margin: 0 0 16px;
  color: var(--ui-text);
  font-size: 1.45rem;
  line-height: 1.18;
  font-weight: 700;
}

#gameOverScreen > p:not(.be-better) {
  margin: 8px 0;
  color: var(--ui-text-muted);
  font-size: .9rem;
  line-height: 1.4;
}

#gameOverScreen #finalScore,
#gameOverScreen #timeSpent {
  color: var(--ui-accent);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.button-style {
  border-color: var(--ui-border-strong);
  border-radius: 11px;
  background: rgba(18,16,31,.48);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
  padding: 12px 18px;
  margin: 18px auto 4px;
  font-size: .92rem;
  font-weight: 500;
  letter-spacing: .04em;
}

.button-style::before {
  box-shadow: 0 0 0 1px rgba(240,204,251,.08), 0 0 18px rgba(240,204,251,.16);
}

.button-style::after {
  box-shadow: 0 0 24px 5px rgba(240,204,251,.12);
}

.button-style:hover,
.button-style:focus-visible {
  border-color: rgba(240,204,251,.62);
  background: var(--ui-accent-soft);
}

.button-style:active {
  transform: translate(-50%, 1px);
}

@media (max-width: 600px) {
  #gameStartScreen {
    padding: 18px;
  }

  #gameOverScreen {
    padding: 22px 20px 24px;
  }

  #countDownPopup {
    min-width: 200px;
    padding: 18px 20px 20px;
  }

  #countdown {
    font-size: 3.7rem;
  }

  .be-better {
    font-size: 1.2rem;
  }
}


/* Primary start action: large and centered on the start screen. */
#startButton {
  left: auto;
  width: auto;
  min-width: 190px;
  padding: 15px 30px;
  margin: 20px auto 4px;
  transform: none;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: .02em;
}

#startButton:active {
  transform: translateY(1px);
}

@media (max-width: 600px) {
  #startButton {
    min-width: 170px;
    padding: 13px 26px;
    font-size: 1.2rem;
  }
}


/* Game over result emphasis: match the primary start action. */
#gameOverScreen > p:not(.be-better) {
  font-size: 1.08rem;
  line-height: 1.5;
}

#gameOverScreen #finalScore,
#gameOverScreen #timeSpent {
  font-size: 1.18rem;
}

#restartButton {
  left: auto;
  width: auto;
  min-width: 210px;
  padding: 15px 30px;
  margin: 22px auto 4px;
  transform: none;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: .02em;
}

#restartButton:active {
  transform: translateY(1px);
}

@media (max-width: 600px) {
  #gameOverScreen > p:not(.be-better) {
    font-size: 1rem;
  }

  #gameOverScreen #finalScore,
  #gameOverScreen #timeSpent {
    font-size: 1.1rem;
  }

  #restartButton {
    min-width: 180px;
    padding: 13px 26px;
    font-size: 1.2rem;
  }
}


/* Result screen actions. */
.game-over-actions {
  display: grid;
  grid-template-columns: minmax(0, 5.67fr) minmax(0, 1fr);
  align-items: stretch;
  width: min(100%, 420px);
  margin: 18px auto 4px;
  gap: 10px;
}

.game-over-actions #restartButton {
  width: 100%;
  min-width: 0;
  height: 50px;
  box-sizing: border-box;
  margin: 0;
}

.game-over-home-button {
  width: 100%;
  height: 50px;
  min-height: 0;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  border: 1px solid var(--ui-border-strong);
  border-radius: 11px;
  background: rgba(18,16,31,.48);
  color: var(--ui-text);
  cursor: pointer;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
  transition: border-color .16s ease, background-color .16s ease, transform .16s ease;
}

.game-over-home-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.game-over-home-button:hover,
.game-over-home-button:focus-visible {
  border-color: rgba(240,204,251,.62);
  background: var(--ui-accent-soft);
  outline: none;
}

.game-over-home-button:active {
  transform: translateY(1px);
}

@media (max-width: 600px) {
  .game-over-actions {
    width: 100%;
    gap: 8px;
  }

  .game-over-actions #restartButton,
  .game-over-home-button {
    height: 50px;
  }
}

/* Primary action attention pulse. The button stays calm between pulses and gets a soft glow to draw the eye. */
@keyframes primaryActionPulse {
  0%, 72%, 100% {
    box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 0 0 0 rgba(240,204,251,0);
  }
  80% {
    box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 0 0 5px rgba(240,204,251,.06), 0 0 28px 4px rgba(240,204,251,.22);
  }
  88% {
    box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 0 0 2px rgba(240,204,251,.04), 0 0 16px 2px rgba(240,204,251,.12);
  }
}

#startButton,
#restartButton {
  animation: primaryActionPulse 3.2s ease-in-out infinite;
}

#startButton:hover,
#startButton:focus-visible,
#restartButton:hover,
#restartButton:focus-visible {
  animation-play-state: paused;
}

@media (prefers-reduced-motion: reduce) {
  #startButton,
  #restartButton {
    animation: none;
  }
}


/* ============================================================
   Extra lives / heart counter and shared game HUD
   ============================================================ */

/* Extra lives / heart counter and shared game HUD. */
body { transform: scale(1); transform-origin: top left; }

#gameCanvas {
  width: auto;
  height: auto;
  position: fixed;
  left: 50%;
  top: 50%;
  margin: 0;
  transform: translate(-50%, -50%);
  z-index: 2;
}

audio, embed { position: absolute; z-index: -9999; }

/* Luma-inspired translucent header: border, 50% background and backdrop blur. */
#gameHeader {
  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 50;
  border-bottom: 1px solid rgba(42, 36, 64, 0.5);
  background: linear-gradient(
    180deg,
    rgba(8, 6, 15, 0.58) 0%,
    rgba(8, 6, 15, 0.42) 100%
  );
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  color: #f4f4f5;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top);
  pointer-events: none;
}

#gameHeader::after {
  content: '';
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  height: 1px;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(240, 204, 251, 0.25) 50%,
    transparent 100%
  );
}

.game-header-inner {
  box-sizing: border-box;
  width: 100%;
  max-width: 1152px;
  height: 32px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

#gameHud {
  box-sizing: border-box;
  position: static;
  top: auto;
  left: auto;
  right: auto;
  width: auto;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 28px;
  flex: 1 1 auto;
  pointer-events: none;
}

#scoreLabel,
#timeLabel {
  box-sizing: border-box;
  position: static;
  top: auto;
  left: auto;
  right: auto;
  display: none;
  width: auto;
  min-width: 0;
  max-width: none;
  margin: 0;
  padding: 8px 12px;
  border: 1px solid rgba(42, 36, 64, 0.9);
  border-radius: 8px;
  background: rgba(16, 12, 30, 0.52);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #f4f4f5;
  font: 500 0.9rem/1.15 Gotham, Open Sans, Helvetica Neue, arial, sans-serif;
  text-shadow: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  z-index: auto;
  font-variant-numeric: tabular-nums;
}

#scoreLabel { text-align: left; }
#timeLabel { text-align: left; }
#scoreLabel,
#timeLabel {
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  display: inline-flex;
  align-items: baseline;
  justify-content: flex-start;
  gap: 6px;
  overflow: visible;
}

/* Fixed desktop columns keep later metrics stationary while values grow. */
#scoreValue {
  display: inline-block;
  position: relative;
  min-width: 0;
  transform-origin: center;
}

#scoreValue::after {
  content: '';
  position: absolute;
  inset: -4px -6px;
  border-radius: 7px;
  background: rgba(240, 204, 251, 0.10);
  box-shadow:
    0 0 10px rgba(240, 204, 251, 0.18),
    inset 0 0 8px rgba(255, 255, 255, 0.05);
  opacity: 0;
  transform: scale(.82);
  pointer-events: none;
  z-index: -1;
}

#scoreValue.score-pulse::after {
  animation: scoreValueFlash .42s cubic-bezier(.22, 1, .36, 1);
}

@keyframes scoreValueFlash {
  0% {
    opacity: 0;
    transform: scale(.82);
  }
  20% {
    opacity: .95;
    transform: scale(1);
  }
  52% {
    opacity: .55;
    transform: scale(1.03);
  }
  100% {
    opacity: 0;
    transform: scale(1.08);
  }
}

#scoreValue.score-pulse {
  animation: scoreNumberPulse .42s cubic-bezier(.22, 1, .36, 1);
}

@keyframes scoreNumberPulse {
  0%, 100% {
    color: #f0ccfb;
    text-shadow: 0 0 0 rgba(240, 204, 251, 0);
    transform: scale(1);
  }
  24% {
    color: #fff;
    text-shadow: 0 0 13px rgba(240, 204, 251, .76);
    transform: scale(1.16);
  }
  58% {
    color: #f0ccfb;
    text-shadow: 0 0 7px rgba(240, 204, 251, .34);
    transform: scale(1.04);
  }
}

#timeLabel {
  flex: 0 0 120px;
  width: 120px;
  min-width: 120px;
}

#scoreLabel {
  flex: 0 0 130px;
  width: 130px;
  min-width: 130px;
}

#heartCounter {
  flex: 0 0 84px;
  width: 84px;
  min-width: 84px;
  max-width: 84px;
}

/* Fixed desktop fuel resource column keeps the resource row stable. */
#fuelCounter {
  flex: 0 0 82px;
  width: 82px;
  min-width: 82px;
  max-width: 82px;
}

.hud-metric-label {
  flex: 0 0 auto;
  color: rgba(244, 244, 245, 0.72);
  font-weight: 500;
}

.hud-metric-value {
  flex: 0 0 auto;
  color: #f0ccfb;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: left;
}

#scoreValue {
  min-width: 0;
  text-align: right;
}


#gameControls {
  position: static;
  top: auto;
  left: auto;
  right: auto;
  bottom: auto;
  width: auto;
  max-width: none;
  min-width: 0;
  margin: 0;
  padding: 0;
  transform: none;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 1 auto;
  pointer-events: auto;
}

.game-control-button {
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  flex: 0 0 24px !important;
  width: 24px !important;
  height: 24px !important;
  min-width: 24px !important;
  min-height: 24px !important;
  max-width: 24px !important;
  max-height: 24px !important;
  aspect-ratio: 1 / 1 !important;
  padding: 0 !important;
  margin: 0;
  border: 1px solid rgba(42, 36, 64, 1);
  border-radius: 10px !important;
  color: #f4f4f5;
  background: rgba(25, 19, 48, 0.6);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    box-shadow 160ms ease;
}

.game-control-button svg {
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.game-control-button:hover,
.game-control-button:focus-visible {
  background: rgba(25, 19, 48, 0.78);
  border-color: rgba(240, 204, 251, 0.6);
  box-shadow: 0 0 0 1px rgba(240, 204, 251, 0.08);
  outline: none;
}

.game-control-button:active { transform: translateY(1px); }

.game-control-button.music-active {
  border-color: rgba(130, 255, 165, 0.95);
  box-shadow: 0 0 10px rgba(65, 220, 105, 0.2);
}

.game-control-button.music-inactive {
  border-color: rgba(255, 145, 145, 0.95);
  box-shadow: 0 0 10px rgba(240, 70, 70, 0.18);
}

.game-control-button.pause-active { border-color: rgba(240, 204, 251, 0.6); }
.game-control-button.pause-inactive {
  border-color: rgba(255, 210, 110, 0.95);
  box-shadow: 0 0 10px rgba(255, 160, 40, 0.16);
}

#gameStartScreen,
#gameOverScreen,
#countDownPopup { z-index: 10; }
#dangerEdgeGlow {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  overflow: hidden;
}

#dangerEdgeGlow > span {
  position: absolute;
  left: 0;
  right: 0;
  height: 18%;
  opacity: 0;
  will-change: opacity;
}

.danger-edge-glow-top {
  top: 0;
  background: linear-gradient(
    to bottom,
    rgba(255, 34, 54, 0.68) 0%,
    rgba(255, 34, 54, 0.38) 20%,
    rgba(255, 34, 54, 0.12) 58%,
    rgba(255, 34, 54, 0) 100%
  );
}

.danger-edge-glow-bottom {
  bottom: 0;
  background: linear-gradient(
    to top,
    rgba(255, 34, 54, 0.68) 0%,
    rgba(255, 34, 54, 0.38) 20%,
    rgba(255, 34, 54, 0.12) 58%,
    rgba(255, 34, 54, 0) 100%
  );
}

@media (prefers-reduced-motion: reduce) {
  #dangerEdgeGlow > span {
    transition: none;
  }
}


#fuelCounter {
  position: static;
  z-index: auto;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex: 0 0 82px;
  width: 82px;
  min-width: 82px;
  max-width: 82px;
  height: 24px;
  box-sizing: border-box;
  padding: 0 8px;
  border: 1px solid rgba(42, 36, 64, 0.9);
  border-radius: 8px;
  background: rgba(16, 12, 30, 0.52);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #f4f4f5;
  font: 600 .8rem/1 Gotham,Open Sans,Helvetica Neue,arial,sans-serif;
  text-shadow: none;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

#fuelCounter .fuel-counter-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #f0ccfb;
  flex: 0 0 13px;
}

#fuelCounter .fuel-counter-icon svg {
  width: 13px;
  height: 13px;
  display: block;
  fill: rgba(240, 204, 251, 0.18);
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linejoin: round;
}

#fuelCounter.fuel-counter-warning {
  border-color: rgba(255, 189, 69, 0.95);
}

#fuelCounter.fuel-counter-warning .fuel-counter-icon,
#fuelCounter.fuel-counter-warning .hud-metric-value {
  color: #ffbd45;
}

#fuelCounter.fuel-counter-critical {
  border-color: rgba(255, 74, 92, 0.95);
  animation: fuelCriticalBlink .85s ease-in-out infinite;
}

#fuelCounter.fuel-counter-critical .fuel-counter-icon,
#fuelCounter.fuel-counter-critical .hud-metric-value,
#fuelCounter.fuel-counter-empty .fuel-counter-icon,
#fuelCounter.fuel-counter-empty .hud-metric-value {
  color: #ff6675;
}

#fuelCounter.fuel-counter-empty {
  border-color: rgba(255, 74, 92, 0.95);
}

#fuelCounter.fuel-counter-gained {
  animation: fuelCounterGained .45s cubic-bezier(.22, 1, .36, 1);
}

@keyframes fuelCriticalBlink {
  0%, 100% { opacity: .72; }
  50% { opacity: 1; }
}

@keyframes fuelCounterGained {
  0% { transform: scale(1); }
  45% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

#heartCounter {
  position: static;
  z-index: auto;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  max-width: 96px;
  box-sizing: border-box;
  height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(42, 36, 64, 0.9);
  border-radius: 8px;
  background: rgba(16, 12, 30, 0.52);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #f4f4f5;
  font: 600 .8rem/1 Gotham,Open Sans,Helvetica Neue,arial,sans-serif;
  text-shadow: none;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}



#heartRecoveryOverlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  color: #fff;
  text-align: center;
  font-family: Gotham,Open Sans,Helvetica Neue,arial,sans-serif;
}

#heartRecoveryOverlay .heart-recovery-card {
  min-width: min(260px,72vw);
  box-sizing: border-box;
  padding: 20px 28px 22px;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 16px;
  background: rgba(20,23,28,.72);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 18px 60px rgba(0,0,0,.38),0 0 24px rgba(83,223,255,.18);
}

#heartRecoveryOverlay .heart-recovery-title { margin:0 0 7px; font-size:1.05rem; font-weight:500; }
#heartRecoveryOverlay .heart-recovery-count { margin:0; font-size:3.5rem; line-height:1; font-weight:700; font-variant-numeric:tabular-nums; text-shadow:0 0 18px rgba(83,223,255,.75); }
#heartRecoveryOverlay .heart-recovery-subtitle { margin:8px 0 0; font-size:.85rem; opacity:.78; }

#heartCounter .heart-counter-icon {
  color: #ff4b61;
  font-size: 1.05rem;
  line-height: 1;
  text-shadow: 0 0 7px rgba(255,64,91,.65);
}

#heartCounter.heart-counter-empty { opacity: .72; }

@media (max-width:700px) {
  #scoreLabel,
  #timeLabel,
  #heartCounter {
    font-size: .68rem;
  }

  #heartCounter {
    height: 22px;
    padding: 0 6px;
  }

  .game-header-inner {
    height: 30px;
    padding: 0 8px;
  }

  #gameHud {
    gap: 10px;
  }

  #timeLabel,
  #scoreLabel {
    flex: 0 1 auto;
    width: auto;
    min-width: 0;
  }

  #fuelCounter,
  #heartCounter {
    flex: 0 1 auto;
    width: auto;
    min-width: 0;
    max-width: 30vw;
  }

  #heartCounter {
    flex: 0 1 auto;
    width: auto;
    min-width: 0;
    max-width: 86px;
    overflow: hidden;
  }

  #gameControls { gap: 6px; }

  .game-control-button {
    flex-basis: 22px !important;
    width: 22px !important;
    height: 22px !important;
    min-width: 22px !important;
    min-height: 22px !important;
    max-width: 22px !important;
    max-height: 22px !important;
    border-radius: 7px !important;
  }

  .game-control-button svg {
    width: 12px;
    height: 12px;
    flex-basis: 12px;
  }

  #heartCounter .heart-counter-icon,
  #fuelCounter .fuel-counter-icon svg { width: 12px; height: 12px; flex-basis: 12px; }

  #heartRecoveryOverlay .heart-recovery-card { padding: 17px 22px 19px; }
  #heartRecoveryOverlay .heart-recovery-count { font-size: 3rem; }
}

@media (max-width:380px) {
  .game-header-inner {
    height: 28px;
    padding: 0 6px;
  }

  #scoreLabel,
  #timeLabel,
  #heartCounter {
    font-size: .62rem;
  }

  #gameHud {
    gap: 7px;
  }

  #heartCounter,
  #fuelCounter {
    height: 20px;
    padding: 0 5px;
  }

  #timeLabel,
  #scoreLabel,
  #fuelCounter,
  #heartCounter {
    flex: 0 1 auto;
    width: auto;
    min-width: 0;
    max-width: 72px;
  }

  #gameControls { gap: 4px; }

  .game-control-button {
    flex-basis: 18px !important;
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    min-height: 18px !important;
    max-width: 18px !important;
    max-height: 18px !important;
    border-radius: 6px !important;
  }

  .game-control-button svg {
    width: 10px;
    height: 10px;
    flex-basis: 10px;
  }

}

/* Recovery popup uses the same glass surface, with cyan reserved for the recovery state. */
#heartRecoveryOverlay .heart-recovery-card {
  box-sizing: border-box;
  min-width: min(280px, 76vw);
  padding: 22px 28px 24px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: linear-gradient(145deg, rgba(25,22,38,.78), rgba(10,13,24,.72));
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  box-shadow:
    inset 0 1px 0 var(--ui-highlight),
    var(--ui-shadow),
    0 0 28px rgba(83,223,255,.12);
}

#heartRecoveryOverlay .heart-recovery-title {
  color: var(--ui-text-muted);
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}

#heartRecoveryOverlay .heart-recovery-count {
  color: var(--ui-accent);
  text-shadow: 0 0 22px rgba(240,204,251,.35);
}

#heartRecoveryOverlay .heart-recovery-subtitle {
  color: var(--ui-text-muted);
}

@media (max-width: 700px) {
  #heartRecoveryOverlay .heart-recovery-card {
    padding: 19px 22px 21px;
  }
}

/* Result leaderboard: keep the title visually connected to the table header. */
#leaderboard {
  position: relative;
  width: min(100%, 420px);
  margin: 20px auto 8px;
  padding-top: 14px;
  overflow: visible;
  text-align: center;
  font-size: 1rem;
}

#leaderboard h3 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0;
  padding: 0 0 10px;
  color: rgba(240,204,251,.86);
  font-size: .72rem;
  line-height: 1;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(240,204,251,.16);
}

#leaderboard h3::before,
#leaderboard h3::after {
  content: '';
  width: 34px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(240,204,251,.30));
}

#leaderboard h3::after {
  background: linear-gradient(90deg, rgba(240,204,251,.30), transparent);
}

#leaderboard .leaderboard-status {
  padding: 8px 0 2px;
  color: var(--ui-text-muted);
}

#leaderboard .leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
}

#leaderboard .leaderboard-table th,
#leaderboard .leaderboard-table td {
  padding: 5px 7px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}

#leaderboard .leaderboard-table th {
  color: rgba(255,255,255,.58);
  font-weight: 500;
}

#leaderboard .leaderboard-table td:nth-child(2) { text-align: left; }

@media (max-width:500px) {
  #leaderboard {
    margin-top: 16px;
    padding-top: 11px;
  }

  #leaderboard,
  #leaderboard .leaderboard-table { font-size: .9rem; }

  #leaderboard h3 {
    padding-bottom: 8px;
    font-size: .66rem;
  }

  #leaderboard h3::before,
  #leaderboard h3::after {
    width: 24px;
  }

  #leaderboard .leaderboard-table th,
  #leaderboard .leaderboard-table td {
    padding: 4px 5px;
  }
}
