/* ─────────────────────────────────────────────────────────────────────────
   kyma-pulse — "DEEP-TIDE INSTRUMENT" design system
   κῦμα (wave) + pulse. A calm, luminous oscilloscope for a personal life-
   instrument. Deep tide background, layered translucent surfaces, a living
   pulse waveform as the signature motif. TDAH-calm: subtle motion only.

   Type:  Fraunces (serif identity) · Hanken Grotesk (UI) · JetBrains Mono (data)
   Mobile-first. No framework, no build.
   ───────────────────────────────────────────────────────────────────────── */

:root {
  /* ── the deep tide — looking into dark water ──────────────────────────── */
  --tide-0:    #04110f;   /* abyss (page base) */
  --tide-1:    #07191a;   /* near-black teal */
  --tide-glow: #0d3a3a;   /* the luminous top glow */

  /* layered translucent surfaces (over the tide, with blur) */
  --surface-1: rgba(20, 42, 44, 0.46);
  --surface-2: rgba(30, 58, 60, 0.40);
  --surface-3: rgba(44, 78, 80, 0.46);
  --line:      rgba(120, 220, 210, 0.13);
  --line-soft: rgba(120, 220, 210, 0.08);
  --glass:     rgba(8, 26, 26, 0.62);   /* solid-ish glass (dock/topbar) */

  /* ink */
  --ink:       #e3f1ee;
  --ink-soft:  #93b3ae;
  --ink-faint: #5d817c;

  /* the luminous signal aqua + a warm amber for MIT/streak only */
  --accent:      #5eead4;   /* aqua */
  --signal:      #7df9e4;   /* brighter "signal" aqua (the live pulse) */
  --accent-deep: #2dd4bf;
  --accent-ink:  #03201c;   /* ink on accent */
  --accent-glow: rgba(94, 234, 212, 0.55);
  --warm:        #fbbf24;   /* MIT / streak fire — used SPARINGLY */
  --warm-soft:   rgba(251, 191, 36, 0.14);
  --warm-line:   rgba(251, 191, 36, 0.40);
  --good:        #6ee7a8;
  --danger:      #f87171;

  /* shape & motion */
  --r-sm: 12px;
  --r:    18px;
  --r-lg: 26px;
  --gap:  16px;
  --pad:  20px;
  --tap:  52px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --dock-h: 78px;

  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  color: var(--ink);
  font-family: "Hanken Grotesk", sans-serif;
  font-size: 17px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

/* The deep tide: a near-black teal field with atmospheric depth — a glow
   blooming from the top, a faint vignette at the edges, like dark water. */
body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  background:
    radial-gradient(120% 80% at 50% -10%, var(--tide-glow) 0%, transparent 55%),
    radial-gradient(160% 120% at 50% 120%, #06201d 0%, transparent 60%),
    linear-gradient(180deg, var(--tide-1) 0%, var(--tide-0) 100%);
  background-attachment: fixed;
  position: relative;
}
/* faint vignette */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(130% 100% at 50% 40%, transparent 60%, rgba(0,0,0,.45) 100%);
}

button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input  { font: inherit; }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* mono = the instrument readout */
.mono, .timer__time, .modal__num, .bar-row__val, .macro__v, .stat-big,
.daychip__n, .axis__streak-n, .pillseg {
  font-family: "JetBrains Mono", monospace;
  font-variant-numeric: tabular-nums;
}

/* focus visibility for keyboard users */
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; border-radius: 6px; }

/* ── Top bar — the heartbeat ───────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  padding-top: var(--safe-top);
  background: linear-gradient(180deg, var(--glass) 62%, transparent);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
}
.topbar__inner { padding: 16px var(--pad) 6px; }
.topbar__row { display: flex; align-items: center; gap: 12px; }
.topbar__title {
  font-family: "Fraunces", serif;
  font-optical-sizing: auto;
  font-size: 1.9rem; font-weight: 600; letter-spacing: -0.015em; line-height: 1;
  display: flex; align-items: baseline; gap: 4px;
}
.topbar__title .dot {
  width: 8px; height: 8px; border-radius: 50%; align-self: center; margin-left: 2px;
  background: var(--signal); box-shadow: 0 0 12px 1px var(--accent-glow);
  animation: beat 2.6s var(--ease) infinite;
}
@keyframes beat {
  0%, 100% { opacity: .5; transform: scale(.8); }
  50%      { opacity: 1;  transform: scale(1.15); }
}
.topbar__day {
  margin-left: auto; display: flex; align-items: baseline; gap: 5px;
  padding: 5px 11px; border-radius: 999px;
  background: var(--surface-1); border: 1px solid var(--line);
  font-size: .72rem; color: var(--ink-soft); white-space: nowrap;
}
.topbar__day .daychip__n {
  font-size: .95rem; font-weight: 700; color: var(--signal);
}
.topbar__sub {
  color: var(--ink-faint); font-size: .76rem; margin-top: 4px;
  font-family: "JetBrains Mono", monospace; letter-spacing: .01em;
}

/* the travelling pulse along the baseline */
.pulsebar { height: 26px; margin: 2px 0 -4px; position: relative; overflow: hidden; }
.pulsebar__svg { width: 100%; height: 100%; display: block; }
.pulsebar__svg use { fill: none; vector-effect: non-scaling-stroke; }
.pulsebar__ghost { stroke: var(--line); stroke-width: 1.25; }
.pulsebar__live {
  stroke: url(#signalGrad); stroke-width: 1.8;
  stroke-dasharray: 70 600;
  filter: drop-shadow(0 0 4px var(--accent-glow));
  animation: sweep 5.5s linear infinite;
}
@keyframes sweep { from { stroke-dashoffset: 670; } to { stroke-dashoffset: 0; } }

/* ── Views ────────────────────────────────────────────────────────────── */
.views { flex: 1; position: relative; z-index: 1; }
.view { display: none; animation: fade .3s var(--ease); }
.view.is-active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

.view__body {
  padding: 4px var(--pad);
  padding-bottom: calc(var(--dock-h) + var(--safe-bottom) + 34px);
  max-width: 640px; margin: 0 auto;
}

/* ── Section heading — serif sub-hero ─────────────────────────────────── */
.section-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  margin: 26px 2px 12px;
}
.section-head h2 {
  font-family: "Fraunces", serif; font-optical-sizing: auto;
  font-size: 1.18rem; font-weight: 600; letter-spacing: -0.01em; color: var(--ink);
}
.section-head .count {
  color: var(--ink-faint); font-size: .78rem;
  font-family: "JetBrains Mono", monospace; white-space: nowrap;
}

/* one calm global line (Habits, gate) */
.lede {
  color: var(--ink-soft); font-size: .85rem; line-height: 1.4;
  margin: 2px 2px 18px; display: flex; align-items: center; gap: 8px;
}
.lede svg { width: 16px; height: 16px; color: var(--accent); flex: none; }
.lede b { color: var(--ink); font-weight: 600; }

/* ── Schedule segmented control (today / tmr / later) ─────────────────── */
.segbar {
  display: inline-flex; padding: 4px; gap: 3px; margin: 2px 0 6px;
  background: var(--surface-1); border: 1px solid var(--line);
  border-radius: 999px; backdrop-filter: blur(8px);
}
.seg {
  position: relative; padding: 8px 16px; border-radius: 999px;
  font-size: .82rem; font-weight: 600; color: var(--ink-soft);
  transition: color .2s var(--ease);
}
.seg.is-on { color: var(--accent-ink); }
.seg.is-on::before {
  content: ""; position: absolute; inset: 0; border-radius: 999px; z-index: -1;
  background: linear-gradient(135deg, var(--signal), var(--accent-deep));
  box-shadow: 0 0 16px var(--accent-glow);
}
.seg:active { transform: scale(.96); }
.seg .seg__c {
  font-family: "JetBrains Mono", monospace; font-size: .72rem;
  opacity: .7; margin-left: 4px;
}

/* ── Card (generic) ───────────────────────────────────────────────────── */
.card, .task, .stat-card {
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r);
  backdrop-filter: blur(10px) saturate(1.1);
  -webkit-backdrop-filter: blur(10px) saturate(1.1);
  box-shadow: 0 1px 0 0 rgba(255,255,255,.025) inset, 0 8px 24px -16px rgba(0,0,0,.7);
}

/* ── Task card ────────────────────────────────────────────────────────── */
.task {
  padding: 15px 16px 13px;
  margin-bottom: 12px;
  position: relative; overflow: hidden;
  transition: opacity .3s var(--ease), border-color .25s var(--ease), transform .15s var(--ease);
}
/* MIT: warm hairline + faint amber wash + a small warm tick on the left edge */
.task.is-mit {
  border-color: var(--warm-line);
  background:
    linear-gradient(180deg, var(--warm-soft), transparent 60%),
    var(--surface-1);
}
.task.is-mit::before {
  content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--warm), transparent);
  box-shadow: 0 0 10px var(--warm);
}
.task.is-done { opacity: .46; }
.task.is-done .task__title { text-decoration: line-through; color: var(--ink-soft); }
/* soft gate: dimmed + de-saturated, legible, encouraging (not punitive) */
.task.is-gated { opacity: .5; filter: saturate(.5); }
.task.is-gated .task__main, .task.is-gated .task__play { pointer-events: none; }

.task__top { display: flex; align-items: flex-start; gap: 12px; }

.task__check {
  width: 28px; height: 28px; flex: none; margin-top: 2px;
  border-radius: 9px; border: 1.5px solid var(--line);
  background: var(--surface-2);
  display: grid; place-items: center;
  transition: background .2s var(--ease), border-color .2s var(--ease), box-shadow .2s;
}
.task__check svg { width: 15px; height: 15px; stroke-width: 3; opacity: 0; transform: scale(.5);
  transition: opacity .2s, transform .2s var(--ease); }
.task.is-done .task__check {
  background: linear-gradient(135deg, var(--signal), var(--accent-deep));
  border-color: var(--accent); color: var(--accent-ink);
  box-shadow: 0 0 14px var(--accent-glow);
}
.task.is-done .task__check svg { opacity: 1; transform: none; }

.task__main { flex: 1; min-width: 0; }
.task__title { font-weight: 600; font-size: 1.04rem; word-break: break-word; letter-spacing: -0.005em; }

.task__meta { display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  margin-top: 7px; color: var(--ink-soft); font-size: .8rem; }
.task__meta .stat { display: inline-flex; align-items: center; gap: 4px;
  font-family: "JetBrains Mono", monospace; font-size: .74rem; }
.task__meta .stat svg { width: 13px; height: 13px; opacity: .7; }
.tag {
  font-size: .64rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em;
  padding: 3px 9px; border-radius: 999px;
}
.tag--mit { background: var(--warm-soft); color: var(--warm); border: 1px solid var(--warm-line); }
.tag--gated {
  background: transparent; color: var(--ink-faint); border: 1px solid var(--line-soft);
  text-transform: none; letter-spacing: 0; font-weight: 500; font-size: .72rem;
}

/* schedule micro-control on each task */
.task__sched {
  margin-left: 4px; display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px; border-radius: 999px; font-size: .72rem; font-weight: 600;
  color: var(--ink-soft); background: var(--surface-2); border: 1px solid var(--line-soft);
  transition: color .15s, border-color .15s;
}
.task__sched svg { width: 12px; height: 12px; opacity: .8; }
.task__sched:active { transform: scale(.95); }

.task__play {
  width: 46px; height: 46px; flex: none; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--line);
  display: grid; place-items: center; color: var(--accent);
  transition: transform .12s var(--ease), background .2s, box-shadow .2s;
}
.task__play:active { transform: scale(.9); }
.task__play svg { width: 19px; height: 19px; }

/* progress bar — a glowing signal line */
.progress { height: 5px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-top: 12px; }
.progress > i { display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-deep), var(--signal));
  box-shadow: 0 0 10px var(--accent-glow);
  transition: width .5s var(--ease); }

/* running-timer strip inside a task */
.timers { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.timer {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface-2); border-radius: var(--r-sm); padding: 11px 13px;
  border: 1px solid var(--line);
}
.timer.is-over { border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-glow) inset, 0 0 18px -6px var(--accent-glow); }
.timer__time { font-weight: 700; font-size: 1.24rem; letter-spacing: .02em; min-width: 78px; color: var(--ink); }
.timer.is-over .timer__time { color: var(--signal); }
.timer__target { color: var(--ink-faint); font-size: .74rem; flex: 1; line-height: 1.3; }
.timer.is-over .timer__target { color: var(--accent); }
.timer__btns { display: flex; gap: 8px; }
.timer__btn {
  height: 38px; padding: 0 15px; border-radius: 999px; font-size: .82rem; font-weight: 600;
  background: var(--surface-3); color: var(--ink); border: 1px solid var(--line-soft);
}
.timer__btn--accent {
  background: linear-gradient(135deg, var(--signal), var(--accent-deep));
  color: var(--accent-ink); border-color: transparent;
}
.timer__btn:active { transform: scale(.94); }

/* gate banner — encouraging, not punitive */
.gate-note {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--surface-1); backdrop-filter: blur(8px);
  border: 1px solid var(--warm-line);
  border-radius: var(--r); padding: 13px 16px; margin: 2px 0 16px;
  color: var(--ink-soft); font-size: .86rem; line-height: 1.4;
}
.gate-note .ico { color: var(--warm); flex: none; display: grid; }
.gate-note .ico svg { width: 18px; height: 18px; }
.gate-note strong { color: var(--warm); font-weight: 700; }
.gate-note .link {
  margin-left: auto; color: var(--accent); font-size: .82rem; font-weight: 600;
  text-decoration: underline; text-underline-offset: 3px;
}
.gate-note .link:active { color: var(--signal); }

/* ── Add-task / inline input row ──────────────────────────────────────── */
.add-row { display: flex; gap: 10px; margin-top: 8px; }
.add-row input[type="text"] {
  flex: 1; height: var(--tap); border-radius: var(--r);
  background: var(--surface-1); border: 1px solid var(--line);
  color: var(--ink); padding: 0 18px; outline: none; backdrop-filter: blur(8px);
  transition: border-color .2s, box-shadow .2s;
}
.add-row input::placeholder { color: var(--ink-faint); }
.add-row input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.add-row button {
  width: var(--tap); height: var(--tap); flex: none; border-radius: var(--r);
  background: linear-gradient(135deg, var(--signal), var(--accent-deep));
  color: var(--accent-ink); display: grid; place-items: center;
  box-shadow: 0 0 18px -6px var(--accent-glow);
}
.add-row button svg { width: 22px; height: 22px; stroke-width: 2.6; }
.add-row button:active { transform: scale(.93); }
.add-row .mit-toggle {
  width: var(--tap); height: var(--tap); flex: none; border-radius: var(--r);
  background: var(--surface-1); border: 1px solid var(--line); color: var(--ink-faint);
  display: grid; place-items: center; font-size: 1.2rem; backdrop-filter: blur(8px);
  transition: color .2s, background .2s, border-color .2s;
}
.add-row .mit-toggle.is-on {
  background: var(--warm-soft); color: var(--warm); border-color: var(--warm-line);
}

/* ── Mood strip ───────────────────────────────────────────────────────── */
.mood { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.mood__faces { display: flex; gap: 8px; flex: 1; }
.mood__face {
  flex: 1; height: var(--tap); border-radius: var(--r);
  background: var(--surface-1); border: 1px solid var(--line);
  font-size: 1.4rem; display: grid; place-items: center; backdrop-filter: blur(8px);
  transition: transform .12s var(--ease), background .2s, box-shadow .2s;
}
.mood__face:active { transform: scale(.9); }
.mood__face.is-picked {
  background: var(--surface-3); border-color: var(--accent);
  box-shadow: 0 0 16px -4px var(--accent-glow); transform: scale(1.06);
}

/* ── Habits / Axis ────────────────────────────────────────────────────── */
.axis {
  margin-bottom: var(--gap); padding: 14px 14px 12px;
  background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r);
  backdrop-filter: blur(10px);
  box-shadow: 0 1px 0 0 rgba(255,255,255,.025) inset, 0 8px 24px -18px rgba(0,0,0,.7);
}
.axis__head { display: flex; align-items: center; gap: 9px; margin: 0 2px 12px; }
.axis__name { font-family: "Fraunces", serif; font-optical-sizing: auto;
  font-weight: 600; font-size: 1.18rem; letter-spacing: -0.01em; }
.axis__cat { color: var(--ink-faint); font-size: .68rem; text-transform: uppercase; letter-spacing: .1em;
  font-family: "JetBrains Mono", monospace; }

/* streak shown as a tiny waveform sparkline + count */
.axis__streak {
  margin-left: auto; display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 11px 5px 9px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line-soft);
}
.axis__streak.is-warm { background: var(--warm-soft); border-color: var(--warm-line); }
.axis__streak.is-zero { opacity: .6; }
.axis__streak-wave { width: 34px; height: 16px; display: block; color: var(--ink-faint); }
.axis__streak.is-warm .axis__streak-wave { color: var(--warm); }
.axis__streak-wave path { fill: none; stroke: currentColor; stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.axis__streak-n { font-size: .9rem; font-weight: 700; color: var(--ink-soft); }
.axis__streak.is-warm .axis__streak-n { color: var(--warm); }
.axis__logged {
  width: 8px; height: 8px; border-radius: 50%; background: var(--surface-3); flex: none;
  transition: background .2s, box-shadow .2s;
}
.axis__logged.is-on { background: var(--signal); box-shadow: 0 0 9px var(--accent-glow); }

.actions { display: flex; flex-direction: column; gap: 8px; }
.action-btn {
  display: flex; align-items: center; gap: 12px;
  min-height: var(--tap); position: relative;
  background: var(--surface-2); border: 1px solid var(--line-soft);
  border-radius: var(--r-sm); padding: 10px 15px 10px 17px;
  transition: transform .12s var(--ease), border-color .2s, background .2s;
  text-align: left;
}
.action-btn:active { transform: scale(.99); background: var(--surface-3); }
/* the "waterline / floor" marker — a quiet aqua tick on the FIRST (easiest) only */
.action-btn.is-easiest {
  border-color: color-mix(in srgb, var(--accent) 28%, var(--line));
}
.action-btn.is-easiest::before {
  content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px;
  border-radius: 0 3px 3px 0; background: linear-gradient(180deg, var(--signal), var(--accent-deep));
  box-shadow: 0 0 8px var(--accent-glow);
}
.action-btn__name { flex: 1; font-weight: 600; font-size: 1rem; }
/* quiet measure glyph instead of jargon labels */
.action-btn__glyph { color: var(--ink-faint); display: grid; place-items: center; flex: none; }
.action-btn__glyph svg { width: 18px; height: 18px; }
.action-btn__glyph .x { font-family: "JetBrains Mono", monospace; font-size: .82rem; font-weight: 700; }
.action-btn__go { color: var(--accent); display: grid; flex: none; }
.action-btn__go svg { width: 20px; height: 20px; }
.action-btn.is-macros { opacity: .55; }
.action-btn.is-macros .action-btn__go { color: var(--ink-faint); }
.action-btn.is-easiest.is-macros::before { display: none; }

/* ── Stats — the kyma scorecard ───────────────────────────────────────── */
/* hero: Day N · kyma name with a waveform underline */
.stat-hero {
  margin: 12px 2px 22px; padding-bottom: 14px; border-bottom: 1px solid var(--line-soft);
  position: relative;
}
.stat-hero__day {
  font-family: "JetBrains Mono", monospace; font-size: .76rem;
  color: var(--accent); letter-spacing: .04em; text-transform: uppercase;
}
.stat-hero__name {
  font-family: "Fraunces", serif; font-optical-sizing: auto;
  font-size: 1.95rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.05;
  margin-top: 4px;
}
.stat-hero__wave { width: 100%; height: 22px; margin-top: 8px; display: block; color: var(--accent); opacity: .55; }
.stat-hero__wave path { fill: none; stroke: currentColor; stroke-width: 1.5; vector-effect: non-scaling-stroke; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.stat-card { padding: 17px; }
.stat-card.wide { grid-column: 1 / -1; }
.stat-card__label {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .12em;
  color: var(--ink-soft); margin-bottom: 12px; font-weight: 600;
}
.stat-big { font-size: 2.1rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1; }
.stat-big .sub { font-size: .95rem; color: var(--ink-faint); font-weight: 500; }
.stat-card__ring {
  --p: 0;
  width: 62px; height: 62px; border-radius: 50%; float: right;
  background: conic-gradient(var(--signal) calc(var(--p) * 1%), var(--surface-3) 0);
  display: grid; place-items: center; margin: -2px 0 0 8px;
  box-shadow: 0 0 16px -6px var(--accent-glow);
}
.stat-card__ring::after {
  content: ""; width: 48px; height: 48px; border-radius: 50%; background: var(--tide-1);
}
.stat-card__sub { color: var(--ink-faint); font-size: .76rem; margin-top: 6px;
  font-family: "JetBrains Mono", monospace; }

.bar-row { display: flex; align-items: center; gap: 10px; margin: 9px 0; }
.bar-row__name { width: 86px; font-size: .85rem; color: var(--ink-soft); flex: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row__track { flex: 1; height: 9px; background: var(--surface-2); border-radius: 999px; overflow: hidden;
  border: 1px solid var(--line-soft); }
.bar-row__track > i { display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-deep), var(--signal));
  box-shadow: 0 0 10px var(--accent-glow); transition: width .5s var(--ease); }
.bar-row__val { width: 50px; text-align: right; font-size: .8rem; color: var(--ink-soft); flex: none; }

/* mood "tide" — a smooth filled waveform */
.tide { width: 100%; height: 72px; display: block; margin-top: 2px; }
.tide__fill { fill: url(#signalGrad); opacity: .16; }
.tide__line { fill: none; stroke: var(--signal); stroke-width: 2;
  filter: drop-shadow(0 0 5px var(--accent-glow)); vector-effect: non-scaling-stroke; }
.tide__dot { fill: var(--signal); }
.tide-empty { color: var(--ink-faint); font-size: .82rem; padding: 14px 0 4px; text-align: center; }

/* streak waveforms list */
.streak-waves { display: flex; flex-direction: column; gap: 11px; }
.streak-wave-row { display: flex; align-items: center; gap: 12px; }
.streak-wave-row__name { width: 78px; font-size: .85rem; color: var(--ink-soft); flex: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.streak-wave-row__wave { flex: 1; height: 22px; display: block; color: var(--ink-faint); }
.streak-wave-row.is-warm .streak-wave-row__wave { color: var(--warm); }
.streak-wave-row__wave path { fill: none; stroke: currentColor; stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.streak-wave-row__n { font-family: "JetBrains Mono", monospace; font-weight: 700; font-size: .9rem;
  width: 28px; text-align: right; color: var(--ink-soft); flex: none; }
.streak-wave-row.is-warm .streak-wave-row__n { color: var(--warm); }

.macros { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 14px; }
.macro { min-width: 0; }
.macro__v { font-size: 1.4rem; font-weight: 700; }
.macro__v .u { font-size: .82rem; color: var(--ink-faint); font-weight: 500; }
.macro__k { font-size: .66rem; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .08em;
  font-family: "JetBrains Mono", monospace; margin-top: 2px; }

/* ── Empty / first-run states (waveform language) ─────────────────────── */
.empty {
  text-align: center; color: var(--ink-soft); padding: 30px 22px 36px;
  background: var(--surface-1); border: 1px solid var(--line-soft); border-radius: var(--r);
  backdrop-filter: blur(8px); margin: 6px 0 4px;
}
.empty__wave { width: 168px; height: 46px; margin: 0 auto 16px; display: block; color: var(--accent); opacity: .85; }
/* the full calm wave is always drawn; a brighter "signal" packet sweeps across it */
.empty__wave .base { fill: none; stroke: currentColor; stroke-width: 1.5; opacity: .4; vector-effect: non-scaling-stroke; }
.empty__wave .live { fill: none; stroke: var(--signal); stroke-width: 1.8; vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 4px var(--accent-glow));
  stroke-dasharray: 26 360; animation: emptyDraw 4.5s linear infinite; }
@keyframes emptyDraw { from { stroke-dashoffset: 386; } to { stroke-dashoffset: 0; } }
.empty__title { font-family: "Fraunces", serif; font-size: 1.1rem; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.empty__sub { font-size: .85rem; color: var(--ink-faint); line-height: 1.4; }

.banner-offline {
  display: flex; gap: 10px; align-items: center;
  background: color-mix(in srgb, var(--danger) 12%, var(--surface-1));
  border: 1px solid color-mix(in srgb, var(--danger) 30%, var(--line));
  color: var(--ink-soft); border-radius: var(--r); padding: 12px 16px; margin-bottom: 16px;
  font-size: .85rem; backdrop-filter: blur(8px);
}
.banner-offline svg { width: 18px; height: 18px; color: var(--danger); flex: none; }

/* ── Loading state — a pulse sweep, not a plain skeleton ──────────────── */
.pulse-load {
  background: var(--surface-1); border: 1px solid var(--line-soft); border-radius: var(--r);
  height: 80px; margin-bottom: 12px; position: relative; overflow: hidden;
  display: grid; place-items: center;
}
.pulse-load svg { width: 86%; height: 30px; color: var(--accent); opacity: .35; }
.pulse-load svg path { fill: none; stroke: currentColor; stroke-width: 1.6; vector-effect: non-scaling-stroke;
  stroke-dasharray: 50 600; animation: sweep 2.4s linear infinite; }

/* ── Bottom dock ──────────────────────────────────────────────────────── */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--dock-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: flex;
  background: linear-gradient(180deg, transparent, var(--glass) 40%);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border-top: 1px solid var(--line);
}
.dock__tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; color: var(--ink-faint); font-size: .66rem; font-weight: 600;
  letter-spacing: .02em; padding-top: 6px; position: relative;
  transition: color .25s var(--ease);
}
.dock__tab svg { width: 25px; height: 25px; transition: filter .25s; }
.dock__tab.is-active { color: var(--accent); }
.dock__tab.is-active svg { filter: drop-shadow(0 0 6px var(--accent-glow)); }
.dock__tab.is-active::before {
  content: ""; position: absolute; top: 0; width: 26px; height: 3px; border-radius: 999px;
  background: var(--signal); box-shadow: 0 0 12px var(--accent-glow);
}
.dock__tab:active { transform: scale(.94); }

/* faint kyma horizon behind the dock */
.horizon {
  position: fixed; left: 0; right: 0; z-index: 29; pointer-events: none;
  bottom: calc(var(--dock-h) + var(--safe-bottom) - 8px); height: 60px;
  opacity: .5; mask-image: linear-gradient(180deg, transparent, #000);
}
.horizon svg { width: 100%; height: 100%; display: block; }
.horizon path { fill: none; stroke: var(--accent); stroke-width: 1; opacity: .35; }

/* ── Toast ────────────────────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%) translateY(20px);
  bottom: calc(var(--dock-h) + var(--safe-bottom) + 18px); z-index: 50;
  background: var(--glass); color: var(--ink);
  border: 1px solid var(--line); border-radius: 999px; backdrop-filter: blur(14px);
  padding: 11px 20px; font-size: .88rem; font-weight: 500;
  box-shadow: 0 12px 34px rgba(0,0,0,.5);
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s var(--ease);
  max-width: 88vw; text-align: center;
}
.toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.is-good { border-color: var(--accent); box-shadow: 0 12px 34px rgba(0,0,0,.5), 0 0 20px -8px var(--accent-glow); }

/* ── Modal (prompts) ──────────────────────────────────────────────────── */
.modal-host[hidden] { display: none; }
.modal-host {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: end center;
  background: rgba(2, 12, 11, .62); backdrop-filter: blur(4px);
  animation: fade .2s var(--ease);
}
.modal {
  width: 100%; max-width: 520px;
  background: linear-gradient(180deg, var(--surface-2), var(--glass));
  border: 1px solid var(--line); border-bottom: 0;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  backdrop-filter: blur(20px) saturate(1.2);
  padding: 22px var(--pad);
  padding-bottom: calc(24px + var(--safe-bottom));
  box-shadow: 0 -16px 40px -12px rgba(0,0,0,.6);
  animation: slideup .3s var(--ease);
}
@keyframes slideup { from { transform: translateY(100%); } to { transform: none; } }
.modal__handle { width: 40px; height: 4px; border-radius: 999px; background: var(--line);
  margin: -6px auto 18px; }
.modal__title { font-family: "Fraunces", serif; font-optical-sizing: auto;
  font-size: 1.3rem; font-weight: 600; margin-bottom: 4px; letter-spacing: -0.01em; }
.modal__sub { color: var(--ink-soft); font-size: .85rem; margin-bottom: 18px; }

.chips { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.chip {
  min-width: 56px; min-height: var(--tap); padding: 0 18px;
  border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line);
  font-weight: 600; display: grid; place-items: center; font-size: 1rem;
  font-family: "JetBrains Mono", monospace;
  transition: transform .1s var(--ease), background .15s, border-color .15s;
}
.chip:active { transform: scale(.94); }
.chip.is-sel { background: linear-gradient(135deg, var(--signal), var(--accent-deep));
  color: var(--accent-ink); border-color: transparent; }
.chip--wide { flex: 1; font-family: "Hanken Grotesk", sans-serif; }

.modal__num {
  width: 100%; height: 60px; border-radius: var(--r);
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink);
  font-size: 1.7rem; font-weight: 700; text-align: center; outline: none;
  margin-bottom: 18px;
}
.modal__num:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

.modal__actions { display: flex; gap: 12px; }
.btn {
  flex: 1; height: var(--tap); border-radius: var(--r); font-weight: 700; font-size: 1rem;
  display: grid; place-items: center; transition: transform .1s var(--ease);
}
.btn:active { transform: scale(.97); }
.btn--ghost { background: var(--surface-2); color: var(--ink-soft); border: 1px solid var(--line-soft); }
.btn--accent { background: linear-gradient(135deg, var(--signal), var(--accent-deep)); color: var(--accent-ink);
  box-shadow: 0 0 20px -6px var(--accent-glow); }

.stars { display: flex; gap: 6px; justify-content: center; margin-bottom: 20px; }
.star { font-size: 2.1rem; color: var(--ink-faint); transition: transform .1s var(--ease), color .15s, text-shadow .15s; }
.star.is-on { color: var(--warm); text-shadow: 0 0 14px rgba(251,191,36,.5); }
.star:active { transform: scale(1.2); }

/* schedule picker rows in modal */
.sched-opts { display: flex; flex-direction: column; gap: 10px; margin-bottom: 6px; }
.sched-opt {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line);
  text-align: left; transition: border-color .15s, background .15s;
}
.sched-opt svg { width: 20px; height: 20px; color: var(--accent); flex: none; }
.sched-opt.is-current { border-color: var(--accent); background: var(--surface-3); }
.sched-opt__main { flex: 1; }
.sched-opt__name { font-weight: 600; }
.sched-opt__hint { font-size: .76rem; color: var(--ink-faint); }
.sched-opt:active { transform: scale(.99); }

@media (min-width: 560px) {
  .modal-host { place-items: center; }
  .modal { border-radius: var(--r-lg); border-bottom: 1px solid var(--line); margin: 0 16px; }
}

/* respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; }
  .pulsebar__live { stroke-dasharray: none; stroke-dashoffset: 0; }
  .empty__wave .live { stroke-dasharray: none; stroke-dashoffset: 0; }
}
