/* Семейные баллы — «геральдическая сказка»: ночное небо, золото, пергамент.
   Одна тёмная тема. Шрифты свои (OFL, папка fonts/), внешних запросов нет. */

/* ---------- шрифты ---------- */

@font-face {
  font-family: "Playfair Display"; font-style: normal; font-weight: 600 700; font-display: swap;
  src: url("fonts/playfair-display-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Playfair Display"; font-style: normal; font-weight: 600 700; font-display: swap;
  src: url("fonts/playfair-display-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "PT Serif"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/pt-serif-400-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "PT Serif"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/pt-serif-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "PT Serif"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("fonts/pt-serif-700-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "PT Serif"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("fonts/pt-serif-700-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "PT Serif"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("fonts/pt-serif-400italic-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "PT Serif"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("fonts/pt-serif-400italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- токены ---------- */

:root {
  color-scheme: dark;
  --head: "Playfair Display", Georgia, "Times New Roman", serif;
  --body: "PT Serif", Georgia, "Times New Roman", serif;
  --emoji: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;

  --night: #0d1424;
  --night-2: #111a2e;
  --panel: #131c31;
  --well: rgba(8, 13, 25, 0.62);       /* утопленные плашки внутри карточек */
  --line: rgba(201, 164, 92, 0.5);     /* золотые рамки */
  --line-soft: rgba(201, 164, 92, 0.22);
  --gold: #c9a45c;
  --gold-hi: #e3c27a;
  --text: #f1e7d0;                     /* на ночном фоне ≈ 14:1 */
  --muted: #b9ad93;                    /* ≈ 8:1 */
  --plus: #ecca82;                     /* плюсы — тёплое золото */
  --minus: #aba293;                    /* штрафы — спокойный серый */
  --ok: #8fe0ad;

  --parch: #efe3c8;
  --ink: #33241a;                      /* на пергаменте ≈ 12:1 */
  --ink-2: #5a4430;                    /* ≈ 7:1 */
  --ink-line: rgba(110, 80, 40, 0.3);

  --gold-btn: linear-gradient(180deg, #efd496, #c99d50);
  --on-gold: #2a1c0e;

  --focus: #f0d08a;
  --r: 8px;
  --gutter: 1rem;

  --corner: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath d='M1 17V7C1 3.7 3.7 1 7 1h10' fill='none' stroke='%23c9a45c' stroke-width='1.2'/%3E%3Cpath d='M6 3.4 8.6 6 6 8.6 3.4 6z' fill='%23e3c27a'/%3E%3C/svg%3E");
  --corner-tr: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cg transform='matrix(-1 0 0 1 18 0)'%3E%3Cpath d='M1 17V7C1 3.7 3.7 1 7 1h10' fill='none' stroke='%23c9a45c' stroke-width='1.2'/%3E%3Cpath d='M6 3.4 8.6 6 6 8.6 3.4 6z' fill='%23e3c27a'/%3E%3C/g%3E%3C/svg%3E");
  --corner-bl: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cg transform='matrix(1 0 0 -1 0 18)'%3E%3Cpath d='M1 17V7C1 3.7 3.7 1 7 1h10' fill='none' stroke='%23c9a45c' stroke-width='1.2'/%3E%3Cpath d='M6 3.4 8.6 6 6 8.6 3.4 6z' fill='%23e3c27a'/%3E%3C/g%3E%3C/svg%3E");
  --corner-br: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cg transform='matrix(-1 0 0 -1 18 18)'%3E%3Cpath d='M1 17V7C1 3.7 3.7 1 7 1h10' fill='none' stroke='%23c9a45c' stroke-width='1.2'/%3E%3Cpath d='M6 3.4 8.6 6 6 8.6 3.4 6z' fill='%23e3c27a'/%3E%3C/g%3E%3C/svg%3E");
}

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

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--night); }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--night);
  color: var(--text);
  font: 400 1rem/1.5 var(--body);
  font-variant-numeric: lining-nums;   /* у антиквы по умолчанию могут быть «старостильные» цифры */
  font-feature-settings: "lnum" 1;
  -webkit-font-smoothing: antialiased;
}
/* Ночное небо: три слоя звёзд разного шага + мягкое свечение. */
body::before {
  content: "";
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(255, 240, 205, 0.85) 0 1px, transparent 1.6px),
    radial-gradient(circle, rgba(227, 194, 122, 0.7) 0 1.2px, transparent 1.9px),
    radial-gradient(circle, rgba(255, 255, 255, 0.45) 0 0.7px, transparent 1.3px),
    radial-gradient(ellipse 70% 55% at 75% 0%, rgba(44, 70, 120, 0.4), transparent 70%),
    radial-gradient(ellipse 50% 45% at 0% 100%, rgba(70, 48, 22, 0.35), transparent 70%),
    linear-gradient(180deg, #0b1221 0%, #111a2e 55%, #0d1424 100%);
  background-size: 211px 197px, 347px 331px, 127px 139px, 100% 100%, 100% 100%, 100% 100%;
  background-position: 13px 47px, 91px 163px, 57px 21px, 0 0, 0 0, 0 0;
}

h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; }
a { color: var(--gold-hi); }
[hidden] { display: none !important; }

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

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

.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.spacer { flex: 1 1 auto; }
.loading { padding: 2rem 0; color: var(--muted); text-align: center; }

.ic { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.spark { width: 1em; height: 1em; flex: none; fill: currentColor; }

/* ---------- рамки и пергамент ---------- */

.frame {
  position: relative;
  padding: 1rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: linear-gradient(180deg, rgba(24, 35, 58, 0.97), rgba(14, 21, 37, 0.97));
  box-shadow: inset 0 0 0 3px rgba(12, 18, 33, 0.95), inset 0 0 0 4px var(--line-soft), 0 10px 28px rgba(0, 0, 0, 0.35);
}
.frame::before, .parch::before {
  content: "";
  position: absolute;
  top: 5px; right: 5px; bottom: 5px; left: 5px;
  pointer-events: none;
  background: var(--corner) left top / 16px 16px no-repeat, var(--corner-tr) right top / 16px 16px no-repeat,
    var(--corner-bl) left bottom / 16px 16px no-repeat, var(--corner-br) right bottom / 16px 16px no-repeat;
}

.parch {
  position: relative;
  padding: 1rem 1.15rem;
  border: 1px solid #b38f52;
  border-radius: var(--r);
  color: var(--ink);
  background-color: var(--parch);
  background-image:
    radial-gradient(ellipse at 18% 22%, rgba(255, 252, 240, 0.6), transparent 55%),
    radial-gradient(ellipse at 82% 78%, rgba(176, 134, 70, 0.16), transparent 60%),
    radial-gradient(ellipse at 50% 120%, rgba(140, 98, 40, 0.22), transparent 60%),
    radial-gradient(circle at 93% 10%, rgba(150, 110, 50, 0.12), transparent 25%),
    radial-gradient(circle at 5% 90%, rgba(150, 110, 50, 0.14), transparent 28%);
  box-shadow: inset 0 0 0 3px var(--parch), inset 0 0 0 4px rgba(150, 112, 52, 0.6), inset 0 0 40px rgba(120, 82, 30, 0.28), 0 10px 28px rgba(0, 0, 0, 0.4);
}

/* заголовки панелей */
.phead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.25rem 1rem; margin-bottom: 0.65rem; }
.ptitle { display: flex; align-items: center; gap: 0.5rem; color: var(--gold-hi); font-family: var(--head); font-size: 1.41rem; font-weight: 600; line-height: 1.15; }
.ptitle__spark { width: 0.9rem; height: 0.9rem; color: var(--gold); }
.parch .ptitle { color: var(--ink); }
.parch .ptitle__spark { color: #a77c35; }
.phead__note { color: var(--muted); }
.panel-empty { color: var(--muted); }
.parch .panel-empty { color: var(--ink-2); }

.more-link { display: inline-flex; align-items: center; gap: 0.2rem; color: var(--gold-hi); font-size: 0.9rem; text-decoration: none; }
.more-link:hover { text-decoration: underline; }
.more-link .ic { width: 1rem; height: 1rem; }

/* ---------- кнопки ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.75rem;
  padding: 0.45rem 1.1rem;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, filter 0.15s;
}
.btn:disabled { opacity: 0.6; cursor: default; }
.btn--gold, .btn--primary {
  border-color: #f3dca4;
  background: var(--gold-btn);
  color: var(--on-gold);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25), 0 4px 14px rgba(0, 0, 0, 0.35);
}
.btn--gold:hover:not(:disabled), .btn--primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn--ghost { border-color: var(--line); background: transparent; color: var(--text); }
.btn--ghost:hover:not(:disabled) { background: rgba(201, 164, 92, 0.12); }
.btn--soft { border-color: var(--line-soft); background: rgba(201, 164, 92, 0.16); color: var(--gold-hi); }
.btn--soft:hover:not(:disabled) { background: rgba(201, 164, 92, 0.26); }
.btn--ink { background: var(--ink); color: var(--parch); }
.btn--ink:hover:not(:disabled) { background: #4a3626; }
.btn--danger { border-color: #c76a55; background: #8e3a2c; color: #fff1e8; }
.btn--sm { min-height: 2.25rem; padding: 0.2rem 0.8rem; font-size: 0.875rem; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--gold-hi);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
}
.icon-btn:hover:not(:disabled) { background: rgba(201, 164, 92, 0.14); }
.icon-btn:disabled { opacity: 0.3; cursor: default; }

.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.6rem;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: rgba(201, 164, 92, 0.12);
  color: var(--gold-hi);
  font-size: 0.75rem;
  white-space: nowrap;
}
.pill--offline { border-color: rgba(171, 162, 147, 0.4); background: rgba(171, 162, 147, 0.15); color: var(--muted); }
.pill--ok { border-color: rgba(143, 224, 173, 0.4); background: rgba(47, 158, 90, 0.2); color: var(--ok); }
.pill--off { border-color: rgba(171, 162, 147, 0.35); background: rgba(171, 162, 147, 0.12); color: var(--minus); }

.pts { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pts--plus { color: var(--plus); }
.pts--minus { color: var(--minus); }
.parch .pts--plus { color: #7a5214; }
.dot { display: inline-block; flex: none; width: 0.6rem; height: 0.6rem; margin-right: 0.45rem; border-radius: 50%; box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.3); vertical-align: 0.05em; }

/* ---------- каркас: сайдбар + страница ---------- */

.layout { min-height: 100vh; }
.page { min-width: 0; padding: 0.9rem var(--gutter) 6rem; }
.layout.is-parent .page { padding-bottom: 6rem; }

.side {
  position: fixed;
  right: 0; bottom: 0; left: 0;
  z-index: 40;
  padding: 0.2rem 0.2rem 0.2rem;
  padding-bottom: calc(0.2rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(10, 15, 28, 0.97);
  box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.45);
}
.side__brand, .side__quote { display: none; }
.nav { display: flex; }
.nav__item {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  min-width: 0;
  min-height: 3.4rem;
  padding: 0.35rem 0.1rem;
  border: 1px solid transparent;
  border-radius: 6px;
  background: none;
  color: var(--text);
  font-size: 0.72rem;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.nav__ic { width: 1.4rem; height: 1.4rem; color: var(--gold-hi); }
.nav__label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 380px) { .nav__label { font-size: 0.64rem; letter-spacing: -0.01em; } } /* «Настройки» целиком на 360 px */
.nav__item:hover { background: rgba(201, 164, 92, 0.08); }
.nav__item[aria-current="page"] { border-color: var(--line-soft); background: rgba(201, 164, 92, 0.2); color: #fff7e2; }

/* шапка */
.head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.5rem; margin-bottom: 1rem; }
.head__brand { display: grid; justify-items: center; }
.title {
  color: var(--gold-hi);
  font-family: var(--head);
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.005em;
  background: linear-gradient(180deg, #f8e2a8 10%, #c99a4b 90%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 1px rgba(0, 0, 0, 0.45));
}
.subtitle {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.3rem;
  color: var(--gold-hi);
  font-family: var(--head);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
}
.orn { position: relative; width: 2.75rem; height: 1px; background: linear-gradient(90deg, transparent, var(--gold)); }
.orn::after { content: ""; position: absolute; top: -3px; right: -4px; width: 6px; height: 6px; border: 1px solid var(--gold); transform: rotate(45deg); }
.orn--r { transform: scaleX(-1); }

.plaque {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(10, 16, 30, 0.88);
  box-shadow: inset 0 0 0 3px rgba(10, 16, 30, 0.95), inset 0 0 0 4px var(--line-soft);
}
.plaque__cell { display: flex; align-items: center; gap: 0.7rem; padding: 0.55rem 1.1rem; }
.plaque__cell + .plaque__cell { border-left: 1px solid var(--line); }
.plaque__ic { width: 1.9rem; height: 1.9rem; color: var(--gold-hi); }
.plaque__season { color: var(--text); font-family: var(--head); font-size: 1.23rem; font-weight: 600; line-height: 1.15; }
.plaque__season strong { color: var(--gold-hi); }
.plaque__dot { color: var(--gold); }
.plaque__small { display: block; color: var(--muted); font-size: 0.78rem; line-height: 1.2; }
.plaque__left strong { color: var(--gold-hi); font-family: var(--head); font-size: 1.28rem; line-height: 1.05; }
.plaque__left.is-final strong { color: #fff0c8; }
.head__actions { display: flex; align-items: center; gap: 0.6rem; margin-left: auto; }

.add-btn { display: none; }
.nav__add { color: var(--gold-hi); }
.nav__add-ic {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.3rem;
  height: 2.3rem;
  margin-top: -0.85rem;
  border: 1px solid #f3dca4;
  border-radius: 50%;
  background: var(--gold-btn);
  color: var(--on-gold);
  box-shadow: 0 0 0 3px rgba(10, 15, 28, 0.97), 0 4px 12px rgba(0, 0, 0, 0.5);
}
.nav__add-ic .ic { width: 1.3rem; height: 1.3rem; stroke-width: 2.4; }
.add-btn__ic { width: 1.2rem; height: 1.2rem; stroke-width: 2.4; }

/* ---------- главная ---------- */

.dash { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }

.banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 1rem;
  padding: 0.6rem 0.75rem 0.6rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: rgba(201, 164, 92, 0.14);
  color: var(--gold-hi);
  font-family: var(--head);
  font-size: 1.14rem;
  font-weight: 600;
}

/* прогресс семьи */
.fam {
  display: grid;
  grid-template-columns: 4.6rem minmax(0, 1fr);
  align-items: center;
  gap: 0.9rem;
  padding: 0.9rem 1rem;
}
.fam__art .art__svg { display: block; width: 4.6rem; height: 5.4rem; filter: drop-shadow(0 3px 5px rgba(60, 40, 10, 0.35)); }
.fam__title { display: flex; align-items: center; gap: 0.5rem; color: var(--ink); font-family: var(--head); font-size: 1.41rem; font-weight: 600; line-height: 1.1; }
.fam__spark { width: 1rem; height: 1rem; color: #b08436; }
.fam__score { margin: 0.2rem 0 0.55rem; color: var(--ink); font-family: var(--head); font-weight: 600; line-height: 1; white-space: nowrap; }
.fam__big { font-size: 2.29rem; }
.fam__of { font-size: 1.58rem; }
.fam__unit { font-size: 1.3rem; font-weight: 600; }
.fam__line { margin-top: 0.55rem; color: var(--ink-2); font-size: 0.95rem; }
.fam__line strong { color: var(--ink); }
.fam__prize {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: 4.2rem minmax(0, 1fr);
  align-items: center;
  gap: 0.8rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--ink-line);
}
.fam__emblem .emblem__svg { display: block; width: 4.2rem; height: 4.2rem; filter: drop-shadow(0 3px 5px rgba(60, 40, 10, 0.35)); }
.fam__prize-label { color: var(--ink-2); font-family: var(--head); font-size: 1.01rem; font-weight: 600; }
.fam__prize-title { margin-top: 0.15rem; color: var(--ink); font-family: var(--head); font-size: 1.32rem; font-weight: 600; line-height: 1.1; }
.fam__prize-sub { margin-top: 0.25rem; color: var(--ink-2); font-size: 0.88rem; }

/* полосы прогресса */
.bar {
  position: relative;
  height: 0.95rem;
  margin-right: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #090f1e;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
}
.bar__fill {
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--kid-l, #f2d48f), var(--kid, #c9a45c) 55%, var(--kid-d, #8c6b33));
  transition: width 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.bar__star {
  position: absolute;
  top: 50%;
  right: -0.7rem;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  margin-top: -0.7rem;
  border: 1.5px solid var(--gold-hi);
  border-radius: 50%;
  background: #0d1424;
  box-shadow: 0 0 8px rgba(243, 212, 138, 0.65);
}
.bar__star .spark { width: 0.85rem; height: 0.85rem; color: #fff3cf; }
.bar__tick { position: absolute; top: 2px; bottom: 2px; z-index: 1; width: 2px; margin-left: -1px; background: rgba(227, 194, 122, 0.55); }
.bar__tick.is-done { background: rgba(255, 248, 225, 0.7); }
.bar--fam { height: 1.45rem; margin-right: 0.9rem; border: 1.5px solid #6b4f2a; background: #d6c49c; box-shadow: inset 0 2px 4px rgba(80, 50, 20, 0.35); }
.bar--fam .bar__fill { background: linear-gradient(180deg, #45a76d, #1f6b43 60%, #154d30); }
.bar--fam .bar__tick { background: rgba(70, 45, 15, 0.45); }
.bar--fam .bar__tick.is-done { background: rgba(240, 230, 200, 0.65); }
.bar--fam .bar__star { right: -0.85rem; width: 1.7rem; height: 1.7rem; margin-top: -0.85rem; }

.ticks { position: relative; height: 1.25rem; margin: 0.35rem 0.75rem 0 0; color: var(--muted); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.tick { position: absolute; top: 0; line-height: 1.25rem; white-space: nowrap; transform: translateX(-50%); }
.tick--end { transform: translateX(-100%); }
.tick--start { transform: none; }
.tick.is-done { color: var(--gold-hi); font-weight: 700; }

/* карточки детей */
.kids { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
.kids-empty { color: var(--muted); }
.kid { display: grid; gap: 0.7rem; padding: 0.9rem 0.95rem 0.8rem; }
.kid.is-clickable { cursor: pointer; transition: border-color 0.15s; }
.kid.is-clickable:hover { border-color: var(--gold); }
.kid__deco { position: absolute; top: 0.85rem; right: 1rem; display: flex; gap: 0.35rem; color: var(--gold); opacity: 0.75; pointer-events: none; }
.kid__deco .spark { width: 0.8rem; height: 0.8rem; }
.kid__deco .spark + .spark { width: 0.5rem; height: 0.5rem; margin-top: 0.7rem; }
.kid__body { display: grid; grid-template-columns: 6.6rem minmax(0, 1fr); align-items: center; gap: 0.7rem; }
.shield { position: relative; width: 100%; height: 0; padding-bottom: 116.7%; }
.shield__svg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5)); }
.shield__emoji {
  position: absolute;
  top: 59%;
  left: 50%;
  font-family: var(--emoji);
  font-size: 2.4rem;
  line-height: 1;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.35));
}
.kid__name { color: #f6ead0; font-family: var(--head); font-size: 1.67rem; font-weight: 600; line-height: 1; overflow-wrap: anywhere; }
.kid__score { margin: 0.3rem 0 0.55rem; color: var(--text); font-family: var(--head); font-weight: 600; line-height: 1; white-space: nowrap; }
.kid__big { font-size: 1.63rem; }
.kid__of { font-size: 1.28rem; }
.kid__unit { color: var(--muted); font-size: 1rem; font-weight: 600; }
.kid .bar { margin-bottom: 0.7rem; }

.next {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--well);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.next:hover { border-color: var(--gold-hi); }
.next__ic { width: 1.8rem; height: 1.8rem; color: var(--gold-hi); }
.next__text { display: grid; flex: 1; min-width: 0; line-height: 1.25; }
.next__label { overflow: hidden; color: var(--muted); font-size: 0.78rem; text-overflow: ellipsis; white-space: nowrap; }
.next__value { font-size: 0.95rem; font-weight: 700; }
.next__more { color: var(--muted); font-size: 0.82rem; font-weight: 400; }
.next__icwrap { position: relative; display: flex; flex: none; }
.next__badge {
  position: absolute;
  top: -0.4rem;
  left: -0.45rem;
  min-width: 1.05rem;
  height: 1.05rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: var(--gold-btn);
  color: var(--on-gold);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.05rem;
  text-align: center;
  box-shadow: 0 0 0 2px #0b1120;
}
.next__chev { width: 1rem; height: 1rem; color: var(--gold); }

.kid__last {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.6rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: rgba(8, 13, 25, 0.4);
  font-size: 0.92rem;
}
.kid__last-ic { width: 1.25rem; height: 1.25rem; color: var(--gold-hi); }
.kid__last .pts { font-family: var(--head); font-size: 1.14rem; line-height: 1; }
.kid__last-text { flex: 1; min-width: 0; line-height: 1.3; overflow-wrap: anywhere; }
.kid__last-text--empty { color: var(--muted); }
.kid__last-when { color: var(--muted); font-size: 0.78rem; white-space: nowrap; }

/* лучшие моменты */
.moments { padding: 0.9rem 1.05rem 1rem; }
.moments__motto { color: var(--ink-2); font-size: 0.85rem; font-style: italic; line-height: 1.25; }
.moments__grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.7rem; }
.moment {
  display: grid;
  grid-template-columns: 3.6rem minmax(0, 1fr);
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--ink-line);
  border-radius: 6px;
  background: rgba(255, 250, 236, 0.55);
}
.hex { display: block; width: 3.6rem; height: 4.05rem; filter: drop-shadow(0 3px 4px rgba(60, 40, 10, 0.35)); }
.moment__title { color: var(--ink); font-family: var(--head); font-size: 1.14rem; font-weight: 600; line-height: 1.1; }
.moment__text { margin-top: 0.2rem; color: var(--ink-2); font-size: 0.88rem; line-height: 1.35; overflow-wrap: anywhere; }
.moments__empty { color: var(--ink-2); }

/* награды и пороги */
.ladder { padding: 0.9rem 1.05rem 0.9rem; }
.info-btn { width: 2rem; height: 2rem; color: var(--gold); }
.info-btn .ic { width: 1.25rem; height: 1.25rem; }
.steps { position: relative; margin: 0; padding: 0; list-style: none; }
.steps::before { content: ""; position: absolute; top: 1.4rem; bottom: 1.4rem; left: 0.8rem; width: 1px; background: var(--line); }
.step {
  position: relative;
  display: grid;
  grid-template-columns: 1.6rem 6.2rem minmax(0, 1fr) 2rem;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.15rem 0.55rem 0;
  border-bottom: 1px solid var(--line-soft);
}
.step:last-of-type { border-bottom: 0; }
.step__dot {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border: 1.5px solid var(--gold);
  border-radius: 50%;
  background: #111a2e;
}
.step.is-done .step__dot { border-color: var(--ok); background: #2f9e5a; color: #fff; box-shadow: 0 0 0 3px rgba(47, 158, 90, 0.25); }
.step__dot .ic { width: 1rem; height: 1rem; stroke-width: 2.6; }
.step__pts { color: var(--text); font-family: var(--head); font-size: 1.01rem; font-weight: 600; white-space: nowrap; }
.step__title { color: var(--text); font-size: 0.92rem; line-height: 1.25; overflow-wrap: anywhere; }
.step__sub { display: block; color: var(--muted); font-size: 0.8rem; }
.step__ic { justify-self: end; width: 1.9rem; height: 1.9rem; color: var(--gold-hi); }
.step.is-done .step__title { color: #fff3d6; }

/* последние действия и таблицы */
.recent { padding: 0.85rem 1.05rem 0.7rem; }
.tbl { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.tbl th {
  padding: 0.35rem 0.6rem;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(201, 164, 92, 0.09);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 400;
  text-align: left;
}
.tbl td { padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .c-pts { width: 4rem; }
.tbl tr.is-minus .c-what { color: var(--muted); }
.tbl--recent .c-date { width: 5.5rem; color: var(--muted); white-space: nowrap; }
.tbl--recent .c-who { width: 7.5rem; white-space: nowrap; }
.tbl--recent .c-when { width: 7rem; color: var(--muted); font-size: 0.82rem; text-align: right; white-space: nowrap; }

/* ---------- история ---------- */

.hist-panel { padding: 1rem 1.15rem; }
.hist-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1rem; margin-bottom: 1rem; }
.season-pick { display: flex; align-items: center; gap: 0.5rem; min-width: 0; max-width: 100%; }
.season-pick__label { color: var(--muted); font-size: 0.875rem; }
.season-pick .input { width: auto; min-width: 0; max-width: 100%; text-overflow: ellipsis; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 2.4rem;
  padding: 0.3rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--well);
  color: var(--text);
  cursor: pointer;
}
.chip:hover { border-color: var(--gold-hi); }
.chip[aria-pressed="true"] { border-color: #f3dca4; background: var(--gold-btn); color: var(--on-gold); font-weight: 700; }
.chip--sm { min-height: 2rem; padding: 0.1rem 0.75rem; font-size: 0.875rem; }

.hist { transition: opacity 0.2s; }
.hist.is-loading { opacity: 0.55; }
.hist td { padding: 0.6rem; }
.hist .c-date { width: 6.5rem; color: var(--muted); white-space: nowrap; }
.hist .c-child { width: 9rem; white-space: nowrap; }
.hist .c-pts { width: 4.5rem; text-align: right; }
.hist .c-act { width: 1%; padding-top: 0.3rem; padding-bottom: 0.3rem; white-space: nowrap; }
.d-long { display: none; }
.reason { overflow-wrap: anywhere; }
.reason__emoji { margin-right: 0.35rem; font-family: var(--emoji); }
.hrow.is-minus .reason__text { color: var(--muted); }
.meta { margin-top: 0.1rem; color: var(--muted); font-size: 0.8rem; }
.row-actions { display: flex; justify-content: flex-end; gap: 0.1rem; }
.row-actions .icon-btn { font-family: var(--emoji); }
.star-btn:not(.is-on) span { filter: grayscale(1); opacity: 0.45; }
.hist-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1rem; margin-top: 1rem; }

.soft-empty { display: flex; align-items: flex-start; gap: 0.8rem; padding: 0.9rem 1.1rem; border: 1px dashed var(--line-soft); border-radius: var(--r); color: var(--muted); }
.soft-empty__icon { font-family: var(--emoji); font-size: 1.4rem; line-height: 1.2; }

/* ---------- вкладки «Дети» и «Награды» ---------- */

.view-head { margin: 0.2rem 0 1rem; }
.view-title { display: flex; align-items: center; gap: 0.6rem; color: var(--gold-hi); font-family: var(--head); font-size: 1.85rem; font-weight: 600; line-height: 1.1; }
.view-sub { margin-top: 0.25rem; color: var(--muted); }

.cdetails { display: grid; gap: 1.25rem; }
.cdetail { display: grid; gap: 1.1rem; padding: 1.1rem 1.15rem; }
.cdetail:focus { outline: none; }
.cdetail:focus-visible { outline: 2px solid var(--focus); }
.cdetail__top { display: grid; grid-template-columns: 6.6rem minmax(0, 1fr); align-items: center; gap: 0.9rem; }
.cdetail__next { margin-top: 0.35rem; }
.cdetail__next strong { color: var(--gold-hi); }
.cdetail__cols { display: grid; gap: 1.25rem; }
.subhead { margin-bottom: 0.5rem; color: var(--gold-hi); font-family: var(--head); font-size: 1.19rem; font-weight: 600; }
.evlist { margin: 0 0 0.6rem; padding: 0; list-style: none; }
.ev { display: grid; grid-template-columns: 2.6rem minmax(0, 1fr) auto; align-items: baseline; gap: 0.5rem; padding: 0.4rem 0; border-bottom: 1px solid var(--line-soft); }
.ev__text { overflow-wrap: anywhere; }
.ev.is-minus .ev__text { color: var(--muted); }
.ev__when { color: var(--muted); font-size: 0.8rem; white-space: nowrap; }

.rgrid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; align-items: start; }
.kladder .ptitle { color: var(--kid-l, var(--gold-hi)); }
.kladder__av { font-family: var(--emoji); font-size: 1.35rem; }
.kladder__score { color: var(--text); font-family: var(--head); font-size: 1.14rem; font-weight: 600; }
.kladder__foot { display: flex; justify-content: flex-end; margin-top: 0.6rem; }
.catalog__note { color: var(--ink-2); font-size: 0.9rem; }
.catalog__list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.45rem 1rem; margin: 0.6rem 0 0; padding: 0; list-style: none; }
.catalog__item { display: flex; align-items: center; gap: 0.5rem; color: var(--ink); }
.catalog__ic { width: 1.3rem; height: 1.3rem; color: #8a6220; }
.catalog__big { padding: 0 0.45rem; border-radius: 999px; background: rgba(110, 80, 40, 0.15); color: var(--ink-2); font-size: 0.75rem; }

/* пороги ребёнка: просмотр и выбор */
.rw-list { display: grid; gap: 0.6rem; }
.rw-summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem; font-family: var(--head); font-weight: 600; }
.rw-summary .big { font-size: 1.94rem; line-height: 1; }
.rw-summary .of { color: var(--muted); font-size: 1.4rem; }
.rw-summary .small { font-family: var(--body); font-weight: 400; }
.rw { display: grid; gap: 0.55rem; padding: 0.65rem 0.8rem; border: 1px solid var(--line-soft); border-radius: 6px; background: var(--well); }
.rw.is-open { border-color: var(--line); }
.rw__head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.6rem; }
.rw__badge { display: inline-flex; align-items: center; justify-content: center; width: 1.6rem; height: 1.6rem; border: 1.5px solid var(--gold); border-radius: 50%; color: var(--gold-hi); }
.rw__badge .ic { width: 0.95rem; height: 0.95rem; }
.rw.is-open .rw__badge { border-color: var(--ok); background: #2f9e5a; color: #fff; }
.rw.is-open .rw__badge .ic { stroke-width: 2.6; }
.rw__pts { font-family: var(--head); font-size: 1.01rem; font-weight: 600; white-space: nowrap; }
.rw__title { flex: 1 1 8rem; min-width: 0; } /* узко — статус переносится на свою строку, а не наезжает на название */
.rw__status { color: var(--muted); font-size: 0.82rem; }
.rw.is-open .rw__status { color: var(--ok); }
.rw__body { display: grid; gap: 0.35rem; }
.rw__chosen { color: var(--muted); font-size: 0.9rem; }
.rw__chosen strong { color: var(--text); }
.rw__given { color: var(--ok); }

/* ---------- формы ---------- */

.form { display: grid; gap: 1.2rem; }
fieldset.field { min-width: 0; margin: 0; padding: 0; border: 0; }
.field { display: grid; align-content: start; gap: 0.35rem; min-width: 0; }
.field__label { padding: 0; color: var(--gold-hi); font-size: 0.92rem; font-weight: 700; }
legend.field__label { margin-bottom: 0.5rem; }
.field__hint { color: var(--muted); font-size: 0.8rem; }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.2rem; }

.input {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0a1122;
  color: var(--text);
}
.input:focus { border-color: var(--gold-hi); }
.input::placeholder { color: var(--muted); opacity: 0.75; }
select.input option, select.input optgroup { background: #0a1122; color: var(--text); }
.input--num { width: 6.5rem; font-variant-numeric: tabular-nums; }
.input--pts { width: 4.75rem; font-size: 1.15rem; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.input--emoji { width: 5rem; font-family: var(--emoji); font-size: 1.25rem; text-align: center; }
.input--date { max-width: 12rem; }

.form-error { padding: 0.5rem 0.75rem; border: 1px solid rgba(239, 143, 122, 0.45); border-radius: 6px; background: rgba(239, 143, 122, 0.1); color: #ffc2b4; font-weight: 700; }
.note { padding: 0.5rem 0.75rem; border-radius: 6px; background: rgba(201, 164, 92, 0.1); color: var(--muted); font-size: 0.875rem; }

.opt-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.opt {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.35rem 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--well);
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}
.opt:hover { border-color: var(--gold-hi); }
.opt__emoji { font-family: var(--emoji); font-size: 1.2rem; line-height: 1; }
.opt--sm { min-height: 2.5rem; }
.opt-input:checked + .opt { border-color: var(--gold-hi); background: rgba(201, 164, 92, 0.22); color: #fff3d6; box-shadow: inset 0 0 0 1px var(--gold-hi); }
.opt-input:focus-visible + .opt { outline: 2px solid var(--focus); outline-offset: 2px; }
.cat-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.5rem; }
.cat-grid + .cat-grid { margin-top: 0.5rem; }
.opt--cat { width: 100%; border-radius: 6px; }
.opt__label { flex: 1; min-width: 0; }
.opt__pts { color: var(--plus); font-weight: 700; font-variant-numeric: tabular-nums; }
.opt--minus .opt__pts { color: var(--minus); }
.opt-input:checked + .opt--minus { border-color: var(--minus); background: rgba(171, 162, 147, 0.16); color: var(--text); box-shadow: inset 0 0 0 1px var(--minus); }
.penalties { margin-top: 0.75rem; }
.penalties > summary { padding: 0.25rem 0; color: var(--muted); cursor: pointer; }
.penalties[open] > summary { margin-bottom: 0.5rem; }
.penalties .note { margin-bottom: 0.5rem; }
.stepper { display: flex; align-items: center; gap: 0.35rem; }
.stepper .icon-btn { border: 1px solid var(--line); font-size: 1.25rem; font-weight: 700; }
.quick-dates { display: flex; gap: 0.5rem; margin-top: 0.25rem; }
.check { display: flex; align-items: center; gap: 0.6rem; min-height: 2.4rem; cursor: pointer; }
.check input { flex: none; width: 1.2rem; height: 1.2rem; margin: 0; accent-color: var(--gold); }
.check.is-disabled { color: var(--muted); cursor: default; }
.check--sm { min-height: 2.2rem; font-size: 0.875rem; }

/* ---------- диалоги ---------- */

.dlg {
  width: 34rem;
  max-width: calc(100vw - 1.5rem);
  max-height: calc(100vh - 2rem);
  margin: auto;
  padding: 0;
  overflow: visible;
  border: 0;
  background: transparent;
  color: var(--text);
}
.dlg::backdrop { background: rgba(4, 7, 15, 0.72); }
.dlg--sm { width: 27rem; }
.dlg--md { width: 38rem; }
.dlg--wide { width: 60rem; }
.dlg--full { width: 56rem; }
.dlg__box {
  position: relative;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 2rem);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, #172239, #0f172a);
  box-shadow: inset 0 0 0 3px #10182b, inset 0 0 0 4px var(--line-soft), 0 24px 60px rgba(0, 0, 0, 0.6);
  animation: dlg-in 0.18s ease-out;
}
.dlg__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.8rem 0.75rem 0.7rem 1.25rem; border-bottom: 1px solid var(--line-soft); }
.dlg__title { color: var(--gold-hi); font-family: var(--head); font-size: 1.41rem; font-weight: 600; line-height: 1.15; }
.dlg__sub { padding: 0.75rem 1.25rem 0; color: var(--muted); }
.dlg__body { flex: 1 1 auto; min-height: 0; padding: 1.2rem 1.25rem; overflow-y: auto; overscroll-behavior: contain; }
.dlg__foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.5rem; padding: 0.8rem 1.25rem; border-top: 1px solid var(--line-soft); }
.dlg__text { line-height: 1.55; }
.dlg--fallback {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  width: auto;
  max-width: none;
  max-height: none;
  background: rgba(4, 7, 15, 0.72);
}
@keyframes dlg-in { from { opacity: 0; transform: translateY(0.5rem); } }

/* итоги сезона */
.dlg--summary .dlg__title { font-size: 2rem; }
.sum { display: grid; gap: 1rem; }
.sum__season { color: var(--muted); font-size: 1.05rem; }
.sum__note { padding: 0.5rem 0.75rem; border: 1px solid var(--line-soft); border-radius: 6px; background: rgba(201, 164, 92, 0.12); color: var(--gold-hi); }
.sum__grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.75rem; }
.sum-kid { display: grid; gap: 0.6rem; padding: 0.7rem 0.85rem; border: 1px solid var(--line-soft); border-radius: 6px; background: var(--well); }
.sum-kid--family { border-color: var(--line); }
.sum-kid__row { display: flex; align-items: center; gap: 0.6rem; }
.sum-kid__av { font-family: var(--emoji); font-size: 1.4rem; }
.sum-kid__name { flex: 1; min-width: 0; color: var(--kid-l, var(--gold-hi)); font-family: var(--head); font-size: 1.19rem; font-weight: 600; }
.sum-kid__score { color: var(--muted); font-family: var(--head); font-size: 1.01rem; font-weight: 600; white-space: nowrap; }
.sum-kid__score strong { color: var(--text); font-size: 1.5rem; }
.sum__h { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.4rem; color: var(--gold-hi); font-family: var(--head); font-size: 1.28rem; font-weight: 600; }
.sum-lines { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.5rem 1rem; margin: 0; padding: 0; list-style: none; }
.sum-line { display: flex; align-items: center; gap: 0.7rem; }
.sum-line .hex { width: 2.6rem; height: 2.95rem; }
.sum-line__emoji { width: 2.6rem; font-family: var(--emoji); font-size: 1.5rem; text-align: center; }
.sum-line strong { color: var(--plus); font-family: var(--head); font-size: 1.41rem; }
.sum-events { display: grid; gap: 0.55rem; margin: 0; padding: 0; list-style: none; }
.sum-ev { display: flex; align-items: flex-start; gap: 0.7rem; padding: 0.55rem 0.8rem; border: 1px solid var(--line-soft); border-radius: 6px; background: var(--well); }
.sum-ev__emoji { font-family: var(--emoji); font-size: 1.3rem; line-height: 1.3; }
.sum-ev__text { overflow-wrap: anywhere; }
.sum-ev__meta { color: var(--muted); font-size: 0.8rem; }

/* настройки */
.dlg--wide .dlg__body { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; padding: 0; }
.set-nav { position: sticky; top: 0; z-index: 1; display: flex; flex-wrap: wrap; gap: 0.35rem; padding: 0.7rem 1.25rem; border-bottom: 1px solid var(--line-soft); background: #141e33; }
.set-nav__btn { min-height: 2.25rem; padding: 0.3rem 0.85rem; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
.set-nav__btn:hover { color: var(--text); }
.set-nav__btn[aria-selected="true"] { border-color: var(--line-soft); background: rgba(201, 164, 92, 0.18); color: var(--gold-hi); font-weight: 700; }
.set-pane { min-width: 0; padding: 1.2rem 1.25rem; }
.set-pane:focus { outline: none; }
.set-sec { display: grid; gap: 1rem; }
.set-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
.set-h { margin-top: 0.4rem; color: var(--gold-hi); font-family: var(--head); font-size: 1.19rem; font-weight: 600; }
.set-h--sm { margin-top: 0.2rem; font-size: 1.2rem; }
.set-actions { display: flex; justify-content: flex-end; gap: 0.5rem; padding-top: 0.25rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tiers { display: grid; gap: 0.5rem; }
.tier-row { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr) auto; align-items: center; gap: 0.5rem; }
.tier-row .input--num { width: 100%; }
.set-child { padding: 0; border: 1px solid var(--line-soft); border-radius: var(--r); background: var(--well); }
.set-child__sum { display: flex; align-items: center; gap: 0.6rem; min-height: 3.4rem; padding: 0.45rem 0.75rem 0.45rem 1rem; font-weight: 700; list-style: none; cursor: pointer; }
.set-child__sum::-webkit-details-marker { display: none; }
.set-child__sum::after { content: "▾"; color: var(--gold); transition: transform 0.2s; }
.set-child[open] > .set-child__sum::after { transform: rotate(180deg); }
.set-child__name { min-width: 0; font-family: var(--head); font-size: 1.14rem; overflow-wrap: anywhere; }
.set-child__order { display: flex; gap: 0.1rem; }
.set-child__body { display: grid; gap: 1rem; padding: 1rem; border-top: 1px solid var(--line-soft); }
.set-child.is-inactive .set-child__name { color: var(--muted); }
.set-child--new .set-child__sum { color: var(--gold-hi); }
.avatar { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 2.25rem; height: 2.25rem; border: 1px solid var(--line-soft); border-radius: 50%; background: rgba(201, 164, 92, 0.1); font-family: var(--emoji); font-size: 1.2rem; line-height: 1; }
.avatar-pick { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-top: -0.5rem; }
.avatar-pick__btn { width: 2.5rem; height: 2.5rem; border: 1px solid var(--line-soft); border-radius: 6px; background: var(--well); font-family: var(--emoji); font-size: 1.2rem; line-height: 1; cursor: pointer; }
.avatar-pick__btn:hover { border-color: var(--gold-hi); }
.cat-list { display: grid; gap: 0.75rem; }
.opt-edit { display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: center; gap: 0.25rem 0.75rem; }
.opt-edit .input { grid-column: 1 / -1; }
.opt-edit .icon-btn { justify-self: end; font-family: var(--emoji); }
.opt-edit.is-off .input { color: var(--muted); }
.tier-row .icon-btn { font-family: var(--emoji); }
.pts-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.5rem 0; border-bottom: 1px solid var(--line-soft); }
.pts-row__label { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.pts-row__emoji { width: 2rem; font-family: var(--emoji); font-size: 1.3rem; text-align: center; }
.pts-row__name { display: block; font-weight: 700; }
.pts-row__short { display: block; color: var(--muted); font-size: 0.8rem; }
.parents { display: grid; gap: 0.6rem; margin: 0; padding: 0; list-style: none; }
.parent { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; padding: 0.8rem 1rem; border: 1px solid var(--line-soft); border-radius: var(--r); background: var(--well); }
.parent.card { padding: 0.8rem 1rem; }
.parent__name { font-weight: 700; }
.parent__meta { color: var(--muted); font-size: 0.875rem; }

/* ---------- уведомления ---------- */

.toasts {
  position: fixed;
  bottom: 5rem;
  bottom: calc(5rem + env(safe-area-inset-bottom));
  left: 50%;
  z-index: 1000;
  display: grid;
  gap: 0.5rem;
  width: calc(100vw - 2rem);
  max-width: 28rem;
  transform: translateX(-50%);
  pointer-events: none;
}
.dlg .toasts { top: 1rem; bottom: auto; } /* сверху: снизу уведомление закрывало кнопки подвала окна */
.toast {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.35rem 0.45rem 1rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #151f36;
  color: var(--text);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
  pointer-events: auto;
  animation: toast-in 0.2s ease-out;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.is-leaving { opacity: 0; transform: translateY(0.4rem); }
.toast__msg { flex: 1; min-width: 0; padding: 0.25rem 0; overflow-wrap: anywhere; }
.toast__act { padding: 0.35rem 0.6rem; border: 0; border-radius: 4px; background: transparent; color: var(--gold-hi); font-weight: 700; text-decoration: underline; cursor: pointer; }
.toast__x { flex: none; width: 2rem; height: 2rem; border: 0; border-radius: 50%; background: transparent; color: inherit; opacity: 0.7; cursor: pointer; }
.toast--party { border-color: #f3dca4; background: var(--gold-btn); color: var(--on-gold); font-weight: 700; }
.toast--party .toast__act { color: var(--on-gold); }
.toast--error { border-color: #a5544a; background: #3a1d1b; color: #ffe1d8; }
@keyframes toast-in { from { opacity: 0; transform: translateY(0.5rem); } }

/* ---------- экраны «нет доступа» / ошибка ---------- */

.screen { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 1.5rem var(--gutter); }
.screen__card {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 0.75rem;
  max-width: 28rem;
  padding: 2rem 1.6rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(24, 35, 58, 0.97), rgba(14, 21, 37, 0.97));
  box-shadow: inset 0 0 0 3px rgba(12, 18, 33, 0.95), inset 0 0 0 4px var(--line-soft), 0 20px 50px rgba(0, 0, 0, 0.5);
  text-align: center;
}
.screen__icon { font-family: var(--emoji); font-size: 3rem; line-height: 1.1; }
.screen__title { color: var(--gold-hi); font-family: var(--head); font-size: 1.76rem; font-weight: 600; line-height: 1.1; }
.screen__text { color: var(--text); font-size: 1.05rem; }
.screen__hint { color: var(--muted); font-size: 0.875rem; }

/* ---------- адаптив ---------- */

@media (max-width: 719.98px) {
  .head { flex-direction: column; align-items: stretch; gap: 0.7rem; }
  .title { font-size: 2.3rem; text-align: center; }
  .subtitle { justify-content: center; font-size: 0.78rem; letter-spacing: 0.22em; }
  .plaque { flex-direction: column; }
  .plaque__cell { padding: 0.5rem 0.9rem; }
  .plaque__cell + .plaque__cell { border-top: 1px solid var(--line); border-left: 0; }
  .plaque__season { font-size: 1.1rem; }
  .plaque__left strong { font-size: 1.1rem; }
  .head__actions { justify-content: center; margin-left: 0; }
  .head__actions:empty { display: none; }

  .phead .ptitle { font-size: 1.23rem; }
  .moments__motto { text-align: left; }
  .step { grid-template-columns: 1.6rem 5.6rem minmax(0, 1fr) 1.7rem; gap: 0.5rem; }
  .step__ic { width: 1.6rem; height: 1.6rem; }

  .tbl--recent thead, .hist thead { display: none; }
  .tbl--recent, .tbl--recent tbody, .hist, .hist tbody { display: block; }
  .tbl--recent tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "who pts" "what what" "date when";
    gap: 0.15rem 0.75rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--line-soft);
  }
  .tbl--recent tbody tr:last-child { border-bottom: 0; }
  .tbl--recent td, .hist td { display: block; width: auto !important; padding: 0 !important; border: 0 !important; }
  .tbl--recent .c-who { grid-area: who; font-weight: 700; }
  .tbl--recent .c-pts { grid-area: pts; text-align: right; }
  .tbl--recent .c-what { grid-area: what; }
  .tbl--recent .c-date { grid-area: date; font-size: 0.8rem; }
  .tbl--recent .c-when { grid-area: when; }

  .hist tr.hrow {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "child pts" "reason reason" "date act";
    align-items: center;
    gap: 0.35rem 0.75rem;
    margin-bottom: 0.6rem;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--line-soft);
    border-radius: 6px;
    background: var(--well);
  }
  .hist:not(.hist--parent) tr.hrow { grid-template-areas: "child pts" "reason reason" "date date"; }
  .hist .c-child { grid-area: child; font-weight: 700; }
  .hist .c-pts { grid-area: pts; font-size: 1.1rem; }
  .hist .c-reason { grid-area: reason; }
  .hist .c-date { grid-area: date; font-size: 0.85rem; }
  .hist .c-act { grid-area: act; margin-right: -0.4rem; }
  .d-short { display: none; }
  .d-long { display: inline; }
  .season-pick { flex: 1 1 100%; }
  .season-pick .input { flex: 1 1 auto; width: 100%; }

  .dlg--md, .dlg--wide, .dlg--full { width: 100%; max-width: 100%; height: 100%; max-height: 100%; margin: 0; }
  .dlg--md .dlg__box, .dlg--wide .dlg__box, .dlg--full .dlg__box { height: 100%; max-height: 100%; border-radius: 0; }
  .dlg__foot .btn { flex: 1 1 auto; }
  .dlg__title, .dlg--summary .dlg__title { font-size: 1.35rem; }
  .dlg__foot .spacer { display: none; }
}

@media (max-width: 559.98px) {
  .kid__info { display: contents; }
  .kid__body {
    grid-template-columns: 5.8rem minmax(0, 1fr);
    grid-template-areas: "shield name" "shield score" "shield bar" "next next";
    row-gap: 0.25rem;
  }
  .kid__shield { grid-area: shield; }
  .kid__name { grid-area: name; align-self: end; }
  .kid__score { grid-area: score; margin: 0.15rem 0 0.2rem; }
  .kid .bar { grid-area: bar; align-self: start; margin-top: 0.3rem; margin-bottom: 0; }
  .kid .next { grid-area: next; margin-top: 0.45rem; }
  .shield__emoji { font-size: 2.2rem; }
}

@media (min-width: 480px) {
  .cat-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .cdetail__top { grid-template-columns: 7.4rem minmax(0, 1fr); }
}

@media (min-width: 560px) {
  .kid__body { grid-template-columns: 7.4rem minmax(0, 1fr); }
  .shield__emoji { font-size: 2.7rem; }
  .set-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .field-row { grid-template-columns: auto minmax(0, 1fr); }
  .opt-edit { grid-template-columns: minmax(0, 1fr) auto auto auto; }
  .opt-edit .input { grid-column: auto; }
  .sum__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sum-lines { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .catalog__list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 720px) {
  :root { --gutter: 1.5rem; }
  .fam { grid-template-columns: 6.5rem minmax(0, 1fr) minmax(12rem, 16rem); gap: 1.1rem; }
  .fam__art .art__svg { width: 6.5rem; height: 7.7rem; }
  .fam__prize { grid-column: auto; grid-template-columns: 4.6rem minmax(0, 1fr); padding: 0 0 0 1.1rem; border-top: 0; border-left: 1px solid var(--ink-line); }
  .fam__emblem .emblem__svg { width: 4.6rem; height: 4.6rem; }
  .kids { grid-template-columns: repeat(auto-fit, minmax(21rem, 1fr)); }
  .moments__grid { grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
  .moments__motto { text-align: right; }
  .cdetail__top { grid-template-columns: 8rem minmax(0, 1fr); }
}

@media (min-width: 900px) {
  .cdetail__cols { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
  .rgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dlg--wide .dlg__body { grid-template-columns: 12.5rem minmax(0, 1fr); }
  .set-nav { flex-direction: column; flex-wrap: nowrap; align-self: start; padding: 1rem 0.75rem; border-right: 1px solid var(--line-soft); border-bottom: 0; background: transparent; }
  .set-nav__btn { text-align: left; }
  .set-pane { padding: 1.2rem 1.5rem; }
}

/* десктоп: сайдбар слева, как в макете. С 1240px: уже (1100–1225) три карточки детей,
   плашка сезона с кнопкой «Добавить» и «Лучшие моменты» рядом с сайдбаром не помещаются
   и налезают друг на друга; планшет в альбомной ориентации получает нижнюю панель. */
@media (min-width: 1240px) {
  .layout { display: grid; grid-template-columns: 13.5rem minmax(0, 1fr); }
  .layout.is-parent .page, .page { padding: 0.7rem 1.6rem 1.5rem 1.4rem; }
  .side {
    position: sticky;
    top: 0;
    right: auto; bottom: auto; left: auto;
    z-index: 5;
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 1.4rem 0.85rem 1rem;
    border-top: 0;
    border-right: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(10, 16, 30, 0.94), rgba(14, 21, 38, 0.94));
    box-shadow: inset -4px 0 0 rgba(10, 16, 30, 0.95), inset -5px 0 0 var(--line-soft);
  }
  .side__brand { display: grid; justify-items: center; gap: 0.2rem; padding-bottom: 1.1rem; text-align: center; }
  .crest__svg { display: block; width: 7.8rem; height: 8.9rem; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.5)); }
  .side__family { margin-top: 0.35rem; color: var(--gold-hi); font-family: var(--head); font-size: 0.97rem; font-weight: 600; line-height: 1.2; letter-spacing: 0.16em; text-transform: uppercase; }
  .side__motto { color: var(--muted); font-size: 0.66rem; letter-spacing: 0.24em; text-transform: uppercase; }
  .nav { display: grid; gap: 0.3rem; }
  .nav__item { flex-direction: row; justify-content: flex-start; gap: 0.8rem; min-height: 2.9rem; padding: 0.5rem 0.85rem; font-size: 1.02rem; text-align: left; }
  .nav__item[aria-current="page"] { border-color: var(--line); background: linear-gradient(90deg, rgba(201, 164, 92, 0.42), rgba(201, 164, 92, 0.1)); box-shadow: inset 0 0 0 1px rgba(10, 16, 30, 0.6); }
  .side__quote { display: block; margin-top: auto; padding: 1rem 0.4rem 0.25rem; color: var(--gold-hi); font-size: 1.02rem; font-style: italic; line-height: 1.4; text-align: center; opacity: 0.92; }
  .add-btn { display: inline-flex; min-height: 2.75rem; font-size: 1rem; }
  .nav__add { display: none; }
  .toasts { bottom: 1.25rem; }

  .head { flex-wrap: nowrap; gap: 1.4rem; margin-bottom: 0.75rem; }
  .head__brand { flex: none; }
  .plaque { flex: 0 1 auto; min-width: 0; }
  .head__actions { flex: none; }
  .title, .subtitle { white-space: nowrap; }
  .dash { gap: 0.75rem; }
  .moments { padding: 0.65rem 1rem 0.75rem; }
  .moments .phead, .recent .phead, .ladder .phead { margin-bottom: 0.5rem; }
  .recent { padding: 0.7rem 1rem 0.55rem; }
  .tbl--recent { font-size: 0.86rem; }
  .tbl--recent th { padding-top: 0.18rem; padding-bottom: 0.18rem; }
  .tbl--recent td { padding-top: 0.17rem; padding-bottom: 0.17rem; }
  .ladder { padding: 0.75rem 1rem 0.75rem; }
  .title { font-size: 2.73rem; }

  .dash {
    grid-template-columns: minmax(0, 1.72fr) minmax(0, 1fr);
    grid-template-areas: "fam fam" "kids kids" "moments ladder" "recent ladder";
    align-items: start;
  }
  .dash > .fam { grid-area: fam; }
  .dash > .kids { grid-area: kids; }
  .dash > .moments { grid-area: moments; }
  .dash > .ladder { grid-area: ladder; align-self: stretch; }
  .dash > .recent { grid-area: recent; }
  .fam {
    grid-template-columns: 7.4rem minmax(0, 1fr) 19rem;
    gap: 1.3rem;
    padding: 0.75rem 1.25rem 0.75rem 1rem;
    background-image:
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 110'%3E%3Cg fill='none' stroke='%23a2814f' stroke-opacity='.4' stroke-width='1'%3E%3Cpath d='M0 110 50 64l26 24 52-66 46 54 28-26 54 60 36-34 108 94'/%3E%3Cpath d='M128 22l-7 12 5-3 3 4 3-4 5 3zM256 56l-5 9 4-2 2 3 2-3 4 2z'/%3E%3Cpath d='M300 110V84M296 92l4-8 4 8M310 110V78M305 88l5-10 5 10M290 110V90M287 96l3-6 3 6'/%3E%3C/g%3E%3C/svg%3E"),
      radial-gradient(ellipse at 18% 22%, rgba(255, 252, 240, 0.6), transparent 55%),
      radial-gradient(ellipse at 82% 78%, rgba(176, 134, 70, 0.16), transparent 60%),
      radial-gradient(ellipse at 50% 120%, rgba(140, 98, 40, 0.22), transparent 60%),
      radial-gradient(circle at 93% 10%, rgba(150, 110, 50, 0.12), transparent 25%);
    background-position: right 21rem bottom 0, 0 0, 0 0, 0 0, 0 0;
    background-size: 24rem auto, auto, auto, auto, auto;
    background-repeat: no-repeat;
  }
  .fam__art .art__svg { width: 7.4rem; height: 8.75rem; }
  .fam__title { font-size: 1.72rem; }
  .fam__big { font-size: 2.82rem; }
  .fam__of { font-size: 1.94rem; }
  .fam__unit { font-size: 1.32rem; }
  .fam__score { margin: 0.15rem 0 0.6rem; }
  .fam .bar--fam { max-width: 34rem; }
  .fam__prize { grid-template-columns: 6rem minmax(0, 1fr); gap: 1rem; }
  .fam__emblem .emblem__svg { width: 6rem; height: 6rem; }
  .fam__prize-title { font-size: 1.4rem; }

  .kids { grid-template-columns: repeat(var(--kids, 3), minmax(0, 1fr)); }
  .kid__body { grid-template-columns: 6.6rem minmax(0, 1fr); gap: 0.7rem; }
  .shield__emoji { font-size: 3rem; }
  .kid__name { font-size: 1.89rem; }
  .moments__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .moment { grid-template-columns: 3.4rem minmax(0, 1fr); gap: 0.6rem; padding: 0.45rem 0.6rem; }
  .hex { width: 3.4rem; height: 3.8rem; }
  .rgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1500px) {
  .rgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .plaque__season { white-space: nowrap; }
  .kid__body { grid-template-columns: 8rem minmax(0, 1fr); gap: 0.8rem; }
}

/* телевизор и большой экран */
@media (min-width: 1900px) {
  html { font-size: 112.5%; }
}
@media (min-width: 2500px) {
  html { font-size: 137.5%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
