@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;700&family=Space+Mono:wght@400;700&display=swap');

* { box-sizing: border-box; }

:root {
  color-scheme: dark;
  --bg: #0B0D0C;
  --surface: #141816;
  --line: #1F2621;
  --line-strong: #3A4540;
  --text: #E9EEE6;
  --text-2: #C4CCC5;
  --muted: #8A948C;
  --faint: #5C665E;
  --accent: #C8F25A;
  --accent-hover: #DBFF7A;
  --on-accent: #0B0D0C;
}

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

body {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a {
  color: var(--accent);
}

.mono {
  font-family: 'Space Mono', ui-monospace, monospace;
}

/* --- layout --- */

.app {
  max-width: 440px;
  margin: 0 auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

[hidden] { display: none !important; }

/* --- header --- */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px;
}

.logo {
  font: 700 18px 'Space Grotesk', sans-serif;
  letter-spacing: -0.02em;
  color: var(--accent);
}

.logo .dot {
  color: white;
}

.source-link {
  font: 400 11px 'Space Mono', monospace;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.source-link:hover {
  color: var(--text);
}

/* --- radar --- */

.radar {
  position: relative;
  height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.radar-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  border-radius: 50%;
  border: 1px solid var(--line);
}

.radar-ring-outer { width: 250px; height: 250px; margin: -125px 0 0 -125px; }
.radar-ring-mid { width: 170px; height: 170px; margin: -85px 0 0 -85px; }
.radar-ring-inner { width: 90px; height: 90px; margin: -45px 0 0 -45px; }

.radar-cross-h,
.radar-cross-v {
  position: absolute;
  top: 50%;
  left: 50%;
  background: var(--line);
}

.radar-cross-h { width: 250px; height: 1px; margin: -0.5px 0 0 -125px; }
.radar-cross-v { width: 1px; height: 250px; margin: -125px 0 0 -0.5px; }

.radar-pulse {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 250px;
  height: 250px;
  margin: -125px 0 0 -125px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  animation: radar-ring 2.4s ease-out infinite;
}

.radar-pulse-delayed {
  animation-delay: 1.2s;
}

.radar-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 24px var(--accent);
}

.radar-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 4px;
  text-align: center;
  font: 400 11px 'Space Mono', monospace;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.radar-caption.live {
  color: var(--accent);
}

@keyframes radar-ring {
  0% { transform: scale(0.2); opacity: 0.9; }
  100% { transform: scale(1); opacity: 0; }
}

@keyframes radar-blink {
  50% { opacity: 0.25; }
}

/* --- idle state --- */

.hero {
  padding: 16px 22px 0;
}

h1 {
  margin: 0;
  font: 700 34px/1.02 'Space Grotesk', sans-serif;
  letter-spacing: -0.035em;
}

.hero p {
  margin: 12px 0 0;
  font-size: 15px;
  line-height: 1.45;
  color: var(--muted);
}

.duration {
  padding: 24px 22px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.duration-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.duration-label {
  font: 400 11px 'Space Mono', monospace;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.duration-value {
  font: 700 22px 'Space Mono', monospace;
  color: var(--accent);
}

input[type="range"] {
  width: 100%;
  margin: 0;
  accent-color: var(--accent);
}

.duration-ticks {
  display: flex;
  justify-content: space-between;
  font: 400 10px 'Space Mono', monospace;
  color: var(--faint);
}

.actions {
  padding: 22px 22px 0;
}

button {
  font-family: 'Space Grotesk', sans-serif;
  cursor: pointer;
}

.btn-primary {
  width: 100%;
  height: 60px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  font-size: 17px;
  transition: background 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  height: 60px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-weight: 500;
  font-size: 17px;
  transition: border-color 0.15s ease;
}

.btn-secondary:hover {
  border-color: var(--text);
}

.link-toggle {
  margin: 14px 22px 22px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: 400 12px 'Space Mono', monospace;
  text-align: center;
  padding: 0;
}

.how-it-works {
  margin: 14px 22px 22px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}

.how-row {
  display: grid;
  grid-template-columns: 36px 1fr;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.4;
}

.how-row .num {
  font: 700 12px 'Space Mono', monospace;
  color: var(--accent);
}

.how-row .txt {
  color: var(--text-2);
}

.how-row .txt .hash {
  font-family: 'Space Mono', monospace;
  color: var(--accent);
}

.how-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: 400 12px 'Space Mono', monospace;
  cursor: pointer;
  padding-top: 6px;
  text-align: left;
}

/* --- video (two-click consent) --- */

.video {
  margin: 0 22px 22px;
}

.video-consent {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  text-align: center;
}

.video-consent[hidden],
.video-frame[hidden] {
  display: none;
}

.video-consent p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.video-consent a {
  color: var(--text-2);
}

.video-external {
  font: 400 12px 'Space Mono', monospace;
  text-decoration: none;
}

.video-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  margin: 0 -22px; /* full app width: every pixel helps at phone size */
  overflow: hidden;
}

.video-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* --- live state --- */

.live-panel {
  padding: 16px 22px 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.countdown {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.countdown-value {
  font: 700 56px/1 'Space Mono', monospace;
  letter-spacing: -0.04em;
}

.countdown-label {
  font: 400 11px 'Space Mono', monospace;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.stat-tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font: 400 10px 'Space Mono', monospace;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.stat-value {
  font: 700 20px 'Space Mono', monospace;
}

.cipher-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cipher-text {
  font: 400 11px/1.5 'Space Mono', monospace;
  color: var(--faint);
  word-break: break-all;
  height: 34px;
  overflow: hidden;
}

.live-footer {
  margin-top: auto;
  padding: 22px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.live-footer .btn-primary,
.live-footer .btn-secondary {
  height: 56px;
  font-size: 15px;
}

.status {
  padding: 0 22px;
  color: var(--muted);
  font-size: 0.85rem;
  min-height: 1.2em;
}

/* --- viewer (share.html) --- */

body.viewer {
  overflow: hidden;
}

.viewer-app {
  position: relative;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
  background: var(--bg);
}

#map {
  position: absolute;
  inset: 0;
}

.viewer-topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 500;
  padding: 18px 18px 40px;
  background: linear-gradient(var(--bg), rgba(11, 13, 12, 0));
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.viewer-topbar .logo {
  font-size: 17px;
  padding-left: 2em;
}

.e2e-pill {
  font: 400 11px 'Space Mono', monospace;
  color: var(--accent);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 5px 10px;
  background: var(--bg);
}

.map-credit {
  position: absolute;
  z-index: 500;
  right: 14px;
  bottom: 210px;
  font: 400 9px 'Space Mono', monospace;
  color: var(--faint);
}

.decrypting-overlay {
  position: absolute;
  inset: 0;
  z-index: 900;
  background: rgba(11, 13, 12, 0.86);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 40px;
  text-align: center;
}

.decrypting-label {
  font: 700 13px 'Space Mono', monospace;
  color: var(--accent);
  letter-spacing: 0.08em;
  animation: radar-blink 1s infinite;
}

.decrypting-cipher {
  font: 400 11px/1.5 'Space Mono', monospace;
  color: var(--faint);
  word-break: break-all;
  max-width: 280px;
}

.decrypting-note {
  font-size: 13px;
  color: var(--muted);
}

.viewer-marker {
  position: relative;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.viewer-marker-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 120px;
  height: 120px;
  margin: -60px 0 0 -60px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  animation: radar-ring 2.4s ease-out infinite;
}

.viewer-marker-halo {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  border-radius: 50%;
  background: rgba(200, 242, 90, 0.18);
}

.viewer-marker-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg);
  box-shadow: 0 0 20px var(--accent);
}

.bottom-sheet {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 500;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

.sheet-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.sheet-title strong {
  font: 700 22px 'Space Grotesk', sans-serif;
  letter-spacing: -0.02em;
}

.sheet-coords {
  font: 400 12px 'Space Mono', monospace;
  color: var(--muted);
}

.live-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font: 400 11px 'Space Mono', monospace;
  color: var(--accent);
  flex-shrink: 0;
}

.live-badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: radar-blink 1.2s infinite;
}

.sheet-footer {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.btn-directions {
  height: 52px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: var(--on-accent);
  font: 700 15px 'Space Grotesk', sans-serif;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- expired state --- */

.expired-view {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.expired-radar {
  position: relative;
  height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.expired-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px dashed var(--line);
}

.expired-ring-outer { width: 250px; height: 250px; }
.expired-ring-inner { width: 170px; height: 170px; }

.expired-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
}

.expired-body {
  padding: 0 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.expired-label {
  font: 400 11px 'Space Mono', monospace;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.expired-body p {
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
  color: var(--muted);
}

.expired-footer {
  margin-top: auto;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.expired-fineprint {
  font: 400 11px 'Space Mono', monospace;
  color: var(--faint);
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .radar-pulse,
  .viewer-marker-ring,
  .decrypting-label,
  .live-badge .dot {
    animation: none;
  }
}
