:root {
  color-scheme: dark;
  --ink: #f0f0e8;
  --muted: #a7aea1;
  --forest: #101a16;
  --card: rgba(26, 39, 32, 0.88);
  --line: rgba(230, 239, 220, 0.12);
  --lime: #d6ff67;
  --orange: #ff9a62;
  --shadow: 0 24px 60px rgba(2, 8, 5, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--forest);
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% -10%, rgba(141, 171, 105, 0.22), transparent 42%),
    radial-gradient(circle at 100% 45%, rgba(255, 154, 98, 0.1), transparent 32%),
    linear-gradient(155deg, #18271f 0%, #0d1612 62%, #0a110e 100%);
  font-family: "Avenir Next", "PingFang SC", "Noto Sans SC", sans-serif;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.topography {
  position: fixed;
  inset: -20%;
  pointer-events: none;
  opacity: 0.13;
  background-image:
    repeating-radial-gradient(ellipse at 18% 25%, transparent 0 31px, #d5e0c9 33px 34px),
    repeating-radial-gradient(ellipse at 82% 72%, transparent 0 44px, #d5e0c9 46px 47px);
  transform: rotate(-8deg) scale(1.15);
  mask-image: linear-gradient(to bottom, black, transparent 88%);
}

.shell {
  position: relative;
  width: min(100% - 32px, 720px);
  margin: 0 auto;
  padding: max(28px, env(safe-area-inset-top)) 0 max(32px, env(safe-area-inset-bottom));
}

.masthead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
  animation: arrive 0.6s ease both;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--lime);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  letter-spacing: 0.16em;
}

h1 {
  margin: 0;
  font-family: "STSong", "Songti SC", serif;
  font-size: clamp(32px, 9vw, 52px);
  font-weight: 600;
  letter-spacing: -0.06em;
}

.live-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 8px;
  padding: 8px 11px;
  color: #c6ccbf;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(6, 14, 10, 0.36);
  font-size: 11px;
  white-space: nowrap;
}

.pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6d776e;
}

.live-pill.active .pulse {
  background: var(--lime);
  box-shadow: 0 0 0 0 rgba(214, 255, 103, 0.55);
  animation: pulse 1.8s infinite;
}

.hero-card,
.coordinate-grid article,
.metrics article,
.status-panel {
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.hero-card {
  position: relative;
  min-height: 330px;
  padding: 26px;
  overflow: hidden;
  border-radius: 4px 4px 46px 4px;
  animation: arrive 0.6s 0.08s ease both;
}

.hero-card::after {
  content: "M";
  position: absolute;
  right: -6px;
  bottom: -62px;
  color: rgba(235, 244, 224, 0.035);
  font-family: Georgia, serif;
  font-size: 260px;
  line-height: 1;
}

.hero-label {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}

.signal {
  color: var(--lime);
  font-family: "SFMono-Regular", Consolas, monospace;
}

.altitude-readout {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-top: 24px;
}

.altitude-readout strong {
  font-family: "Bodoni 72", Didot, serif;
  font-size: clamp(96px, 30vw, 182px);
  font-weight: 400;
  line-height: 0.9;
  letter-spacing: -0.08em;
  font-variant-numeric: tabular-nums;
}

.altitude-readout span {
  color: var(--lime);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 18px;
}

.altitude-note {
  position: relative;
  z-index: 1;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.contour-line {
  position: absolute;
  inset: auto 0 0;
  height: 82px;
  opacity: 0.55;
}

.contour-line svg {
  width: 100%;
  height: 100%;
}

.contour-line path {
  fill: none;
  stroke: var(--orange);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.coordinate-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
  animation: arrive 0.6s 0.14s ease both;
}

.coordinate-grid article {
  min-width: 0;
  padding: 18px;
  border-radius: 4px 18px 4px 4px;
}

.coordinate-grid span,
.metrics span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.coordinate-grid strong {
  display: block;
  overflow: hidden;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: clamp(15px, 4.4vw, 22px);
  font-weight: 500;
  letter-spacing: -0.04em;
  text-overflow: ellipsis;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
  animation: arrive 0.6s 0.2s ease both;
}

.metrics article {
  min-height: 122px;
  padding: 18px;
  border-radius: 4px;
}

.metrics strong {
  display: block;
  margin-bottom: 7px;
  font-family: "Bodoni 72", Didot, serif;
  font-size: 30px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.metrics small {
  color: #7f8a80;
  font-size: 10px;
}

.actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 16px;
  animation: arrive 0.6s 0.26s ease both;
}

button {
  min-height: 54px;
  padding: 0 20px;
  border: 0;
  border-radius: 4px;
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 3px;
}

.primary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #11190f;
  background: var(--lime);
}

.primary svg {
  width: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.secondary {
  color: var(--ink);
  border: 1px solid var(--line);
  background: rgba(230, 239, 220, 0.08);
}

.secondary:disabled {
  color: #667067;
  cursor: not-allowed;
}

.status-panel {
  display: flex;
  gap: 12px;
  margin-top: 10px;
  padding: 15px 17px;
  border-radius: 4px;
  box-shadow: none;
  animation: arrive 0.6s 0.3s ease both;
}

.status-panel.error {
  border-color: rgba(255, 154, 98, 0.35);
}

.status-icon {
  display: grid;
  flex: 0 0 20px;
  height: 20px;
  place-items: center;
  color: #101a16;
  border-radius: 50%;
  background: var(--orange);
  font-family: Georgia, serif;
  font-size: 12px;
  font-weight: 700;
}

.status-panel p {
  margin: 1px 0 0;
  color: #bbc2b7;
  font-size: 12px;
  line-height: 1.55;
}

footer {
  padding: 28px 2px 0;
  color: #717b73;
  font-size: 10px;
  line-height: 1.7;
}

footer p {
  margin: 0 0 4px;
}

footer a {
  color: #aeb8aa;
}

.mobile-credit {
  display: none;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 10;
  padding: 11px 16px;
  color: #101a16;
  border-radius: 999px;
  background: var(--ink);
  font-size: 12px;
  font-weight: 650;
  opacity: 0;
  transform: translate(-50%, 12px);
  transition: 0.25s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@keyframes arrive {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  70% {
    box-shadow: 0 0 0 7px rgba(214, 255, 103, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(214, 255, 103, 0);
  }
}

@media (min-width: 640px) {
  .metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .metrics article {
    min-height: 132px;
  }
}

@media (max-width: 639px) {
  html,
  body {
    height: 100%;
    min-height: 100%;
  }

  body {
    overflow: hidden;
  }

  .shell {
    display: flex;
    width: min(100% - 24px, 420px);
    height: 100dvh;
    min-height: 560px;
    padding: max(10px, env(safe-area-inset-top)) 0 max(8px, env(safe-area-inset-bottom));
    flex-direction: column;
    overflow: hidden;
  }

  .masthead {
    flex: 0 0 auto;
    align-items: center;
    margin-bottom: 8px;
  }

  .eyebrow {
    margin-bottom: 1px;
    font-size: 8px;
  }

  h1 {
    font-size: 29px;
    line-height: 1;
  }

  .live-pill {
    margin-top: 0;
    padding: 6px 9px;
    font-size: 10px;
  }

  .hero-card {
    flex: 1 1 174px;
    min-height: 158px;
    max-height: 190px;
    padding: 14px 16px;
    border-radius: 4px 4px 32px 4px;
  }

  .hero-card::after {
    right: 2px;
    bottom: -44px;
    font-size: 178px;
  }

  .hero-label {
    font-size: 10px;
  }

  .altitude-readout {
    gap: 8px;
    margin-top: 8px;
  }

  .altitude-readout strong {
    font-size: clamp(76px, 25vw, 104px);
    line-height: 0.88;
  }

  .altitude-readout span {
    font-size: 13px;
  }

  .altitude-note {
    max-width: 86%;
    margin-top: 8px;
    overflow: hidden;
    font-size: 10px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .contour-line {
    height: 48px;
  }

  .coordinate-grid,
  .metrics {
    flex: 0 0 auto;
    gap: 6px;
    margin-top: 6px;
  }

  .coordinate-grid article {
    min-height: 54px;
    padding: 9px 11px;
    border-radius: 4px 13px 4px 4px;
  }

  .coordinate-grid span,
  .metrics span {
    margin-bottom: 3px;
    font-size: 8px;
  }

  .coordinate-grid strong {
    font-size: clamp(13px, 4vw, 16px);
  }

  .metrics article {
    min-height: 66px;
    padding: 8px 10px;
  }

  .metrics strong {
    margin-bottom: 1px;
    font-size: 21px;
    line-height: 1.05;
  }

  .metrics small {
    display: block;
    overflow: hidden;
    font-size: 8px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .actions {
    flex: 0 0 auto;
    gap: 6px;
    margin-top: 7px;
  }

  button {
    min-height: 43px;
    padding: 0 14px;
    font-size: 12px;
  }

  .primary svg {
    width: 18px;
  }

  .status-panel {
    flex: 0 0 auto;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    margin-top: 6px;
    padding: 6px 9px;
  }

  .status-icon {
    flex-basis: 17px;
    width: 17px;
    height: 17px;
    font-size: 10px;
  }

  .status-panel p {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    font-size: 9px;
    line-height: 1.3;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .mobile-credit {
    display: block;
    flex: 0 0 auto;
    margin: 5px 1px 0;
    color: #717b73;
    font-size: 8px;
    line-height: 1.2;
    text-align: center;
  }

  .mobile-credit a {
    color: #aeb8aa;
  }

  footer {
    display: none;
  }
}

@media (max-width: 639px) and (max-height: 620px) {
  .shell {
    padding-top: max(6px, env(safe-area-inset-top));
  }

  .eyebrow,
  .mobile-credit {
    display: none;
  }

  .masthead {
    margin-bottom: 5px;
  }

  h1 {
    font-size: 25px;
  }

  .hero-card {
    min-height: 140px;
    max-height: 160px;
  }

  .altitude-readout strong {
    font-size: clamp(68px, 22vw, 88px);
  }

  .metrics article {
    min-height: 60px;
    padding-block: 6px;
  }

  .status-panel {
    min-height: 30px;
    margin-top: 4px;
    padding-block: 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
