/* =============================================================================
   Bloom — компоненти
   ============================================================================= */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* Каркас телефона для прев'ю на десктопі.
   На самому телефоні рамка зникає і додаток займає весь екран. */
.phone {
  max-width: 420px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  padding-bottom: calc(var(--tabbar-h) + 24px);
}

@media (min-width: 480px) {
  body { background: #F2EBE3; padding: 24px 0; }
  .phone {
    background: var(--bg);
    border-radius: 40px;
    box-shadow: 0 24px 60px rgba(46, 40, 35, 0.14);
    overflow: hidden;
    min-height: 860px;
  }
}

.screen { padding: 0 var(--pad-screen); }

/* ── Шапка ─────────────────────────────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px var(--pad-screen) 16px;
}

.greeting {
  font-family: var(--font-display);
  font-size: var(--size-xl);
  font-weight: 500;
  margin: 0;
  letter-spacing: -0.01em;
}

.greeting em {
  font-style: italic;
  color: var(--accent);
}

.avatar {
  width: 42px; height: 42px;
  border-radius: var(--radius-pill);
  background: var(--card-lilac);
  display: grid; place-items: center;
  font-size: var(--size-md);
  flex-shrink: 0;
}

/* ── Головна картка: «Твій день» ───────────────────────────────────────── */

.today {
  background: linear-gradient(160deg, var(--pink-soft) 0%, var(--lilac-soft) 100%);
  border-radius: var(--radius-card);
  padding: 26px 22px 22px;
  text-align: center;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

/* Декоративна пляма — м'яка, як на мудборді */
.today::after {
  content: '';
  position: absolute;
  width: 180px; height: 180px;
  right: -70px; top: -70px;
  background: var(--card-butter);
  border-radius: 50%;
  opacity: 0.35;
  pointer-events: none;
}

.today__label {
  font-size: var(--size-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 0 0 6px;
}

.ring { position: relative; width: 176px; height: 176px; margin: 4px auto 10px; }
.ring svg { transform: rotate(-90deg); display: block; }
.ring__track { stroke: rgba(46, 40, 35, 0.07); }
.ring__fill  { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 1s ease; }

.ring__center {
  position: absolute; inset: 0;
  display: grid; place-content: center; gap: 0;
  text-align: center;
}

.ring__value {
  font-family: var(--font-display);
  font-size: var(--size-hero);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.03em;
}

/* Цифра ніколи не стоїть сама: без словесного пояснення
   число викликає тривогу, а не допомагає. */
.ring__state {
  font-size: var(--size-sm);
  color: var(--ink-muted);
  margin-top: 4px;
}

.today__phrase {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--size-lg);
  line-height: 1.35;
  margin: 6px 4px 0;
  position: relative;
}

/* ── Смужка фази циклу ─────────────────────────────────────────────────── */

.phase {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border-radius: var(--radius-card);
  padding: 16px 18px;
  margin-top: var(--gap);
  box-shadow: var(--shadow-card);
}

.phase__dot {
  width: 40px; height: 40px;
  border-radius: var(--radius-pill);
  background: var(--card-pink);
  display: grid; place-items: center;
  flex-shrink: 0;
}

.phase__title { font-weight: 500; font-size: var(--size-sm); margin: 0; }
.phase__hint  { font-size: var(--size-xs); color: var(--ink-muted); margin: 2px 0 0; }

/* ── Заголовок секції ──────────────────────────────────────────────────── */

.section-title {
  font-size: var(--size-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 26px 0 12px;
  padding: 0 4px;
}

/* ── Bento-сітка рекомендацій ──────────────────────────────────────────── */

.bento {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
}

.card {
  border-radius: var(--radius-card);
  padding: 18px;
  box-shadow: var(--shadow-card);
  border: none;
  font-family: inherit;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 132px;
  position: relative;
  overflow: hidden;
}

.card:active { transform: scale(0.98); box-shadow: var(--shadow-lift); }

.card--pink   { background: var(--card-pink); }
.card--lilac  { background: var(--card-lilac); }
.card--sage   { background: var(--card-sage); }
.card--butter { background: var(--card-butter); }
.card--wide   { grid-column: 1 / -1; min-height: 96px; flex-direction: row; align-items: center; gap: 16px; }

.card__icon { font-size: 22px; }
.card__title { font-weight: 500; font-size: var(--size-md); margin: 10px 0 2px; }
.card__meta  { font-size: var(--size-xs); color: rgba(46, 40, 35, 0.6); }

.card__big {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
}

/* ── Рядок метрик за сьогодні ──────────────────────────────────────────── */

.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  background: var(--surface);
  border-radius: var(--radius-card);
  padding: 16px 10px;
  box-shadow: var(--shadow-card);
}

.metric { text-align: center; }
.metric__icon  { font-size: 17px; }
.metric__value {
  font-family: var(--font-display);
  font-size: var(--size-lg);
  font-weight: 600;
  margin-top: 3px;
  letter-spacing: -0.02em;
}
.metric__label { font-size: 10px; color: var(--ink-muted); letter-spacing: 0.04em; }

/* Стан «даних немає» — пояснює, що робити, а не показує прочерк */
.metric--empty .metric__value { color: var(--ink-muted); opacity: 0.45; }

/* ── Кнопка «Сьогодні я не можу» ───────────────────────────────────────── */

.soft-day {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  margin-top: 22px;
  padding: 16px;
  border: 1.5px dashed rgba(46, 40, 35, 0.16);
  border-radius: var(--radius-card);
  background: transparent;
  color: var(--ink-muted);
  font-family: inherit;
  font-size: var(--size-sm);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.soft-day:active { background: var(--sage-soft); color: var(--ink); }

/* ── Нижня навігація: рівно 5 пунктів ──────────────────────────────────── */

.tabbar {
  position: absolute;
  left: 12px; right: 12px; bottom: 12px;
  height: var(--tabbar-h);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-lift);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
}

@media (max-width: 479px) { .tabbar { position: fixed; max-width: 396px; margin: 0 auto; } }

.tab {
  background: none; border: none;
  display: grid; place-items: center; gap: 3px;
  font-family: inherit;
  font-size: 10px;
  color: var(--ink-muted);
  cursor: pointer;
  padding: 8px 0;
}

.tab__icon { font-size: 19px; line-height: 1; }
.tab[aria-current='page'] { color: var(--accent); font-weight: 500; }

/* ── Лінійні ілюстрації (рішення 20-Б, правило D-1) ────────────────────── */

.line-art { stroke: var(--ink); fill: none; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; opacity: 0.55; }

/* ── Плашка прев'ю ─────────────────────────────────────────────────────── */

.preview-note {
  max-width: 420px;
  margin: 0 auto 16px;
  padding: 12px 16px;
  background: var(--butter-soft);
  border-radius: var(--radius-inner);
  font-size: var(--size-xs);
  color: var(--ink-muted);
  text-align: center;
}

/* =============================================================================
   СПІЛЬНІ КОМПОНЕНТИ
   =============================================================================
   Були розкидані по CSS окремих сторінок — через це кнопка «Зберегти»
   на екрані циклу лишалась без стилів, бо cycle.html не підключав
   onboarding.css. Усе, що використовується більш ніж на одному екрані,
   живе тут.
   ============================================================================= */

/* Атрибут hidden має перемагати будь-який display у компонентах.
   Без цього .field { display: block } показував поле імені на вході. */
[hidden] { display: none !important; }

/* ── Кнопки ────────────────────────────────────────────────────────────── */

.btn {
  flex: 1;
  padding: 15px;
  border-radius: var(--radius-pill);
  border: none;
  font-family: inherit;
  font-size: var(--size-sm);
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.12s ease;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.35; cursor: default; }
.btn--primary { background: var(--accent); color: #fff; flex: 2; }
.btn--ghost   { background: transparent; color: var(--ink-muted); }

/* ── Поля вводу ────────────────────────────────────────────────────────── */

.field { display: block; }

.field__label {
  display: block;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 6px;
}

.field__input {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid transparent;
  border-radius: var(--radius-inner);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  font-family: inherit;
  font-size: var(--size-md);
  color: var(--ink);
  transition: border-color 0.18s ease;
}
.field__input:focus { outline: none; border-color: var(--accent); }

.field__hint {
  display: block;
  font-size: var(--size-xs);
  color: var(--ink-muted);
  margin-top: 5px;
}

/* ── Нижня панель ──────────────────────────────────────────────────────── */

.sheet { position: fixed; inset: 0; z-index: 50; }
.sheet__backdrop { position: absolute; inset: 0; background: rgba(46, 40, 35, 0.32); }

.sheet__body {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  max-width: 420px;
  margin: 0 auto;
  background: var(--bg);
  border-radius: 28px 28px 0 0;
  padding: 12px 20px 28px;
  max-height: 88vh;
  overflow-y: auto;
  animation: slideUp 0.28s ease;
}

@keyframes slideUp { from { transform: translateY(100%); } to { transform: none; } }

.sheet__grip {
  width: 38px; height: 4px;
  background: rgba(46, 40, 35, 0.16);
  border-radius: var(--radius-pill);
  margin: 0 auto 16px;
}

.sheet__title {
  font-family: var(--font-display);
  font-size: var(--size-lg);
  font-weight: 500;
  margin: 0 0 18px;
}

.sheet__label {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 16px 0 8px;
}

.sheet__save { width: 100%; margin-top: 22px; }

/* ── Сітка варіантів вибору ────────────────────────────────────────────── */

.opts { display: grid; gap: 10px; }
.opts--compact { grid-template-columns: 1fr 1fr; }

/* ── Чипи вибору ───────────────────────────────────────────────────────── */

.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chips--wrap { flex-wrap: wrap; }

.chip {
  padding: 9px 13px;
  border: 1.5px solid transparent;
  background: var(--surface);
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: var(--size-xs);
  color: var(--ink);
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.chip.is-on { border-color: var(--accent); background: var(--pink-soft); }

/* ── Вкладка, що ще не готова ──────────────────────────────────────────── */

.tab--soon { opacity: 0.4; }

/* Повідомлення про екран у роботі */
.nav-toast {
  position: absolute;
  left: 20px; right: 20px;
  bottom: calc(var(--tabbar-h) + 22px);
  padding: 11px 16px;
  background: var(--ink);
  color: var(--bg);
  border-radius: var(--radius-pill);
  font-size: var(--size-xs);
  text-align: center;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .22s ease, transform .22s ease;
  pointer-events: none;
  z-index: 40;
}
.nav-toast.is-on { opacity: 1; transform: none; }

@media (max-width: 479px) {
  .nav-toast { position: fixed; max-width: 380px; margin: 0 auto; }
}

/* Явна кнопка закриття панелі.
   Дотик по фону не працює, коли вміст високий: панель перекриває
   весь екран, і закрити її стає нічим. */
.sheet__x {
  position: absolute;
  top: 10px; right: 14px;
  width: 34px; height: 34px;
  border: none; background: rgba(46, 40, 35, 0.06);
  border-radius: var(--radius-pill);
  font-size: 21px; line-height: 1;
  color: var(--ink-muted);
  cursor: pointer;
  z-index: 2;
}

/* ── Сповіщення ────────────────────────────────────────────────────────── */

.topbar { gap: 8px; }

.bell {
  position: relative;
  width: 42px; height: 42px; flex-shrink: 0;
  margin-left: auto;
  border: none; border-radius: var(--radius-pill);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  display: grid; place-items: center; cursor: pointer;
}
.bell__dot {
  position: absolute; top: 9px; right: 10px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--surface);
}

.notes { display: grid; gap: 9px; }

.note {
  background: var(--surface);
  border-radius: var(--radius-inner);
  padding: 14px 16px;
  box-shadow: var(--shadow-card);
}
.note.is-new { background: var(--pink-soft); }

.note__head {
  display: flex; align-items: baseline; gap: 8px;
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-muted); margin-bottom: 5px;
}
.note__when { margin-left: auto; letter-spacing: 0; text-transform: none; }
.note__body { font-size: var(--size-sm); line-height: 1.5; }

.notes-empty {
  text-align: center; padding: 26px 16px;
  color: var(--ink-muted); font-size: var(--size-sm); line-height: 1.5;
}

/* ── Оновлення свайпом ─────────────────────────────────────────────────── */

.ptr {
  position: fixed;
  top: -46px; left: 50%;
  margin-left: -18px;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-card);
  display: grid; place-items: center;
  opacity: 0;
  z-index: 80;
  pointer-events: none;
}
.ptr.is-animating { transition: transform .28s ease, opacity .28s ease; }

.ptr__spin {
  width: 15px; height: 15px;
  border: 2px solid rgba(46, 40, 35, .16);
  border-top-color: var(--accent);
  border-radius: 50%;
}
.ptr.is-armed .ptr__spin { border-top-color: var(--accent); transform: rotate(180deg); transition: transform .2s ease; }
.ptr.is-loading .ptr__spin { animation: ptr-spin .7s linear infinite; }

@keyframes ptr-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .ptr.is-loading .ptr__spin { animation-duration: 2s; }
}

/* ── Підказка про підключення годинника ────────────────────────────────── */

.connect-hint {
  display: flex; align-items: center; gap: 13px;
  margin-top: var(--gap);
  padding: 15px 17px;
  background: var(--butter-soft);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  text-decoration: none;
  color: var(--ink);
}
.connect-hint__icon {
  width: 38px; height: 38px; flex-shrink: 0;
  border-radius: var(--radius-pill);
  background: var(--surface);
  display: grid; place-items: center; font-size: 18px;
}
.connect-hint__body { flex: 1; min-width: 0; }
.connect-hint__title { display: block; font-size: var(--size-sm); font-weight: 500; }
.connect-hint__text {
  display: block; font-size: var(--size-xs);
  color: var(--ink-muted); line-height: 1.4; margin-top: 3px;
}
.connect-hint__go { font-size: 18px; opacity: .45; flex-shrink: 0; }
