/* «Навстречу».
   Идея: вечерний город. Днём прохладная бумага и тёмно-синие чернила, ночью глубокий синий.
   Акцент один: тёплый свет окна (--lamp). Им отмечено то, что сделано, и то, что делать дальше.
   Макет: одна колонка до 640px, шапка сверху, панель разделов снизу, как у приложения на телефоне. */

:root {
  --bg: #f1f3f7;
  --surface: #ffffff;
  --sunken: #e5e9f0;
  --ink: #1a2240;
  --muted: #58627d;
  --line: #d5dbe6;
  --lamp: #e3a23a;
  --lamp-ink: #855510;
  --lamp-soft: #f9ebcf;
  --on-lamp: #241703;
  --danger: #a63f38;
  --scrim: rgb(14 19 34 / 0.45);
  --shadow: rgb(26 34 64 / 0.1);
  --mood-1: #5d6988;
  --mood-2: #8990a6;
  --mood-3: #b3a784;
  --mood-4: #daa64f;
  --mood-5: #f0b43a;

  --font-display: "Literata", Georgia, "Times New Roman", serif;
  --font-body: "Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --radius: 14px;
  --gutter: 16px;
  --tabbar-h: 60px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1322;
    --surface: #161c30;
    --sunken: #1e253d;
    --ink: #e6e9f2;
    --muted: #9aa3bb;
    --line: #2a3250;
    --lamp: #f2b84b;
    --lamp-ink: #f4c46c;
    --lamp-soft: #33291a;
    --on-lamp: #241703;
    --danger: #e8877e;
    --scrim: rgb(4 6 12 / 0.6);
    --shadow: rgb(0 0 0 / 0.35);
    --mood-1: #56617f;
    --mood-2: #7a829b;
    --mood-3: #a39776;
    --mood-4: #d6a24c;
    --mood-5: #f2b84b;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0e1322;
  --surface: #161c30;
  --sunken: #1e253d;
  --ink: #e6e9f2;
  --muted: #9aa3bb;
  --line: #2a3250;
  --lamp: #f2b84b;
  --lamp-ink: #f4c46c;
  --lamp-soft: #33291a;
  --on-lamp: #241703;
  --danger: #e8877e;
  --scrim: rgb(4 6 12 / 0.6);
  --shadow: rgb(0 0 0 / 0.35);
  --mood-1: #56617f;
  --mood-2: #7a829b;
  --mood-3: #a39776;
  --mood-4: #d6a24c;
  --mood-5: #f2b84b;
  color-scheme: dark;
}

/* ---------- Основа ---------- */

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

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

html.is-locked {
  overflow: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--lamp-ink);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

svg .fill {
  fill: currentColor;
  stroke: none;
}

/* ---------- Каркас ---------- */

.app {
  max-width: 640px;
  margin-inline: auto;
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 40px);
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
}

.topbar {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-inline: calc(var(--gutter) * -1);
  padding: 8px var(--gutter);
  background: var(--bg);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
}

.brand-mark .mark-lamp {
  fill: var(--lamp);
  stroke: none;
}

.brand-mark .mark-other {
  stroke-width: 2;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
}

.icon-btn:hover {
  background: var(--sunken);
  color: var(--ink);
}

.icon-btn svg {
  width: 24px;
  height: 24px;
}

.view {
  display: grid;
  gap: 32px;
  padding-block: 8px 0;
}

.view:focus {
  outline: none;
}

.view > * {
  min-width: 0;
}

/* ---------- Текст ---------- */

.page-head {
  display: grid;
  gap: 6px;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.65rem, 1.35rem + 1.4vw, 2.1rem);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.page-lead {
  margin: 0;
  max-width: 60ch;
  color: var(--muted);
}

.section-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.3;
  text-wrap: balance;
}

.count {
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* ---------- Кнопки и поля ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s;
}

.btn:hover {
  border-color: var(--muted);
}

.btn--primary {
  border-color: var(--lamp);
  background: var(--lamp);
  color: var(--on-lamp);
}

.btn--primary:hover {
  border-color: var(--lamp);
  background: color-mix(in srgb, var(--lamp) 86%, var(--ink));
}

.btn--small {
  min-height: 40px;
  padding: 8px 14px;
  font-size: 0.9rem;
}

.btn--danger {
  border-color: var(--danger);
  background: var(--danger);
  color: var(--surface);
}

.btn--danger:hover {
  border-color: var(--danger);
}

.file-btn:focus-within {
  outline: 2px solid var(--lamp-ink);
  outline-offset: 2px;
}

.link-btn {
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--lamp-ink);
  font-weight: 600;
  text-align: left;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.link-btn--quiet {
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
}

.input,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

.input:focus,
textarea:focus {
  border-color: var(--lamp);
  outline: 2px solid var(--lamp);
  outline-offset: -1px;
}

::placeholder {
  color: var(--muted);
  opacity: 0.8;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  margin-bottom: 8px;
  padding: 0;
  font-size: 0.9rem;
  font-weight: 600;
}

.field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.field-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

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

.chip {
  min-height: 36px;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 500;
}

.chip:hover {
  border-color: var(--muted);
}

.chip[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--bg);
}

/* ---------- Путь ---------- */

.intro {
  display: grid;
  gap: 10px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

.intro-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
}

.intro p {
  margin: 0;
  max-width: 60ch;
}

.intro .btn {
  justify-self: start;
  margin-top: 6px;
}

.route {
  display: grid;
  grid-auto-columns: 1fr;
  grid-auto-flow: column;
  gap: 4px;
  margin-top: 10px;
}

.route-seg {
  height: 6px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--sunken);
}

.route-seg > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--lamp);
  transition: width 0.5s ease;
}

.route-caption {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

/* Единственная «карточка» на экране: окно, в котором горит свет. */
.next {
  display: grid;
  gap: 10px;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--lamp-soft);
}

.next .eyebrow {
  color: var(--lamp-ink);
}

.next-text {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 500;
  line-height: 1.4;
  text-wrap: pretty;
}

.next .row {
  margin-top: 4px;
}

/* Этапы нарисованы как маршрут: кружки на одной линии. */
.stages {
  margin: 0;
  padding: 0;
  list-style: none;
}

.stage {
  position: relative;
  padding-left: 46px;
}

.stage:not(:last-child)::before {
  content: "";
  position: absolute;
  top: 26px;
  bottom: -26px;
  left: 15px;
  width: 2px;
  background: var(--line);
}

.stage--done:not(:last-child)::before {
  background: var(--lamp);
}

.stage-head {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 8px 0;
  border: 0;
  background: none;
  color: var(--ink);
  text-align: left;
}

.stage-num {
  position: absolute;
  top: 10px;
  left: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.stage-num svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.4;
}

.stage--current .stage-num {
  border-color: var(--lamp);
  color: var(--lamp-ink);
}

.stage--done .stage-num {
  border-color: var(--lamp);
  background: var(--lamp);
  color: var(--on-lamp);
}

.stage-name {
  flex: 1;
  min-width: 0;
  font-size: 1.02rem;
  font-weight: 600;
}

.stage-count {
  color: var(--muted);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.stage-chevron {
  flex: none;
  width: 20px;
  height: 20px;
  color: var(--muted);
  transition: transform 0.2s;
}

.is-open .stage-chevron {
  transform: rotate(180deg);
}

.stage-body {
  display: grid;
  gap: 12px;
  padding-bottom: 24px;
}

.stage-lead {
  margin: 0;
  max-width: 60ch;
  color: var(--muted);
}

.note {
  margin: 0;
  max-width: 60ch;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-style: italic;
}

.checklist {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.check {
  display: grid;
}

.check label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding-block: 8px;
  cursor: pointer;
}

.check input {
  -webkit-appearance: none;
  appearance: none;
  display: grid;
  flex: none;
  place-content: center;
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  border: 2px solid var(--muted);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
}

.check input::after {
  content: "";
  width: 11px;
  height: 6px;
  border-bottom: 2px solid var(--on-lamp);
  border-left: 2px solid var(--on-lamp);
  opacity: 0;
  transform: translateY(-1px) rotate(-45deg);
}

.check input:checked {
  border-color: var(--lamp);
  background: var(--lamp);
}

.check input:checked::after {
  opacity: 1;
}

.check.is-done .check-text {
  color: var(--muted);
}

.check .link-btn {
  justify-self: start;
  margin: -4px 0 6px 34px;
  font-size: 0.9rem;
}

.care {
  display: grid;
  gap: 6px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.care h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.care p {
  margin: 0;
  max-width: 60ch;
  color: var(--muted);
  font-size: 0.92rem;
}

/* ---------- Дневник ---------- */

.composer {
  display: grid;
  gap: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.prompt {
  display: grid;
  gap: 2px;
}

.prompt-text {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 500;
  line-height: 1.35;
  text-wrap: balance;
}

.prompt .link-btn {
  justify-self: start;
}

.moods {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
}

.mood {
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 6px;
  padding: 8px 2px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: none;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.2;
  text-align: center;
}

.mood:hover {
  background: var(--sunken);
}

.mood[aria-pressed="true"] {
  border-color: var(--line);
  background: var(--sunken);
  color: var(--ink);
  font-weight: 600;
}

.dot {
  display: inline-block;
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--c);
}

.dot--1 { --c: var(--mood-1); }
.dot--2 { --c: var(--mood-2); }
.dot--3 { --c: var(--mood-3); }
.dot--4 { --c: var(--mood-4); }
.dot--5 { --c: var(--mood-5); }

.mood[aria-pressed="true"] .dot {
  box-shadow: 0 0 0 3px var(--sunken), 0 0 0 5px var(--c);
}

.entries {
  margin: 0;
  padding: 0;
  list-style: none;
}

.entry {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 14px;
  padding-block: 18px;
  border-top: 1px solid var(--line);
}

.entry-date {
  display: grid;
  align-content: start;
  line-height: 1.1;
}

.entry-day {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.entry-month {
  color: var(--muted);
  font-size: 0.8rem;
}

.entry-body {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.entry-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 12px;
  color: var(--muted);
  font-size: 0.85rem;
}

.tag {
  color: var(--ink);
  font-weight: 600;
}

.entry-mood {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.entry-mood .dot {
  width: 10px;
  height: 10px;
}

.entry-text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.entry-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}

.empty {
  margin: 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

/* ---------- Я ---------- */

.segmented {
  display: grid;
  grid-auto-columns: 1fr;
  grid-auto-flow: column;
  gap: 4px;
  margin-top: 14px;
  padding: 4px;
  border-radius: 999px;
  background: var(--sunken);
}

.segmented button {
  min-height: 40px;
  padding: 8px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
}

.segmented button[aria-selected="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px var(--shadow);
}

.panel {
  display: grid;
  gap: 20px;
  margin-top: -8px;
}

.questions {
  display: grid;
}

.question {
  display: grid;
  gap: 8px;
  padding-block: 20px;
  border-top: 1px solid var(--line);
}

.question-text {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 500;
  line-height: 1.35;
  text-wrap: balance;
}

.question textarea,
.field textarea[data-portrait] {
  min-height: 64px;
}

.chips--options {
  margin-block: 2px 4px;
}

/* «Пока не знаю» — отдельный, спокойный вариант, а не ещё один ответ в ряду. */
.chip--not-yet {
  border-style: dashed;
  color: var(--muted);
}

/* ---------- Что дальше: портрет → поиск ---------- */

.next-steps {
  display: grid;
  gap: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  scroll-margin-top: 72px;
}

.next-steps:focus {
  outline: none;
}

.next-steps .section-title {
  margin: 0;
}

.next-steps .section-title + .page-lead {
  margin-top: -14px;
}

.suggest,
.check-rows {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.suggest li,
.check-row {
  padding-block: 10px;
  border-top: 1px solid var(--line);
}

.suggest li {
  display: grid;
  gap: 2px;
}

.suggest-name,
.check-row-title {
  margin: 0;
  font-weight: 600;
}

.check-row {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
}

.check-row-body {
  display: grid;
  gap: 2px;
  min-width: 0;
}

/* Метка списка: тёплая для «Обязательно», пунктир для «Точно нет» — как у пунктов портрета. */
.kind {
  justify-self: start;
  margin-top: 2px;
  padding: 2px 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.kind--must {
  background: var(--lamp-soft);
  color: var(--lamp-ink);
}

.kind--no {
  border-color: var(--muted);
  border-style: dashed;
  color: var(--muted);
}

@media (max-width: 420px) {
  .check-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }
}

/* ---------- Быстрый подбор ---------- */

.quiz {
  display: grid;
  gap: 12px;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--lamp-soft);
}

.quiz .eyebrow {
  color: var(--lamp-ink);
}

.quiz-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.quiz-count {
  color: var(--muted);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.quiz-bar {
  background: var(--surface);
}

.quiz-intro,
.quiz-done {
  margin: 0;
  max-width: 60ch;
}

.quiz-item {
  margin: 6px 0 2px;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 600;
  line-height: 1.3;
  text-wrap: balance;
}

.quiz-choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.quiz-choice {
  padding-inline: 10px;
}

.quiz-choice--no {
  border-style: dashed;
  border-color: var(--muted);
}

.quiz-key {
  display: none;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--sunken);
  color: var(--muted);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.quiz-foot {
  min-height: 24px;
}

@media (min-width: 560px) {
  .quiz-choices {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (hover: hover) and (pointer: fine) {
  .quiz-key {
    display: grid;
  }
}

.who-switch {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.who-label {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.portrait {
  display: grid;
  gap: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  max-width: 100%;
  min-height: 36px;
  padding: 3px 3px 3px 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--sunken);
}

.pill > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.pill--must {
  background: var(--lamp-soft);
}

.pill--no {
  border-color: var(--muted);
  border-style: dashed;
  background: transparent;
}

.pill button {
  display: grid;
  flex: none;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
}

.pill button:hover {
  background: var(--surface);
  color: var(--ink);
}

.pill button svg {
  width: 14px;
  height: 14px;
  stroke-width: 2.2;
}

.add-row {
  display: flex;
  gap: 8px;
}

.add-row .input {
  flex: 1;
  min-width: 0;
}

.nudge {
  margin: 0;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--sunken);
  font-size: 0.95rem;
}

/* ---------- Места ---------- */

.stats {
  margin: 4px 0 0;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.place-groups {
  display: grid;
  gap: 32px;
}

.places {
  margin: 0;
  padding: 0;
  list-style: none;
}

.place {
  display: grid;
  gap: 10px;
  padding-block: 14px;
  border-top: 1px solid var(--line);
}

.place-head {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
}

/* Метка места: пустой кружок, кружок с тёплым контуром или «горящее окно». */
.place-mark {
  width: 12px;
  height: 12px;
  margin-top: 6px;
  border: 2px solid var(--line);
  border-radius: 50%;
}

.place--once .place-mark {
  border-color: var(--lamp);
}

.place--regular .place-mark {
  border-color: var(--lamp);
  background: var(--lamp);
  box-shadow: 0 0 0 4px var(--lamp-soft);
}

.place h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
}

.place-text p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.place-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding-left: 24px;
}

.status {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: var(--sunken);
}

.status button {
  min-height: 34px;
  padding: 4px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.status button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px var(--shadow);
}

.status button[data-value="regular"][aria-pressed="true"] {
  background: var(--lamp);
  color: var(--on-lamp);
}

.place-note {
  width: calc(100% - 24px);
  margin-left: 24px;
}

.add-place {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.add-place .section-title {
  margin: 0;
}

/* ---------- Нижняя панель, уведомления, окно ---------- */

.tabbar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 10;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.tabbar-inner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  max-width: 640px;
  margin-inline: auto;
}

.tab {
  position: relative;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 2px;
  min-height: var(--tabbar-h);
  padding: 6px 4px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
}

.tab svg {
  width: 24px;
  height: 24px;
}

.tab[aria-current="page"] {
  color: var(--ink);
}

.tab[aria-current="page"]::before {
  content: "";
  position: absolute;
  top: -1px;
  right: 32%;
  left: 32%;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--lamp);
}

/* Логотип и нижние ссылки боковой панели нужны только на компьютере. */
.side-brand,
.side-foot {
  display: none;
}

.side-link {
  padding: 8px 12px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  text-align: left;
}

.side-link:hover {
  background: var(--sunken);
  color: var(--ink);
}

.side-link--accent {
  color: var(--lamp-ink);
  font-weight: 600;
}

.install-banner {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.install-banner p {
  margin: 0;
  max-width: 60ch;
  font-size: 0.95rem;
}

.kbd-hint {
  display: none;
  color: var(--muted);
  font-size: 0.85rem;
}

@media (hover: hover) and (pointer: fine) {
  .kbd-hint {
    display: inline;
  }
}

.notice {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--lamp-soft);
  font-size: 0.9rem;
}

.toast {
  position: fixed;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 16px);
  left: 50%;
  z-index: 30;
  max-width: calc(100% - 32px);
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 0.9rem;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 0.2s, transform 0.2s;
}

.toast.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-top: calc(env(safe-area-inset-top, 0px) + 24px);
  background: var(--scrim);
}

.sheet {
  display: grid;
  gap: 20px;
  width: 100%;
  max-width: 640px;
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 var(--gutter) calc(24px + env(safe-area-inset-bottom, 0px));
  border-radius: 20px 20px 0 0;
  background: var(--surface);
}

.sheet-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  background: var(--surface);
}

.sheet h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
}

.sheet p {
  margin: 0;
  max-width: 60ch;
}

.sheet textarea {
  min-height: 80px;
  font-size: 0.85rem;
}

.error {
  color: var(--danger);
  font-size: 0.9rem;
}

@media (min-width: 700px) {
  .sheet-backdrop {
    align-items: center;
    padding: 24px;
  }

  .sheet {
    max-height: 88vh;
    border-radius: 20px;
  }
}

/* ---------- Компьютер: меню слева, текст по центру ---------- */

@media (min-width: 960px) {
  :root {
    --sidebar-w: 248px;
  }

  .app {
    max-width: none;
    margin: 0;
    padding: 0 48px 72px calc(var(--sidebar-w) + 48px);
  }

  .topbar {
    display: none;
  }

  #notice,
  .view {
    max-width: 720px;
    margin-inline: auto;
  }

  #notice {
    padding-top: 24px;
  }

  .view {
    gap: 40px;
    padding-top: 48px;
  }

  .tabbar {
    top: 0;
    right: auto;
    display: flex;
    flex-direction: column;
    gap: 28px;
    width: var(--sidebar-w);
    padding: 24px 16px;
    border-top: 0;
    border-right: 1px solid var(--line);
  }

  .side-brand {
    display: inline-flex;
    align-self: flex-start;
    padding: 4px 12px;
  }

  .tabbar-inner {
    display: grid;
    grid-template-columns: none;
    gap: 2px;
    max-width: none;
    margin: 0;
  }

  .tab {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 0.95rem;
  }

  .tab:hover {
    background: var(--sunken);
    color: var(--ink);
  }

  .tab[aria-current="page"] {
    background: var(--sunken);
  }

  /* На компьютере текущий раздел отмечен огоньком справа. */
  .tab[aria-current="page"]::before {
    top: 50%;
    right: 14px;
    left: auto;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    box-shadow: 0 0 0 3px var(--lamp-soft);
    transform: translateY(-50%);
  }

  .side-foot {
    display: grid;
    gap: 2px;
    margin-top: auto;
  }

  /* Кнопка установки есть в боковой панели, поэтому отдельная плашка не нужна. */
  .install-banner {
    display: none;
  }

  .toast {
    bottom: 24px;
    left: calc(50% + var(--sidebar-w) / 2);
  }
}

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