:root {
  color-scheme: dark;
  --bg: #070817;
  --bg-soft: #101229;
  --card: rgba(18, 21, 45, 0.72);
  --card-strong: rgba(27, 31, 64, 0.92);
  --text: #f5f6ff;
  --muted: #aeb4d5;
  --line: rgba(255,255,255,0.12);
  --accent: #b7a7ff;
  --accent-2: #80f2d1;
  --accent-3: #ffd08a;
  --danger: #ff9aa2;
  --shadow: 0 24px 80px rgba(0,0,0,0.35);
  --radius: 28px;
  --focus: 0 0 0 4px rgba(183, 167, 255, .2);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f5fb;
  --bg-soft: #e8eaf5;
  --card: rgba(255, 255, 255, 0.88);
  --card-strong: rgba(255, 255, 255, 0.96);
  --text: #11142a;
  --muted: #4a5070;
  --line: rgba(17, 20, 42, 0.12);
  --shadow: 0 24px 80px rgba(17, 20, 42, 0.12);
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 20% 8%, rgba(128, 242, 209, 0.16), transparent 28rem),
    radial-gradient(circle at 84% 0%, rgba(183, 167, 255, 0.20), transparent 32rem),
    linear-gradient(145deg, #060711 0%, #10122a 52%, #08111d 100%);
  color: var(--text);
  overflow-x: hidden;
}
html[data-theme="light"] body {
  background: linear-gradient(145deg, #f8f9ff 0%, #eef1fb 52%, #e4e9f8 100%);
}
body[data-mode="minimum"] .full-only,
body[data-mode="minimum"] .full-only-row { display: none !important; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, a:focus-visible, select:focus-visible { outline: none; box-shadow: var(--focus); }
a { color: inherit; text-decoration: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.screen-filter {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
  background: rgba(255, 114, 51, .1);
  mix-blend-mode: multiply;
  transition: background .35s ease, opacity .35s ease;
}
.ambient { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.orb { position: absolute; width: 28rem; height: 28rem; border-radius: 999px; filter: blur(48px); opacity: .35; animation: floatOrb 12s ease-in-out infinite alternate; }
.orb-a { background: #7762ff; left: -7rem; top: 7rem; }
.orb-b { background: #25dfb2; right: -9rem; top: 14rem; animation-delay: -4s; }
.orb-c { background: #ffb86b; left: 45%; bottom: -16rem; animation-delay: -7s; }
.moon { position: absolute; right: 7vw; top: 8vh; width: 72px; height: 72px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff4c8, #d5d2ff 65%, transparent 66%); box-shadow: 0 0 60px rgba(255,244,200,.3); animation: moonDrift 10s ease-in-out infinite alternate; }
.star { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: white; opacity: .45; animation: twinkle 4s ease-in-out infinite; }
.s1 { top: 8%; left: 12%; } .s2 { top: 18%; right: 14%; animation-delay: -1.1s; }
.s3 { top: 44%; left: 6%; animation-delay: -2.2s; } .s4 { top: 66%; right: 20%; animation-delay: -3s; }
.s5 { top: 32%; left: 54%; animation-delay: -1.8s; } .s6 { top: 75%; left: 42%; animation-delay: -2.6s; }

.sticky-nav {
  margin: 0 auto;
  width: 100%;
  padding-top: 6px;
}
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  margin: 0 auto;
  width: min(1180px, calc(100% - 28px));
  padding: max(10px, env(safe-area-inset-top, 0px)) max(8px, env(safe-area-inset-right, 0px)) 0 max(8px, env(safe-area-inset-left, 0px));
  background: linear-gradient(180deg, rgba(7, 8, 23, 0.94) 0%, rgba(7, 8, 23, 0.88) 72%, rgba(7, 8, 23, 0) 100%);
  backdrop-filter: blur(18px);
}
html[data-theme="light"] .app-header {
  background: linear-gradient(180deg, rgba(244, 245, 251, 0.96) 0%, rgba(244, 245, 251, 0.9) 72%, rgba(244, 245, 251, 0) 100%);
}
.app-header .sticky-nav,
.app-header .app-toolbar {
  position: static;
  width: 100%;
  padding-top: 0;
  margin: 0;
}
.app-toolbar {
  margin: 0 auto;
  width: min(1180px, calc(100% - 28px));
  padding-top: 12px;
}
.app-toolbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 4px;
}
.app-toolbar-title {
  margin: 0;
  font-size: .95rem;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--text);
  white-space: nowrap;
}
.app-toolbar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.theme-glyph {
  display: none;
  line-height: 1;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.theme-text { white-space: nowrap; }
.lang-short { display: none; }
.lang-long { white-space: nowrap; }
.onboarding-header {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}
.onboarding-lang { margin: 0; }
.sticky-nav-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(13, 16, 36, 0.82);
  backdrop-filter: blur(16px);
}
html[data-theme="light"] .sticky-nav-inner { background: rgba(255,255,255,0.9); }
.sticky-nav-label { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; font-weight: 750; flex-shrink: 0; }
.section-nav-scroll {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
  mask-image: linear-gradient(90deg, transparent 0, #000 10px, #000 calc(100% - 10px), transparent 100%);
}
.section-nav-scroll::-webkit-scrollbar { display: none; }
.section-nav-links { display: flex; gap: 6px; flex-wrap: nowrap; flex: 1; padding: 2px 4px; }
.section-nav-link {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: .82rem;
  color: var(--muted);
  border: 1px solid transparent;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  flex-shrink: 0;
  scroll-snap-align: start;
}
.section-nav-link:hover, .section-nav-link.active { color: var(--text); background: rgba(128,242,209,.12); border-color: rgba(128,242,209,.25); }
.section-nav-link.tonight-link {
  color: var(--text);
  background: rgba(183, 167, 255, .16);
  border-color: rgba(183, 167, 255, .28);
  font-weight: 800;
}
.section-nav-link.tonight-link:hover, .section-nav-link.tonight-link.active {
  background: rgba(183, 167, 255, .24);
  border-color: rgba(183, 167, 255, .4);
}

.app-shell { width: min(1180px, calc(100% - 28px)); margin: 0 auto; padding: 12px 0 70px; }
.card { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, rgba(255,255,255,.08), rgba(255,255,255,.025)), var(--card); box-shadow: var(--shadow); backdrop-filter: blur(22px); }
html[data-theme="light"] .card { background: var(--card); }
.card::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(115deg, rgba(255,255,255,.22), transparent 28%, transparent 72%, rgba(255,255,255,.08)); opacity: .35; }
.card > * { position: relative; }
.reveal { opacity: 0; transform: translateY(24px); }
.reveal.in-view { animation: rise .72s cubic-bezier(.2,.8,.2,1) both; }

.context-banner { margin-top: 18px; padding: 18px 24px; }
.context-banner p:last-child { margin: 8px 0 0; line-height: 1.55; color: var(--text); }

.hero { min-height: 310px; padding: clamp(24px, 5vw, 54px); display: grid; grid-template-columns: 1.45fr .55fr; align-items: center; gap: 28px; }
.top-actions { display:flex; align-items:center; justify-content:space-between; gap: 16px; flex-wrap: wrap; }
.eyebrow { margin: 0 0 8px; color: var(--accent-2); text-transform: uppercase; letter-spacing: .15em; font-size: .74rem; font-weight: 750; }
h1, h2 { margin: 0; letter-spacing: -.04em; }
h1 { font-size: clamp(2.55rem, 8vw, 6.4rem); line-height: .9; max-width: 790px; }
h2 { font-size: clamp(1.35rem, 3.4vw, 2rem); }
.hero-subtitle { color: var(--muted); font-size: clamp(1rem, 2vw, 1.18rem); max-width: 720px; line-height: 1.65; }
.mode-switch, .lang-switch, .filter-pills, .theme-switch { display: inline-flex; gap: 6px; padding: 6px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,.06); flex-wrap: wrap; }
.mode-pill, .lang-pill, .filter-pill, .theme-pill { border: 0; color: var(--muted); background: transparent; border-radius: 999px; padding: 12px 18px; min-height: 44px; transition: transform .2s ease, background .2s ease, color .2s ease; }
.lang-pill, .filter-pill, .theme-pill { padding: 9px 13px; }
.mode-pill:hover, .lang-pill:hover, .filter-pill:hover, .theme-pill:hover { transform: translateY(-1px); }
.mode-pill.active, .lang-pill.active, .filter-pill.active, .theme-pill.active { background: var(--text); color: #11142a; }

.sleep-score { display: grid; place-items: center; gap: 16px; text-align: center; }
.ring { position: relative; width: 178px; height: 178px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--accent-2) 0deg, rgba(255,255,255,.1) 0deg); box-shadow: inset 0 0 36px rgba(128,242,209,.08), 0 20px 60px rgba(0,0,0,.2); animation: pulseGlow 4s ease-in-out infinite; }
.ring::before { content: ""; position: absolute; width: 132px; height: 132px; border-radius: 50%; background: #101228; border: 1px solid rgba(255,255,255,.08); }
html[data-theme="light"] .ring::before { background: #eef1fb; }
.ring span { position: relative; font-size: 2.1rem; font-weight: 850; }
#progressLabel, #readinessText { color: var(--muted); margin: 0; line-height: 1.5; }
.score-tags { display:flex; gap:8px; flex-wrap:wrap; justify-content:center; }
.score-tags span { border: 1px solid var(--line); border-radius: 999px; padding: 7px 10px; color: var(--muted); background: rgba(255,255,255,.05); font-size: .8rem; }

.grid { display: grid; gap: 18px; margin-top: 18px; }
.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card-header { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; padding: 24px 24px 0; }
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.clock-card, .screen-card, .focus-card, .breathing-card, .metrics-card, .tools-card, .reflection-card, .readiness-card { min-height: 250px; }
.live-clock { font-size: clamp(1.6rem, 4vw, 2.5rem); font-weight: 850; letter-spacing: -.04em; color: var(--accent-3); }
.time-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 24px; }
label { color: var(--muted); font-size: .9rem; }
input[type="time"], select {
  width: 100%;
  margin-top: 8px;
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 14px;
  min-height: 44px;
  color-scheme: dark;
}
select option {
  background: var(--bg-soft);
  color: var(--text);
}
html[data-theme="light"] input[type="time"],
html[data-theme="light"] select {
  background: #eef1fb;
  color: var(--text);
  color-scheme: light;
}
html[data-theme="light"] select option {
  background: #eef1fb;
  color: #11142a;
}
.next-step {
  display: block;
  width: calc(100% - 48px);
  margin: 0 24px 12px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(128, 242, 209, .08);
  border: 1px solid rgba(128, 242, 209, .16);
  color: #dffcf4;
  line-height: 1.45;
  text-align: left;
  cursor: pointer;
  min-height: 44px;
}
html[data-theme="light"] .next-step { color: var(--text); }
.consistency-note, .consistency-label { margin: 0 24px 24px; color: var(--muted); font-size: .88rem; line-height: 1.5; }

.ghost-btn, .primary-btn, .install-btn, .import-label, .ghost-link {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 11px 15px;
  min-height: 44px;
  color: var(--text);
  background: rgba(255,255,255,.065);
  transition: transform .2s ease, background .2s ease, border-color .2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.primary-btn { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #090b19; font-weight: 800; border: 0; }
.ghost-btn:hover, .primary-btn:hover, .install-btn:hover, .import-label:hover, .ghost-link:hover { transform: translateY(-2px); background: rgba(255,255,255,.12); }
.primary-btn:hover { background: linear-gradient(135deg, #c8bbff, #a5ffe5); }
.install-btn { position: fixed; right: 18px; bottom: 18px; z-index: 50; background: #f5f6ff; color: #11142a; font-weight: 800; }
.hidden { display: none !important; }

.readiness-meter { padding: 24px; display: grid; justify-items: center; gap: 16px; text-align: center; }
.readiness-orbit { --ready: 0deg; width: 144px; height: 144px; border-radius: 999px; display:grid; place-items:center; background: conic-gradient(var(--accent-3) var(--ready), rgba(255,255,255,.12) 0deg); position: relative; animation: slowTurn 10s linear infinite; }
.readiness-orbit::before { content:""; position:absolute; inset: 16px; border-radius: 999px; background:#101228; border:1px solid rgba(255,255,255,.08); }
html[data-theme="light"] .readiness-orbit::before { background: #eef1fb; }
.readiness-orbit span { position:relative; font-size: 2.3rem; font-weight: 900; }

.slider-row { padding: 18px 24px 0; display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.slider-row.compact { padding-top: 10px; }
.slider-row input { grid-column: 1 / -1; accent-color: var(--accent-2); width: 100%; min-height: 44px; }
output { color: var(--accent-3); font-weight: 750; }
.mini-note { margin: 18px 24px 24px; padding: 14px; color: var(--muted); line-height: 1.55; background: rgba(255,255,255,.045); border: 1px solid var(--line); border-radius: 16px; }
.os-guide { margin: 0 24px 24px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; color: var(--muted); }
.os-guide summary { cursor: pointer; color: var(--accent-2); font-weight: 700; min-height: 44px; display: flex; align-items: center; }
.os-guide ul { margin: 10px 0 0; padding-left: 18px; line-height: 1.55; }

.timeline-card, .checklist-card, .evidence-card, .safety-card, .insights-card, .cbti-card { margin-top: 18px; }
.timeline { padding: 24px; display: grid; grid-template-columns: repeat(7, minmax(120px, 1fr)); gap: 12px; overflow-x: auto; }
.timeline-step { position: relative; min-height: 148px; border: 1px solid var(--line); background: rgba(255,255,255,.055); border-radius: 22px; padding: 16px; color: var(--text); text-align: left; transition: transform .2s ease, border-color .2s ease, background .2s ease; min-width: 120px; }
.timeline-step:hover { transform: translateY(-4px); border-color: rgba(128,242,209,.38); background: rgba(128,242,209,.08); }
.timeline-step.past { opacity: .55; border-style: dashed; }
.timeline-step.current { border-color: rgba(128,242,209,.65); background: rgba(128,242,209,.14); box-shadow: 0 0 0 1px rgba(128,242,209,.2); }
.timeline-step.current .timeline-dot { animation: timelinePulse 2s ease-in-out infinite; }
.timeline-step.upcoming { opacity: .92; border-color: rgba(183,167,255,.28); }
.timeline-step time { display:block; color: var(--accent-3); font-weight: 850; margin-bottom: 10px; }
.timeline-step strong { display:block; margin-bottom: 6px; }
.timeline-step small { display:block; color: var(--muted); line-height: 1.45; }
.timeline-dot { position: absolute; right: 14px; top: 14px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 20px rgba(128,242,209,.6); }
.timeline-step.past .timeline-dot { background: var(--muted); box-shadow: none; }
.timeline-step.upcoming .timeline-dot { background: var(--accent); }

.checklist { padding: 24px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.check-item { width: 100%; border: 1px solid var(--line); background: rgba(255,255,255,.055); color: var(--text); border-radius: 20px; padding: 18px; min-height: 72px; display: grid; grid-template-columns: auto 1fr auto; gap: 14px; text-align: left; align-items: center; transition: transform .2s ease, background .2s ease, border-color .2s ease; }
.check-item:hover { transform: translateY(-2px); background: rgba(255,255,255,.085); }
.check-item.pending { opacity: .78; border-style: dashed; }
.check-item.pending small { color: var(--muted); }
.check-dot { width: 30px; height: 30px; border-radius: 999px; border: 2px solid rgba(255,255,255,.32); display: grid; place-items: center; flex-shrink: 0; }
.check-item.done { background: rgba(128,242,209,.16); border-color: rgba(128,242,209,.45); border-style: solid; opacity: 1; }
.check-item.done .check-dot { background: var(--accent-2); border-color: var(--accent-2); }
.check-item.done .check-dot::after { content: "✓"; color: #061014; font-weight: 900; }
.check-item.done small { text-decoration: line-through; text-decoration-color: rgba(174,180,213,.6); }
.check-item.just-done { animation: checkPop .45s ease both; }
.check-copy small { color: var(--muted); display:block; line-height: 1.45; margin-top: 4px; }
.check-action { font-size: .75rem; color: var(--accent-3); border: 1px solid rgba(255,208,138,.25); border-radius: 999px; padding: 7px 9px; white-space: nowrap; }
.custom-checklist { padding: 0 24px 24px; }
.custom-checklist-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.custom-habit-btn { font-size: .78rem; }

.evidence-grid { padding: 24px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.evidence-mini { min-height: 210px; border: 1px solid var(--line); border-radius: 22px; color: var(--text); background: rgba(255,255,255,.055); padding: 18px; text-align:left; display:grid; gap: 10px; transition: transform .2s ease, background .2s ease, border-color .2s ease; }
.evidence-mini:hover { transform: translateY(-4px); background: rgba(255,255,255,.085); }
.evidence-mini.strong { border-color: rgba(128,242,209,.22); }
.evidence-mini.moderate { border-color: rgba(255,208,138,.25); }
.evidence-mini.caution { border-color: rgba(255,154,162,.26); }
.evidence-icon { width: 42px; height: 42px; display:grid; place-items:center; border-radius: 14px; background: rgba(255,255,255,.09); color: var(--accent-2); }
.evidence-mini .level { color: var(--accent-2); text-transform: uppercase; letter-spacing: .14em; font-size: .68rem; font-weight: 850; }
.evidence-mini small { color: var(--muted); line-height: 1.5; }

.evidence-dialog, .onboarding-dialog, .success-dialog {
  width: min(720px, calc(100% - 24px));
  border: 1px solid var(--line);
  background: rgba(13,16,36,.96);
  color: var(--text);
  border-radius: 28px;
  padding: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
  opacity: 0;
  transform: translateY(12px) scale(.98);
  transition: opacity .25s ease, transform .25s ease, overlay .25s ease;
}
.evidence-dialog[open], .onboarding-dialog[open], .success-dialog[open] { opacity: 1; transform: translateY(0) scale(1); }
.evidence-dialog::backdrop, .onboarding-dialog::backdrop, .success-dialog::backdrop { background: rgba(0,0,0,.62); backdrop-filter: blur(8px); }
.dialog-close { position:absolute; top: 14px; right: 14px; width: 44px; height: 44px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,.07); color: var(--text); font-size: 1.6rem; }
#dialogBody, #dialogBullets { color: var(--muted); line-height: 1.65; }
#dialogBullets li { margin: 8px 0; }
.onboarding-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.onboard-habits { display: grid; gap: 8px; margin-top: 12px; }
.onboard-habit.active { background: rgba(128,242,209,.18); border-color: rgba(128,242,209,.35); }
.success-dialog { text-align: center; }

.mood-row { padding: 24px 24px 10px; display:grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.mood-row button {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.055);
  color: var(--text);
  padding: 14px 8px;
  min-height: 72px;
  display: grid;
  gap: 6px;
  justify-items: center;
  font-size: 1.5rem;
  transition: transform .2s ease, background .2s ease;
}
.mood-label { font-size: .68rem; color: var(--muted); line-height: 1.2; }
.mood-row button:hover, .mood-row button.active { transform: translateY(-2px); background: rgba(128,242,209,.13); border-color: rgba(128,242,209,.35); }
.sleep-log-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 10px 24px 0; }
.history-bars { height: 72px; margin: 18px 24px 24px; display:flex; align-items:end; gap: 8px; padding: 12px; border-radius: 18px; background: rgba(255,255,255,.045); border: 1px solid var(--line); }
.history-bars span { flex:1; min-height: 8px; border-radius: 999px 999px 4px 4px; background: linear-gradient(180deg, var(--accent-2), var(--accent)); animation: barRise .45s ease both; }
.history-bars span.empty { opacity: .25; background: rgba(255,255,255,.3); }

.timer-display { padding: 20px 24px 0; font-size: clamp(4rem, 10vw, 7rem); font-weight: 900; letter-spacing: -.06em; color: var(--accent-3); }
.timer-progress { margin: 0 24px 16px; height: 10px; border-radius: 999px; background: rgba(255,255,255,.08); overflow:hidden; }
.timer-progress span { display:block; height:100%; width:0%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: inherit; transition: width .3s ease; }
.ambient-controls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 12px;
  align-items: center;
  padding: 12px 24px 0;
}
.ambient-controls label[for="ambientSelect"] { grid-column: 1; }
.ambient-controls #ambientSelect { grid-column: 2; min-width: 140px; margin-top: 0; }
.ambient-controls label[for="ambientVolume"] { grid-column: 1; }
.ambient-controls #ambientVolume { grid-column: 1 / -1; margin-top: 0; }
.ambient-controls #ambientVolumeValue { grid-column: 2; justify-self: end; color: var(--accent-3); font-weight: 750; }
.ambient-player-host {
  position: fixed;
  width: 1px;
  height: 1px;
  left: -9999px;
  top: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}
.ambient-note { margin: 8px 24px 0; font-size: .82rem; }
.timer-actions, .tool-actions { padding: 0 24px 18px; display: flex; gap: 10px; flex-wrap: wrap; }
.import-label input { display:none; }
.routine-list { padding: 0 24px 24px 46px; margin: 0; color: var(--muted); line-height: 1.55; }
.routine-list li { margin: 8px 0; transition: color .2s ease, transform .2s ease; }
.routine-list li span { display:inline-block; color: var(--accent-3); margin-right: 8px; font-weight: 800; }
.routine-list li.active { color: var(--text); transform: translateX(3px); }
.breath-toggle { display: flex; align-items: center; gap: 10px; padding: 0 24px; color: var(--muted); min-height: 44px; }
.breath-orbit { height: 250px; display:grid; place-items:center; }
.breath-circle { width: 122px; height: 122px; border-radius: 999px; display:grid; place-items:center; background: radial-gradient(circle, rgba(128,242,209,.28), rgba(183,167,255,.16)); border: 1px solid rgba(255,255,255,.18); box-shadow: 0 0 80px rgba(128,242,209,.22); transition: transform 4s ease-in-out; font-weight: 850; font-size: 1.1rem; }
.breath-circle.inhale { transform: scale(1.55); }
.breath-circle.hold { transform: scale(1.55); }
.breath-circle.exhale { transform: scale(.92); transition-duration: 6s; }
.breath-cue { margin: 0 24px 24px; color: var(--muted); text-align:center; line-height: 1.5; }
.stats-grid { display:grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 24px; }
.stats-grid div { border: 1px solid var(--line); background: rgba(255,255,255,.055); border-radius: 20px; padding: 18px; }
.stats-grid strong { display:block; font-size: 1.65rem; color: var(--accent-3); }
.stats-grid span { color: var(--muted); font-size:.86rem; }
.safety-grid { padding: 24px; display:grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.safety-grid p { margin:0; padding: 18px; border:1px solid var(--line); border-radius: 20px; background: rgba(255,255,255,.055); color: var(--muted); line-height: 1.55; }
.insights-text, .cbti-body { padding: 0 24px 24px; color: var(--muted); line-height: 1.6; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 10000;
  background: #f5f6ff;
  color:#11142a;
  padding: 13px 18px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  font-weight: 800;
  animation: toastIn .25s ease both;
  display: flex;
  align-items: center;
  gap: 12px;
}
.toast-undo { border: 0; background: #11142a; color: #f5f6ff; border-radius: 999px; padding: 6px 12px; font-weight: 800; min-height: 36px; }

@keyframes rise { from { opacity: 0; transform: translateY(24px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes floatOrb { from { transform: translate3d(0,0,0) scale(1); } to { transform: translate3d(2rem,-2rem,0) scale(1.08); } }
@keyframes twinkle { 0%,100% { opacity:.25; transform:scale(.9); } 50% { opacity:.9; transform:scale(1.35); } }
@keyframes moonDrift { from { transform: translateY(0); } to { transform: translateY(18px); } }
@keyframes pulseGlow { 0%,100% { filter: drop-shadow(0 0 0 rgba(128,242,209,.2)); } 50% { filter: drop-shadow(0 0 18px rgba(128,242,209,.3)); } }
@keyframes slowTurn { to { transform: rotate(360deg); } }
@keyframes barRise { from { transform: scaleY(.2); opacity: .3; } to { transform: scaleY(1); opacity: 1; } }
@keyframes toastIn { from { opacity:0; transform: translate(-50%, 12px); } to { opacity:1; transform: translate(-50%, 0); } }
@keyframes checkPop { 0% { transform: scale(1); } 40% { transform: scale(1.03); box-shadow: 0 0 24px rgba(128,242,209,.25); } 100% { transform: scale(1); } }
@keyframes timelinePulse { 0%,100% { transform: scale(1); box-shadow: 0 0 20px rgba(128,242,209,.6); } 50% { transform: scale(1.25); box-shadow: 0 0 28px rgba(128,242,209,.9); } }

@media (max-width: 980px) {
  .hero, .two-col { grid-template-columns: 1fr; }
  .timeline { grid-template-columns: repeat(7, 180px); }
  .checklist, .evidence-grid, .safety-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; }
  .sleep-log-row { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .sticky-nav-label { display: none; }
  .sticky-nav-inner {
    border-radius: 18px;
    padding: 8px 10px;
    gap: 0;
  }
  .section-nav-scroll {
    width: 100%;
    flex: none;
    mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 28px), transparent 100%);
  }
}

@media (max-width: 560px) {
  .app-header {
    width: 100%;
    padding-left: max(12px, env(safe-area-inset-left, 0px));
    padding-right: max(12px, env(safe-area-inset-right, 0px));
  }
  .app-shell { width: min(100% - 24px, 1180px); padding-top: 6px; }
  .app-toolbar-inner {
    flex-wrap: nowrap;
    justify-content: center;
    gap: 8px;
    padding: 2px 0 6px;
  }
  .app-toolbar-title { display: none; }
  .app-toolbar-controls {
    flex-wrap: nowrap;
    gap: 6px;
    flex-shrink: 0;
    width: 100%;
    justify-content: center;
  }
  .theme-switch, .lang-switch {
    flex-wrap: nowrap;
    padding: 4px;
    gap: 4px;
  }
  .theme-pill, .lang-pill {
    padding: 8px 10px;
    min-height: 40px;
    min-width: 40px;
    justify-content: center;
  }
  .theme-glyph { display: inline; }
  .theme-text { display: none; }
  .lang-short { display: inline; }
  .lang-long { display: none; }
  .hero { padding: 24px; }
  .card-header { flex-direction: column; }
  .time-controls, .mood-row { grid-template-columns: 1fr; }
  .check-action { display:none; }
  .timer-display { font-size: 4.2rem; }
  .section-nav-link {
    padding: 8px 12px;
    font-size: .8rem;
    min-height: 40px;
  }
  .check-item, .mood-row button, .timeline-step, .ghost-btn, .primary-btn { min-height: 48px; }
  .card[id] { scroll-margin-top: calc(var(--header-offset, 132px) + 8px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
  .timeline-step.current .timeline-dot { animation: none; box-shadow: 0 0 0 3px var(--accent-2); }
  .check-item.just-done { animation: none; background: rgba(128,242,209,.16); }
  .ring, .readiness-orbit { animation: none; }
}
