
.slp {
  --slp-night:     #04060f;
  --slp-deep:      #080c1e;
  --slp-indigo:    #0d1233;
  --slp-purple:    #1a1040;
  --slp-cyan:      #38bdf8;
  --slp-cyan-lt:   #7dd3fc;
  --slp-cyan-dk:   #0369a1;
  --slp-violet:    #818cf8;
  --slp-violet-lt: #c7d2fe;
  --slp-rose:      #fb7185;
  --slp-emerald:   #34d399;
  --slp-amber:     #fbbf24;
  --slp-white:     #f0f4ff;
  --slp-w80:       rgba(240,244,255,0.80);
  --slp-w50:       rgba(240,244,255,0.50);
  --slp-w25:       rgba(240,244,255,0.25);
  --slp-w10:       rgba(240,244,255,0.10);
  --slp-w05:       rgba(240,244,255,0.05);
  --slp-line:      rgba(240,244,255,0.08);
  --slp-line2:     rgba(240,244,255,0.14);
  --slp-ff-head:   'Fraunces', Georgia, serif;
  --slp-ff-body:   'Manrope', system-ui, sans-serif;
  --slp-ff-mono:   'DM Mono', monospace;
  --slp-r8:  8px;
  --slp-r12: 12px;
  --slp-r16: 16px;
  --slp-r20: 20px;
  --slp-r24: 24px;

  font-family: var(--slp-ff-body);
  font-size: 15px;
  color: var(--slp-white);
  background: var(--slp-night);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.slp *, .slp *::before, .slp *::after { box-sizing: border-box; }

/* ── STARFIELD BG ────────────────────────────────────────── */
.slp__bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.slp__bg-star {
  position: absolute;
  border-radius: 50%;
  background: white;
  animation: slp-twinkle var(--dur, 4s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
  opacity: var(--op, 0.4);
}
@keyframes slp-twinkle {
  0%, 100% { opacity: var(--op, 0.4); transform: scale(1); }
  50%       { opacity: calc(var(--op, 0.4) * 0.2); transform: scale(0.7); }
}
.slp__bg-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
}

/* ── LAYOUT ──────────────────────────────────────────────── */
.slp__page {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 48px 20px 100px;
}

/* ── HERO ─────────────────────────────────────────────────  */
.slp__hero {
  text-align: center;
  margin-bottom: 52px;
}
.slp__hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(56,189,248,0.1);
  border: 1px solid rgba(56,189,248,0.2);
  color: var(--slp-cyan);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 5px 12px;
  border-radius: 20px;
  margin-bottom: 18px;
}
.slp__hero-title {
  font-family: var(--slp-ff-head);
  font-size: clamp(32px, 7vw, 68px);
  font-weight: 900;
  line-height: 1.0;
  letter-spacing: -1px;
  color: var(--slp-white);
  margin-bottom: 14px;
}
.slp__hero-title em {
  font-style: italic;
  font-weight: 400;
  color: var(--slp-cyan);
}
.slp__hero-sub {
  font-size: 16px;
  color: var(--slp-w50);
  max-width: 480px;
  margin: 0 auto;
  line-height: 1.65;
}

/* ── GLASS CARD ──────────────────────────────────────────── */
.slp__card {
  background: rgba(13,18,51,0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--slp-line2);
  border-radius: var(--slp-r24);
  padding: 32px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}
.slp__card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(56,189,248,0.4), transparent);
}

/* ── MODE TOGGLE ─────────────────────────────────────────── */
.slp__mode-row {
  display: flex;
  gap: 8px;
  margin-bottom: 28px;
  background: var(--slp-w05);
  border-radius: var(--slp-r12);
  padding: 4px;
}
.slp__mode-btn {
  flex: 1;
  padding: 10px 14px;
  border-radius: var(--slp-r8);
  border: none;
  background: transparent;
  color: var(--slp-w50);
  font-family: var(--slp-ff-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  line-height: 1.3;
}
.slp__mode-btn.active {
  background: var(--slp-indigo);
  color: var(--slp-cyan);
  border: 1px solid rgba(56,189,248,0.25);
  box-shadow: 0 0 20px rgba(56,189,248,0.08);
}
.slp__mode-btn-icon { display: block; font-size: 18px; margin-bottom: 2px; }

/* ── FORM ────────────────────────────────────────────────── */
.slp__input-row {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.slp__fg { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 160px; }
.slp__label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--slp-w25);
}
.slp__input {
  padding: 13px 16px;
  font-family: var(--slp-ff-mono);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 1px;
  background: var(--slp-w05);
  border: 1px solid var(--slp-line2);
  border-radius: var(--slp-r12);
  color: var(--slp-white);
  outline: none;
  width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
}
.slp__input:focus {
  border-color: var(--slp-cyan);
  box-shadow: 0 0 0 3px rgba(56,189,248,0.1);
}
.slp__input::-webkit-calendar-picker-indicator {
  filter: invert(1) opacity(0.3);
  cursor: pointer;
}

/* Latency slider */
.slp__slider-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 180px;
}
.slp__slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.slp__slider-val {
  font-family: var(--slp-ff-mono);
  font-size: 13px;
  color: var(--slp-cyan);
  font-weight: 500;
}
.slp__range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--slp-cyan) 0%, var(--slp-cyan) var(--pct,38%), rgba(240,244,255,0.12) var(--pct,38%), rgba(240,244,255,0.12) 100%);
  outline: none;
  cursor: pointer;
}
.slp__range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--slp-cyan);
  box-shadow: 0 0 12px rgba(56,189,248,0.5);
  cursor: pointer;
  border: 2px solid var(--slp-night);
  transition: transform 0.15s;
}
.slp__range::-webkit-slider-thumb:hover { transform: scale(1.2); }
.slp__range::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--slp-cyan);
  border: 2px solid var(--slp-night);
  cursor: pointer;
}

/* ── CALCULATE BUTTON ────────────────────────────────────── */
.slp__calc-btn {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, var(--slp-cyan) 0%, var(--slp-violet) 100%);
  color: var(--slp-night);
  font-family: var(--slp-ff-head);
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 0.3px;
  border: none;
  border-radius: var(--slp-r12);
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s, box-shadow 0.2s;
  box-shadow: 0 8px 32px rgba(56,189,248,0.25);
  position: relative;
  overflow: hidden;
}
.slp__calc-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: white;
  opacity: 0;
  transition: opacity 0.15s;
}
.slp__calc-btn:hover { box-shadow: 0 12px 40px rgba(56,189,248,0.35); transform: translateY(-1px); }
.slp__calc-btn:hover::after { opacity: 0.05; }
.slp__calc-btn:active { transform: scale(0.99); }

/* ── RESULTS ─────────────────────────────────────────────── */
#slp-results { display: none; }
#slp-results.slp--visible {
  display: block;
  animation: slp-fadein 0.4s ease;
}
@keyframes slp-fadein {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── RESULT HEADER ───────────────────────────────────────── */
.slp__res-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 12px;
  flex-wrap: wrap;
}
.slp__res-title {
  font-family: var(--slp-ff-head);
  font-size: 20px;
  font-weight: 700;
  font-style: italic;
  color: var(--slp-w80);
}
.slp__res-subtitle { font-size: 12px; color: var(--slp-w25); margin-top: 2px; }

/* ── CYCLE CARDS GRID ────────────────────────────────────── */
.slp__cycles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 10px;
  margin-bottom: 28px;
}
.slp__cycle-card {
  background: var(--slp-w05);
  border: 1px solid var(--slp-line);
  border-radius: var(--slp-r16);
  padding: 16px 14px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}
.slp__cycle-card::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.2s;
  background: radial-gradient(ellipse at center, rgba(56,189,248,0.08), transparent 70%);
}
.slp__cycle-card:hover { border-color: var(--slp-line2); transform: translateY(-2px); }
.slp__cycle-card:hover::before { opacity: 1; }
.slp__cycle-card.slp--recommended {
  border-color: rgba(56,189,248,0.4);
  background: rgba(56,189,248,0.06);
}
.slp__cycle-card.slp--recommended::before { opacity: 1; }
.slp__cycle-card.slp--selected {
  border-color: var(--slp-cyan);
  background: rgba(56,189,248,0.1);
  box-shadow: 0 0 24px rgba(56,189,248,0.15);
}
.slp__cycle-rec-badge {
  position: absolute;
  top: -1px; right: -1px;
  background: var(--slp-cyan);
  color: var(--slp-night);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 0 var(--slp-r16) 0 var(--slp-r8);
}
.slp__cycle-num {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--slp-w25);
  margin-bottom: 6px;
}
.slp__cycle-time {
  font-family: var(--slp-ff-mono);
  font-size: 22px;
  font-weight: 500;
  color: var(--slp-white);
  line-height: 1;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}
.slp__cycle-card.slp--selected .slp__cycle-time { color: var(--slp-cyan); }
.slp__cycle-dur {
  font-size: 11px;
  color: var(--slp-w50);
  margin-bottom: 8px;
}
.slp__cycle-score {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
}
.slp__score-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
}

/* ── VISUAL CLOCK ────────────────────────────────────────── */
.slp__visual-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 28px;
}
.slp__clock-svg { width: min(300px, 80vw); height: min(300px, 80vw); }
.slp__phase-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 12px;
}
.slp__phase-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--slp-w50);
}
.slp__phase-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── DETAIL STATS ────────────────────────────────────────── */
.slp__stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}
.slp__stat {
  background: var(--slp-w05);
  border: 1px solid var(--slp-line);
  border-radius: var(--slp-r12);
  padding: 14px 16px;
}
.slp__stat-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--slp-w25);
  margin-bottom: 5px;
}
.slp__stat-value {
  font-family: var(--slp-ff-mono);
  font-size: 20px;
  font-weight: 500;
  color: var(--slp-white);
  line-height: 1;
}
.slp__stat-unit { font-size: 11px; color: var(--slp-w25); margin-left: 2px; }

/* ── SLEEP PHASES BREAKDOWN ──────────────────────────────── */
.slp__phases-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
  font-size: 13px;
}
.slp__phases-table th {
  padding: 8px 12px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--slp-w25);
  border-bottom: 1px solid var(--slp-line);
}
.slp__phases-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--slp-line);
  color: var(--slp-w80);
  vertical-align: middle;
}
.slp__phases-table tr:last-child td { border-bottom: none; }
.slp__phase-bar-cell { width: 100px; }
.slp__phase-bar-track {
  height: 6px;
  background: var(--slp-w05);
  border-radius: 3px;
  overflow: hidden;
}
.slp__phase-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease;
}

/* ── QUALITY METER ───────────────────────────────────────── */
.slp__quality-wrap { margin-bottom: 24px; }
.slp__quality-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.slp__quality-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--slp-w25);
}
.slp__quality-score {
  font-family: var(--slp-ff-mono);
  font-size: 15px;
  font-weight: 500;
}
.slp__quality-track {
  height: 8px;
  background: var(--slp-w05);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 6px;
}
.slp__quality-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}
.slp__quality-desc { font-size: 12px; color: var(--slp-w50); }

/* ── TIPS SECTION ────────────────────────────────────────── */
.slp__tips {
  background: rgba(56,189,248,0.04);
  border: 1px solid rgba(56,189,248,0.12);
  border-radius: var(--slp-r16);
  padding: 18px 20px;
  margin-bottom: 20px;
}
.slp__tips-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--slp-cyan);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.slp__tips-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.slp__tips-list li {
  font-size: 13px;
  color: var(--slp-w80);
  line-height: 1.5;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.slp__tip-bullet {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--slp-cyan);
  flex-shrink: 0;
  margin-top: 6px;
}

/* ── ACTION BUTTONS ──────────────────────────────────────── */
.slp__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.slp__action-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 16px;
  border-radius: var(--slp-r8);
  border: 1px solid var(--slp-line2);
  background: var(--slp-w05);
  color: var(--slp-w80);
  font-family: var(--slp-ff-body);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.slp__action-btn:hover { background: var(--slp-w10); border-color: var(--slp-line2); color: var(--slp-white); }
.slp__action-btn svg { width: 13px; height: 13px; flex-shrink: 0; }

/* ── GUIDE SECTION ───────────────────────────────────────── */
.slp__guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin-top: 16px;
}
.slp__guide-card {
  background: var(--slp-w05);
  border: 1px solid var(--slp-line);
  border-radius: var(--slp-r16);
  padding: 18px;
  position: relative;
  transition: border-color 0.2s;
}
.slp__guide-card:hover { border-color: var(--slp-line2); }
.slp__guide-num {
  font-family: var(--slp-ff-mono);
  font-size: 28px;
  font-weight: 500;
  color: var(--slp-w10);
  margin-bottom: 8px;
  line-height: 1;
}
.slp__guide-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--slp-white);
  margin-bottom: 6px;
}
.slp__guide-desc { font-size: 12px; color: var(--slp-w50); line-height: 1.55; }

/* ── ARTICLE ─────────────────────────────────────────────── */
.slp__article {
  margin-top: 64px;
  padding-top: 40px;
  border-top: 1px solid var(--slp-line);
}
.slp__article-eyebrow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--slp-cyan);
  margin-bottom: 10px;
}
.slp__article-h1 {
  font-family: var(--slp-ff-head);
  font-size: clamp(24px, 4vw, 40px);
  font-weight: 900;
  line-height: 1.1;
  color: var(--slp-white);
  margin-bottom: 16px;
}
.slp__article-lead {
  font-size: 16px;
  color: var(--slp-w80);
  line-height: 1.75;
  padding-left: 16px;
  border-left: 2px solid var(--slp-cyan);
  margin-bottom: 36px;
  font-style: italic;
}
.slp__article-body { color: var(--slp-w80); line-height: 1.8; }
.slp__article-body h2 {
  font-family: var(--slp-ff-head);
  font-size: 22px;
  font-weight: 700;
  color: var(--slp-white);
  margin: 36px 0 10px;
  letter-spacing: -0.2px;
}
.slp__article-body h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--slp-w80);
  margin: 22px 0 8px;
}
.slp__article-body p { margin-bottom: 14px; font-size: 14px; }
.slp__article-body ul { padding-left: 18px; margin-bottom: 14px; }
.slp__article-body li { margin-bottom: 7px; font-size: 14px; }
.slp__article-body strong { color: var(--slp-white); font-weight: 600; }

.slp__stage-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 14px 0 22px;
}
.slp__stage-table th {
  background: var(--slp-w05);
  padding: 9px 12px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--slp-w25);
  border-bottom: 1px solid var(--slp-line);
}
.slp__stage-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--slp-line);
  color: var(--slp-w80);
  vertical-align: top;
}
.slp__stage-table tr:last-child td { border-bottom: none; }
.slp__stage-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}

.slp__faq-item {
  border-top: 1px solid var(--slp-line);
  padding: 16px 0;
}
.slp__faq-q {
  font-size: 15px;
  font-weight: 700;
  color: var(--slp-white);
  margin-bottom: 6px;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.slp__faq-q-text { flex: 1; }
.slp__faq-chevron {
  width: 16px; height: 16px;
  color: var(--slp-w25);
  flex-shrink: 0;
  transition: transform 0.2s;
  margin-top: 2px;
}
.slp__faq-item.slp--open .slp__faq-chevron { transform: rotate(180deg); }
.slp__faq-a {
  font-size: 13px;
  color: var(--slp-w50);
  line-height: 1.65;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.2s;
}
.slp__faq-item.slp--open .slp__faq-a { max-height: 400px; }

/* ── TOAST ───────────────────────────────────────────────── */
.slp__toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--slp-indigo);
  border: 1px solid var(--slp-line2);
  color: var(--slp-white);
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s;
  white-space: nowrap;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.slp__toast.slp--show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 540px) {
  .slp__card { padding: 20px; }
  .slp__cycles-grid { grid-template-columns: 1fr 1fr; }
  .slp__mode-btn-icon { display: none; }
}