:root {
  color-scheme: dark;
  --bg: #07111f;
  --bg-elev: #0b1628;
  --bg-soft: #12213b;
  --text: #e7eefc;
  --muted: #9cb0d1;
  --accent: #67d1ff;
  --accent-strong: #2eb8ff;
  --good: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
  --border: rgba(255,255,255,0.08);
  --shadow: 0 16px 40px rgba(0,0,0,0.35);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; min-height: 100%; background: radial-gradient(circle at top, #10213f 0, var(--bg) 45%, #040814 100%); color: var(--text); font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
body.app-fullscreen {
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
}
body.app-fullscreen .topbar,
body.app-fullscreen .page-footer { display: none; }
body.app-fullscreen .layout { width: min(100vw, 100%); min-height: 100dvh; padding: 0; margin: 0 auto; }
body.app-fullscreen .screen-panel {
  min-height: 100dvh;
  padding-top: 4.5rem;
}
.gps-indicator {
  position: sticky;
  top: 0.5rem;
  z-index: 5;
  backdrop-filter: blur(8px);
}
body.app-fullscreen .screen-panel:not([hidden]) { display: block; }
body.app-fullscreen .card { border-radius: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
body { padding: 0 0 env(safe-area-inset-bottom); }

.banner {
  position: sticky; top: 0; z-index: 50;
  padding: 0.8rem 1rem;
  text-align: center;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.banner-offline { background: #7c2d12; color: #fff7ed; }
.banner-update { background: #1d4ed8; color: white; display: flex; align-items: center; justify-content: center; gap: 0.75rem; }

.topbar, .footer, .docs { width: min(1200px, calc(100% - 1rem)); margin: 0 auto; }
.topbar { display: flex; gap: 1rem; justify-content: space-between; align-items: flex-start; padding: 1rem 0 0.5rem; }
.topbar h1 { margin: 0.1rem 0 0.25rem; font-size: clamp(1.6rem, 5vw, 3rem); line-height: 1.05; }
.topbar .eyebrow { text-transform: uppercase; letter-spacing: 0.18em; font-size: 0.75rem; color: var(--accent); font-weight: 700; }
.topbar .muted, .footer p { color: var(--muted); }
.topbar-meta { display: flex; gap: 0.5rem; flex-wrap: wrap; justify-content: flex-end; }

.layout, .docs { display: grid; gap: 1rem; padding: 0.5rem 0 2rem; }
.layout { grid-template-columns: repeat(12, 1fr); }
.card { grid-column: span 12; background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02)); border: 1px solid var(--border); border-radius: 20px; padding: 1rem; box-shadow: var(--shadow); backdrop-filter: blur(6px); }
.card-hero { background: linear-gradient(180deg, rgba(103,209,255,0.12), rgba(255,255,255,0.03)); }
.card-title-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 0.75rem; }
.card h2 { margin: 0; font-size: 1.25rem; }

.grid-2, .grid-3, .button-grid { display: grid; gap: 0.8rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.button-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.button-grid.compact { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.button-row { display: flex; gap: 0.65rem; flex-wrap: wrap; margin-top: 0.8rem; }
.stack { display: grid; gap: 0.75rem; }
.gps-indicator {
  display: inline-flex; align-items: center; gap: 0.9rem; justify-content: flex-start;
  width: 100%; margin: 0.1rem 0 1rem; padding: 1rem 1rem;
  border: 1px solid var(--border); border-radius: 14px; background: rgba(255,255,255,0.04);
  color: var(--text); font-weight: 700;
}
.gps-guess { color: var(--muted); font-size: 1.25rem; font-weight: 900; white-space: nowrap; }
.gps-dot {
  width: 14px; height: 14px; border-radius: 999px; background: var(--bad);
  box-shadow: 0 0 0 3px rgba(239,68,68,0.16);
  flex: 0 0 auto;
}
.gps-dot-good { background: var(--good); box-shadow: 0 0 0 3px rgba(34,197,94,0.16); }
.gps-dot-bad { background: var(--bad); box-shadow: 0 0 0 3px rgba(239,68,68,0.16); }

label { display: block; margin-bottom: 0.35rem; color: var(--muted); font-size: 0.9rem; }
.text-input {
  width: 100%; border: 1px solid var(--border); border-radius: 14px; background: rgba(4, 12, 24, 0.85);
  color: var(--text); padding: 0.95rem 1rem; font-size: 1rem; outline: none;
}
.text-input:focus { border-color: rgba(103,209,255,0.7); box-shadow: 0 0 0 3px rgba(103,209,255,0.15); }
.textarea { resize: vertical; min-height: 7rem; }

.primary-button, .secondary-button, .large-button, .small-button, .link-button {
  appearance: none; border: 0; border-radius: 16px; cursor: pointer; font: inherit; font-weight: 700; transition: transform 0.08s ease, filter 0.2s ease, background 0.2s ease;
}
.primary-button, .large-button {
  background: linear-gradient(180deg, var(--accent), var(--accent-strong)); color: #02111f; padding: 1rem 1.1rem; min-height: 56px; box-shadow: 0 10px 24px rgba(46,184,255,0.25);
}
.secondary-button, .link-button {
  background: rgba(255,255,255,0.08); color: var(--text); padding: 0.85rem 1rem; border: 1px solid var(--border);
}
.small-button { background: rgba(255,255,255,0.15); color: white; padding: 0.5rem 0.85rem; }
.primary-button:active, .secondary-button:active, .large-button:active, .small-button:active, .link-button:active { transform: translateY(1px); }
.primary-button:hover, .secondary-button:hover, .large-button:hover, .small-button:hover, .link-button:hover { filter: brightness(1.05); text-decoration: none; }
.large-button { min-height: 70px; font-size: 1.02rem; }
.button-grid .large-button { width: 100%; }
.link-button { display: inline-flex; align-items: center; justify-content: center; }

.pill {
  display: inline-flex; align-items: center; gap: 0.4rem; border-radius: 999px; border: 1px solid var(--border);
  background: rgba(255,255,255,0.07); color: var(--text); padding: 0.42rem 0.75rem; font-size: 0.85rem; white-space: nowrap;
}
.pill-ghost { color: var(--muted); }

.value-box {
  min-height: 54px; display: flex; align-items: center; padding: 0.8rem 1rem; border-radius: 14px; border: 1px solid var(--border);
  background: rgba(255,255,255,0.04); color: var(--text);
}
.estimate { font-size: clamp(2.4rem, 6vw, 3.6rem); font-weight: 900; line-height: 1.05; margin-bottom: 0.25rem; }
.confidence { font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); font-size: 1.15rem; }

.results, .timeline { display: grid; gap: 0.5rem; }
.result-item, .timeline-item {
  border: 1px solid var(--border); border-radius: 16px; background: rgba(255,255,255,0.04); padding: 0.85rem 0.9rem;
}
.result-item button { width: 100%; text-align: left; background: transparent; border: 0; color: inherit; padding: 0; cursor: pointer; }
.result-meta { color: var(--muted); font-size: 0.9rem; margin-top: 0.3rem; }
.result-title { font-weight: 800; }
.result-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.65rem; }

.hidden, .hidden-field { display: none !important; }
.footer { padding: 1rem 0 2.5rem; border-top: 1px solid var(--border); margin-top: 1rem; }
.footer p { margin: 0.35rem 0; }

.docs-page { padding-bottom: 2rem; }
.docs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.docs .card { grid-column: span 2; }
.docs h2 { margin-top: 0; }
.docs p, .docs li { line-height: 1.55; }

@media (min-width: 780px) {
  .card:nth-child(1) { grid-column: span 12; }
  .card:nth-child(2), .card:nth-child(3) { grid-column: span 6; }
  .card:nth-child(4), .card:nth-child(5) { grid-column: span 6; }
  .card:nth-child(6), .card:nth-child(7) { grid-column: span 6; }
}

@media (max-width: 900px) {
  .topbar { flex-direction: column; }
  .grid-2, .grid-3, .button-grid.compact { grid-template-columns: 1fr; }
  .button-grid { grid-template-columns: 1fr; }
  .docs { grid-template-columns: 1fr; }
  .docs .card { grid-column: span 1; }
}
