:root {
  --page: #f3f4f7;
  --surface: #ffffff;
  --text: #1d2433;
  --muted: #5d6576;
  --line: #e3e6ec;
  --primary: #2f6fdb;
  --primary-dark: #2257b5;
  --danger: #c8372d;
  --person: #26324a;
  --radius: 18px;
  --shadow: 0 2px 10px rgb(20 30 60 / .08);

  /* Цвета мест: основной и светлый для градиента. Один и тот же цвет —
     везде, где встречается место. */
  --orange: #ec6a1e;  --orange-light: #ffa04d;
  --blue: #2f5fe0;    --blue-light: #5b9bff;
  --green: #0f8f6b;   --green-light: #34c48f;
  --purple: #6b45d8;  --purple-light: #a07bff;
  --pink: #d43c7c;    --pink-light: #ff7aa8;
  --teal: #0a8aa3;    --teal-light: #3cc9d9;

  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
}

.c-orange { --c: var(--orange); --c-light: var(--orange-light); }
.c-blue { --c: var(--blue); --c-light: var(--blue-light); }
.c-green { --c: var(--green); --c-light: var(--green-light); }
.c-purple { --c: var(--purple); --c-light: var(--purple-light); }
.c-pink { --c: var(--pink); --c-light: var(--pink-light); }
.c-teal { --c: var(--teal); --c-light: var(--teal-light); }

* { box-sizing: border-box; }
body { margin: 0; background: var(--page); }
h1 { font-size: 1.75rem; font-weight: 900; margin: 1.5rem 0 1rem; }
h2 { font-size: 1.15rem; font-weight: 800; margin: 0 0 .25rem; }
p { margin: .25rem 0 .5rem; }

/* --- Фото людей и значки мест ------------------------------------------------ */

.photo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; border-radius: 50%; flex: none;
  object-fit: cover; background: #fff4e3; font-size: 1.6rem; line-height: 1;
}
.photo-sm { width: 44px; height: 44px; font-size: 1.5rem; }
.photo-md { width: 56px; height: 56px; font-size: 2rem; }
.photo-xl { width: 104px; height: 104px; font-size: 3.6rem; }
.photo-xxl { width: 132px; height: 132px; font-size: 4.6rem; }

.badge {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 56px; height: 56px; border-radius: 50%; overflow: hidden;
  background: color-mix(in srgb, var(--c) 16%, #fff); border: 4px solid var(--c);
}
.badge img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.badge-emoji { font-size: 1.7rem; line-height: 1; }
.badge-sm { width: 40px; height: 40px; border-width: 3px; }
.badge-sm .badge-emoji { font-size: 1.2rem; }
.badge-md { width: 56px; height: 56px; }
.badge-lg { width: 76px; height: 76px; }
.badge-lg .badge-emoji { font-size: 2.4rem; }
.badge-xl { width: 104px; height: 104px; }
.badge-xl .badge-emoji { font-size: 3.3rem; }

/* --- Детский экран ------------------------------------------------------------
   Сверху «фраза из картинок» (кто → куда) и она же словами, под ней полоска
   пути и карта, внизу весь путь. Без анимаций, миганий и звуков — только
   медленное движение фото. */

.kid-body { background: var(--surface); overscroll-behavior: none; }

.kid { height: 100dvh; display: flex; flex-direction: column; }

.now {
  position: relative; overflow: hidden; color: #fff; text-align: center;
  padding: 22px 16px 24px; border-radius: 0 0 36px 36px;
  background:
    radial-gradient(circle at 12% 8%, rgb(255 255 255 / .28) 0 70px, transparent 71px),
    radial-gradient(circle at 92% 110%, rgb(255 255 255 / .16) 0 110px, transparent 111px),
    linear-gradient(155deg, var(--c-light), var(--c) 70%);
  box-shadow: 0 10px 30px -12px var(--c);
}
.now > * { position: relative; }
.now-picture { display: flex; align-items: center; justify-content: center; gap: 12px; }
.now-people { display: flex; }
.now-people .photo, .now .badge { border: 5px solid #fff; box-shadow: 0 4px 14px rgb(0 0 0 / .18); }
.now-people .photo + .photo { margin-left: -34px; }
.now .badge { background: #fff; }
.now .badge .badge-emoji { font-size: 3.6rem; }
.now-arrow { font-size: 2.6rem; font-weight: 900; line-height: 1; }
/* «Папа на работе»: фото стоит прямо на месте. */
.now-people:has(+ .now-at) { margin-right: -46px; position: relative; z-index: 1; }
.now-text { font-size: 1.9rem; font-weight: 900; line-height: 1.15; margin: 14px 0 0; text-shadow: 0 2px 8px rgb(0 0 0 / .15); }

.kid-live { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 14px; padding: 16px 16px 0; }

.way { display: flex; align-items: center; gap: 10px; }
.way-track {
  position: relative; flex: 1; height: 14px; border-radius: 999px;
  background: color-mix(in srgb, var(--c) 22%, #fff);
}
.way-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--c-light), var(--c)); transition: width 4s linear; }
.way-person {
  position: absolute; top: 50%; transform: translate(-50%, -50%);
  transition: left 4s linear;
}
.way-person { display: flex; }
.way-person .photo { border: 3px solid #fff; box-shadow: 0 2px 8px rgb(0 0 0 / .25); }
.way-person .photo + .photo { margin-left: -18px; }

.kid-map {
  flex: 1; min-height: 150px; border-radius: 24px; overflow: hidden;
  background: #e9edf2; box-shadow: inset 0 0 0 1px var(--line);
}

.path {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  list-style: none; margin: 14px 16px calc(14px + env(safe-area-inset-bottom));
  padding: 14px 4px 12px; background: var(--surface); border-radius: 26px;
  box-shadow: 0 4px 18px rgb(20 30 60 / .10);
}
.path-step { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
/* Линия между кружками: левая и правая половинки у каждого шага. */
.path-step::before, .path-step::after {
  content: ""; position: absolute; top: 26px; height: 6px; margin-top: -3px; background: #e2e5eb;
}
.path-step::before { left: 0; right: 50%; }
.path-step::after { left: 50%; right: 0; }
.path-step:first-child::before, .path-step:last-child::after { display: none; }
.path-step-done::before, .path-step-done::after, .path-step-current::before { background: var(--c); }

.path-dot { position: relative; z-index: 1; display: inline-flex; height: 52px; align-items: center; }
.path-dot .badge { width: 52px; height: 52px; box-shadow: 0 0 0 4px #fff; }
.path-name {
  font-size: .9rem; font-weight: 800; text-align: center; line-height: 1.1;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px;
}
.path-step-done .badge { filter: grayscale(.5); opacity: .7; }
.path-step-done .path-name, .path-step-next .path-name { color: var(--muted); }
.path-check {
  position: absolute; right: -5px; top: -3px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--c); color: #fff; font-weight: 900; font-size: .8rem;
  display: flex; align-items: center; justify-content: center; border: 2px solid #fff;
}
.path-step-current .badge { box-shadow: 0 0 0 4px #fff, 0 0 0 7px var(--c), 0 6px 14px -4px var(--c); }
.path-step-current .path-name {
  color: #fff; background: var(--c); padding: 2px 9px; border-radius: 999px; font-weight: 900;
}

/* Маркеры на карте */
.map-place { box-shadow: 0 2px 8px rgb(0 0 0 / .3); border-color: #fff; }
.map-place .badge-emoji { font-size: 1.4rem; }
.map-place-target { border-color: var(--c); background: #fff; }
.map-place-target .badge-emoji { font-size: 1.8rem; }
.map-person { display: flex; }
.map-person .photo {
  width: 60px; height: 60px; font-size: 2.2rem;
  border: 4px solid #fff; box-shadow: 0 3px 10px rgb(0 0 0 / .35);
}
.map-person .photo + .photo { margin-left: -24px; }
/* Фото переезжает по карте медленно и равномерно — без рывков. */
.leaflet-marker-icon.map-person { transition: transform 4s linear; }

/* --- Папина часть ------------------------------------------------------------ */

.nav {
  display: flex; flex-wrap: wrap; gap: .25rem; align-items: center;
  padding: .6rem 1rem; background: var(--surface); box-shadow: var(--shadow);
}
.nav form { margin-left: auto; }
.nav-link {
  padding: .55rem .85rem; border-radius: 12px; color: var(--text); text-decoration: none;
  background: none; border: 0; font: inherit; font-weight: 800; cursor: pointer;
}
.nav-link-current { background: var(--primary); color: #fff; }
.nav-exit { color: var(--muted); font-weight: 700; }

.page { max-width: 640px; margin: 0 auto; padding: 0 1rem 3rem; }
.narrow { max-width: 360px; margin: 3rem auto; }

.flash { padding: .8rem 1rem; border-radius: 14px; margin: 1rem 0; font-weight: 700; }
.flash-notice { background: #dff3e7; color: #146b3c; }
.flash-alert { background: #fbe3e1; color: var(--danger); }

.card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.1rem; margin: 0 0 .9rem;
}
.card-row { display: flex; align-items: center; gap: .9rem; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); font-size: .95rem; }
.hint { color: var(--muted); }
.hint ol { padding-left: 1.2rem; line-height: 1.6; }

.live { background: linear-gradient(155deg, var(--c-light), var(--c) 70%); color: #fff; margin-top: 1.25rem; }
.live .muted { color: rgb(255 255 255 / .85); }
.live-label { font-size: .8rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; opacity: .85; }
.live-headline { display: flex; align-items: center; gap: .75rem; font-size: 1.5rem; font-weight: 900; margin: .4rem 0 .8rem; }
.live .badge { border-color: #fff; background: #fff; }
.live .button { border-color: #fff; }
.live .button-primary { background: #fff; color: var(--c); }
.live .button-danger { background: transparent; color: #fff; border-color: rgb(255 255 255 / .6); }

.chain { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; padding: 0; list-style: none; margin: .5rem 0; }
.chain-step {
  display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .7rem .3rem .3rem;
  border-radius: 999px; background: color-mix(in srgb, var(--c) 14%, #fff); color: var(--text); font-weight: 800;
}
.chain-step .badge { width: 28px; height: 28px; border-width: 2px; }
.chain-step .badge-emoji { font-size: .95rem; }
.chain-arrow { color: #a3aab6; font-weight: 900; }
.live .chain-step { background: rgb(255 255 255 / .2); color: #fff; }
.live .chain-step-done { opacity: .6; }
.live .chain-step-current { background: #fff; color: var(--text); }

.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .9rem; }
.actions form { margin: 0; }

.button {
  display: inline-block; padding: .75rem 1.1rem; border-radius: 14px;
  border: 2px solid var(--line); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 800; text-decoration: none; cursor: pointer;
}
.button-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.button-primary:hover { background: var(--primary-dark); }
.button-danger { color: var(--danger); border-color: #f1c4bf; }
.button-small { padding: .45rem .7rem; }

.form { display: flex; flex-direction: column; gap: 1.1rem; margin-bottom: 1.5rem; }
.form label { display: flex; flex-direction: column; gap: .4rem; font-weight: 700; }
.form input[type=text], .form input[type=email], .form input[type=password],
.form input[type=number], .form select {
  font: inherit; font-weight: 600; padding: .7rem .8rem; border: 2px solid var(--line);
  border-radius: 12px; background: var(--surface); width: 100%;
}
.form input:focus, .form select:focus { outline: none; border-color: var(--primary); }
.form fieldset {
  border: 0; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow);
  padding: 1.1rem; display: flex; flex-direction: column; gap: .8rem;
}
.form legend { float: left; width: 100%; padding: 0; font-weight: 900; font-size: 1.05rem; }
.form label.check { flex-direction: row; align-items: center; gap: .5rem; }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.field-photo { display: flex; align-items: center; gap: .9rem; }

/* Выбор значка и цвета места — кнопками, а не списком. */
.choices { display: flex; flex-wrap: wrap; gap: .4rem; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
  display: inline-flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; border-radius: 12px; border: 2px solid var(--line);
  background: var(--surface); font-size: 1.5rem; cursor: pointer;
}
.choice input:checked + span { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary); }
.choice-color span { background: var(--c); border-color: var(--c); border-radius: 50%; }
.choice-color input:checked + span { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--c); }

.steps { margin: 0; padding-left: 1.4rem; display: flex; flex-direction: column; gap: .5rem; }
.step-row select { width: calc(100% - 3.2rem); }

.picker-map { height: 300px; border-radius: var(--radius); margin-bottom: .5rem; }
.copy { width: 100%; font: inherit; padding: .55rem; border: 2px solid var(--line); border-radius: 10px; background: var(--page); }
.errors { color: var(--danger); margin: 0; padding-left: 1.2rem; font-weight: 700; }

/* «Потом → Дом» — пока стоим на месте. */
.kid .then {
  display: flex; align-items: center; justify-content: center; gap: 10px; margin: 0;
  padding: 8px 14px; border-radius: 999px; background: color-mix(in srgb, var(--c) 14%, #fff);
  font-size: 1.35rem; font-weight: 900;
}
.then-label { color: var(--muted); }
.then-arrow { color: var(--c); }

/* Без поездки: спокойная картинка «Ярослав у папы» на мягком фоне цвета родителя. */
.home {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 28px; padding: 24px;
  background:
    radial-gradient(circle at 20% 15%, rgb(255 255 255 / .55) 0 120px, transparent 121px),
    linear-gradient(170deg, color-mix(in srgb, var(--c-light) 22%, #fff), color-mix(in srgb, var(--c) 30%, #fff));
}
.home-picture { display: flex; align-items: center; }
.home-picture .photo { border: 6px solid #fff; box-shadow: 0 8px 24px -8px rgb(0 0 0 / .3); }
.home-picture .photo + .photo { margin-left: -28px; }
.home-text { font-size: 2.1rem; font-weight: 900; text-align: center; line-height: 1.15; margin: 0; color: var(--text); }

/* --- Папина часть: вход, ребёнок, приглашение -------------------------------- */

.whereabouts { margin-top: 1.25rem; flex-wrap: wrap; }
.whereabouts-photos { display: flex; }
.whereabouts-photos .photo { border: 3px solid #fff; }
.whereabouts-photos .photo + .photo { margin-left: -16px; }
.whereabouts form { margin: 0; }

.button-google {
  display: flex; align-items: center; justify-content: center; gap: .6rem; width: 100%;
  background: #fff; border-color: var(--line);
}
.narrow form.button_to { margin: 0; }
.or { text-align: center; color: var(--muted); margin: 1rem 0; }
.stack { display: flex; flex-direction: column; gap: .6rem; margin-top: 1rem; }
.stack .button { text-align: center; }
.invite { text-align: center; }
.invite h1 { margin: .75rem 0 .25rem; font-size: 1.5rem; }
.plain { list-style: none; padding: 0; margin: .5rem 0 1rem; display: flex; flex-direction: column; gap: .5rem; }
.plain li { display: flex; align-items: center; gap: .6rem; font-weight: 700; }
