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

:root {
  --bg: #080c14;
  --fg: #e8e0d0;
  --accent: #f0a500;
  --muted: #4a5568;
  --card-bg: rgba(8, 12, 20, 0.80);
  --card-border: rgba(240, 165, 0, 0.20);
}

body {
  height: 200vh;
  overflow-x: hidden;
  background: var(--bg);
  font-family: 'DM Mono', monospace;
  color: var(--fg);
}

/* ── Layers ── */
.layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  pointer-events: none;
  will-change: transform;
}

#l-stars {
  height: 115vh;
  background: var(--bg);
  z-index: 1;
}

#l-sky {
  height: 128vh;
  z-index: 2;
  background: linear-gradient(to bottom,
      rgba(8, 12, 20, 0) 0%, rgba(8, 18, 45, .55) 10%,
      #080c20 20%, #0a1535 38%, #0c1d48 58%, #0e2560 78%, #111d35 100%);
}

#l-mfar {
  height: 148vh;
  background: transparent;
  z-index: 3;
}

#l-mnear {
  height: 192vh;
  background: transparent;
  z-index: 4;
}

#l-ground {
  height: 240vh;
  background: transparent;
  z-index: 5;
}

.mtn-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  display: block;
}

.layer-fill {
  position: absolute;
  top: 100vh;
  left: 0;
  width: 100%;
  bottom: 0;
}

/* ── Moon ── */
.moon {
  position: absolute;
  top: 8vh;
  right: 18vw;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 34%, #f5f5e2, #c5c5ad);
  box-shadow:
    0 0 16px 5px rgba(245, 245, 210, .50),
    0 0 55px 12px rgba(200, 210, 245, .18),
    0 0 100px 28px rgba(175, 195, 235, .08);
}

@keyframes twinkle {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: .12;
    transform: scale(.55);
  }
}

/* ── UI shared ── */
.ui-title {
  position: fixed;
  top: 1.8rem;
  left: 2rem;
  z-index: 200;
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.6rem, 3vw, 2.6rem);
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: -.02em;
  color: var(--fg);
  text-shadow: 0 2px 30px rgba(0, 0, 0, .9);
}

.ui-title span {
  color: var(--accent);
}

.card {
  background: var(--card-bg);
  backdrop-filter: blur(14px);
  border: 1px solid var(--card-border);
  border-radius: 8px;
}

/* ── Explainer (bottom-left) ── */
.ui-explainer {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  z-index: 200;
  width: min(340px, calc(100vw - 4rem));
  padding: 1.2rem 1.4rem;
}

.ex-intro {
  font-size: .74rem;
  line-height: 1.8;
  color: rgba(232, 224, 208, .65);
  margin-bottom: .9rem;
}

.ex-intro em {
  font-style: italic;
  color: var(--fg);
}

.ls-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .28rem;
  margin-bottom: .9rem;
}

.ls-list li {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .7rem;
}

.ls-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, .1);
}

.ls-label {
  flex: 1;
  color: rgba(232, 224, 208, .55);
}

.ls-speed {
  font-size: .66rem;
  color: var(--accent);
  background: rgba(240, 165, 0, .10);
  border: 1px solid rgba(240, 165, 0, .18);
  border-radius: 4px;
  padding: .04rem .3rem;
}

.ex-code {
  font-size: .74rem;
  color: var(--muted);
  border-top: 1px solid var(--card-border);
  padding-top: .7rem;
  text-align: center;
  font-style: italic;
}

.ex-code span {
  color: var(--accent);
  font-weight: 500;
  font-style: normal;
}

/* ── Coords (bottom-right) — hidden on mobile ── */
.ui-coords {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 200;
  min-width: 185px;
  padding: 1rem 1.3rem;
}

.c-header {
  font-size: .58rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: .6rem;
}

.c-row {
  display: flex;
  align-items: baseline;
  gap: .3rem;
  padding: .18rem 0;
}

.c-lbl {
  font-size: .55rem;
  letter-spacing: .1em;
  color: var(--muted);
  min-width: 66px;
}

.c-val {
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
  min-width: 50px;
  text-align: right;
}

.c-unit {
  font-size: .6rem;
  color: var(--muted);
}

.c-divider {
  height: 1px;
  background: var(--card-border);
  margin: .65rem 0 .5rem;
}

.c-hint {
  font-size: .62rem;
  color: var(--muted);
  text-align: center;
  letter-spacing: .08em;
  animation: pulse 2.5s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: .4;
  }

  50% {
    opacity: 1;
  }
}

/* ── Footer ── */
.footer {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.footer-text {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  padding-top: 12px;
}

.footer a {
  display: block;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.footer a:hover {
  opacity: 1;
}

.footer svg {
  height: 20px;
  width: auto;
  display: block;
}

/* ── Mobile ── */
@media (max-width: 540px) {
  .ui-coords {
    display: none;
  }

  .ui-explainer {
    width: calc(100vw - 4rem);
    bottom: 4.5rem;
  }

  .footer {
    bottom: 1.2rem;
  }
}