:root {
  --background: #f8f9fb;
  --foreground: #0f1114;
  --muted: #6b7280;
  --muted-strong: #374151;
  --border: #e5e7eb;
  --panel: #ffffff;
  --panel-muted: #f3f4f6;
  --accent: #111827;
  --accent-foreground: #ffffff;
  --accent-orange: #f2734a;
  --warning: #b45309;
  --success: #15803d;
  --danger: #b91c1c;
  --max-width: min(1100px, calc(100vw - 3rem));
  --font-sans: "Manrope", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
  --font-display: "Playfair Display", serif;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.25rem;
  --text-xl: 1.5rem;
  --text-display: clamp(2.25rem, 5vw, 3.75rem);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.5;
}

body {
  padding: 0 0 4rem;
}

button,
input {
  font: inherit;
}

.page-shell {
  width: 100%;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 1.1rem 1.75rem;
  border-bottom: 1px solid var(--border);
  background: rgba(248, 249, 251, 0.88);
  backdrop-filter: blur(18px);
}

.header-tag {
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.wordmark {
  font-size: var(--text-base);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: inherit;
  text-decoration: none;
}

.eyebrow,
.metric-label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--muted);
  font-size: var(--text-xs);
}

.page-container {
  width: var(--max-width);
  margin: 0 auto;
  padding-top: 3.5rem;
}

/* ── hero ─────────────────────────────────────────────────── */

.hero {
  display: block;
  margin-bottom: 3rem;
}

.hero-copy {
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.hero h1 {
  margin: 0;
  line-height: 1.02;
  font-family: var(--font-display);
  font-size: var(--text-display);
  font-weight: 800;
  letter-spacing: -0.025em;
  max-width: 22ch;
}

.hero-text {
  margin: 1.25rem 0 0;
  color: var(--muted-strong);
  font-size: var(--text-base);
  line-height: 1.55;
  white-space: nowrap;
}

@media (max-width: 980px) {
  .hero-text {
    white-space: normal;
  }
}

/* ── form ─────────────────────────────────────────────────── */

.control-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

.control-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.field > span {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.field input[type="text"],
.field input[type="number"],
.field input[type="email"],
.field select {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  background: #fff;
  outline: none;
  appearance: none;
  font-size: var(--text-base);
  color: var(--foreground);
}

.field input:focus,
.field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.08);
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
}

.field select:disabled,
.field input:disabled {
  color: #9ca3af;
  background: var(--panel-muted);
}

.location-stack {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.typeahead {
  position: relative;
}

.typeahead-menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  z-index: 20;
  max-height: 15rem;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--border);
}

.typeahead-option {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  cursor: pointer;
  border: 0;
  border-top: 1px solid var(--border);
  background: #fff;
  color: var(--foreground);
  text-align: left;
  font: inherit;
  font-size: var(--text-sm);
}

.typeahead-option:first-child {
  border-top: 0;
}

.typeahead-option:hover,
.typeahead-option.is-active {
  background: var(--panel-muted);
}

.typeahead-empty {
  padding: 0.75rem 1rem;
  color: var(--muted);
  font-size: var(--text-sm);
}

.input-with-suffix {
  position: relative;
}

.input-with-suffix input {
  padding-right: 4.25rem;
}

.input-with-suffix span {
  position: absolute;
  top: 50%;
  right: 1rem;
  transform: translateY(-50%);
  font-size: var(--text-xs);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.checkbox-row {
  flex-direction: row;
  align-items: center;
  gap: 0.6rem;
}

.checkbox-row > span {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--foreground);
  text-transform: none;
  letter-spacing: 0;
}

.checkbox-row input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
}

.range-field {
  display: none;
}

.control-panel.is-showing-promoted-rate .range-field {
  display: flex;
}

.range-field > span {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.range-field > span strong {
  font-size: var(--text-sm);
  color: var(--foreground);
}

.range-field input {
  accent-color: var(--accent);
}

.form-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.primary-button {
  background: var(--accent);
  color: var(--accent-foreground);
  border: 1px solid var(--accent);
  padding: 0.9rem 1.4rem;
  cursor: pointer;
  transition: transform 120ms ease, opacity 120ms ease;
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.primary-button:hover {
  transform: translateY(-1px);
  opacity: 0.96;
}

.mono {
  font-family: var(--font-mono);
}

/* ── results ──────────────────────────────────────────────── */

.results-grid {
  display: flex;
  flex-direction: column;
}

.results-grid:not(:empty) {
  margin-top: 2.5rem;
  border-top: 1px solid var(--border);
}

.result-card {
  background: transparent;
  border: 0;
  padding: 2rem 0;
  display: grid;
  grid-template-columns: 14rem minmax(0, 1fr);
  column-gap: 2.5rem;
  align-items: start;
}

.result-card + .result-card {
  border-top: 1px solid var(--border);
}

.platform-name {
  margin: 0;
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--foreground);
}

.result-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
}

.result-summary {
  margin: 0;
  font-size: var(--text-lg);
  line-height: 1.4;
  color: var(--foreground);
  font-weight: 400;
  letter-spacing: -0.005em;
}

.result-summary strong {
  font-weight: 700;
  color: var(--foreground);
}

.breakdown-disclosure {
  position: relative;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.breakdown-disclosure summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.breakdown-disclosure summary::-webkit-details-marker {
  display: none;
}

.breakdown-indicator {
  display: none;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  color: var(--muted);
}

.breakdown-disclosure[open] .breakdown-indicator {
  display: inline-flex;
}

.breakdown-disclosure[open] .breakdown-label {
  display: none;
}

.breakdown-disclosure[open] .breakdown-indicator::before {
  content: "↑";
  font-size: var(--text-sm);
  font-weight: 700;
  line-height: 1;
}

.breakdown-disclosure[open] summary {
  position: absolute;
  bottom: 0.25rem;
  right: 0;
  padding: 0.25rem 0.35rem;
  margin: 0;
  border: 0;
  background: transparent;
  z-index: 1;
}

.breakdown-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-top: 1.25rem;
  padding-bottom: 2rem;
}

/* ── scenario grid ────────────────────────────────────────── */

.scenario-grid {
  display: grid;
  grid-template-columns: 9rem repeat(2, minmax(0, 1fr));
  row-gap: 0;
  column-gap: 1.5rem;
  font-variant-numeric: tabular-nums;
}

.scenario-axis {
  padding: 0.85rem 0;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  overflow-wrap: anywhere;
  align-self: center;
}

.scenario-axis.corner {
  color: transparent;
}

.scenario-cell {
  padding: 0.85rem 0;
}

.scenario-grid > .scenario-axis:nth-child(n + 4),
.scenario-grid > .scenario-cell:nth-child(n + 4) {
  border-top: 1px solid var(--border);
}

.scenario-cell strong {
  display: block;
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--foreground);
}

.scenario-cell .scenario-sub {
  margin-top: 0.3rem;
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 500;
}

.scenario-cell .scenario-time {
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}

/* ── sources ──────────────────────────────────────────────── */

.sources-layout {
  margin-top: 2.5rem;
}

.sources-disclosure {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0 0;
  background: transparent;
  box-shadow: none;
}

.sources-disclosure summary {
  cursor: pointer;
  list-style: none;
  font-size: var(--text-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sources-disclosure summary::-webkit-details-marker {
  display: none;
}

.sources-disclosure summary::after {
  content: "+";
  color: var(--muted);
  font-weight: 400;
}

.sources-disclosure[open] summary::after {
  content: "−";
}

.sources-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.source-item {
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
  font-size: var(--text-sm);
  color: var(--muted-strong);
}

.source-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.source-item strong {
  display: block;
  margin-bottom: 0.2rem;
  font-weight: 600;
  color: var(--foreground);
}

.source-item a {
  word-break: break-word;
  color: var(--muted-strong);
}

/* ── footnotes ────────────────────────────────────────────── */

.footnotes {
  margin-top: 2.5rem;
  padding: 1.5rem 0 0;
  border-top: 1px solid var(--border);
}

.footnotes p {
  font-size: var(--text-sm);
  color: var(--muted);
  margin: 0 0 0.4rem;
  line-height: 1.55;
}

#statusMessage {
  font-weight: 500;
  color: var(--muted);
}

/* ── responsive ───────────────────────────────────────────── */

@media (max-width: 980px) {
  .page-container {
    padding-top: 2.5rem;
  }

  .hero {
    margin-bottom: 2.25rem;
  }

  .result-card {
    grid-template-columns: 1fr;
    row-gap: 1.25rem;
  }

  .site-header {
    padding-inline: 1.25rem;
  }
}

@media (max-width: 640px) {
  .page-container {
    width: min(100vw - 1.25rem, 100%);
  }

  .control-panel {
    padding: 1.25rem;
  }

  .scenario-grid {
    grid-template-columns: 6.5rem repeat(2, minmax(0, 1fr));
    column-gap: 0.85rem;
  }

  .location-stack {
    grid-template-columns: 1fr;
  }
}

/* ── landing page ──────────────────────────────────────────── */

.landing-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.landing-main {
  flex: 1;
  display: flex;
  align-items: center;
}

.landing-hero {
  width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 0;
}

.landing-hero h1 {
  margin: 0;
  line-height: 1.02;
  font-family: var(--font-display);
  font-size: var(--text-display);
  font-weight: 800;
  letter-spacing: -0.025em;
  max-width: 22ch;
}

.landing-cta {
  display: inline-block;
  margin-top: 2rem;
  text-decoration: none;
}

/* ── beta modal ────────────────────────────────────────────── */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 1.75rem;
  width: 100%;
  max-width: 440px;
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
}

.modal-close:hover {
  color: var(--foreground);
}

.modal-eyebrow {
  margin: 0 0 0.6rem;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.modal-panel h2 {
  margin: 0 0 0.5rem;
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.015em;
}

.modal-sub {
  margin: 0 0 1.25rem;
  color: var(--muted-strong);
  font-size: var(--text-sm);
  line-height: 1.55;
}

.modal-form .field {
  margin-bottom: 1rem;
}

.modal-form .primary-button {
  width: 100%;
}

.modal-link-button {
  background: transparent;
  border: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.modal-link-button:hover {
  color: var(--foreground);
}

.modal-error {
  margin: 0.75rem 0 0;
  color: var(--danger);
  font-size: var(--text-sm);
  line-height: 1.4;
}

#betaSentinel {
  height: 1px;
  width: 100%;
}
