/* ============================================================
   Nafas — نَفَس
   A calm, bilingual design system. Mobile-first, RTL-native.
   ============================================================ */

/* ---------- tokens ---------- */

:root {
  /* goal palette — cool tones calm, warm tones energize */
  --calm:   #63a29a;
  --focus:  #7e91c6;
  --sleep:  #8a7eb5;
  --energy: #d2924f;
  --sos:    #c97a5f;

  /* neutrals (light) */
  --bg:       #f6f4ee;
  --surface:  #fffdf9;
  --surface2: #efece3;
  --ink:      #26393b;
  --muted:    #5f706d; /* ≥4.5:1 on --bg for small text */
  --line:     rgba(38, 57, 59, 0.10);
  --shadow:   0 10px 30px rgba(38, 57, 59, 0.08);
  --overlay:  rgba(246, 244, 238, 0.82);

  --radius:    22px;
  --radius-sm: 14px;

  --font-body: "Avenir Next", "SF Pro Text", -apple-system, BlinkMacSystemFont,
               "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans Arabic", sans-serif;
  --font-display: "New York", ui-serif, Georgia, "Times New Roman",
                  "Noto Naskh Arabic", serif;

  /* default goal context */
  --gc: var(--calm);
  --gc-soft: color-mix(in oklab, var(--gc) 14%, var(--bg));
  /* readable accent text on light surfaces (flips light in dark theme via --ink) */
  --gc-strong: color-mix(in oklab, var(--gc) 55%, var(--ink));
  /* fill deep enough for white text (≥4.5:1) in BOTH themes — anchored to a
     constant dark ink, not the theme ink */
  --gc-deep: color-mix(in oklab, var(--gc) 52%, #1c2e30);
}

[data-theme="dark"] {
  --bg:       #10181b;
  --surface:  #182226;
  --surface2: #1f2b2f;
  --ink:      #e5edeb;
  --muted:    #8fa3a0;
  --line:     rgba(229, 237, 235, 0.09);
  --shadow:   0 10px 30px rgba(0, 0, 0, 0.35);
  --overlay:  rgba(16, 24, 27, 0.84);

  --calm:   #74b3aa;
  --focus:  #8fa2d6;
  --sleep:  #9d92c9;
  --energy: #dda05e;
  --sos:    #d68a70;
}

/* goal contexts — any element with .goal-X tints its descendants */
.goal-calm   { --gc: var(--calm); }
.goal-focus  { --gc: var(--focus); }
.goal-sleep  { --gc: var(--sleep); }
.goal-energy { --gc: var(--energy); }
.goal-sos    { --gc: var(--sos); }

/* Derived tokens must be re-declared where --gc changes: var() inside a
   custom property resolves where the property is DECLARED, so the :root
   versions freeze to the default goal color and would leak teal into
   every other goal context. */
.goal-calm, .goal-focus, .goal-sleep, .goal-energy, .goal-sos {
  --gc-soft: color-mix(in oklab, var(--gc) 14%, var(--bg));
  --gc-strong: color-mix(in oklab, var(--gc) 55%, var(--ink));
  --gc-deep: color-mix(in oklab, var(--gc) 52%, #1c2e30);
}

/* ---------- base ---------- */

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

html { height: 100%; }

body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.4s ease, color 0.4s ease;
}

/* Arabic reads best a touch larger and looser */
html[lang="ar"] body { font-size: 17px; line-height: 1.75; }
html[lang="ar"] { --font-display: "SF Arabic", "Geeza Pro", "Noto Naskh Arabic", var(--font-body); }

button, input, select {
  font: inherit;
  color: inherit;
  border: none;
  background: none;
  cursor: pointer;
}

a { color: inherit; text-decoration: none; }

svg { display: block; }
.tech-icon svg, .tab svg, .icon-btn svg, .goal-card svg, .onb-goal svg {
  width: 100%; height: 100%;
  fill: currentColor; stroke: currentColor;
}

:focus-visible { outline: 2px solid var(--gc); outline-offset: 3px; border-radius: 6px; }

.app { max-width: 520px; margin: 0 auto; min-height: 100dvh; }

/* ---------- screens & motion ---------- */

.screen {
  min-height: 100dvh;
  padding: max(20px, env(safe-area-inset-top)) 22px calc(104px + env(safe-area-inset-bottom));
  animation: screen-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

.boot-splash {
  min-height: 100dvh;
  display: grid; place-items: center;
}

/* the little breathing dot used on splash / onboarding / done screens */
.mini-orb {
  width: 84px; height: 84px; border-radius: 50%;
  background: radial-gradient(circle at 38% 32%,
              color-mix(in oklab, var(--gc) 55%, white) 0%, var(--gc) 70%);
  box-shadow: 0 0 60px color-mix(in oklab, var(--gc) 45%, transparent);
}
.mini-orb.breathe { animation: mini-breathe 7s ease-in-out infinite; }

@keyframes mini-breathe {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  45%      { transform: scale(1.18); opacity: 1; }
  60%      { transform: scale(1.18); opacity: 1; }
}

/* ---------- typography ---------- */

.display {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.8rem;
  line-height: 1.28;
  letter-spacing: -0.01em;
}
html[lang="ar"] .display { letter-spacing: 0; font-weight: 700; }

.greeting { color: var(--muted); font-size: 0.95rem; margin-bottom: 2px; }

.section-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 26px 0 10px;
}
html[lang="ar"] .section-title { letter-spacing: 0; font-size: 0.88rem; }

.page-head { margin-bottom: 6px; }
.page-sub { color: var(--muted); font-size: 0.95rem; margin-top: 6px; }

.fineprint { color: var(--muted); font-size: 0.8rem; line-height: 1.6; margin-top: 18px; }
.fineprint.gentle { text-align: center; padding: 0 8px; }

/* ---------- buttons ---------- */

.btn {
  display: block;
  background: var(--gc-deep);
  color: #fff;
  border-radius: 999px;
  font-weight: 700;
  text-align: center;
  padding: 15px 28px;
  box-shadow: 0 6px 20px color-mix(in oklab, var(--gc) 40%, transparent);
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.btn:active { transform: scale(0.97); filter: brightness(0.96); }
.btn:disabled { opacity: 0.45; box-shadow: none; cursor: default; }
.btn-lg { width: 100%; font-size: 1.05rem; }

.btn-ghost {
  display: block;
  width: 100%;
  text-align: center;
  color: var(--muted);
  font-weight: 600;
  padding: 13px;
  border-radius: 999px;
  transition: color 0.2s ease, background 0.2s ease;
}
.btn-ghost:hover { color: var(--ink); background: var(--surface2); }

.btn-danger {
  display: block;
  width: 100%;
  text-align: center;
  padding: 13px;
  border-radius: var(--radius-sm);
  border: 1px solid color-mix(in oklab, #c0564a 45%, transparent);
  color: #c0564a;
  font-weight: 600;
}

.icon-btn {
  width: 42px; height: 42px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--ink);
  transition: background 0.2s ease, opacity 0.2s ease;
}
/* no fill:none here — solid icon parts carry no fill attribute and must
   inherit currentColor; stroke-only shapes set fill="none" inline */
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:hover { background: var(--surface2); }

/* flip directional chrome in RTL */
[dir="rtl"] .back-btn svg, [dir="rtl"] .chev { transform: scaleX(-1); }

/* ---------- topbar ---------- */

.topbar {
  display: flex; align-items: center; gap: 8px;
  margin: -6px -8px 12px;
}
.topbar-title {
  flex: 1; text-align: center;
  font-size: 1.02rem; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-spacer { width: 42px; flex-shrink: 0; }

/* ---------- tabbar ---------- */

.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  margin: 0 auto;
  max-width: 520px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 8px 10px calc(10px + env(safe-area-inset-bottom));
  background: var(--overlay);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
  z-index: 40;
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--muted);
  font-size: 0.68rem; font-weight: 600;
  padding: 6px 0 2px;
  border-radius: 12px;
  transition: color 0.2s ease;
}
html[lang="ar"] .tab { font-size: 0.76rem; }
.tab-icon { position: relative; display: block; }
.tab-dot {
  position: absolute;
  top: -2px; inset-inline-end: -5px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--gc-strong);
  animation: hint-pulse 2.4s ease-in-out infinite;
}
.tab svg { width: 23px; height: 23px; }
.tab.active { color: var(--gc-strong); }
.tab:active { transform: scale(0.95); }

/* ---------- cards ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

/* home */
.home-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: 8px 0 20px; }

.streak-chip {
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.85rem; font-weight: 700;
  box-shadow: var(--shadow);
}

.card-hero {
  background: linear-gradient(160deg,
    color-mix(in oklab, var(--gc) 16%, var(--surface)) 0%, var(--surface) 70%);
  display: flex; flex-direction: column; gap: 16px;
  margin-bottom: 14px;
}
.hero-eyebrow { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; color: var(--gc-strong); text-transform: uppercase; }
html[lang="ar"] .hero-eyebrow { letter-spacing: 0; font-size: 0.85rem; }
.hero-row { display: flex; align-items: center; gap: 14px; }
.hero-name { font-family: var(--font-display); font-size: 1.35rem; font-weight: 700; line-height: 1.3; }
.hero-tag { color: var(--muted); font-size: 0.92rem; }

.tech-icon {
  width: 52px; height: 52px; flex-shrink: 0;
  border-radius: 16px;
  display: grid; place-items: center;
  background: color-mix(in oklab, var(--gc) 16%, var(--surface));
  color: var(--gc-strong);
  padding: 13px;
}

.card-sos {
  --gc: var(--sos);
  width: 100%;
  display: flex; align-items: center; gap: 16px;
  text-align: start;
  position: relative;
  overflow: hidden;
  margin-bottom: 8px;
  background: linear-gradient(150deg,
    color-mix(in oklab, var(--sos) 18%, var(--surface)) 0%, var(--surface) 75%);
  transition: transform 0.15s ease;
}
.card-sos:active { transform: scale(0.98); }
.sos-pulse {
  width: 46px; height: 46px; flex-shrink: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, color-mix(in oklab, var(--sos) 60%, white), var(--sos));
  position: relative;
}
.sos-pulse::after {
  content: '';
  position: absolute; inset: -6px;
  border-radius: 50%;
  border: 2px solid color-mix(in oklab, var(--sos) 55%, transparent);
  animation: sos-ring 2.6s ease-out infinite;
}
@keyframes sos-ring {
  0%   { transform: scale(0.8); opacity: 0.9; }
  70%  { transform: scale(1.35); opacity: 0; }
  100% { transform: scale(1.35); opacity: 0; }
}
.sos-text { display: flex; flex-direction: column; gap: 1px; }
.sos-title { font-weight: 800; font-size: 1.02rem; }
.sos-sub { color: var(--muted); font-size: 0.88rem; }

.goal-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.goal-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 4px 12px;
  font-size: 0.82rem; font-weight: 700;
  color: var(--ink);
  box-shadow: var(--shadow);
  transition: transform 0.15s ease;
}
.goal-card:active { transform: scale(0.95); }
.goal-card svg { width: 26px; height: 26px; color: var(--gc); fill: currentColor; }

.link-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 20px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-weight: 600;
}
.link-row .chev { width: 18px; height: 18px; stroke: var(--muted); fill: none; flex-shrink: 0; }

/* ---------- chips ---------- */

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 6px; }
.chip {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.88rem; font-weight: 600;
  transition: all 0.2s ease;
}
.chip.active {
  background: var(--gc-deep);
  border-color: var(--gc-deep);
  color: #fff;
  box-shadow: 0 4px 14px color-mix(in oklab, var(--gc) 35%, transparent);
}

/* ---------- soundscapes ---------- */

.scape-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 6px;
}

.scape-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: border-color 0.3s ease, background 0.4s ease;
}
.scape-card.on {
  border-color: color-mix(in oklab, var(--gc) 45%, transparent);
  background: linear-gradient(165deg,
    color-mix(in oklab, var(--gc) 14%, var(--surface)) 0%, var(--surface) 80%);
}

.scape-toggle {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  width: 100%;
  text-align: start;
  padding: 16px 16px 12px;
  position: relative;
  transition: transform 0.15s ease;
}
.scape-toggle:active { transform: scale(0.97); }
.scape-icon { display: block; width: 30px; height: 30px; color: var(--gc-strong); margin-bottom: 8px; }
.scape-icon svg { width: 100%; height: 100%; fill: currentColor; stroke: currentColor; }
.scape-name { font-weight: 700; font-size: 0.98rem; }
.scape-tag { color: var(--muted); font-size: 0.78rem; line-height: 1.45; min-height: 2.3em; }

/* tiny equalizer — only dances while playing */
.eq {
  position: absolute;
  top: 16px; inset-inline-end: 14px;
  display: flex; align-items: flex-end; gap: 2.5px;
  height: 16px;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.scape-card.on .eq { opacity: 1; }
.eq i {
  width: 3.5px;
  border-radius: 2px;
  background: var(--gc-strong);
  height: 30%;
}
.scape-card.on .eq i { animation: eq-dance 1.1s ease-in-out infinite; }
.scape-card.on .eq i:nth-child(2) { animation-delay: 0.25s; }
.scape-card.on .eq i:nth-child(3) { animation-delay: 0.5s; }
@keyframes eq-dance {
  0%, 100% { height: 30%; }
  50%      { height: 95%; }
}

.scape-vol[hidden] { display: none; }
.scape-vol {
  display: block;
  width: calc(100% - 32px);
  margin: 0 16px 16px;
  accent-color: var(--gc-deep);
  height: 22px;
  cursor: pointer;
}

.chip-stop { color: color-mix(in oklab, #c0564a 70%, var(--ink)); border-color: color-mix(in oklab, #c0564a 40%, transparent); }
.timer-sub { margin: -4px 0 2px; font-size: 0.85rem; }
.timer-left {
  align-self: center;
  color: var(--gc-strong);
  font-weight: 700;
  font-size: 0.88rem;
  padding: 8px 6px;
  font-variant-numeric: tabular-nums;
}

/* ---------- library ---------- */

.lib-group { margin-bottom: 8px; }
.lib-caption {
  font-size: 0.83rem;
  color: var(--muted);
  background: color-mix(in oklab, var(--energy) 13%, var(--surface));
  border: 1px solid color-mix(in oklab, var(--energy) 30%, transparent);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 12px;
}

.tech-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: transform 0.15s ease;
}
.tech-card:active { transform: scale(0.98); }
.tech-info { flex: 1; min-width: 0; }
.tech-name { font-weight: 700; font-size: 1rem; line-height: 1.35; }
.tech-tag { color: var(--muted); font-size: 0.85rem; margin-top: 1px; }
.cadence {
  flex-shrink: 0;
  font-size: 0.78rem; font-weight: 700;
  color: var(--gc-strong);
  background: color-mix(in oklab, var(--gc) 12%, var(--surface));
  padding: 5px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.badge {
  display: inline-block;
  font-size: 0.68rem; font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  vertical-align: 2px;
  margin-inline-start: 4px;
  letter-spacing: 0.03em;
}
html[lang="ar"] .badge { font-size: 0.75rem; letter-spacing: 0; }
.badge-start { background: color-mix(in oklab, var(--calm) 20%, var(--surface)); color: var(--gc-strong); }
.badge-adv   { background: color-mix(in oklab, var(--energy) 22%, var(--surface)); color: color-mix(in oklab, var(--energy) 50%, var(--ink)); }
.badge-sos   { background: color-mix(in oklab, var(--sos) 20%, var(--surface)); color: color-mix(in oklab, var(--sos) 50%, var(--ink)); }

/* ---------- technique detail ---------- */

.detail-hero {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  text-align: center;
  margin: 10px 0 16px;
}
.tech-icon-lg { width: 84px; height: 84px; border-radius: 26px; padding: 20px; }
.detail-tag { color: var(--gc-strong); font-weight: 600; font-size: 0.98rem; }
.detail-desc { color: var(--ink); margin-bottom: 18px; }

.cadence-bar {
  display: flex; gap: 5px;
  height: 60px;
  margin: 6px 0 4px;
}
.cadence-seg {
  border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 34px;
  overflow: hidden;
  transition: flex 0.3s ease;
}
.seg-in   { background: var(--gc-deep); color: #fff; }
.seg-in2  { background: color-mix(in oklab, var(--gc) 45%, var(--surface)); color: var(--gc-strong); }
.seg-out  { background: color-mix(in oklab, var(--gc) 30%, var(--surface)); color: var(--gc-strong); }
.seg-hold, .seg-hold2 {
  background: var(--surface);
  border: 1.5px dashed color-mix(in oklab, var(--gc) 45%, transparent);
  color: var(--gc-strong);
}
.seg-name { font-size: 0.68rem; font-weight: 700; opacity: 0.9; }
html[lang="ar"] .seg-name { font-size: 0.76rem; }
.seg-secs { font-size: 1.05rem; font-weight: 800; line-height: 1.1; }

.warn-box {
  background: color-mix(in oklab, var(--energy) 14%, var(--surface));
  border: 1px solid color-mix(in oklab, var(--energy) 35%, transparent);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 0.88rem;
  margin: 16px 0 4px;
}
.warn-box ul { padding-inline-start: 18px; margin-top: 6px; color: var(--muted); }
.warn-box li { margin-bottom: 4px; }

.accordion {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-top: 16px;
  overflow: hidden;
}
.accordion summary {
  list-style: none;
  padding: 15px 18px;
  font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
}
.accordion summary::-webkit-details-marker { display: none; }
.accordion summary::after {
  content: '';
  width: 9px; height: 9px;
  /* physical borders on purpose: a down/up chevron is direction-neutral,
     and logical borders would break the rotation in RTL */
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.25s ease;
  flex-shrink: 0;
}
.accordion[open] summary::after { transform: rotate(225deg); }
.acc-body { padding: 0 18px 16px; color: var(--muted); }
.acc-body p { color: var(--ink); opacity: 0.85; }

.why-acc { background: linear-gradient(160deg, color-mix(in oklab, var(--gc) 10%, var(--surface)), var(--surface)); }

.when-box p { color: var(--ink); opacity: 0.85; }

.stepper-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0;
}
.stepper { display: flex; align-items: center; gap: 4px; }
.step-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--surface2);
  font-size: 1.2rem; font-weight: 700;
  display: grid; place-items: center;
  transition: transform 0.1s ease;
}
.step-btn:active { transform: scale(0.9); }
.step-val { min-width: 62px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }

.cta-space { height: 20px; }
.start-cta {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  margin: 0 auto;
  max-width: 520px;
  padding: 14px 22px calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 55%, transparent);
  z-index: 30;
  display: flex; flex-direction: column; gap: 6px;
}

/* ---------- safety gate ---------- */

.safety { display: flex; flex-direction: column; }
.safety-body { flex: 1; padding-bottom: 140px; }
.safety-icon { font-size: 2.6rem; text-align: center; margin: 18px 0 10px; }
.safety-title {
  font-family: var(--font-display);
  font-size: 1.45rem; font-weight: 700;
  text-align: center;
  margin-bottom: 18px;
}
.safety-list {
  list-style: none;
  display: flex; flex-direction: column; gap: 12px;
  margin-bottom: 22px;
}
.safety-list li {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  font-size: 0.93rem;
  padding-inline-start: 42px;
  position: relative;
}
.safety-list li::before {
  content: '•';
  position: absolute;
  inset-inline-start: 18px;
  color: var(--energy);
  font-size: 1.4rem;
  line-height: 1.1;
}
.check-row {
  display: flex; align-items: flex-start; gap: 12px;
  background: color-mix(in oklab, var(--gc) 10%, var(--surface));
  border-radius: var(--radius-sm);
  padding: 15px 16px;
  font-weight: 600;
  cursor: pointer;
}
.check-row input {
  width: 22px; height: 22px; flex-shrink: 0;
  accent-color: var(--gc);
  margin-top: 2px;
  cursor: pointer;
}

/* ---------- session ---------- */

.session {
  display: flex; flex-direction: column;
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  min-height: 100dvh;
  background:
    radial-gradient(120% 90% at 50% -10%, color-mix(in oklab, var(--gc) 16%, transparent), transparent 60%),
    var(--bg);
}

.session-top { display: flex; align-items: center; gap: 8px; }
.session-tech {
  flex: 1;
  text-align: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.session-toggles { display: flex; gap: 2px; }
.toggle-btn { width: 44px; height: 44px; }
.toggle-btn svg { width: 20px; height: 20px; }
.toggle-btn.off { opacity: 0.32; }
.toggle-btn.off::after {
  content: '';
  position: absolute;
  width: 26px; height: 2px;
  background: currentColor;
  transform: rotate(-45deg);
}
.toggle-btn { position: relative; }

.orb-stage {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px;
  cursor: pointer;
  min-height: 0;
}

.round-indicator {
  font-size: 0.85rem; font-weight: 700;
  color: var(--gc-strong);
  background: color-mix(in oklab, var(--gc) 13%, var(--surface));
  padding: 6px 16px;
  border-radius: 999px;
  margin-bottom: 8px;
  min-height: 33px;
}
/* Keep hidden session chrome occupying its space — the centered orb must
   never jump when the round chip or skip hint appears mid-hold. */
.round-indicator[hidden], .skip-hint[hidden] { display: block; visibility: hidden; }

.orb-scale {
  position: relative;
  width: min(60vw, 280px);
  height: min(60vw, 280px);
  margin: 12px 0 20px;
  will-change: transform;
}
.orb-core, .orb-halo {
  position: absolute;
  border-radius: 50%;
}
.orb-core {
  inset: 0;
  background: radial-gradient(circle at 38% 30%,
    color-mix(in oklab, var(--gc) 45%, white) 0%,
    var(--gc) 62%,
    color-mix(in oklab, var(--gc) 78%, var(--ink)) 100%);
  box-shadow:
    inset 0 -14px 40px color-mix(in oklab, var(--gc) 60%, var(--ink)),
    0 8px 44px color-mix(in oklab, var(--gc) 40%, transparent);
}
[data-theme="dark"] .orb-core {
  background: radial-gradient(circle at 38% 30%,
    color-mix(in oklab, var(--gc) 70%, white) 0%,
    var(--gc) 58%,
    color-mix(in oklab, var(--gc) 45%, var(--bg)) 100%);
  /* mix toward the dark bg, not --ink (near-white in dark mode) */
  box-shadow:
    inset 0 -14px 40px color-mix(in oklab, var(--gc) 45%, var(--bg)),
    0 8px 44px color-mix(in oklab, var(--gc) 40%, transparent);
}
.orb-halo.h1 {
  inset: -13%;
  background: color-mix(in oklab, var(--gc) 30%, transparent);
  filter: blur(24px);
}
.orb-halo.h2 {
  inset: -30%;
  background: color-mix(in oklab, var(--gc) 16%, transparent);
  filter: blur(44px);
}

/* soft shimmer while holding — on the core so it never fights the wrapper's scale */
.orb-scale.shimmer .orb-core { animation: hold-shimmer 2.6s ease-in-out infinite; }
@keyframes hold-shimmer {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.025); }
}

.phase-block { text-align: center; min-height: 138px; }
.phase-label {
  font-family: var(--font-display);
  font-size: 1.7rem; font-weight: 700;
  letter-spacing: 0.01em;
}
.phase-sub { color: var(--muted); font-size: 0.92rem; margin-top: 2px; min-height: 2.9em; padding: 0 24px; }
.phase-count {
  font-family: var(--font-display);
  font-size: 2.1rem; font-weight: 600;
  color: var(--gc-strong);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
  min-height: 1.2em;
}

.skip-hint {
  color: var(--muted);
  font-size: 0.85rem;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 999px;
  animation: hint-pulse 2.4s ease-in-out infinite;
}
@keyframes hint-pulse { 0%, 100% { opacity: 0.45; } 50% { opacity: 1; } }

.session-bottom { padding-top: 10px; }
.progress-line {
  height: 4px;
  border-radius: 999px;
  background: color-mix(in oklab, var(--gc) 18%, var(--surface2));
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--gc);
  transition: width 0.3s linear;
}
.session-meta {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.88rem;
}
.session-meta .btn-ghost { width: auto; padding: 8px 14px; font-size: 1.1rem; }

.pause-overlay {
  position: fixed; inset: 0;
  z-index: 60;
  background: var(--overlay);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px;
  padding: 40px;
}
.pause-overlay[hidden] { display: none; }
.pause-title { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; margin-bottom: 8px; }
.pause-overlay .btn { min-width: 220px; }

/* ---------- done ---------- */

.done {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  gap: 14px;
  padding-bottom: 40px;
}
.done-orb { margin-bottom: 12px; }
.done-msg {
  font-family: var(--font-display);
  font-size: 1.55rem; font-weight: 700;
  line-height: 1.35;
  max-width: 20ch;
}
.done-stats { color: var(--muted); font-size: 0.95rem; }
.done-caution {
  font-size: 0.88rem;
  color: color-mix(in oklab, var(--energy) 50%, var(--ink));
  background: color-mix(in oklab, var(--energy) 14%, var(--surface));
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  max-width: 34ch;
}
.done-badges { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.badge-pop {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 999px;
  padding: 10px 20px;
  font-size: 0.9rem;
  animation: badge-in 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.badge-pop .badge-icon { font-size: 1.3rem; }
@keyframes badge-in { from { opacity: 0; transform: scale(0.7); } to { opacity: 1; transform: none; } }
.done-actions { width: min(100%, 320px); margin-top: 18px; display: flex; flex-direction: column; gap: 6px; }

/* ---------- progress ---------- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}
.stat-tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 8px 14px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  text-align: center;
}
.stat-num {
  font-family: var(--font-display);
  font-size: 1.9rem; font-weight: 700;
  color: var(--gc-strong);
}
.stat-label { color: var(--muted); font-size: 0.78rem; font-weight: 600; }

.badges-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.badge-tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: flex; flex-direction: column; gap: 3px;
  opacity: 0.45;
  filter: grayscale(0.9);
  transition: opacity 0.3s ease, filter 0.3s ease;
}
.badge-tile.earned { opacity: 1; filter: none; box-shadow: var(--shadow); }
.badge-tile .badge-icon { font-size: 1.5rem; }
.badge-tile .badge-name { font-weight: 700; font-size: 0.92rem; }
.badge-tile .badge-sub { color: var(--muted); font-size: 0.8rem; }

.empty-note {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  color: var(--muted);
  text-align: center;
  margin-top: 14px;
}

/* ---------- settings ---------- */

.set-group {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px 18px;
  margin-top: 8px;
}
.set-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}
.set-row:last-child { border-bottom: none; }
.set-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.set-label { font-weight: 600; }
.set-sub { color: var(--muted); font-size: 0.8rem; }
.set-sub.center { text-align: center; padding: 8px 0 2px; }

.seg-control {
  display: flex;
  background: var(--surface2);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.seg {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.85rem; font-weight: 600;
  color: var(--muted);
  transition: all 0.2s ease;
}
.seg.active { background: var(--surface); color: var(--ink); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12); }

.switch {
  position: relative;
  width: 50px; height: 30px; flex-shrink: 0;
  border-radius: 999px;
  background: var(--surface2);
  border: 1px solid var(--line);
  transition: background 0.25s ease;
}
.switch .knob {
  position: absolute;
  top: 3px; inset-inline-start: 3px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  transition: inset-inline-start 0.25s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.switch.on { background: var(--gc-deep); border-color: var(--gc-deep); }
.switch.on .knob { inset-inline-start: calc(100% - 25px); }
.switch:disabled { opacity: 0.4; cursor: default; }

input[type="time"] {
  background: var(--surface2);
  border-radius: 10px;
  padding: 8px 12px;
  font-weight: 600;
  color: var(--ink);
  border: none;
}
input[type="time"]:disabled { opacity: 0.4; }

.about-text { padding: 14px 0 4px; color: var(--ink); opacity: 0.85; font-size: 0.93rem; }
.about-free { padding: 10px 0; color: var(--gc-strong); font-size: 0.93rem; font-weight: 600; }
.disclaimer-box {
  background: var(--surface2);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 0.85rem;
  margin: 8px 0 14px;
}
.disclaimer-box p { color: var(--muted); margin-top: 4px; }

/* ---------- onboarding ---------- */

.onb {
  display: flex; flex-direction: column; justify-content: center;
  min-height: 100dvh;
  padding-bottom: 60px;
}
.onb-orb { display: grid; place-items: center; margin-bottom: 34px; }
.onb-hello {
  font-family: var(--font-display);
  text-align: center;
  font-size: 1.9rem; font-weight: 700;
  display: flex; flex-direction: column; gap: 4px;
  margin-bottom: 28px;
}
.onb-choose { text-align: center; color: var(--muted); font-size: 0.9rem; margin-bottom: 14px; }
.lang-cards { display: flex; flex-direction: column; gap: 12px; max-width: 320px; width: 100%; margin: 0 auto; }
.lang-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  font-size: 1.25rem; font-weight: 700;
  text-align: center;
  transition: transform 0.15s ease, border-color 0.2s ease;
}
.lang-card:active { transform: scale(0.97); }
.lang-card:hover { border-color: var(--gc); }

.onb-title {
  font-family: var(--font-display);
  font-size: 1.7rem; font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
}
.onb-sub { text-align: center; color: var(--muted); margin-bottom: 24px; }
.onb-goals { display: flex; flex-direction: column; gap: 10px; }
.onb-goal {
  display: grid;
  grid-template-columns: 30px 1fr;
  grid-template-rows: auto auto;
  column-gap: 14px;
  align-items: center;
  text-align: start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 15px 18px;
  transition: transform 0.15s ease, border-color 0.2s ease;
}
.onb-goal:active { transform: scale(0.98); }
.onb-goal svg { width: 26px; height: 26px; color: var(--gc); grid-row: 1 / 3; fill: currentColor; }
.onb-goal-name { font-weight: 700; }
.onb-goal-sub { color: var(--muted); font-size: 0.85rem; grid-column: 2; }

.rec-card { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.rec-name { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; }
.rec-tag { color: var(--muted); font-size: 0.9rem; }
.rec-min { color: var(--gc-strong); font-size: 0.85rem; font-weight: 700; margin-top: 3px; }
.onb-note {
  font-size: 0.85rem;
  color: var(--muted);
  background: color-mix(in oklab, var(--energy) 13%, var(--surface));
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 16px;
}
.onb .btn-lg { margin-top: 6px; }

.onb-dots { display: flex; justify-content: center; gap: 7px; margin-top: 34px; }
.onb-dots .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--line);
  transition: background 0.3s ease, transform 0.3s ease;
}
.onb-dots .dot.on { background: var(--gc); transform: scale(1.25); }

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .screen { animation: none; }
  .mini-orb.breathe, .sos-pulse::after, .skip-hint,
  .orb-scale.shimmer .orb-core, .badge-pop,
  .scape-card.on .eq i, .tab-dot { animation: none; }
  .scape-card.on .eq i { height: 70%; }
}

/* ---------- larger screens: keep the phone-like column, breathe a bit ---------- */

@media (min-width: 560px) {
  body { background: color-mix(in oklab, var(--bg) 92%, var(--ink)); }
  .app, .screen { background: var(--bg); }
  .app {
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.1);
  }
}
