/* ===== Night Owl Sleep — participant app ===== */
:root {
  --navy-950: #0a1430;
  --navy-900: #0f1f4a;
  --navy-800: #16295c;
  --navy-700: #1f3a78;
  --indigo-500: #4a5fd6;
  --blue-500: #3d6df2;
  --blue-400: #6b93ff;
  --blue-100: #e3ebff;
  --orange-500: #ff8a3d;
  --orange-100: #fff0e3;
  --mint-500: #35c39a;
  --red-500: #e5484d;
  --bg: #f2f4fb;
  --bg-2: #e9edf8;
  --card: #ffffff;
  --ink: #16213e;
  --ink-2: #56607f;
  --ink-3: #8b93ad;
  --line: #e3e7f3;
  --shadow: 0 1px 2px rgba(20, 40, 90, .05), 0 8px 24px -8px rgba(20, 40, 90, .14);
  --radius: 20px;
  --nav-h: 68px;
  --font: system-ui, -apple-system, "Segoe UI", "PingFang HK", "PingFang SC", "Microsoft JhengHei", "Microsoft YaHei", "Noto Sans TC", "Noto Sans SC", Roboto, "Helvetica Neue", sans-serif;
  color-scheme: light;
}
/* dark theme: chosen automatically at night (19:00-06:00) or by the participant in Settings */
:root[data-theme="dark"] {
  --bg: #0F1428; --bg-2: #0c1122; --card: #171e3a; --ink: #E6E8F0; --ink-2: #aab1c6; --ink-3: #7c85a1; --line: #262e50;
  --blue-100: #1d2a58; --orange-100: #3a2716; --blue-500: #6b93ff;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -8px rgba(0,0,0,.5);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); line-height: 1.5; font-size: 16px; -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
a { color: var(--blue-500); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

#app { min-height: 100vh; min-height: 100dvh; max-width: 560px; margin: 0 auto; position: relative; background: var(--bg); }
@media (min-width: 600px) { body { background: linear-gradient(160deg, var(--bg-2), var(--bg)); } #app { box-shadow: 0 0 60px rgba(20, 40, 90, .12); } }
.view { padding: calc(env(safe-area-inset-top) + 14px) 16px calc(var(--nav-h) + env(safe-area-inset-bottom) + 24px); animation: fadeUp .35s ease both; }
.view.full { padding-bottom: calc(env(safe-area-inset-bottom) + 28px); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ---------- buttons ---------- */
.btn { border: 0; border-radius: 16px; padding: 14px 20px; font-weight: 650; font-size: 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform .1s, filter .15s, opacity .15s; }
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(135deg, var(--blue-500), var(--indigo-500)); color: #fff; box-shadow: 0 8px 20px -8px rgba(61, 109, 242, .7); }
.btn.orange { background: linear-gradient(135deg, #ff9a4d, var(--orange-500)); color: #fff; box-shadow: 0 8px 20px -8px rgba(255, 138, 61, .7); }
.btn.ghost { background: transparent; color: var(--blue-500); }
.btn.soft { background: var(--blue-100); color: var(--blue-500); }
.btn.line { background: transparent; border: 1.5px solid var(--line); color: var(--ink); }
.btn.danger { background: var(--red-500); color: #fff; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn.sm { padding: 9px 14px; font-size: 14px; border-radius: 12px; }

/* ---------- cards ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 14px; }
.card h3 { font-size: 15px; color: var(--ink-2); font-weight: 650; margin-bottom: 10px; letter-spacing: .02em; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.section-title { font-size: 13px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .08em; margin: 22px 4px 10px; }

/* ---------- hero (Today header) ---------- */
.hero { position: relative; overflow: hidden; border-radius: 28px; color: #fff; padding: 22px 20px 18px; margin-bottom: 14px;
  background: radial-gradient(120% 90% at 100% 0%, rgba(120, 140, 255, .55), transparent 55%), radial-gradient(90% 80% at 0% 100%, rgba(255, 138, 61, .22), transparent 60%), linear-gradient(160deg, var(--navy-800), var(--navy-950)); box-shadow: 0 18px 40px -16px rgba(15, 31, 74, .7); }
.hero .stars { position: absolute; inset: 0; pointer-events: none; opacity: .9; }
.hero .moon { position: absolute; right: 16px; top: 14px; opacity: .95; }
.hero-date { font-size: 13px; color: rgba(255, 255, 255, .72); letter-spacing: .04em; }
.hero-greet { font-size: 26px; font-weight: 750; margin: 2px 0 14px; letter-spacing: .01em; }
.hero-block { background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .12); backdrop-filter: blur(6px); border-radius: 16px; padding: 12px 14px; margin-top: 10px; }
.hero-block h4 { margin: 0 0 8px; font-size: 12px; font-weight: 650; color: rgba(255, 255, 255, .7); letter-spacing: .06em; }
.progress-row { display: flex; align-items: baseline; justify-content: space-between; }
.progress-row b { font-size: 18px; }
.seg7 { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-top: 8px; }
.seg7 i { height: 8px; border-radius: 5px; background: rgba(255, 255, 255, .18); }
.seg7 i.done { background: linear-gradient(90deg, #8fb0ff, #b7c8ff); }
.seg7 i.today { background: var(--orange-500); box-shadow: 0 0 10px rgba(255, 138, 61, .8); }
.plan { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.plan div { background: rgba(255, 255, 255, .07); border-radius: 12px; padding: 8px 10px; }
.plan small { display: block; font-size: 11px; color: rgba(255, 255, 255, .62); }
.plan b { font-size: 15px; font-variant-numeric: tabular-nums; }
.plan .cur { outline: 1.5px solid rgba(255, 176, 120, .8); }
.plan-note { font-size: 12px; color: rgba(255, 255, 255, .62); margin-top: 8px; display: flex; gap: 6px; align-items: center; }

/* ---------- Next card ---------- */
.next { position: relative; display: block; width: 100%; text-align: left; border: 0; border-radius: 24px; color: #fff; padding: 20px; margin-bottom: 14px; overflow: hidden;
  background: radial-gradient(90% 120% at 100% 0%, rgba(107, 147, 255, .5), transparent 60%), linear-gradient(150deg, #1b3a86, #0f2358 60%, #0b1a45); box-shadow: 0 18px 36px -16px rgba(15, 35, 88, .85); }
.next.open { box-shadow: 0 0 0 2px var(--orange-500), 0 18px 36px -16px rgba(255, 138, 61, .55); }
.next .tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; letter-spacing: .1em; color: #ffc9a0; text-transform: uppercase; }
.next .tag .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--orange-500); animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 138, 61, .7); } 70% { box-shadow: 0 0 0 10px rgba(255, 138, 61, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 138, 61, 0); } }
.next .when { font-size: 44px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; margin: 8px 0 2px; font-variant-numeric: tabular-nums; }
.next .what { font-size: 19px; font-weight: 650; }
.next .meta { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; font-size: 14px; color: rgba(255, 255, 255, .78); }
.next .go { display: inline-flex; align-items: center; gap: 4px; background: var(--orange-500); color: #fff; padding: 8px 14px; border-radius: 999px; font-weight: 700; font-size: 14px; }
.next .go.idle { background: rgba(255, 255, 255, .14); color: rgba(255, 255, 255, .8); }

/* ---------- timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.tl-item { display: flex; align-items: center; gap: 14px; padding: 13px 4px; border-bottom: 1px solid var(--line); }
.tl-item:last-child { border-bottom: 0; }
.tl-time { width: 52px; font-variant-numeric: tabular-nums; font-weight: 700; font-size: 15px; }
.tl-name { flex: 1; min-width: 0; }
.tl-name b { display: block; font-size: 15px; font-weight: 650; }
.tl-name span { font-size: 12.5px; color: var(--ink-3); }
.tl-ind { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.tl-item.done .tl-ind { background: var(--blue-500); color: #fff; }
.tl-item.next .tl-ind { background: var(--orange-100); color: var(--orange-500); box-shadow: inset 0 0 0 2px var(--orange-500); }
.tl-item.next .tl-time, .tl-item.next .tl-name b { color: var(--orange-500); }
.tl-item.upcoming .tl-ind { box-shadow: inset 0 0 0 2px var(--line); }
.tl-item.upcoming { color: var(--ink-2); }
.tl-item.missed { color: var(--ink-3); }
.tl-item.missed .tl-ind { box-shadow: inset 0 0 0 2px var(--line); background: var(--bg-2); color: var(--ink-3); }
.tl-item.missed .tl-time, .tl-item.missed .tl-name b { color: var(--ink-3); font-weight: 500; }
.tl-item.clickable { cursor: pointer; }
.pill { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--bg-2); color: var(--ink-2); }
.pill.orange { background: var(--orange-100); color: var(--orange-500); }
.pill.blue { background: var(--blue-100); color: var(--blue-500); }

/* ---------- banner / notices ---------- */
.notice { display: flex; gap: 12px; align-items: flex-start; border-radius: 18px; padding: 14px 16px; margin-bottom: 12px; background: var(--card); box-shadow: var(--shadow); }
.notice .ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--blue-100); color: var(--blue-500); }
.notice.warn .ic { background: var(--orange-100); color: var(--orange-500); }
.notice b { display: block; margin-bottom: 2px; }
.notice .btns { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.reminder { border-left: 4px solid var(--blue-500); }

/* ---------- bottom nav ---------- */
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: center; padding: 0 12px calc(env(safe-area-inset-bottom) + 8px); pointer-events: none; }
.nav-inner { pointer-events: auto; width: 100%; max-width: 536px; display: grid; grid-template-columns: repeat(4, 1fr); background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(14px); border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 10px 30px -10px rgba(15, 31, 74, .35); padding: 6px; }
.nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 6px; color: var(--ink-3); text-decoration: none; font-size: 11.5px; font-weight: 650; border-radius: 18px; transition: background .2s, color .2s; }
.nav a.active { background: var(--blue-100); color: var(--blue-500); }

/* ---------- top bars / flows ---------- */
.topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.topbar h1 { font-size: 20px; flex: 1; }
.iconbtn { width: 40px; height: 40px; border-radius: 14px; border: 0; background: var(--card); box-shadow: var(--shadow); display: grid; place-items: center; color: var(--ink); }
.page-title { font-size: 26px; font-weight: 800; margin: 6px 4px 16px; letter-spacing: -.01em; }

/* ---------- login ---------- */
.auth { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 24px 22px calc(env(safe-area-inset-bottom) + 24px); color: #fff; position: relative; overflow: hidden;
  background: radial-gradient(90% 60% at 80% 0%, rgba(120, 140, 255, .5), transparent 60%), radial-gradient(70% 50% at 0% 100%, rgba(255, 138, 61, .2), transparent 60%), linear-gradient(170deg, var(--navy-800), var(--navy-950)); }
.auth .stars { position: absolute; inset: 0; pointer-events: none; }
.auth-logo { width: 84px; height: 84px; border-radius: 24px; box-shadow: 0 16px 40px -10px rgba(0, 0, 0, .6); margin-bottom: 18px; }
.auth h1 { font-size: 32px; font-weight: 800; letter-spacing: -.01em; }
.auth .sub { color: rgba(255, 255, 255, .72); margin: 6px 0 26px; }
.auth form { display: grid; gap: 12px; position: relative; }
.auth label { font-size: 13px; color: rgba(255, 255, 255, .75); font-weight: 600; display: grid; gap: 6px; }
.auth input { background: rgba(255, 255, 255, .1); border: 1.5px solid rgba(255, 255, 255, .18); color: #fff; border-radius: 14px; padding: 14px 16px; font-size: 18px; letter-spacing: .12em; outline: none; }
.auth input:focus { border-color: var(--blue-400); background: rgba(255, 255, 255, .14); }
.auth .err { color: #ffb4b6; font-size: 14px; min-height: 20px; }
.lang-row { display: flex; gap: 8px; margin-top: 22px; position: relative; flex-wrap: wrap; }
.lang-chip { border: 1.5px solid rgba(255, 255, 255, .25); background: transparent; color: rgba(255, 255, 255, .85); border-radius: 999px; padding: 7px 14px; font-size: 14px; font-weight: 600; }
.lang-chip.active { background: #fff; color: var(--navy-900); border-color: #fff; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--bg-2); border-radius: 14px; padding: 4px; gap: 4px; }
.seg button { border: 0; background: transparent; padding: 10px 6px; border-radius: 11px; font-weight: 650; color: var(--ink-2); }
.seg button.active { background: var(--card); color: var(--blue-500); box-shadow: var(--shadow); }

/* ---------- forms ---------- */
.field { margin-bottom: 20px; }
.field > label, .q-title { display: block; font-weight: 650; margin-bottom: 10px; font-size: 16px; }
.q-sub { font-size: 13px; color: var(--ink-3); margin: -6px 0 10px; }
.input, .select, .textarea { width: 100%; background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; padding: 13px 14px; font-size: 16px; outline: none; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--blue-500); box-shadow: 0 0 0 4px rgba(61, 109, 242, .12); }
.textarea { min-height: 96px; resize: vertical; }
.input.time { font-variant-numeric: tabular-nums; font-size: 22px; font-weight: 700; text-align: center; }
.opts { display: grid; gap: 8px; }
.opt { text-align: left; background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; padding: 13px 14px; display: flex; align-items: center; gap: 12px; font-size: 15.5px; transition: border-color .15s, background .15s; }
.opt .dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--ink-3); flex: none; display: grid; place-items: center; }
.opt.sel { border-color: var(--blue-500); background: var(--blue-100); }
.opt.sel .dot { border-color: var(--blue-500); background: var(--blue-500); box-shadow: inset 0 0 0 4px var(--blue-100); }
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.scale button { border: 1.5px solid var(--line); background: var(--card); border-radius: 14px; padding: 14px 0; font-weight: 750; font-size: 17px; }
.scale button.sel { border-color: var(--blue-500); background: var(--blue-500); color: #fff; }
.scale-ends { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--ink-3); margin-top: 6px; }
.scale-labels { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 6px; font-size: 11.5px; color: var(--ink-3); text-align: center; line-height: 1.25; }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button { width: 46px; height: 46px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); font-size: 22px; font-weight: 700; }
.stepper input { flex: 1; text-align: center; font-size: 22px; font-weight: 750; }
.stepper .unit { color: var(--ink-3); min-width: 36px; font-size: 14px; }
.faces { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.faces button { border: 1.5px solid var(--line); background: var(--card); border-radius: 16px; padding: 10px 0 8px; display: grid; gap: 4px; place-items: center; font-size: 26px; }
.faces button small { font-size: 11px; color: var(--ink-3); }
.faces button.sel { border-color: var(--blue-500); background: var(--blue-100); }
.progressbar { height: 6px; border-radius: 4px; background: var(--line); overflow: hidden; margin-bottom: 18px; }
.progressbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--blue-500), var(--indigo-500)); border-radius: 4px; transition: width .3s; }
.sticky-actions { position: sticky; bottom: 0; padding: 12px 0 calc(env(safe-area-inset-bottom) + 4px); background: linear-gradient(to top, var(--bg) 70%, transparent); display: flex; gap: 10px; margin-top: 8px; }
.sticky-actions .btn { flex: 1; }
.qcard { background: var(--card); border-radius: 18px; padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.qcard.err { outline: 2px solid var(--red-500); }
.qnum { display: inline-grid; place-items: center; min-width: 26px; height: 26px; border-radius: 9px; background: var(--blue-100); color: var(--blue-500); font-size: 13px; font-weight: 750; margin-right: 8px; }

/* ---------- sliders (EMA) ---------- */
.slider-card { background: var(--card); border-radius: 22px; padding: 20px 18px 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.slider-card h2 { font-size: 18px; font-weight: 700; line-height: 1.35; }
.slider-val { font-size: 46px; font-weight: 800; text-align: center; margin: 10px 0 0; font-variant-numeric: tabular-nums; color: var(--blue-500); transition: color .2s; }
.slider-val.untouched { color: var(--ink-3); }
input[type=range].vas { -webkit-appearance: none; appearance: none; width: 100%; height: 44px; background: transparent; margin: 6px 0 0; outline: none; touch-action: pan-y; }
input[type=range].vas::-webkit-slider-runnable-track { height: 12px; border-radius: 8px; background: linear-gradient(90deg, #58d3a6, #f6d365 50%, #ff7a59); }
input[type=range].vas::-moz-range-track { height: 12px; border-radius: 8px; background: linear-gradient(90deg, #58d3a6, #f6d365 50%, #ff7a59); }
input[type=range].vas::-webkit-slider-thumb { -webkit-appearance: none; width: 34px; height: 34px; border-radius: 50%; background: #fff; border: 4px solid var(--blue-500); margin-top: -11px; box-shadow: 0 4px 12px rgba(20, 40, 90, .35); }
input[type=range].vas::-moz-range-thumb { width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 4px solid var(--blue-500); box-shadow: 0 4px 12px rgba(20, 40, 90, .35); }
input[type=range].vas.untouched::-webkit-slider-thumb { border-color: var(--ink-3); }
input[type=range].vas.untouched::-moz-range-thumb { border-color: var(--ink-3); }
.slider-ends { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--ink-3); }

/* ---------- relax ---------- */
.ex-card { display: flex; gap: 14px; align-items: center; width: 100%; border: 0; text-align: left; background: var(--card); border-radius: 20px; padding: 14px; margin-bottom: 12px; box-shadow: var(--shadow); }
.ex-art { width: 62px; height: 62px; border-radius: 18px; flex: none; display: grid; place-items: center; color: #fff; }
.ex-art.a { background: linear-gradient(135deg, #5b8def, #7c5cf0); }
.ex-art.b { background: linear-gradient(135deg, #2bb6a3, #4f8df5); }
.ex-art.c { background: linear-gradient(135deg, #f59e6b, #e46aa5); }
.ex-art.m { background: linear-gradient(135deg, #38427d, #6a59c9); }
.ex-card b { display: block; font-size: 16.5px; }
.ex-card span { font-size: 13px; color: var(--ink-2); }
.breath-stage { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: #fff; padding: 30px 24px calc(env(safe-area-inset-bottom) + 30px); position: relative; overflow: hidden;
  background: radial-gradient(80% 60% at 50% 30%, rgba(90, 120, 230, .45), transparent 65%), linear-gradient(170deg, var(--navy-800), var(--navy-950)); }
.breath-top { position: absolute; top: calc(env(safe-area-inset-top) + 14px); left: 16px; right: 16px; display: flex; justify-content: space-between; }
.breath-top .iconbtn { background: rgba(255, 255, 255, .12); color: #fff; box-shadow: none; }
.orb-wrap { position: relative; width: min(250px, 62vw); height: min(250px, 62vw); display: grid; place-items: center; margin: 10px 0 18px; }
.orb { position: absolute; width: min(130px, 33vw); height: min(130px, 33vw); border-radius: 50%; background: radial-gradient(circle at 35% 30%, #cfe0ff, #6b93ff 55%, #3f5fe0); box-shadow: 0 0 60px 10px rgba(107, 147, 255, .55), inset 0 -10px 30px rgba(20, 30, 100, .5); transform: scale(1); }
.orb-ring { position: absolute; inset: 0; border-radius: 50%; border: 2px dashed rgba(255, 255, 255, .22); }
.orb-ring2 { position: absolute; inset: 22px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .14); }
.breath-phase { font-size: 30px; font-weight: 750; letter-spacing: .02em; min-height: 42px; }
.breath-count { font-size: 15px; color: rgba(255, 255, 255, .7); margin-top: 6px; min-height: 22px; }
.breath-time { font-variant-numeric: tabular-nums; color: rgba(255, 255, 255, .7); margin-top: 18px; }
.media-wrap { border-radius: 20px; overflow: hidden; background: #000; box-shadow: var(--shadow); }
.media-wrap video { width: 100%; display: block; max-height: 60vh; }
.media-wrap audio { width: 100%; display: block; background: var(--card); }
.audio-art { height: 190px; display: grid; place-items: center; color: #fff; background: linear-gradient(140deg, #38427d, #6a59c9); }

/* ---------- records / settings ---------- */
.day-group { margin-bottom: 16px; }
.day-head { font-weight: 750; font-size: 15px; margin: 0 4px 8px; display: flex; justify-content: space-between; }
.rec-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.rec-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--card); border-radius: 12px; padding: 8px 12px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow); }
.rec-chip svg { color: var(--blue-500); }
.rec-chip time { color: var(--ink-3); font-weight: 500; font-variant-numeric: tabular-nums; }
.empty { text-align: center; color: var(--ink-3); padding: 40px 10px; }
.row { display: flex; align-items: center; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.row:last-child { border-bottom: 0; }
.row .ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--blue-100); color: var(--blue-500); flex: none; }
.row .grow { flex: 1; min-width: 0; }
.row b { display: block; font-size: 15.5px; }
.row small { color: var(--ink-3); font-size: 13px; }
.status-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; background: var(--ink-3); }
.status-dot.ok { background: var(--mint-500); } .status-dot.bad { background: var(--red-500); } .status-dot.warn { background: var(--orange-500); }
.callout { background: var(--orange-100); color: var(--ink); border-radius: 14px; padding: 12px 14px; font-size: 14px; margin-top: 10px; }
ol.steps { margin: 8px 0 0; padding-left: 20px; font-size: 14px; color: var(--ink-2); }
ol.steps li { margin-bottom: 4px; }

/* ---------- modal / toast ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(8, 14, 34, .55); backdrop-filter: blur(3px); display: grid; align-items: end; justify-items: center; opacity: 0; transition: opacity .2s; padding: 16px; }
.overlay.show { opacity: 1; }
@media (min-height: 700px) and (min-width: 500px) { .overlay { align-items: center; } }
.modal { width: 100%; max-width: 420px; background: var(--card); border-radius: 26px; padding: 24px 22px 18px; box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .5); transform: translateY(20px); transition: transform .25s cubic-bezier(.2, .9, .3, 1.2); }
.overlay.show .modal { transform: none; }
.modal-title { font-size: 20px; font-weight: 750; margin-bottom: 8px; }
.modal-body { color: var(--ink-2); margin-bottom: 8px; }
.modal-actions { display: grid; gap: 8px; margin-top: 16px; }
.modal-actions .btn { width: 100%; }
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 24px); transform: translate(-50%, 20px); background: #101a38; color: #fff; padding: 11px 18px; border-radius: 14px; font-size: 14.5px; z-index: 60; opacity: 0; pointer-events: none; transition: all .25s; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- welcome / done ---------- */
.center-stage { min-height: 70dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 12px; padding: 20px 8px; }
.big-check { width: 88px; height: 88px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, var(--blue-500), var(--indigo-500)); color: #fff; box-shadow: 0 16px 36px -10px rgba(61, 109, 242, .7); animation: pop .5s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
.center-stage h2 { font-size: 24px; }
.dots { display: flex; gap: 6px; justify-content: center; margin: 8px 0 18px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.dots i.on { width: 24px; border-radius: 6px; background: var(--blue-500); }
.hotline { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.hotline:last-child { border-bottom: 0; }
.hotline .num { font-weight: 800; font-size: 19px; color: var(--blue-500); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* EMA: 9 compact sliders */
.ema-item { padding: 12px 0 4px; border-bottom: 1px solid var(--line); }
.ema-item:last-child { border-bottom: 0; }
.ema-head { display: flex; align-items: baseline; justify-content: space-between; }
.ema-head b { font-size: 17px; }
.ema-val { font-size: 24px; font-weight: 800; color: var(--blue-500); font-variant-numeric: tabular-nums; min-width: 44px; text-align: right; }
.ema-val.untouched { color: var(--ink-3); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1.5px solid var(--line); background: var(--card); border-radius: 999px; padding: 10px 16px; font-weight: 650; }
.chip.sel { background: var(--blue-500); border-color: var(--blue-500); color: #fff; }

/* ---- Today header follows the time of day ---- */
.hero { --hero-fg: #fff; --hero-soft: rgba(255,255,255,.72); --hero-block: rgba(255,255,255,.08); --hero-block-b: rgba(255,255,255,.12); --hero-seg: rgba(255,255,255,.18); color: var(--hero-fg); transition: background .6s; }
.hero-date, .hero-block h4, .plan small, .plan-note { color: var(--hero-soft); }
.hero-block { background: var(--hero-block); border-color: var(--hero-block-b); }
.plan div { background: var(--hero-block); }
.seg7 i { background: var(--hero-seg); }
.plan b { display: block; font-size: 15px; line-height: 1.5; }
.hero.sky-dawn { background: radial-gradient(120% 90% at 100% 0%, rgba(255,248,200,.85), transparent 55%), linear-gradient(160deg, #ffa24d, #ff7a2e 55%, #f2652a); box-shadow: 0 18px 40px -16px rgba(242,101,42,.6); }
.hero.sky-day { background: radial-gradient(120% 90% at 100% 0%, rgba(255,255,255,.7), transparent 55%), linear-gradient(160deg, #57b4ff, #2f86e8 60%, #2c6fd6); box-shadow: 0 18px 40px -16px rgba(44,111,214,.6); }
.hero.sky-dusk { background: radial-gradient(120% 90% at 100% 0%, rgba(255,190,120,.6), transparent 55%), linear-gradient(160deg, #ff8a5c, #b65a9a 55%, #5b4b9c); box-shadow: 0 18px 40px -16px rgba(120,70,150,.6); }
.hero.sky-dawn, .hero.sky-day, .hero.sky-dusk { --hero-soft: rgba(255,255,255,.9); --hero-block: rgba(255,255,255,.22); --hero-block-b: rgba(255,255,255,.35); --hero-seg: rgba(255,255,255,.35); }
.hero.sky-dawn .hero-greet, .hero.sky-day .hero-greet, .hero.sky-dusk .hero-greet { text-shadow: 0 1px 8px rgba(0,0,0,.18); }

/* ---- 24-hour time picker ---- */
.time24 { display: flex; align-items: center; justify-content: center; gap: 8px; }
.time24 .colon { font-size: 26px; font-weight: 800; color: var(--ink-2); }
.sel24 { font: inherit; font-size: 26px; font-weight: 750; font-variant-numeric: tabular-nums; text-align: center; text-align-last: center; min-width: 92px; padding: 10px 6px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); appearance: none; -webkit-appearance: none; }
.sel24:focus { outline: none; border-color: var(--blue-500); box-shadow: 0 0 0 4px rgba(61, 109, 242, .15); }

/* ---- illustrated iPhone guide ---- */
.guide-step { background: var(--card); border-radius: 20px; box-shadow: var(--shadow); padding: 14px 14px 12px; margin-bottom: 14px; }
.guide-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 16px; }
.guide-n { width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--blue-500); color: #fff; font-weight: 800; font-size: 14px; }
.guide-pic svg { width: 100%; height: auto; display: block; border-radius: 14px; background: linear-gradient(180deg, #e9edf8, #dfe4f2); }
.guide h3 { font-size: 18px; color: var(--ink); text-transform: none; letter-spacing: 0; }
.end-actions { display: flex; gap: 10px; margin: 22px 0 6px; }
.end-actions .btn { flex: 1; }

/* ---- relax page icons ---- */
.ex-icon { width: 64px; height: 64px; border-radius: 18px; flex: none; display: block; box-shadow: 0 2px 8px rgba(20, 40, 90, .12); }
a.btn { text-decoration: none; }

.pw-toggle { justify-self: start; background: none; border: 0; padding: 4px 2px; color: rgba(255,255,255,.85); font-weight: 650; font-size: 14px; text-decoration: underline; }
.pw-toggle.dark { color: var(--blue-500); }
