:root {
  --bg: #091a32;
  --bg-2: #0f2747;
  --card: rgba(19, 45, 81, 0.88);
  --card-2: rgba(22, 53, 96, 0.9);
  --border: rgba(255, 255, 255, 0.08);
  --text: #ffffff;
  --muted: #a8b7cc;
  --muted-2: #7f96b7;
  --accent: #1e7bff;
  --accent-2: #56a2ff;
  --accent-3: #cfe4ff;
  --protein: linear-gradient(90deg, #1e7bff, #56a2ff);
  --carbs: linear-gradient(90deg, #6ab7ff, #b6deff);
  --fats: linear-gradient(90deg, #6b7e9b, #a6b7ce);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(30, 123, 255, 0.18), transparent 30%),
    radial-gradient(circle at 90% 10%, rgba(86, 162, 255, 0.16), transparent 20%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  color: var(--text);
  min-height: 100vh;
}

a { color: inherit; }
button, input, select { font: inherit; }

.app-shell {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 26px 0 34px;
}

.site-header,
.site-footer,
.hero-card,
.card,
.legal-card,
.modal-card {
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(10, 25, 46, 0.72);
  box-shadow: var(--shadow);
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02));
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 11px 10px;
}
.brand-mark span {
  align-self: end;
  display: block;
  border-radius: 10px;
  background: var(--protein);
  box-shadow: 0 0 18px rgba(30, 123, 255, 0.3);
}
.brand-mark span:nth-child(1) { height: 46%; }
.brand-mark span:nth-child(2) { height: 72%; }
.brand-mark span:nth-child(3) { height: 100%; background: linear-gradient(180deg, #ffffff, #7bc0ff); }

.brand-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.brand-subtitle,
.support-text,
.form-note,
.site-footer p,
.site-footer a,
.empty-state p,
.hero-card p,
.legal-card p {
  color: var(--muted);
}
.brand-subtitle { margin: 2px 0 0; font-size: 0.92rem; }

.icon-button,
.modal-close {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  cursor: pointer;
  transition: 0.2s ease;
}
.icon-button:hover,
.modal-close:hover { background: rgba(255,255,255,0.1); }

.hero-card {
  margin-top: 18px;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, rgba(21, 47, 84, 0.92), rgba(9, 25, 46, 0.88));
  box-shadow: var(--shadow);
  display: flex;
  gap: 24px;
  justify-content: space-between;
  align-items: center;
}
.hero-card h2 {
  margin: 6px 0 10px;
  font-size: clamp(1.6rem, 3.2vw, 2.5rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
}
.hero-card p { max-width: 700px; line-height: 1.65; margin: 0; }
.hero-points {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}
.hero-pill {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.07);
  color: var(--accent-3);
  font-weight: 600;
  white-space: nowrap;
}

.eyebrow,
.section-kicker,
.mini-label {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-2);
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  margin-bottom: 20px;
}
.section-head h3,
.legal-card h1,
.modal-card h3 {
  margin: 5px 0 0;
  font-size: 1.6rem;
  letter-spacing: -0.04em;
}

.main-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 20px;
  margin-top: 20px;
}
.card,
.legal-card,
.modal-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, var(--card) 0%, rgba(9, 24, 44, 0.95) 100%);
  box-shadow: var(--shadow);
}
.card { padding: 26px; }

.status-badge {
  font-size: 0.82rem;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(86, 162, 255, 0.12);
  color: var(--accent-3);
  border: 1px solid rgba(86, 162, 255, 0.22);
}

.form-section + .form-section,
.form-grid + .form-section,
.form-section + .form-grid,
.form-grid + .form-grid {
  margin-top: 18px;
}
.field-label {
  display: block;
  margin-bottom: 10px;
  font-weight: 600;
}
.form-grid {
  display: grid;
  gap: 14px;
}
.two-col { grid-template-columns: repeat(2, 1fr); }
.three-col { grid-template-columns: repeat(3, 1fr); }
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.field label {
  color: var(--muted);
  font-size: 0.94rem;
}
.field input,
.field select {
  height: 52px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  padding: 0 14px;
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.field input::placeholder { color: #7e90ab; }
.field input:focus,
.field select:focus {
  border-color: rgba(86,162,255,0.45);
  background: rgba(255,255,255,0.06);
}
select option { color: #0b172b; }

.segmented {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  padding: 4px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.05);
  gap: 4px;
}
.segmented-btn {
  height: 46px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
}
.segmented-btn.active {
  background: linear-gradient(180deg, rgba(30,123,255,0.25), rgba(30,123,255,0.12));
  color: var(--text);
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.choice-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  padding: 14px;
  text-align: center;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  cursor: pointer;
  transition: 0.2s ease;
}
.choice-card input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.choice-card.active {
  background: linear-gradient(180deg, rgba(30,123,255,0.18), rgba(30,123,255,0.08));
  border-color: rgba(86,162,255,0.24);
  color: var(--text);
}

.actions-row {
  display: flex;
  gap: 12px;
  margin-top: 22px;
}
.primary-btn,
.ghost-btn {
  height: 52px;
  border-radius: 16px;
  padding: 0 20px;
  border: 0;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease;
}
.primary-btn:hover,
.ghost-btn:hover { transform: translateY(-1px); }
.primary-btn {
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  color: white;
  box-shadow: 0 16px 32px rgba(30,123,255,0.28);
}
.ghost-btn {
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.08);
}
.form-note { margin: 14px 0 0; font-size: 0.92rem; line-height: 1.55; }

.empty-state {
  text-align: center;
  padding: 44px 22px 28px;
}
.empty-state h4 { margin: 18px 0 8px; font-size: 1.3rem; }
.empty-graphic {
  height: 96px;
  display: flex;
  justify-content: center;
  align-items: end;
  gap: 8px;
}
.empty-graphic span {
  width: 18px;
  border-radius: 999px;
  background: var(--protein);
  display: block;
}
.empty-graphic span:nth-child(1) { height: 34px; }
.empty-graphic span:nth-child(2) { height: 56px; }
.empty-graphic span:nth-child(3) { height: 80px; background: linear-gradient(180deg, #ffffff, #8ac6ff); }

.result-hero {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
  padding: 20px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.025));
  border: 1px solid rgba(255,255,255,0.06);
}
.result-hero h2 {
  margin: 8px 0 6px;
  font-size: clamp(2.4rem, 5vw, 3.4rem);
  line-height: 1;
  letter-spacing: -0.05em;
}
.result-stat {
  min-width: 110px;
  text-align: right;
}
.result-stat strong { display: block; font-size: 1.3rem; margin-top: 6px; }

.macro-bars { margin-top: 18px; display: grid; gap: 14px; }
.macro-row {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
}
.macro-row-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.macro-row-head span { color: var(--muted); }
.progress {
  height: 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
}
.progress > div {
  width: 0;
  height: 100%;
  border-radius: inherit;
  transition: width 0.45s ease;
}
.protein .progress > div { background: var(--protein); }
.carbs .progress > div { background: var(--carbs); }
.fats .progress > div { background: var(--fats); }

.results-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-top: 18px;
}
.insight-card,
.tip-card {
  padding: 18px;
  border-radius: 18px;
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(255,255,255,0.06);
}
.insight-card h4,
.tip-card p:last-child { margin: 8px 0 0; }
.tip-card { margin-top: 14px; }
.result-actions { margin-top: 18px; }

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-top: 20px;
  padding: 18px 12px 6px;
}
.site-footer nav {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}
.site-footer a {
  text-decoration: none;
}
.site-footer a:hover { color: var(--accent-3); }

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 50;
}
.modal.hidden,
.hidden { display: none !important; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
}
.modal-card {
  position: relative;
  width: min(640px, calc(100% - 24px));
  padding: 28px;
  z-index: 1;
}
.modal-card p { line-height: 1.7; color: var(--muted); }
.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
}

.legal-body {
  min-height: 100vh;
}
.legal-shell {
  width: min(920px, calc(100% - 24px));
  margin: 0 auto;
  padding: 30px 0 40px;
}
.back-link {
  display: inline-block;
  margin-bottom: 16px;
  color: var(--accent-3);
  text-decoration: none;
}
.back-link:hover { text-decoration: underline; }
.legal-card {
  padding: 30px;
}
.legal-card h2 {
  margin-top: 28px;
  font-size: 1.06rem;
  letter-spacing: -0.02em;
}
.legal-card p {
  line-height: 1.75;
  margin: 10px 0 0;
}

@media (max-width: 980px) {
  .main-grid,
  .hero-card {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }
  .hero-points { justify-content: flex-start; }
}

@media (max-width: 720px) {
  .app-shell { width: min(100% - 18px, 1220px); padding-top: 14px; }
  .site-header,
  .card,
  .hero-card,
  .modal-card,
  .legal-card { padding: 18px; }
  .site-header,
  .site-footer,
  .section-head,
  .result-hero,
  .actions-row,
  .site-footer nav {
    flex-direction: column;
    align-items: stretch;
  }
  .two-col,
  .three-col,
  .choice-grid,
  .results-grid { grid-template-columns: 1fr; }
  .segmented { width: 100%; }
  .segmented-btn { min-width: 0; }
  .site-footer { padding-left: 4px; padding-right: 4px; }
}


.support-card {
  margin-top: 22px;
  padding: 20px;
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.support-card h4 {
  margin: 6px 0 10px;
  font-size: 1.05rem;
}

.support-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
  padding: 12px 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  box-shadow: 0 16px 30px rgba(30,123,255,0.28);
}

.support-button:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

.legal-footer {
  margin-top: 18px;
  display: flex;
  justify-content: center;
}

.legal-footer nav {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

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

.legal-footer a:hover {
  text-decoration: underline;
}


/* Motion */
:root {
  --ease-premium: cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 560ms var(--ease-premium), transform 560ms var(--ease-premium);
  will-change: opacity, transform;
}

.reveal-up {
  transform: translateY(18px);
}

.reveal-delay-1 { transition-delay: 90ms; }
.reveal-delay-2 { transition-delay: 180ms; }
.reveal-delay-3 { transition-delay: 270ms; }

body.is-loaded .reveal {
  opacity: 1;
  transform: translateY(0);
}

.progress {
  overflow: hidden;
}

.progress > div {
  width: 0;
  transition: width 900ms var(--ease-premium), filter 320ms ease;
  will-change: width;
}

.result-hero h2,
.result-stat strong,
.macro-row-head strong {
  font-variant-numeric: tabular-nums;
}

.results-card.flash {
  animation: resultPulse 520ms var(--ease-premium);
}

@keyframes resultPulse {
  0% { box-shadow: 0 0 0 rgba(30, 123, 255, 0); }
  35% { box-shadow: 0 18px 60px rgba(30, 123, 255, 0.18); }
  100% { box-shadow: 0 0 0 rgba(30, 123, 255, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .progress > div,
  .results-card.flash,
  .primary-btn,
  .ghost-btn,
  .hero-pill,
  .card {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }

  .reveal {
    opacity: 1 !important;
  }
}
