/* my luna 9 — мини-апп. Цвета и шрифты только из tokens.css. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; padding: 0; }
ul, ol { list-style: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: inherit; }
a { color: inherit; }
.icon { width: 24px; height: 24px; flex: none; }
:focus-visible { outline: 2px solid var(--rose-ink); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }

/* тона для иконок и подсветок */
.tone-sage { --tone: var(--sage-ink); --tone-tint: var(--sage-tint); }
.tone-rose { --tone: var(--rose-ink); --tone-tint: var(--rose-tint); }
.tone-honey { --tone: var(--honey-ink); --tone-tint: var(--honey-tint); }
.tone-apricot { --tone: var(--apricot-ink); --tone-tint: var(--apricot-tint); }
.tone-blueberry { --tone: var(--blueberry-ink); --tone-tint: var(--blueberry-tint); }
.tone-lavender { --tone: var(--lavender-ink); --tone-tint: var(--lavender-tint); }
.tone-plain { --tone: var(--ink-2); --tone-tint: var(--surface-2); }

/* ---------- каркас ---------- */
.app { max-width: 480px; margin: 0 auto; min-height: 100dvh; }
.screen {
  padding: calc(8px + var(--tg-content-safe-area-inset-top, 0px) + var(--tg-safe-area-inset-top, 0px)) 16px calc(96px + env(safe-area-inset-bottom));
}
.screen.is-onboarding { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.proto-bar {
  margin: 0 auto;
  max-width: 480px;
  padding: 8px 16px;
  font-size: 12px;
  color: var(--ink-2);
  border-bottom: 1px solid var(--line);
}

.is-shot .proto-bar { display: none; }
.screen-head { display: grid; gap: 4px; padding: 12px 4px 18px; }
.kicker { font-size: 13px; color: var(--ink-2); }
.kicker.accent { color: var(--rose-ink); font-weight: 600; }
.title {
  font-family: var(--font-display);
  font-weight: 650;
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.lead { font-size: 15px; color: var(--ink-2); max-width: 36ch; }
.back-link {
  display: inline-flex; align-items: center; gap: 2px;
  margin: 0 0 6px -6px; padding: 6px 8px 6px 2px;
  color: var(--rose-ink); font-weight: 600; font-size: 15px;
  justify-self: start;
}

.block { margin-top: 28px; }
.block.first { margin-top: 4px; }
.block-title {
  font-family: var(--font-display);
  font-weight: 650;
  font-size: 21px;
  line-height: 1.2;
  margin: 0 4px 10px;
}
.block-lead { font-size: 14px; color: var(--ink-2); margin: -4px 4px 10px; }
.block-lead.small { font-size: 13px; margin: 8px 4px 0; }
.source { margin: 20px 4px 0; font-size: 12.5px; line-height: 1.45; color: var(--ink-2); }
.choice-grid { display: grid; gap: 8px; }
.choice { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--surface); text-align: left; }
.choice.active { border-color: var(--rose-ink); background: var(--rose-tint); color: var(--rose-ink); font-weight: 650; }
.feature-card { padding: 18px; border-radius: var(--radius-card); background: var(--sage-tint); color: var(--sage-ink); }
.feature-card p { margin-top: 6px; color: var(--ink); }
.entry-form { display: flex; gap: 8px; margin: 10px 0 12px; }
.entry-form input { min-width: 0; flex: 1; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--surface); color: var(--ink); }
.entry-form .primary { padding: 0 14px; }
.entry-list { display: grid; gap: 8px; }
.entry { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--surface); }
.entry span { flex: 1; }
.entry > button { color: var(--rose-ink); font-size: 18px; }
.entry.is-done span { color: var(--ink-2); text-decoration: line-through; }
.empty { color: var(--ink-2); font-size: 14px; }
.guide-list { display: grid; gap: 10px; }
.guide-item { display: block; width: 100%; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--surface); text-align: left; }
.guide-button { position: relative; padding-right: 42px; }
.guide-button b, .guide-button small { display: block; }
.guide-button small { margin-top: 4px; color: var(--ink-2); }
.guide-button span { position: absolute; right: 16px; top: 17px; color: var(--rose-ink); }
.guide-item summary { cursor: pointer; font-weight: 650; }
.guide-item p { margin-top: 10px; color: var(--ink-2); }
.danger { color: var(--critical) !important; }

/* ---------- «Сегодня» ---------- */
.hero {
  background: var(--surface);
  border-radius: var(--radius-sheet);
  padding: 18px 18px 4px;
  box-shadow: var(--shadow-lift);
}
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.week { display: flex; align-items: flex-end; gap: 10px; }
.week-num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 88px;
  line-height: 0.8;
  letter-spacing: -0.03em;
  color: var(--rose);
  font-variant-numeric: lining-nums;
}
.week-label { font-family: var(--font-display); font-weight: 600; font-size: 20px; line-height: 1.05; padding-bottom: 2px; }
.berry { width: 68px; height: 68px; flex: none; }
.hero-size { margin-top: 14px; font-size: 15px; }

.moons { margin: 16px 0 4px; }
.moons svg { display: block; width: 100%; height: auto; overflow: visible; }
.moons-thread { stroke: var(--line); stroke-width: 2; stroke-dasharray: 5 5; stroke-linecap: round; }
.moons-sep { stroke: var(--ink-2); stroke-width: 1.4; opacity: .5; stroke-linecap: round; }
.moon-dark { fill: var(--surface); }
.moon-lit { fill: var(--honey); }
.moon-ring { fill: none; stroke: var(--line); stroke-width: 1.8; }
.moon-ring-past { fill: none; stroke: var(--honey); stroke-width: 1.8; }
.moon-ring-now { fill: none; stroke: var(--rose); stroke-width: 2.2; }
.moons-labels { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 6px; font-size: 12px; color: var(--ink-2); }
.moons-labels span:last-child { display: flex; justify-content: space-between; gap: 6px; }
.moons-labels b { font-weight: 600; color: var(--honey-ink); white-space: nowrap; }

.row-link {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 12px; padding: 14px 0;
  border-top: 1px solid var(--line);
  font-weight: 600; color: var(--rose-ink);
}
.row-link .icon { width: 20px; height: 20px; }

.tasks { background: var(--surface); border-radius: var(--radius-card); }
.task { display: grid; grid-template-columns: 28px 1fr; gap: 12px; padding: 14px 16px; }
.task + .task { border-top: 1px solid var(--line); }
.check {
  width: 26px; height: 26px; margin-top: 1px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 2px solid var(--line);
  color: transparent;
  transition: background-color .2s, border-color .2s;
}
.check .icon { width: 16px; height: 16px; }
.check .check-path { stroke-dasharray: 22; stroke-dashoffset: 22; }
.task.is-done .check { background: var(--sage); border-color: var(--sage); color: var(--surface); }
.task.is-done .check .check-path { stroke-dashoffset: 0; transition: stroke-dashoffset .35s ease-out .05s; }
.task-title { font-weight: 600; }
.task-note { margin-top: 3px; font-size: 13.5px; color: var(--ink-2); }
.task.is-done .task-title { color: var(--ink-2); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 9px 14px;
  border-radius: var(--radius-chip);
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 14px; font-weight: 500;
}
.chip.is-on { background: var(--rose-tint); border-color: var(--rose-ink); color: var(--ink); }
.mood-reply { margin-top: 12px; padding: 10px 12px; border-radius: 14px; background: var(--sage-tint); font-size: 14px; }
.link-critical {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 14px; padding: 4px 0;
  color: var(--critical); font-size: 14px; font-weight: 600;
}
.link-critical .icon { width: 20px; height: 20px; }

.advice { margin-top: 28px; padding: 16px; border-radius: var(--radius-card); background: var(--tone-tint); }
.advice-from { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--tone); }
.advice-from .icon { width: 20px; height: 20px; }
.advice-text { margin: 8px 0 6px; font-size: 16px; line-height: 1.45; }
.advice-note { font-size: 13px; color: var(--ink-2); }
.text-button { padding: 10px 0 2px; color: var(--tone, var(--rose-ink)); font-weight: 600; font-size: 14.5px; }

.card-row, .list-item {
  width: 100%;
  display: grid; grid-template-columns: 40px 1fr 20px; align-items: center; gap: 12px;
  padding: 12px 16px;
  text-align: left;
}
.card-row { margin-top: 12px; background: var(--surface); border-radius: var(--radius-card); }
.card-row > .icon, .list-item > .icon { width: 20px; height: 20px; color: var(--ink-2); }
.card-row-text { display: grid; gap: 2px; min-width: 0; }
.card-row-text b { font-weight: 600; }
.card-row-text small { font-size: 13px; color: var(--ink-2); }
.dot-icon {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--tone-tint); color: var(--tone);
}
.dot-icon.square { border-radius: 12px; }
.dot-icon .icon { width: 22px; height: 22px; }
.dot-icon.letter { font-family: var(--font-display); font-weight: 700; font-size: 17px; }

/* ---------- «Неделя», «Когда нельзя ждать» ---------- */
.bullets, .questions { background: var(--surface); border-radius: var(--radius-card); padding: 6px 16px; }
.bullets li, .questions li { position: relative; padding: 9px 0 9px 18px; }
.bullets li + li, .questions li + li { border-top: 1px solid var(--line); }
.bullets li::before { content: ""; position: absolute; left: 2px; top: 17px; width: 6px; height: 6px; border-radius: 50%; background: var(--rose); }
.questions li::before { content: "?"; position: absolute; left: 0; top: 9px; font-weight: 700; color: var(--rose-ink); }
.note { margin-top: 10px; padding: 10px 12px; border-radius: 14px; background: var(--tone-tint); color: var(--ink); font-size: 14px; }

.alert { margin-top: 12px; padding: 16px; border-radius: var(--radius-card); }
.alert h2 { font-family: var(--font-display); font-size: 19px; font-weight: 700; line-height: 1.2; }
.alert ul { margin-top: 8px; }
.alert li { position: relative; padding: 5px 0 5px 16px; }
.alert li::before { content: ""; position: absolute; left: 0; top: 13px; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .6; }
.alert-critical { background: var(--critical-tint); }
.alert-critical h2 { color: var(--critical); }
.alert-honey { background: var(--honey-tint); }
.alert-honey h2 { color: var(--honey-ink); }
.call-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.call {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; border-radius: 14px;
  background: var(--critical); color: #FFFFFF;
  text-decoration: none; font-weight: 700; font-size: 18px;
  font-variant-numeric: tabular-nums;
}
:root[data-theme="dark"] .call { color: #1B1522; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .call { color: #1B1522; } }
.call .icon { width: 20px; height: 20px; }

/* ---------- «План» ---------- */
.timeline { position: relative; margin-top: 4px; }
.tl-item { position: relative; padding: 0 0 22px 40px; }
.tl-item::before {
  content: ""; position: absolute; left: 13px; top: 20px; bottom: -4px; width: 2px;
  background: repeating-linear-gradient(to bottom, var(--line) 0 6px, transparent 6px 12px);
}
.tl-item:last-child::before { display: none; }
.tl-item.is-now::before { background: linear-gradient(to bottom, var(--rose) 0 30%, transparent 30%), repeating-linear-gradient(to bottom, var(--line) 0 6px, transparent 6px 12px); }
.tl-marker {
  position: absolute; left: 7px; top: 5px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--ground); border: 2px solid var(--line);
}
.tl-item.is-next .tl-marker { border-color: var(--rose); }
.tl-item.is-goal .tl-marker { background: var(--honey); border-color: var(--honey); }
.tl-item.is-now .tl-marker { left: 2px; top: 1px; width: 24px; height: 24px; border: 0; border-radius: 0; background: none; }
.tl-moon { width: 24px; height: 24px; display: block; overflow: visible; }
.tl-when { font-size: 13px; font-weight: 600; color: var(--honey-ink); font-variant-numeric: tabular-nums; }
.tl-when span { margin-left: 8px; font-weight: 400; color: var(--ink-2); }
.tl-title { margin-top: 2px; font-size: 16.5px; font-weight: 650; line-height: 1.3; }
.tl-note { margin-top: 3px; font-size: 14px; color: var(--ink-2); }
.tl-badge {
  display: inline-block; margin-top: 8px; padding: 3px 9px;
  border-radius: var(--radius-chip);
  background: var(--rose-tint); color: var(--rose-ink);
  font-size: 12px; font-weight: 600;
}

/* ---------- «Меню» ---------- */
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.day {
  min-height: 44px; border-radius: var(--radius-control);
  background: var(--surface); border: 1px solid var(--line);
  font-size: 14px; font-weight: 600; text-align: center;
}
.day.is-on { background: var(--ink); border-color: var(--ink); color: var(--ground); }
.meals { display: grid; gap: 10px; margin-top: 16px; }
.meal { background: var(--surface); border-radius: var(--radius-card); }
.meal-head {
  width: 100%;
  display: grid; grid-template-columns: 1fr 20px; column-gap: 12px; row-gap: 2px;
  padding: 14px 16px;
}
.meal-head > .icon { grid-column: 2; grid-row: 1 / span 3; align-self: center; width: 20px; height: 20px; color: var(--ink-2); transition: transform .2s; }
.meal.is-open .meal-head > .icon { transform: rotate(90deg); }
.meal-kind { font-size: 12.5px; font-weight: 600; color: var(--sage-ink); }
.meal-title { font-family: var(--font-display); font-weight: 650; font-size: 19px; line-height: 1.2; }
.meal-meta { font-size: 13px; color: var(--ink-2); }
.plates { padding: 0 16px 8px; }
.plates-title { font-size: 13px; font-weight: 600; color: var(--ink-2); padding-bottom: 6px; }
.plate { padding: 10px 0; border-top: 1px solid var(--line); }
.plate-who { font-size: 13px; font-weight: 700; }
.plate p + p { margin-top: 2px; font-size: 14px; }
.check-badge {
  display: inline-flex !important; align-items: center; gap: 4px;
  margin-top: 7px !important; padding: 3px 9px 3px 6px;
  border-radius: var(--radius-chip);
  background: var(--sage-tint); color: var(--sage-ink);
  font-size: 12.5px !important; font-weight: 600;
}
.check-badge .icon { width: 14px; height: 14px; }

.secondary, .primary {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 16px;
  border-radius: 14px;
  font-weight: 600;
}
.secondary { background: var(--surface); border: 1px solid var(--line); color: var(--ink); }
.secondary .icon { width: 20px; height: 20px; color: var(--ink-2); }
.primary { background: var(--button); color: var(--button-text); }
.wide { width: 100%; margin-top: 16px; }
.split { justify-content: space-between; }
.split small { font-size: 14px; font-weight: 400; color: var(--ink-2); }

/* ---------- «Помощники», «Семья» ---------- */
.list-card { background: var(--surface); border-radius: var(--radius-card); }
.list-card > li + li { border-top: 1px solid var(--line); }
.list-item.static { grid-template-columns: 40px 1fr; }
.list-item.static:not(:has(.dot-icon)) { grid-template-columns: 1fr auto; }
.list-item:not(:has(.dot-icon)) { grid-template-columns: 1fr 20px; }
.list-item.danger b { color: var(--critical); }
.list-item.add b { color: var(--rose-ink); }
.list-item .text-button { padding: 6px 0; color: var(--rose-ink); }
.switch-row { padding-top: 10px; padding-bottom: 10px; }
.switch {
  position: relative; width: 50px; height: 30px; flex: none;
  border-radius: var(--radius-chip);
  background: var(--line);
  transition: background-color .2s;
}
.switch span {
  position: absolute; top: 3px; left: 3px;
  width: 24px; height: 24px; border-radius: 50%;
  background: #FFFFFF; box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
  transition: transform .2s;
}
.switch[aria-checked="true"] { background: var(--sage); }
.switch[aria-checked="true"] span { transform: translateX(20px); }

/* ---------- лист помощника ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(27, 21, 34, .45); z-index: 20; }
.sheet {
  position: fixed; z-index: 21; left: 0; right: 0; bottom: 0;
  max-width: 480px; margin: 0 auto;
  max-height: 88dvh; overflow: auto;
  background: var(--surface);
  border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
  padding: 10px 16px calc(18px + env(safe-area-inset-bottom));
  animation: sheet-in .28s cubic-bezier(.2, .8, .2, 1);
}
@keyframes sheet-in { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet-grip { width: 36px; height: 4px; margin: 0 auto 12px; border-radius: 2px; background: var(--line); }
.sheet-head { display: grid; grid-template-columns: 40px 1fr 36px; align-items: center; gap: 12px; }
.sheet-head h2 { font-family: var(--font-display); font-size: 21px; font-weight: 650; line-height: 1.2; }
.sheet-close { width: 36px; height: 36px; border-radius: 50%; background: var(--surface-2); font-size: 22px; line-height: 1; color: var(--ink-2); }
.sheet-lead { margin-top: 14px; }
.chat { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.bubble { max-width: 88%; padding: 10px 12px; border-radius: 16px; font-size: 14.5px; }
.bubble p + p { margin-top: 6px; }
.bubble.me { align-self: flex-end; background: var(--ink); color: var(--ground); border-bottom-right-radius: 6px; }
.bubble.bot { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 6px; }
.bubble-warn { color: var(--honey-ink); font-weight: 600; }

/* ---------- «Знакомство» ---------- */
.onb { display: grid; gap: 10px; padding: 20px 4px 0; }
.onb-hello { padding-top: 32px; }
.onb-symbol { display: block; width: 120px; height: 120px; margin-bottom: 12px; }
.onb-small { margin-top: 6px; font-size: 14px; color: var(--ink-2); max-width: 40ch; }
.options { display: grid; gap: 8px; margin-top: 8px; }
.option {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--surface); border: 1.5px solid var(--line);
  font-weight: 600;
}
.option .icon { width: 20px; height: 20px; color: transparent; }
.option.is-on { border-color: var(--rose-ink); background: var(--rose-tint); }
.option.is-on .icon { color: var(--rose-ink); }
.field { margin-top: 8px; padding: 14px 16px; border-radius: 14px; background: var(--surface); }
.field-label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field-value { font-family: var(--font-display); font-size: 22px; font-weight: 650; margin-top: 2px; }
.field-hint { font-size: 13px; color: var(--ink-2); margin-top: 4px; }
.facts { display: grid; gap: 12px; margin-top: 6px; padding: 14px 16px; border-radius: var(--radius-card); background: var(--surface); }
.facts dt { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.facts dd { margin-top: 2px; }
.consent { display: grid; grid-template-columns: 24px 1fr; gap: 10px; align-items: start; margin-top: 10px; font-size: 14.5px; }
.consent input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--rose-ink); }
.inline-link { color: var(--rose-ink); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- панель разделов, главная кнопка, тост ---------- */
.tabbar {
  position: fixed; z-index: 10; left: 0; right: 0; bottom: 0;
  max-width: 480px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--ground) 90%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; font-size: 11px; font-weight: 500; color: var(--ink-2); }
.tab.is-on { color: var(--rose-ink); }
.main-button {
  position: fixed; z-index: 15; left: 16px; right: 16px; bottom: calc(14px + env(safe-area-inset-bottom));
  max-width: 448px; margin: 0 auto;
  min-height: 52px; padding: 0 16px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center; text-align: center;
  background: var(--button); color: var(--button-text);
  font-size: 16px; font-weight: 650;
}
.main-button:disabled { opacity: .4; cursor: default; }
.toast {
  position: fixed; z-index: 30; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: max-content; max-width: calc(100% - 32px);
  padding: 10px 14px; border-radius: 12px;
  background: var(--ink); color: var(--ground);
  font-size: 14px;
}
.sheet-open body { overflow: hidden; }

@media (min-width: 560px) {
  body { background: var(--surface-2); }
  .app { background: var(--ground); box-shadow: 0 0 0 1px var(--line); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
