:root {
  --bg: #0E0E0E;
  --surface: #1A1A1A;
  --text: #F5F5F5;
  --secondary: #8A8A8A;
  --accent: #C4713B;

  --grade-b: #A8E04A;
  --grade-a: #4CD964;
  --grade-f: #FF6B6B;
}

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

html, body {
  height: 100%;
  overflow-x: hidden;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ── Page ── */
.page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

/* ── Wordmark (splash → header) ── */
.wordmark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Inter', sans-serif;
  font-weight: 900;
  font-size: clamp(52px, 10vw, 80px);
  letter-spacing: -0.03em;
  color: var(--text);
  white-space: nowrap;
  z-index: 10;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.wordmark.top {
  top: 0;
  transform: translate(-50%, 0);
  font-size: 28px;
  letter-spacing: -0.02em;
  padding-top: max(env(safe-area-inset-top, 0px), 20px);
}

/* ── Main content ── */
.main {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 72px 24px max(env(safe-area-inset-bottom, 0px), 28px);
  gap: clamp(16px, 2.5vh, 24px);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.main.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Headline ── */
.headline {
  font-weight: 700;
  font-size: clamp(22px, 3.5vh, 28px);
  letter-spacing: -0.025em;
  color: var(--text);
  text-align: center;
  line-height: 1.3;
  flex-shrink: 0;
}

/* ── Grade Card ── */
.grade-card {
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
  background: var(--surface);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.card-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(76, 217, 100, 0.15), transparent 70%);
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

.card-gradient.visible {
  opacity: 1;
}

.card-content {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 20px 20px 16px;
}

/* ── Collapsed ── */
.card-collapsed {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.card-header-left {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--secondary);
}

.card-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--grade-a);
}

.card-chevron {
  color: var(--secondary);
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-chevron.visible {
  opacity: 1;
}

.card-chevron.expanded {
  transform: rotate(180deg);
}

/* Grade area: score + letter overlap */
.card-grade-area {
  position: relative;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 140px;
}

.card-score {
  font-weight: 600;
  font-size: 72px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  transition: color 0.08s linear;
}

.card-score.exit {
  opacity: 0;
  transform: scale(0.6);
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-grade {
  position: absolute;
  font-weight: 900;
  font-size: 80px;
  line-height: 1;
  color: var(--grade-a);
  opacity: 0;
  transform: scale(0.5);
}

.card-grade.pop {
  opacity: 1;
  transform: scale(1);
  transition: all 0.5s cubic-bezier(0.2, 1.4, 0.4, 1);
}

/* Comparison callout */
.card-callout {
  font-size: 17px;
  font-weight: 600;
  color: var(--grade-a);
  text-align: center;
  line-height: 1.4;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.card-callout.visible {
  opacity: 1;
}

/* ── Expanded ── */
.card-expanded {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.32s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.25s ease;
}

.card-expanded.open {
  opacity: 1;
  max-height: 1000px;
  transition: max-height 0.32s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.25s ease 0.05s;
}

.card-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin-top: 4px;
}

.card-insight {
  font-size: 15px;
  font-weight: 400;
  color: var(--text);
  opacity: 0.6;
  line-height: 1.55;
}

.card-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  opacity: 0.35;
}

.card-stats-sep {
  opacity: 0.5;
}

/* ── Comparison Table ── */
.card-table {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  overflow: hidden;
}

.card-table-header,
.card-table-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 0.8fr;
  align-items: center;
  padding: 0 14px;
}

.card-table-header {
  padding-top: 10px;
  padding-bottom: 8px;
}

.card-table-header span {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--secondary);
  text-transform: uppercase;
}

.card-table-row {
  padding-top: 8px;
  padding-bottom: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.col-metric {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  opacity: 0.7;
}

.col-prev,
.col-curr {
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--text);
  opacity: 0.5;
}

.col-curr {
  opacity: 0.85;
}

.col-delta {
  font-size: 12px;
  font-weight: 600;
  text-align: right;
  color: var(--secondary);
}

.col-delta.positive {
  color: var(--grade-a);
}

.col-delta.negative {
  color: var(--grade-f);
}

/* ── Split Chart ── */
.split-chart {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.split-chart-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--secondary);
  text-transform: uppercase;
  margin-bottom: 2px;
}

.split-row {
  display: flex;
  align-items: center;
  gap: 0;
  height: 18px;
}

.split-mile {
  width: 22px;
  font-size: 12px;
  font-weight: 500;
  color: var(--secondary);
  text-align: right;
  flex-shrink: 0;
  margin-right: 8px;
}

.split-bar-track {
  flex: 1;
  height: 14px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 7px;
  position: relative;
  overflow: hidden;
}

.split-bar {
  height: 100%;
  border-radius: 7px;
  transition: width 0.4s ease;
}

.split-bar[data-tone="green"] { background: var(--grade-a); }
.split-bar[data-tone="accent"] { background: var(--grade-b); }
.split-bar[data-tone="yellow"] { background: #FFD23F; }
.split-bar[data-tone="red"] { background: var(--grade-f); }

.split-ref-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1.5px;
  background: rgba(255, 255, 255, 0.3);
}

.split-value {
  width: 44px;
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  opacity: 0.6;
  text-align: right;
  flex-shrink: 0;
  margin-left: 8px;
}

/* ── Tip Box ── */
.card-tip {
  padding: 12px 14px;
  background: rgba(76, 217, 100, 0.08);
  border: 1px solid rgba(76, 217, 100, 0.2);
  border-radius: 12px;
}

.tip-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--grade-a);
  margin-bottom: 4px;
  letter-spacing: 0.02em;
}

.tip-text {
  font-size: 14px;
  color: var(--text);
  line-height: 1.45;
}

/* ── Waitlist ── */
.waitlist {
  width: 100%;
  flex-shrink: 0;
}

.waitlist-form {
  display: flex;
  gap: 8px;
}

.waitlist-form input {
  flex: 1;
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color 0.2s;
}

.waitlist-form input::placeholder { color: var(--secondary); }
.waitlist-form input:focus { border-color: rgba(255, 255, 255, 0.2); }

.waitlist-form button {
  padding: 14px 22px;
  border-radius: 12px;
  border: none;
  background: var(--text);
  color: var(--bg);
  font-size: 15px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.waitlist-form button:hover { transform: translateY(-1px); }
.waitlist-form button:active { transform: translateY(0); }
.waitlist-form button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.waitlist-tagline {
  text-align: center;
  margin-top: 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--secondary);
}

/* ── Features ── */
.features {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.feature {
  font-size: 14px;
  font-weight: 400;
  color: var(--secondary);
  line-height: 1.5;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.site-links {
  display: flex;
  gap: 16px;
  margin-top: 8px;
  justify-content: center;
}

.site-links a {
  color: var(--secondary);
  text-decoration: none;
  font-size: 13px;
  transition: color 0.2s ease;
}

.site-links a:hover {
  color: var(--text);
}

.form-message {
  text-align: center;
  margin-top: 10px;
  font-size: 15px;
  font-weight: 500;
  min-height: 1.4em;
}

.form-message.success { color: var(--grade-a); }
.form-message.error { color: var(--grade-f); }

.legal-page {
  min-height: 100vh;
  min-height: 100dvh;
  overflow-y: auto;
  background: var(--bg);
  color: var(--text);
}

.legal-shell {
  width: min(720px, calc(100% - 48px));
  margin: 0 auto;
  padding: 40px 0 72px;
}

.legal-back {
  display: inline-flex;
  align-items: center;
  margin-bottom: 28px;
  color: var(--secondary);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s ease;
}

.legal-back:hover {
  color: var(--text);
}

.legal-title {
  font-size: clamp(32px, 6vw, 44px);
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}

.legal-updated {
  color: var(--secondary);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 36px;
}

.legal-section {
  padding-top: 28px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: 28px;
}

.legal-section:first-of-type {
  border-top: none;
  margin-top: 0;
  padding-top: 0;
}

.legal-section h2 {
  font-size: 20px;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.legal-section p,
.legal-section li {
  color: rgba(245, 245, 245, 0.82);
  font-size: 15px;
  line-height: 1.7;
}

.legal-section p + p {
  margin-top: 14px;
}

.legal-section ul {
  margin: 10px 0 0 20px;
}

.legal-section li + li {
  margin-top: 8px;
}

.legal-section a {
  color: var(--accent);
  text-decoration: none;
}

.legal-section a:hover {
  color: var(--text);
}

/* ── Mobile ── */
@media (max-width: 480px) {
  .waitlist-form { flex-direction: column; }
  .waitlist-form button { width: 100%; }
  .legal-shell { width: min(720px, calc(100% - 32px)); padding-top: 28px; }

  .card-grade-area { height: 64px; }
  .card-score { font-size: 56px; }
  .card-grade { font-size: 64px; }
  .card-callout { font-size: 15px; }
}

/* ── Desktop: scale up to fill space ── */
@media (min-width: 768px) {
  .main {
    max-width: 520px;
    gap: 28px;
  }

  .wordmark.top {
    font-size: 32px;
    padding-top: 28px;
  }

  .headline {
    font-size: 30px;
  }

  .card-content {
    padding: 24px 24px 20px;
  }

  .card-grade-area { height: 96px; }
  .card-score { font-size: 88px; }
  .card-grade { font-size: 96px; }

  .card-callout { font-size: 18px; }
  .card-insight { font-size: 16px; }
  .tip-text { font-size: 15px; }

  .waitlist-form input { padding: 16px 20px; font-size: 16px; }
  .waitlist-form button { padding: 16px 28px; font-size: 16px; }
}
