:root {
  color-scheme: light only;
  /* mymind tokens */
  --color-ember-orange: #ff5924;
  --color-cobalt-link: #1573dd;
  --color-midnight-ink: #000000;
  --color-canvas-white: #f9fafc;
  --color-pure-white: #ffffff;
  --color-blush-tint: #fff1f1;
  --color-mist: #e2e2e2;
  --color-slate-blue-card: #e5eaf2;
  --color-parchment-card: #f3f0e7;
  --color-sage-card: #dde9d3;
  --color-deep-slate: #3a475a;
  --color-storm: #4a5465;
  --color-steel: #717286;
  --color-graphite-nav: #24272d;
  --color-ash: #afb5c1;
  --color-chalk: #a6a8aa;

  /* App-level mapping (prior names kept for backwards compat) */
  --bg: var(--color-canvas-white);
  --surface: var(--color-pure-white);
  --surface-2: var(--color-blush-tint);
  --text: var(--color-midnight-ink);
  --text-2: var(--color-storm);
  --muted: var(--color-steel);
  --border: var(--color-mist);

  --accent: var(--color-ember-orange);
  --accent-soft: var(--color-blush-tint);
  --accent-ink: var(--color-ember-orange);

  --black: var(--color-graphite-nav);
  --success: #6ea84a;
  --danger: #d8556a;

  /* Tile category tints — mymind 3-color system, mapped to legacy names */
  --tile-peach: var(--color-parchment-card);
  --tile-mint:  var(--color-sage-card);
  --tile-pink:  var(--color-blush-tint);
  --tile-cream: var(--color-parchment-card);
  --tile-lav:   var(--color-slate-blue-card);
  --tile-blue:  var(--color-slate-blue-card);

  /* Fonts */
  --font-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-ui: 'Nunito', 'DM Sans', system-ui, sans-serif;

  /* Shadows: feature cards never use shadows. Only floating UI elements (FAB, bottom tabbar, modal). */
  --shadow-sm: rgba(140, 142, 151, 0.18) 0 2px 6px -2px;
  --shadow:    rgba(140, 142, 151, 0.20) 0 8px 24px -8px;
  --shadow-lg: rgba(255, 167, 129, 0.30) 0 16px 36px -12px,
               rgba(255, 128, 36, 0.18)  0 -10px 24px -16px;

  --radius-sm: 12px;
  --radius:    16px;
  --radius-lg: 20px;
  --radius-pill: 100px;

  --tabbar-h: 70px;
  --topbar-pt: 14px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: -0.01em;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}

/* Editorial display style: Playfair, tight negative tracking */
h1, h2, .display, .greet h1 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.02em;
}

/* Section eyebrow: Nunito uppercase, ember orange, wide tracking. */
.eyebrow {
  font-family: var(--font-ui);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.125em;
  text-transform: uppercase;
  color: var(--color-ember-orange);
  display: inline-block;
}

body { min-height: 100vh; min-height: 100dvh; }

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}

/* ---------- Greeting topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: calc(var(--safe-top) + var(--topbar-pt)) 20px 12px;
  background: linear-gradient(var(--bg) 70%, transparent);
}

.greet {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.greet h1 {
  font-family: var(--font-display);
  font-size: 30px;
  line-height: 1.05;
  font-weight: 500;
  letter-spacing: -0.025em;
  margin: 0;
  color: var(--color-midnight-ink);
}
.greet .sub {
  font-family: var(--font-ui);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-steel);
  margin-top: 8px;
}
.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--color-blush-tint);
  color: var(--color-deep-slate);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  border: 1.5px solid var(--color-mist);
}
.avatar.alt {
  background: var(--color-sage-card);
  color: #2f4029;
}

/* ---------- Screen ---------- */
.screen {
  flex: 1;
  padding: 4px 16px calc(var(--tabbar-h) + var(--safe-bottom) + 28px);
}

/* ---------- Cards ---------- */
/* mymind feature cards: pastel surface, 16px radius, no border, no shadow.
   Three category tints rotated by use: parchment (default warm), blue (technical), sage (nature).
*/
.card {
  background: var(--color-parchment-card);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
}
.card.flat       { background: var(--surface-2); }
.card.surface    { background: var(--surface); }
.card.parchment  { background: var(--color-parchment-card); }
.card.blue       { background: var(--color-slate-blue-card); }
.card.sage       { background: var(--color-sage-card); }
.card.tinted-peach { background: var(--color-blush-tint); }
.card h3 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0 0 10px;
  font-size: 20px;
  color: var(--color-deep-slate);
}

.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 18px 4px 12px;
  gap: 12px;
}
.section-head h2 {
  font-family: var(--font-ui);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.125em;
  text-transform: uppercase;
  color: var(--color-ember-orange);
  margin: 0;
}
.section-head .link {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-steel);
  background: none;
  border: 0;
  padding: 4px 6px;
  cursor: pointer;
}

/* ---------- Reminder banner (hero card) ---------- */
.banner {
  background: var(--color-blush-tint);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
}
.banner .ico {
  width: 56px; height: 56px;
  border-radius: var(--radius);
  background: var(--color-pure-white);
  color: var(--color-ember-orange);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  flex-shrink: 0;
}
.banner .body { flex: 1; min-width: 0; }
.banner h3 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
  font-size: 18px;
  color: var(--color-midnight-ink);
}
.banner p { margin: 0 0 10px; color: var(--color-storm); font-size: 13.5px; line-height: 1.45; }
.banner .pill-btn {
  background: transparent;
  color: var(--color-ember-orange);
  border: 1.5px solid var(--color-ember-orange);
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-family: var(--font-ui);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

/* ---------- Buttons ---------- */
/* mymind: pill 100px radius, outlined ember as primary "invitation",
   filled graphite for high-contrast actions, ghost for plain text. */
button.primary, button.ghost, button.secondary, button.dark, button.outline {
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: var(--radius-pill);
  padding: 13px 22px;
  cursor: pointer;
  border: 1.5px solid transparent;
}
button.primary,
button.outline {
  background: transparent;
  color: var(--color-ember-orange);
  border-color: var(--color-ember-orange);
}
button.dark {
  background: var(--color-graphite-nav);
  color: var(--color-pure-white);
  border-color: var(--color-graphite-nav);
}
button.secondary {
  background: var(--color-pure-white);
  color: var(--color-deep-slate);
  border-color: var(--color-mist);
}
button.ghost {
  background: transparent;
  color: var(--color-steel);
  border-color: transparent;
  padding: 6px 10px;
  letter-spacing: 0.04em;
}
button.full { width: 100%; }

/* ---------- Inputs ---------- */
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], textarea, select {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-mist);
  background: var(--color-pure-white);
  color: var(--color-midnight-ink);
  font-family: var(--font-body);
  font-size: 15px;
  letter-spacing: -0.01em;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--color-ember-orange);
}
textarea { min-height: 96px; resize: vertical; }

label.field { display: block; margin-bottom: 14px; }
label.field span {
  display: block;
  font-family: var(--font-ui);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-steel);
  margin: 0 4px 8px;
}

/* ---------- Week strip ---------- */
.weekstrip-wrap {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 16px;
  padding: 6px 6px 8px;
}
.weekstrip-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 6px 4px;
}
.weekstrip-head .weekstrip-title {
  font-size: 13px; font-weight: 600; color: var(--text-2);
}
.iconbtn {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text);
  border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
}
.iconbtn:active { transform: scale(0.95); }

.weekstrip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  padding: 4px 4px 0;
}
.wd {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px;
  border: 0; background: none;
  padding: 6px 4px 8px;
  cursor: pointer;
  color: var(--muted);
  font: inherit;
  border-radius: 14px;
}
.wd .l { font-size: 11.5px; font-weight: 500; letter-spacing: 0.02em; }
.wd .n {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  position: relative;
}
.wd.today .n { box-shadow: inset 0 0 0 1.5px var(--accent); }
.wd.selected .n { background: var(--black); color: #fff; }
.wd.selected .l { color: var(--text); font-weight: 600; }
.wd .dot {
  position: absolute;
  bottom: -7px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--accent);
}
.wd.selected .dot { background: #fff; }

/* ---------- Month calendar (collapsible) ---------- */
.cal {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 14px;
  margin-bottom: 16px;
}
.cal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.cal-head .title {
  font-weight: 600; font-size: 15px; text-transform: capitalize;
}
.cal-head button {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface-2); color: var(--text);
  border: 0; cursor: pointer; font-size: 16px; line-height: 1;
}
.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px;
  margin-top: 10px;
}
.cal-grid .dow {
  font-size: 10.5px; color: var(--muted); text-align: center; padding: 6px 0;
  font-weight: 500; letter-spacing: 0.04em;
}
.cal-cell {
  aspect-ratio: 1 / 1;
  background: transparent;
  border: 0;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--text);
  cursor: pointer; position: relative; padding: 0;
  font-weight: 500;
}
.cal-cell.dim { color: var(--muted); opacity: 0.5; }
.cal-cell.today { box-shadow: inset 0 0 0 1.5px var(--accent); }
.cal-cell.selected { background: var(--black); color: #fff; }
.cal-cell .dot {
  position: absolute; bottom: 5px;
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--accent);
}
.cal-cell.selected .dot { background: #fff; }

details.cal-wrap { margin-bottom: 16px; }
details.cal-wrap > summary {
  list-style: none;
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 4px;
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
}
details.cal-wrap > summary::-webkit-details-marker { display: none; }
details.cal-wrap > summary .chev::after { content: "▾"; margin-left: 4px; }
details.cal-wrap[open] > summary .chev::after { content: "▴"; }

/* ---------- Task row (with colored tile) ---------- */
.task {
  display: flex; align-items: center;
  gap: 12px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 14px;
  border: 1px solid var(--border);
  margin-bottom: 10px;
  position: relative;
}
.task .check {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1.5px solid #d6cdbe;
  flex-shrink: 0;
  background: transparent;
  cursor: pointer;
  position: relative;
}
.task.done .check {
  background: var(--accent);
  border-color: var(--accent);
}
.task.done .check::after {
  content: "";
  position: absolute;
  left: 6px; top: 2px;
  width: 6px; height: 11px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.tile {
  width: 52px; height: 52px;
  border-radius: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--tile-peach);
  flex-shrink: 0;
  color: rgba(0, 0, 0, 0.72);
}
.tile.sm { width: 36px; height: 36px; border-radius: 12px; }
.tile.lg { width: 64px; height: 64px; border-radius: 20px; }
/* mymind tile colors: pastel surface, midnight-ink line-art icons. */
.tile.peach { background: var(--tile-peach); color: var(--color-deep-slate); }
.tile.mint  { background: var(--tile-mint);  color: #38502d; }
.tile.pink  { background: var(--tile-pink);  color: var(--color-ember-orange); }
.tile.cream { background: var(--tile-cream); color: var(--color-deep-slate); }
.tile.lav   { background: var(--tile-lav);   color: var(--color-deep-slate); }
.tile.blue  { background: var(--tile-blue);  color: var(--color-deep-slate); }
.tile svg { display: block; }

.task .meta { flex: 1; min-width: 0; }
.task .meta .t {
  font-size: 14.5px; font-weight: 600; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.task .meta .s {
  font-size: 12px; color: var(--muted); margin-top: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.task.done .meta .t { color: var(--muted); }

.task .right {
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
  font-size: 11.5px;
  color: var(--muted);
}
.task .chip {
  display: inline-flex; align-items: center; gap: 3px;
  background: var(--surface-2);
  padding: 4px 9px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  color: var(--text-2);
}
.task .icon-btn {
  border: 0; background: transparent; color: var(--muted);
  cursor: pointer; padding: 2px 4px;
  font-size: 14px;
}

/* ---------- Inline progress ---------- */
.progress {
  height: 8px;
  background: var(--surface-2);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.progress > span {
  display: block; height: 100%;
  background: var(--accent);
  transition: width 0.25s ease;
}

/* ---------- Day overview header ---------- */
.day-card {
  background: var(--color-slate-blue-card);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
}
.zone-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
}
.zone-badge::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
}

/* Soft pill — peach фон, оранжевая точка слева. Используется в дневных
   карточках для области/темы. */
.chip-soft {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 500;
}
.chip-soft::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
}

/* Inline ссылка-pill «открыть» в карточке упражнения */
.link-pill {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.link-pill:hover { text-decoration: none; }

/* ---------- Streak / stat tiles ---------- */
.streak-card {
  background: var(--color-parchment-card);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  display: flex; align-items: center;
  gap: 16px;
  position: relative;
  overflow: hidden;
}
.streak-card .streak-tile {
  width: 64px; height: 64px;
  border-radius: 18px;
  background: var(--color-pure-white);
  color: var(--color-ember-orange);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.streak-card .streak-body { flex: 1; min-width: 0; }
.streak-card .streak-label {
  color: var(--muted); font-size: 13px;
}
.streak-card .streak-num {
  font-size: 26px; font-weight: 800; color: var(--accent);
  margin-top: 2px;
  letter-spacing: -0.02em;
  line-height: 1;
}
.streak-card .streak-num small {
  font-size: 17px; color: var(--accent); font-weight: 700; margin-left: 6px;
}
.streak-card .streak-hint {
  font-size: 12px; color: var(--muted); margin-top: 4px;
}
.streak-card .streak-decor {
  position: absolute;
  right: 14px; bottom: 8px;
  width: 86px; height: 86px;
  opacity: 0.85;
  pointer-events: none;
  display: flex; align-items: flex-end; justify-content: center;
  font-size: 64px; line-height: 1;
}
.streak {
  font-size: 26px; font-weight: 700; color: var(--accent);
  display: flex; align-items: center; gap: 6px;
}

/* Compact day-jump card (e.g. «4 мая 2026 / Лицо») */
.daycard {
  display: flex; align-items: center;
  gap: 12px;
  background: var(--color-parchment-card);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
  border: 0;
  width: 100%;
  font: inherit;
  text-align: left;
  cursor: pointer;
  color: var(--text);
}
.daycard .body { flex: 1; min-width: 0; }
.daycard .lbl { font-size: 12.5px; color: var(--muted); }
.daycard .row-chips { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.daycard .chev { color: var(--muted); flex-shrink: 0; }

.stat-row { display: flex; gap: 10px; flex-wrap: wrap; }
.stat {
  flex: 1; min-width: 110px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.stat .label { font-size: 11.5px; color: var(--muted); }
.stat .value { font-size: 20px; font-weight: 700; margin-top: 4px; }

/* ---------- Empty state ---------- */
.empty {
  text-align: center; color: var(--muted);
  padding: 28px 12px; font-size: 13.5px; line-height: 1.45;
}

/* ---------- FAB ---------- */
.fab {
  position: fixed;
  right: 18px;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 14px);
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--color-graphite-nav);
  color: var(--color-pure-white);
  border: 0;
  font-size: 28px;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  box-shadow: rgba(36, 39, 45, 0.30) 0px 14px 32px -10px;
  display: flex; align-items: center; justify-content: center;
  z-index: 25;
}
.fab:active { transform: scale(0.97); }

/* ---------- Bottom tabbar ---------- */
.tabbar {
  position: fixed;
  left: 50%; transform: translateX(-50%);
  bottom: calc(8px + var(--safe-bottom));
  width: calc(100% - 24px);
  max-width: 456px;
  height: var(--tabbar-h);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--surface);
  color: var(--text);
  border-radius: 28px;
  box-shadow: var(--shadow-lg);
  z-index: 20;
  padding: 8px;
  border: 1px solid var(--border);
}
.tab {
  background: transparent;
  border: 0;
  color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px;
  font: inherit;
  cursor: pointer;
  border-radius: 18px;
  padding: 4px 4px;
  font-size: 11px;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.tab .ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 12px;
  background: transparent;
}
.tab .ico svg { display: block; }
.tab .lbl {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.tab.active {
  color: var(--color-graphite-nav);
  font-weight: 700;
}
.tab.active .ico {
  background: var(--color-blush-tint);
  color: var(--color-ember-orange);
}

/* ---------- Picker list ---------- */
.picker-list { display: flex; flex-direction: column; gap: 8px; }
.picker-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 10px 12px;
  cursor: pointer;
  font: inherit;
  text-align: left;
  color: var(--text);
}
.picker-item .t { flex: 1; min-width: 0; font-size: 14px; font-weight: 500; }
.picker-item:hover { border-color: var(--accent); }
.picker-item:active { transform: scale(0.99); }

/* ---------- Week dots ---------- */
.dots-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.dot-day {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: transparent; border: 0; cursor: pointer;
  font: inherit; padding: 4px 0;
}
.dot-day .l { font-size: 10.5px; color: var(--muted); }
.dot-day .b {
  width: 14px; height: 14px; border-radius: 50%;
  border: 1.5px solid #d6cdbe;
  background: transparent;
}
.dot-day.done .b { background: var(--accent); border-color: var(--accent); }
.dot-day.sel .l { color: var(--text); font-weight: 600; }
.dot-day.sel .b { box-shadow: 0 0 0 2px var(--accent-soft); }

/* ---------- Segmented control ---------- */
.seg {
  display: inline-flex;
  background: var(--surface-2);
  border-radius: var(--radius-pill);
  padding: 3px;
  gap: 2px;
}
.seg-btn {
  border: 0; background: transparent;
  font: inherit; font-size: 12.5px; font-weight: 500;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  cursor: pointer;
}
.seg-btn.active {
  background: var(--surface);
  color: var(--text);
  
}

/* ---------- Wheel legend ---------- */
.legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  margin-top: 12px;
}
.legend-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px;
}
.legend-dot {
  width: 10px; height: 10px; border-radius: 50%;
  flex-shrink: 0;
}
.legend-name { flex: 1; min-width: 0; color: var(--text-2); }
.legend-val { font-weight: 700; color: var(--text); }

/* ---------- Combined-calendar marker levels ---------- */
.cal-cell .dot.warm { background: #f7a766; }
.cal-cell .dot.hot  { background: var(--accent); width: 6px; height: 6px; }

.row { display: flex; gap: 8px; align-items: center; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.stack > * + * { margin-top: 12px; }
.spacer { height: 8px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ---------- Program block cards (Kids) ---------- */
.block-card {
  background: var(--color-parchment-card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.block-card.done { opacity: 0.7; }
.block-head {
  display: flex; align-items: center; gap: 12px;
}
.block-meta { flex: 1; min-width: 0; }
.block-title {
  font-weight: 600; font-size: 14.5px; line-height: 1.25;
}
.block-topic {
  font-size: 12.5px; color: var(--muted); margin-top: 4px; line-height: 1.35;
}
.block-cta { margin-top: 12px; }

/* Schedule-based lessons: one row per activity in the day */
.activity {
  margin: 10px 0;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--text);
}
.activity-head {
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--color-deep-slate);
  font-size: 13px;
}
.lessons-day-content .empty { padding: 12px 4px; }

.mat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
  margin: 12px 0 0;
}
.mat-thumb {
  display: block;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.mat-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mat-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  background: var(--surface-2);
  border-radius: var(--radius-pill);
  font-size: 12px;
  color: var(--text);
  text-decoration: none;
  margin: 4px 4px 0 0;
}
.mat-link:hover { background: var(--accent-soft); }

.world-text {
  margin-top: 12px;
  background: var(--surface-2);
  border-radius: 14px;
  padding: 10px 14px;
}
.world-text > summary {
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
  list-style: none;
  display: inline-flex; align-items: center; gap: 6px;
}
.world-text > summary::-webkit-details-marker { display: none; }
.world-text[open] > summary { margin-bottom: 8px; color: var(--text); }
.world-text-head {
  font-weight: 700; font-size: 15px; margin-bottom: 6px;
}
.world-text p {
  margin: 6px 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
}

.md-details {
  margin-top: 12px;
  background: var(--surface-2);
  border-radius: 14px;
  padding: 10px 14px;
}
.md-details > summary {
  cursor: pointer;
  list-style: none;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
  display: inline-flex; align-items: center; gap: 6px;
}
.md-details > summary svg, .world-text > summary svg { color: var(--accent); }
.md-details > summary::-webkit-details-marker { display: none; }
.md-details[open] > summary { color: var(--text); margin-bottom: 6px; }

.md-block, .md-details {
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
}
.md-block { margin-top: 12px; }
.md-block p, .md-details p { margin: 6px 0; }
.md-block ul, .md-details ul {
  margin: 6px 0; padding-left: 20px;
}
.md-block li, .md-details li { margin: 2px 0; }
.md-block a, .md-details a, .world-text a {
  color: var(--accent); text-decoration: none;
}
.md-block a:hover, .md-details a:hover { text-decoration: underline; }

/* ---------- Lock / signup ---------- */
body.locked .tabbar { display: none; }

.lock {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px 18px 20px;
  box-shadow: var(--shadow);
  margin: 12px 0;
}
.lock h2 {
  font-size: 19px; font-weight: 700;
  margin: 8px 0 4px; text-align: center;
}
.lock-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f8c08a, #f5946a);
  color: #fff;
  font-weight: 700; font-size: 24px;
  display: flex; align-items: center; justify-content: center;
  margin: 4px auto 6px;
  
}
.pin-dots {
  display: flex; justify-content: center; gap: 14px;
  padding: 12px 0 6px;
}
.pin-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 1.5px solid #d6cdbe;
  background: transparent;
}
.pin-dot.filled { background: var(--accent); border-color: var(--accent); }
.pin-dots.shake { animation: shake 0.4s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
.pin-msg {
  text-align: center; min-height: 18px;
  color: var(--danger); font-size: 13px; margin-bottom: 6px;
}
.numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-width: 280px;
  margin: 8px auto 0;
}
.np-key {
  height: 56px;
  border: 0;
  border-radius: 16px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 22px;
  font-weight: 500;
  cursor: pointer;
}
.np-key:active { transform: scale(0.97); background: var(--accent-soft); }
.np-spacer { background: transparent; }

.lock.signup { padding: 18px; }
.lock.signup .field { margin: 10px 0; }
.signup-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 14px 0;
  color: var(--muted);
  font-size: 12px;
}
.signup-divider::before, .signup-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}

/* Auth (login / register) tabs */
.auth-tabs {
  display: flex;
  background: var(--surface-2);
  border-radius: var(--radius-pill);
  padding: 4px;
  margin: 0 0 18px;
}
.auth-tab {
  flex: 1;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  padding: 9px 12px;
  border-radius: var(--radius-pill);
  cursor: pointer;
}
.auth-tab.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  
}
.auth-msg {
  min-height: 18px;
  text-align: center;
  font-size: 13px;
  color: var(--danger);
  margin: 6px 0 8px;
}

/* ============================================================
   Mobile-first refinements
   Small phone (< 380px width): tighten paddings and reduce
   typography to keep the editorial feel within thumb-reach.
   ============================================================ */
@media (max-width: 380px) {
  .greet h1 { font-size: 26px; }
  .topbar { padding-left: 16px; padding-right: 16px; }
  .screen { padding-left: 14px; padding-right: 14px; }
  .card,
  .day-card,
  .streak-card,
  .block-card,
  .weekstrip-wrap,
  .cal { padding: 14px; }
  .banner { padding: 14px; gap: 12px; }
  .banner .ico { width: 48px; height: 48px; }
  .tile { width: 44px; height: 44px; border-radius: 14px; }
  .tile.lg { width: 56px; height: 56px; border-radius: 18px; }
  button.primary, button.outline, button.dark, button.secondary {
    padding: 12px 18px;
    font-size: 11.5px;
  }
}

/* iPhone landscape / wide phone — keep one column under 480 */
@media (min-width: 480px) {
  #app { max-width: 480px; }
}

/* Touch targets ≥ 44px */
button, .tab, .wd, .cal-cell, .iconbtn, .check {
  -webkit-tap-highlight-color: transparent;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Native iOS PWA: smoother scrolling */
.screen { -webkit-overflow-scrolling: touch; }

/* Disable visible focus halo on touch, keep for keyboard */
:focus:not(:focus-visible) { outline: none; }
:focus-visible { outline: 2px solid var(--color-ember-orange); outline-offset: 2px; }
