/* Вигляд екранів: капсула дня, кільце циклу, диски, картки, сітка місяця. Токени й основа — у styles.css. */
/* Початковий екран — скляна «пігулка» за зразком власниці (17.11.2026). Відступ однаковий зверху й з боків,
   тому центр кола з Місяцем точно збігається з центром верхнього закруглення пігулки. */
.pill-hero {
  --pill-pad: 18px;
  position: relative; display: flex; flex-direction: column; align-items: center; text-align: center;
  /* Перший екран — пігулка цілком: ширина (а з нею коло й уся висота) рахується від видимої висоти екрана
     мінус шапка, нижнє меню, вміст пігулки під колом і запас (~446 px). */
  width: min(100%, 340px);
  width: min(100%, clamp(200px, calc(100svh - 442px - env(safe-area-inset-bottom)), 340px));
  margin: var(--space-1) auto 0; padding: var(--pill-pad);
  padding-bottom: calc(var(--pill-pad) * 1.6);
  border: 1px solid var(--clear-border); border-radius: 999px; background: var(--clear);
  box-shadow: var(--clear-edge), 0 30px 70px rgba(80, 60, 45, 0.25), 0 4px 12px rgba(80, 60, 45, 0.15);
}
/* Тонке світіння по контуру скла — як кромка на зразку */
.pill-hero::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0) 32%, rgba(255, 255, 255, 0) 70%, rgba(255, 255, 255, 0.22));
  padding: 1px; -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.pill-hero::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(125deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, 0) 78%, rgba(255, 255, 255, 0.1));
}
.pill-moon {
  display: grid; place-items: center; width: 100%; aspect-ratio: 1; border-radius: 50%; overflow: hidden;
  background: transparent;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.85), inset 8px 0 18px -12px rgba(40, 30, 20, 0.45), inset -8px 0 18px -12px rgba(255, 255, 255, 0.8);
}
.pill-moon .moon { display: block; width: 88%; height: auto; filter: drop-shadow(0 0 16px var(--moon-glow)); }
.pill-heading { position: relative; margin: var(--space-3) 0 2px; }
.pill-title {
  margin: 0; font: 200 clamp(40px, 7svh, 64px)/1 var(--font-body); letter-spacing: 0.02em; text-transform: uppercase;
  color: var(--text); text-shadow: 0 0 6px var(--glow), 0 0 18px rgba(255, 255, 255, 0.95), 0 0 42px rgba(255, 255, 255, 0.7);
}
.pill-kicker { position: absolute; right: 0; top: -10px; font-size: 12px; letter-spacing: 0.04em; color: var(--muted); white-space: nowrap; }
.pill-facts {
  list-style: none; align-self: stretch; display: grid; gap: 6px;
  margin: var(--space-3) 0 0; padding: 0 var(--space-1); text-align: left;
}
.pill-fact { display: grid; grid-template-columns: 20px 1fr; gap: 10px; align-items: start; font-size: 13px; line-height: 1.3; color: var(--muted); }
.fact-icon { width: 20px; height: 20px; color: var(--text); fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.fact-text { display: flex; flex-direction: column; }
.fact-text span + span { font-size: 12px; }
.pill-btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; margin-top: var(--space-3); padding: 0 22px;
  border: 1.5px solid var(--pill-line); border-radius: 999px; background: var(--tint);
  color: var(--text); font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; text-decoration: none;
  transition: background 0.2s, transform 0.15s;
}
.pill-btn:hover { background: rgba(255, 255, 255, 0.7); }
.pill-tag {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 14px 5px 6px; border-radius: 999px;
  background: var(--tint); border: 1px solid var(--border); color: var(--text); font-size: 14px; font-weight: 500;
}
.pill-tag > span:only-child { padding-left: 8px; }
.btn-cream {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); align-self: stretch;
  min-height: 52px; padding: 0 8px 0 var(--space-5); border-radius: 999px;
  background: var(--btn-bg); color: var(--on-accent); font-weight: 600; text-decoration: none;
}
.btn-cream:hover { background: var(--accent-strong); }
.btn-arrow {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid rgba(51, 54, 58, 0.25); font-size: 18px;
}

/* Кільце місячного циклу */
.cycle-card {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: var(--space-4);
  margin-top: var(--space-3); padding: var(--space-4) var(--space-5);
  border: 1px solid var(--clear-border); border-radius: var(--radius); background: var(--clear);
}
.cycle-label { font-size: 14px; color: var(--muted); margin: 0; }
.cycle-value { font: 300 28px/1.2 var(--font-head); margin: 2px 0; letter-spacing: -0.015em; }
.cycle-rest { font-size: 14px; color: var(--muted); margin: 0 0 var(--space-3); }
.cycle-bar { display: block; width: 100%; height: 6px; }
.bar-track { fill: var(--line); }
.bar-value { fill: var(--shape-sage); }
.ring { width: 76px; height: 76px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 5; }
.ring-track { stroke: var(--line); }
.ring-value { stroke: var(--shape-gold); stroke-linecap: round; }

/* Круглі диски з секторами й поділками (фаза, місячний день) */
.dials { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); margin-top: var(--space-3); }
.dial-card {
  margin: 0; padding: var(--space-4) var(--space-3); text-align: center;
  border: 1px solid var(--clear-border); border-radius: var(--radius); background: var(--clear);
}
.dial { display: block; width: 100%; max-width: 156px; height: auto; margin: 0 auto var(--space-3); filter: drop-shadow(0 6px 14px rgba(80, 60, 45, 0.18)); }
.dial-face { fill: rgba(255, 255, 255, 0.4); stroke: var(--border); }
.dial-sector { fill: rgba(70, 55, 45, 0.04); stroke: var(--line); stroke-width: 0.6; }
.dial-sector.is-past { fill: var(--shape-beige); }
.dial-sector.is-on { fill: var(--shape-sage); fill-opacity: 0.95; }
.dial-tick { stroke: var(--line); stroke-width: 1; }
.dial-tick.is-long { stroke: var(--line-strong); stroke-width: 1.4; }
.dial-hub { fill: rgba(252, 249, 245, 0.95); stroke: var(--border); }
.dial-num { fill: var(--text); font: 300 32px var(--font-head); }
.dial-card figcaption { display: flex; flex-direction: column; gap: 2px; }
.dial-label { font-size: 13px; color: var(--muted); }
.dial-value { font: 400 17px/1.25 var(--font-head); }

.section-title { font-size: 24px; margin: var(--space-6) 0 var(--space-3); }
.page-title { font-size: 30px; margin: var(--space-2) 0 var(--space-3); }
.lead { font-size: 17px; }

/* Картки й нумеровані місячні дні */
.card {
  background: var(--clear); border: 1px solid var(--clear-border); border-radius: var(--radius);
  padding: var(--space-4) var(--space-5); margin-bottom: var(--space-3);
}
@media (max-width: 420px) { .card { padding: var(--space-4); } }
.lunar-steps { list-style: none; margin: 0; padding: 0; }
.card-head { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2) var(--space-3); margin-bottom: var(--space-2); }
.card-head h3 { font-size: 21px; margin-right: auto; }
.step-num {
  display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 50%;
  background: var(--accent-bg); border: 1px solid var(--border); color: var(--accent); font-size: 15px; font-weight: 600;
}
.lunar-card.is-current { border-color: rgba(127, 174, 154, 0.7); }
.lunar-card.is-current .step-num { background: var(--shape-sage); color: var(--on-accent); border-color: var(--shape-sage); }
.lunar-card.is-personal { box-shadow: inset 4px 0 0 var(--personal), var(--clear-edge), var(--shadow); }
.lunar-time { font-size: 15px; }
.lunar-title { font: 500 18px/1.4 var(--font-head); margin: var(--space-3) 0; }
.badge { font-size: 13px; font-weight: 600; padding: 3px 11px; border-radius: 999px; }
.badge-now { background: rgba(127, 174, 154, 0.18); color: var(--sage); border: 1px solid rgba(127, 174, 154, 0.5); }
.badge-personal { background: var(--personal-bg); color: var(--personal); }
.personal-note { color: var(--personal); font-weight: 600; }
dl { margin: 0; }
.field { margin-top: var(--space-3); }
.field dt { font-size: 12px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.field dd { margin: 2px 0 0; }
.empty { font-style: italic; }
.beauty { margin-top: var(--space-4); padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm); border: 1px solid var(--clear-border); background: var(--clear); }
.beauty h4 { font-size: 17px; margin-bottom: var(--space-1); }
.beauty-energy { font-weight: 600; }

/* Сітка місяця */
.month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.month-head { text-align: center; font-size: 13px; font-weight: 600; color: var(--muted); padding: var(--space-1) 0; text-shadow: var(--on-photo-shadow); }
.day-cell {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px;
  min-height: 76px; padding: 6px 2px; border-radius: var(--radius-sm); border: 1px solid var(--clear-border);
  background: var(--clear); color: var(--text); text-decoration: none;
}
.day-cell:hover { border-color: var(--accent); }
.day-cell.is-outside { opacity: 0.5; }
.day-cell.is-today { border: 1.5px solid var(--sage); background: rgba(127, 174, 154, 0.25); }
.day-cell.is-personal::after {
  content: ""; position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--personal);
}
.day-num { font-weight: 500; font-size: 15px; }
.lunar-num { font-size: 12px; color: var(--muted); }
.event { position: absolute; top: 4px; left: 6px; font-size: 11px; color: var(--gold); }
.legend { font-size: 14px; margin-top: var(--space-3); }
.event-list { padding-left: var(--space-5); }
.event-list li { margin-bottom: var(--space-1); }

/* Телефон: шапка без логотипа (рішення власниці 17.11.2026) — кнопки теми й міста у верхніх кутах поверх фону,
   пігулка починається від самого верху й забирає звільнене місце (~60 px). ПК не змінюється. */
@media (max-aspect-ratio: 1/1) {
  .brand { display: none; }
  .top { position: absolute; top: 0; left: 0; right: 0; z-index: 4; pointer-events: none; }
  .top .top-actions { flex: 1; justify-content: space-between; pointer-events: auto; }
  .pill-hero {
    /* --pill-shift ставить src/ui/pillClear.js: пігулка опускається рівно настільки, щоб кнопки вгорі її не торкались,
       і на стільки ж вужчає — перший екран усе одно вміщається. */
    margin-top: calc(env(safe-area-inset-top) + var(--space-2) + var(--pill-shift, 0px));
    width: min(100%, clamp(200px, calc(100svh - 382px - var(--pill-shift, 0px) - env(safe-area-inset-bottom) - env(safe-area-inset-top)), 340px));
  }
}
/* Нижнє меню телефона — скляні плитки за зразком власниці (17.11.2026); на кожній лише назва (кольорові «папки»
   й підписи власниця попросила прибрати). Активний розділ піднятий. На ПК (від 760 px) — колишній ряд кнопок угорі. */
@media (max-width: 759px) {
  .tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--space-2); padding: var(--space-2) var(--space-3) calc(var(--space-2) + env(safe-area-inset-bottom));
    background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.12)); border-top: 0;
    -webkit-backdrop-filter: none; backdrop-filter: none;
  }
  .tabs a {
    display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 48px; padding: 0 6px;
    border-radius: 18px; background: var(--glass); border: 1px solid var(--clear-border); color: var(--text);
    -webkit-backdrop-filter: var(--glass-filter); backdrop-filter: var(--glass-filter);
    box-shadow: var(--glass-edge), 0 10px 22px rgba(0, 0, 0, 0.18);
  }
  .tabs a[aria-current="page"] {
    transform: translateY(-5px); color: var(--text);
    box-shadow: var(--glass-edge), 0 0 0 1px var(--clear-border), 0 16px 30px rgba(0, 0, 0, 0.28);
  }
  .tabs .tab-chip, .tabs .tab-sub { display: none; }
  .tab-title { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
/* Дуже низькі екрани (iPhone SE у Safari тощо): коло менше, пігулка на всю ширину зі скругленими кутами,
   щоб рядки не дробились і перший віджет усе одно вміщався цілком. */
@media (max-height: 600px) {
  /* Пігулка тут на всю ширину — опускаємо її під кнопки теми й міста, щоб вони не накривали кути. */
  .pill-hero { width: min(100%, 340px); border-radius: 36px; margin-top: calc(env(safe-area-inset-top) + 70px); }
  .pill-moon { width: clamp(72px, calc(100svh - 466px), 150px); }
  .pill-title { font-size: 36px; }
  .pill-heading { margin-top: var(--space-2); }
}

/* Календар циклу (рішення власниці 17.11.2026): підсумок, місяць із відмітками, записи */
.cycle-day { margin: 0; font: 300 30px/1.15 var(--font-head); }
.cycle-phase { margin: 2px 0 var(--space-1); font-weight: 600; }
.cycle-facts { display: grid; grid-template-columns: auto 1fr; gap: 4px var(--space-3); margin-top: var(--space-3); }
.cycle-facts dt { color: var(--muted); }
.cycle-facts dd { margin: 0; font-weight: 500; }
.cycle-late { margin-top: var(--space-3); color: var(--personal); }
.cycle-month-title { font-size: 19px; margin-bottom: var(--space-2); }
.cycle-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; text-align: center; }
.cycle-head { font-size: 12px; font-weight: 600; color: var(--muted); }
.cycle-cell { display: grid; place-items: center; aspect-ratio: 1; border-radius: 50%; font-size: 14px; border: 1.5px solid transparent; }
.cycle-cell.is-today { border-color: var(--text); font-weight: 700; }
.cycle-cell.is-period, .dot.is-period { background: var(--cycle-period); }
.cycle-cell.is-predicted, .dot.is-predicted { border: 1.5px dashed var(--cycle-period); }
.cycle-cell.is-fertile, .dot.is-fertile { background: var(--cycle-fertile); }
.cycle-cell.is-ovulation, .dot.is-ovulation { background: var(--cycle-fertile); border: 2px solid var(--cycle-ovulation); }
.cycle-legend { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); font-size: 13px; text-shadow: var(--on-photo-shadow); }
.cycle-legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; }
.cycle-records { list-style: none; margin: var(--space-2) 0 0; padding: 0; }
.cycle-records li { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); padding: var(--space-2) 0; border-top: 1px solid var(--line); }
.cycle-records li:first-child { border-top: 0; }
#cycle-delete-all { margin: var(--space-2) 0 var(--space-6); }