:root {
  --night:    #0c1222;
  --night-2:  #1a2540;
  --sun:      #f59e0b;
  --sun-lt:   #fef3c7;
  --sun-dk:   #92400e;
  --green:    #10b981;
  --green-lt: #d1fae5;
  --green-dk: #065f46;
  --blue:     #3b82f6;
  --red:      #ef4444;
  --red-lt:   #fee2e2;
  --ink:      #0f172a;
  --ink-2:    #334155;
  --ink-3:    #64748b;
  --ink-4:    #94a3b8;
  --line:     #e2e8f0;
  --line-2:   #cbd5e1;
  --surface:  #f8fafc;
  --white:    #ffffff;
  --ff-head:  'Cabinet Grotesk', system-ui, sans-serif;
  --ff-body:  'Cabinet Grotesk', system-ui, sans-serif;
  --ff-serif: 'Literata', Georgia, serif;
  --r4: 4px; --r8: 8px; --r12: 12px; --r16: 16px; --r24: 24px;
}

/* ── RESET ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--ff-body);
  font-size: 15px;
  color: var(--ink);
  background: var(--surface);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ── PAGE ────────────────────────────────────────────────── */
.page { width: 95%; margin: 0 auto; padding: 40px 20px 80px; }

/* ── HERO ─────────────────────────────────────────────────  */
.hero { text-align: center; margin-bottom: 32px; }
.hero-eyebrow {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.5px; color: var(--sun); margin-bottom: 8px;
}
.hero-title {
  font-family: var(--ff-head);
  font-size: clamp(28px, 5vw, 46px);
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.05;
  color: var(--ink);
  margin-bottom: 12px;
}
.hero-sub { font-size: 15px; color: var(--ink-3); max-width: 500px; margin: 0 auto; line-height: 1.6; }

/* ── CARD ────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r24);
  padding: 28px;
  margin-bottom: 20px;
}
.card-dark {
  background: var(--night);
  border-color: var(--night-2);
  color: white;
}

/* ── FORM ────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
@media (max-width: 540px) { .form-grid { grid-template-columns: 1fr; } }

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.7px; color: var(--ink-3);
}
.form-input, .form-select {
  padding: 10px 13px;
  font-family: var(--ff-body);
  font-size: 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--r12);
  background: var(--surface);
  color: var(--ink);
  outline: none;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
  -webkit-appearance: none;
}
.form-input:focus, .form-select:focus {
  border-color: var(--sun);
  box-shadow: 0 0 0 3px rgba(245,158,11,0.15);
}
.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* ── GOAL PILLS ──────────────────────────────────────────── */
.goal-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.goal-pill {
  flex: 1;
  min-width: 120px;
  padding: 10px 12px;
  border-radius: var(--r12);
  border: 1px solid var(--line-2);
  background: var(--white);
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.12s;
}
.goal-pill:hover { border-color: var(--sun); color: var(--ink); }
.goal-pill.active {
  background: var(--night);
  color: var(--white);
  border-color: var(--night);
}
.goal-pill-icon { display: block; font-size: 18px; margin-bottom: 3px; }

/* ── PROTOCOL SELECTOR ───────────────────────────────────── */
.protocol-pills {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}
@media (max-width: 480px) { .protocol-pills { grid-template-columns: 1fr 1fr; } }
.proto-pill {
  padding: 10px 8px;
  border-radius: var(--r12);
  border: 1px solid var(--line-2);
  background: var(--white);
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: all 0.12s;
}
.proto-pill .proto-ratio { display: block; font-size: 16px; font-weight: 800; color: var(--ink); margin-bottom: 2px; }
.proto-pill:hover { border-color: var(--sun); }
.proto-pill.active { background: var(--sun); border-color: var(--sun); color: var(--night); }
.proto-pill.active .proto-ratio { color: var(--night); }

/* ── MAIN BUTTON ─────────────────────────────────────────── */
.btn-primary {
  width: 100%;
  padding: 14px;
  background: var(--night);
  color: white;
  font-family: var(--ff-head);
  font-size: 15px;
  font-weight: 800;
  border: none;
  border-radius: var(--r12);
  cursor: pointer;
  letter-spacing: 0.3px;
  transition: background 0.15s, transform 0.1s;
}
.btn-primary:hover { background: var(--night-2); }
.btn-primary:active { transform: scale(0.99); }

/* ── ALERT ──────────────────────────────────────────────── */
.alert {
  display: none;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--r8);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
  line-height: 1.5;
}
.alert.visible { display: flex; }
.alert-warn { background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; }
.alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }

/* ── RESULTS ─────────────────────────────────────────────── */
#results { display: none; }
#results.visible { display: block; animation: fadeUp 0.35s ease; }
@keyframes fadeUp { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:translateY(0); } }

/* ── SUMMARY GRID ────────────────────────────────────────── */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.summary-item { }
.sum-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.7px; color: rgba(255,255,255,0.4); margin-bottom: 4px; }
.sum-value { font-size: 20px; font-weight: 800; color: white; line-height: 1; }
.sum-value.accent { color: var(--sun); }

/* ── CLOCK VISUAL ────────────────────────────────────────── */
.clock-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 4px 0 20px;
}
.clock-svg { width: 220px; height: 220px; }
.clock-legend {
  display: flex;
  gap: 20px;
  margin-top: 12px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.6);
}
.legend-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 5px;
  flex-shrink: 0;
}

/* ── TIMELINE BAR ────────────────────────────────────────── */
.timeline-outer { margin-bottom: 20px; }
.timeline-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.timeline-bar {
  display: flex;
  height: 44px;
  border-radius: var(--r8);
  overflow: hidden;
}
.tl-seg {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  transition: width 0.5s ease;
  overflow: hidden;
}
.tl-fast { background: var(--night-2); color: rgba(255,255,255,0.4); }
.tl-eat  { background: var(--sun); color: var(--night); }

/* ── MACRO TIMING SECTION ────────────────────────────────── */
.macro-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
@media (max-width: 480px) { .macro-grid { grid-template-columns: 1fr; } }
.macro-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--r12);
  padding: 12px 14px;
}
.macro-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: rgba(255,255,255,0.4); margin-bottom: 4px; }
.macro-time { font-size: 15px; font-weight: 800; color: white; margin-bottom: 2px; }
.macro-desc { font-size: 11px; color: rgba(255,255,255,0.5); line-height: 1.4; }

/* ── HYDRATION ────────────────────────────────────────────── */
.hydration-box {
  background: rgba(59,130,246,0.1);
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: var(--r12);
  padding: 14px 16px;
  margin-bottom: 20px;
}
.hydration-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.6px; color: var(--blue); margin-bottom: 6px;
  display: flex; align-items: center; gap: 6px;
}
.hydration-text { font-size: 13px; color: rgba(255,255,255,0.7); line-height: 1.6; }

/* ── AUTOPHAGY METER ─────────────────────────────────────── */
.autophagy-wrap { margin-bottom: 20px; }
.autophagy-label {
  display: flex; justify-content: space-between;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; color: rgba(255,255,255,0.4);
  margin-bottom: 6px;
}
.autophagy-track {
  height: 8px;
  background: rgba(255,255,255,0.08);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 6px;
}
.autophagy-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(to right, #6366f1, #8b5cf6, #a78bfa);
  transition: width 0.6s ease;
}
.autophagy-desc { font-size: 12px; color: rgba(255,255,255,0.5); }

/* ── ACTIONS ─────────────────────────────────────────────── */
.actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}
@media (max-width: 500px) { .actions-grid { grid-template-columns: 1fr; } }
.btn-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 12px;
  border-radius: var(--r8);
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.8);
  font-family: var(--ff-body);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
}
.btn-action:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.2); }
.btn-action svg { width: 13px; height: 13px; flex-shrink: 0; }

/* ── PROTOCOL GUIDE ──────────────────────────────────────── */
.protocol-guide {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 16px;
}
@media (max-width: 560px) { .protocol-guide { grid-template-columns: 1fr; } }
.pg-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r16);
  padding: 16px;
  text-align: center;
}
.pg-num {
  width: 32px; height: 32px;
  background: var(--night);
  color: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800;
  margin: 0 auto 10px;
}
.pg-title { font-size: 13px; font-weight: 700; margin-bottom: 5px; }
.pg-desc  { font-size: 12px; color: var(--ink-3); line-height: 1.5; }

/* ── ARTICLE ─────────────────────────────────────────────── */
.article { margin-top: 48px; padding-top: 32px; border-top: 1px solid var(--line); }
.article-eyebrow { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px; color: var(--sun); margin-bottom: 8px; }
.article-h1 {
  font-family: var(--ff-serif);
  font-size: clamp(22px, 3.5vw, 32px);
  font-weight: 500;
  font-style: italic;
  line-height: 1.2;
  margin-bottom: 14px;
}
.article-lead {
  font-size: 15px; color: var(--ink-2); line-height: 1.7;
  padding-left: 14px; border-left: 3px solid var(--sun);
  margin-bottom: 28px;
}
.article-body { color: var(--ink-2); line-height: 1.78; }
.article-body h2 { font-family: var(--ff-head); font-size: 20px; font-weight: 800; margin: 28px 0 8px; color: var(--ink); }
.article-body h3 { font-size: 15px; font-weight: 700; margin: 18px 0 6px; color: var(--ink); }
.article-body p { margin-bottom: 13px; font-size: 14px; }
.article-body ul { padding-left: 18px; margin-bottom: 13px; }
.article-body li { margin-bottom: 6px; font-size: 14px; }
.article-body strong { color: var(--ink); font-weight: 600; }

.protocol-compare {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 12px 0 20px;
}
.protocol-compare th {
  background: var(--surface);
  padding: 8px 12px;
  text-align: left;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--ink-4);
  border-bottom: 1px solid var(--line);
}
.protocol-compare td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  vertical-align: top;
}
.protocol-compare tr:last-child td { border-bottom: none; }
.diff-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}
.diff-easy   { background: var(--green-lt); color: var(--green-dk); }
.diff-medium { background: var(--sun-lt); color: var(--sun-dk); }
.diff-hard   { background: var(--red-lt); color: #991b1b; }

.faq-item { border-top: 1px solid var(--line); padding: 14px 0; }
.faq-q { font-size: 14px; font-weight: 700; margin-bottom: 5px; color: var(--ink); }
.faq-a { font-size: 13px; color: var(--ink-3); line-height: 1.6; }

/* ── TOAST ──────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 20px; left: 50%;
  transform: translateX(-50%) translateY(6px);
  background: var(--night);
  color: white;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 13px; font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transition: all 0.2s;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── EXPORT STAGE ────────────────────────────────────────── */
#export-stage {
  position: fixed;
  top: -9999px; left: -9999px;
  width: 700px;
  background: var(--night);
  color: white;
  font-family: 'Cabinet Grotesk', sans-serif;
  padding: 40px;
  z-index: -1;
  border-radius: var(--r24);
}