/* Purr City — уютная тёплая тема */

:root {
  --bg: #fbf3e9;
  --bg-soft: #f5e6d3;
  --surface: #fffdf9;
  --surface-2: #fff4e8;
  --text: #3d2b1f;
  --muted: #8c7363;
  --line: #ecdcc8;
  --accent: #d9734e;
  --accent-strong: #c45f3b;
  --accent-ink: #ffffff;
  --accent-soft: #f9e0d3;
  --honey: #e9a84b;
  --honey-soft: #fbecd0;
  --sage: #6f9a5c;
  --sage-soft: #e2ecd8;
  --danger: #c2493b;
  --polaroid: #ffffff;
  --shadow-sm: 0 2px 6px rgba(92, 58, 33, 0.08);
  --shadow: 0 8px 24px rgba(92, 58, 33, 0.12);
  --radius: 22px;
  --radius-sm: 14px;
  --tabbar-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --vh: var(--tg-viewport-stable-height, 100vh);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #1e1713;
  --bg-soft: #271e18;
  --surface: #2b221c;
  --surface-2: #33281f;
  --text: #f5e8da;
  --muted: #bba390;
  --line: #3f3228;
  --accent: #ee8a62;
  --accent-strong: #f59c77;
  --accent-ink: #2a1a12;
  --accent-soft: #4a2e22;
  --honey: #f0b661;
  --honey-soft: #43351f;
  --sage: #9dbe87;
  --sage-soft: #2c3626;
  --danger: #f07a6b;
  --polaroid: #3a2e26;
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.3);
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}

/* Пока скрипт не выставил тему — следуем системной (без вспышки светлого экрана). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #1e1713;
    --bg-soft: #271e18;
    --surface: #2b221c;
    --surface-2: #33281f;
    --text: #f5e8da;
    --muted: #bba390;
    --line: #3f3228;
    --accent: #ee8a62;
    --accent-strong: #f59c77;
    --accent-ink: #2a1a12;
    --accent-soft: #4a2e22;
    --honey: #f0b661;
    --honey-soft: #43351f;
    --sage: #9dbe87;
    --sage-soft: #2c3626;
    --danger: #f07a6b;
    --polaroid: #3a2e26;
    --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.3);
    --shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
  }
}


:root[data-theme="halloween"] {
  --bg: #17121f;
  --bg-soft: #211a2c;
  --surface: #251c33;
  --surface-2: #2e2340;
  --text: #f6eadb;
  --muted: #b3a2c4;
  --line: #3a2d4d;
  --accent: #ff8a2b;
  --accent-strong: #ffa04f;
  --accent-ink: #1a1020;
  --accent-soft: #4a2a1c;
  --honey: #a879ff;
  --honey-soft: #33244a;
  --sage: #9be36b;
  --sage-soft: #233322;
  --danger: #ff6b6b;
  --polaroid: #2c2238;
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.4);
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.3s ease, color 0.3s ease;
}

button { font: inherit; color: inherit; cursor: pointer; }
/* В Mini App случайное протягивание пальцем не должно выделять подписи кнопок и меню. */
button, .tabbar, .radius, .chips, .seg, .snap-hint { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

/* --- Иконки --- */
.i {
  flex: none;
  width: 1.2em;
  height: 1.2em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.22em;
}
.i--accent { color: var(--accent); }
.i.i--fill { fill: currentColor; stroke: none; }
.illus { display: block; width: 100%; height: auto; }
img { display: block; max-width: 100%; }
h1, h2, h3 { margin: 0; font-weight: 900; letter-spacing: -0.01em; }

.app {
  position: relative;
  max-width: 560px;
  min-height: var(--vh);
  margin: 0 auto;
}

.demo-banner {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 50;
  padding: 6px 16px;
  background: var(--honey-soft);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 700;
  text-align: center;
}

/* --- Общие элементы --- */

.view {
  padding: 18px 16px calc(var(--tabbar-h) + var(--safe-b) + 96px);
  animation: fade-in 0.22s ease;
}

@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.page-head { margin: 4px 2px 14px; }
.page-head h1 { font-size: 28px; }
.eyebrow { display: flex; align-items: center; gap: 6px; margin: 0 0 2px; color: var(--muted); font-weight: 700; font-size: 14px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  font-weight: 800;
  font-size: 16px;
  transition: transform 0.12s ease, background 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn--primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 16px rgba(217, 115, 78, 0.35); }
.btn--soft { background: var(--accent-soft); color: var(--accent-strong); }
.btn--ghost { background: transparent; color: var(--muted); }
.btn--danger { background: transparent; color: var(--danger); }
.btn--danger-fill { background: var(--danger); color: #fff; }
.btn--block { width: 100%; }
.btn--sm { min-height: 38px; padding: 0 14px; font-size: 14px; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--accent);
}
.icon-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.icon-btn.is-busy svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.chips { display: flex; gap: 8px; margin: 0 -16px 16px; padding: 0 16px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 15px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-weight: 700;
  font-size: 14px;
  color: var(--muted);
}
.chip.is-on { background: var(--text); border-color: var(--text); color: var(--bg); }

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.section-title { margin: 22px 4px 10px; font-size: 13px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

/* --- Статистика --- */

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.stat { padding: 12px 12px 10px; border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow-sm); }
.stat b { display: block; font-size: 24px; font-weight: 900; line-height: 1.1; }
.stat span { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.stat:nth-child(1) { background: var(--accent-soft); }
.stat:nth-child(2) { background: var(--honey-soft); }
.stat:nth-child(3) { background: var(--sage-soft); }

/* --- Полароиды --- */

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

.polaroid {
  position: relative;
  padding: 8px 8px 10px;
  border: 0;
  border-radius: 6px;
  background: var(--polaroid);
  box-shadow: var(--shadow);
  text-align: left;
  transform: rotate(var(--tilt, 0deg));
  transition: transform 0.18s ease;
}
.polaroid-wrap { position: relative; min-width: 0; }
.polaroid-wrap:nth-child(4n + 1) .polaroid { --tilt: -1.4deg; }
.polaroid-wrap:nth-child(4n + 2) .polaroid { --tilt: 1.1deg; }
.polaroid-wrap:nth-child(4n + 3) .polaroid { --tilt: 0.8deg; }
.polaroid-wrap:nth-child(4n + 4) .polaroid { --tilt: -0.9deg; }
.polaroid:active { transform: rotate(0deg) scale(0.98); }
.polaroid::before {
  content: "";
  position: absolute;
  top: -9px;
  left: 50%;
  width: 54px;
  height: 18px;
  transform: translateX(-50%) rotate(-3deg);
  background: var(--honey);
  opacity: 0.55;
  border-radius: 2px;
}
.polaroid__photo {
  aspect-ratio: 1;
  width: 100%;
  border-radius: 3px;
  background: var(--bg-soft);
  object-fit: cover;
}
.polaroid__name { margin-top: 8px; font-size: 16px; font-weight: 900; line-height: 1.15; overflow-wrap: anywhere; }
/* В сетке длинное имя — максимум две строки, полностью оно видно в карточке. */
.polaroid .polaroid__name { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.polaroid__meta { display: flex; justify-content: space-between; gap: 6px; margin-top: 2px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.polaroid__badge {
  color: var(--accent-strong);
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  font-size: 16px;
  box-shadow: var(--shadow-sm);
}

/* --- Пустые состояния и загрузка --- */

.empty { padding: 28px 20px 24px; text-align: center; }
.empty svg { width: 150px; height: auto; margin: 0 auto 8px; }
.empty h3 { font-size: 20px; margin-bottom: 6px; }
.empty p { margin: 0 auto 18px; max-width: 300px; color: var(--muted); }

.skeleton { border-radius: 6px; background: linear-gradient(90deg, var(--bg-soft), var(--surface-2), var(--bg-soft)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.skeleton--polaroid { aspect-ratio: 0.82; }
@keyframes shimmer { to { background-position: -200% 0; } }

img.ph { opacity: 0; transition: opacity 0.25s ease; }
img.ph.is-loaded { opacity: 1; }

/* --- Карта --- */

.view--map {
  position: fixed;
  left: 50%;
  top: calc(var(--banner-h, 0px) + env(safe-area-inset-top, 0px));
  bottom: calc(var(--tabbar-h) + var(--safe-b));
  width: 100%;
  max-width: 560px;
  padding: 0;
  transform: translateX(-50%);
  animation: none;
}
.map { position: absolute; inset: 0; background: var(--bg-soft); }
.leaflet-container { font-family: inherit; background: var(--bg-soft); }
.leaflet-tile-pane { filter: sepia(0.22) saturate(0.95); }
:root[data-theme="halloween"] .leaflet-tile-pane { filter: invert(1) hue-rotate(225deg) saturate(0.75) brightness(0.78); }
:root[data-theme="dark"] .leaflet-tile-pane { filter: invert(1) hue-rotate(185deg) sepia(0.35) saturate(0.6) brightness(0.85); }
.leaflet-control-attribution { font-size: 10px; background: color-mix(in srgb, var(--surface) 80%, transparent) !important; color: var(--muted); }
.leaflet-control-attribution a { color: var(--muted); }

.map-top { position: absolute; z-index: 500; top: 12px; left: 12px; right: 12px; display: flex; align-items: center; gap: 10px; }
.radius { display: flex; flex: 1; padding: 4px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); }
.radius button { flex: 1; min-height: 38px; border: 0; border-radius: 999px; background: transparent; font-weight: 800; font-size: 14px; color: var(--muted); }
.radius button.is-on { background: var(--accent); color: var(--accent-ink); }

.pin {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 3px solid var(--surface);
  border-radius: 50% 50% 50% 8px;
  transform: rotate(-45deg);
  background: var(--accent);
  box-shadow: var(--shadow);
}
.pin .cat-head { width: 22px; height: 22px; transform: rotate(45deg); }
.cat-head__face { fill: var(--surface); }
.cat-head__eye { fill: var(--accent); }
.pin--mine .cat-head__eye { fill: var(--honey); }
.pin--mine { background: var(--honey); }
.pin--approx { border-radius: 50%; transform: none; background: var(--surface); border-color: var(--accent); }
.pin--approx .cat-head { transform: none; }
.pin--approx .cat-head__face { fill: var(--accent); }
.pin--approx .cat-head__eye { fill: var(--surface); }
.here-dot { width: 18px; height: 18px; border: 3px solid #fff; border-radius: 50%; background: #3d8bfd; box-shadow: 0 0 0 0 rgba(61, 139, 253, 0.5); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 16px rgba(61, 139, 253, 0); } 100% { box-shadow: 0 0 0 0 rgba(61, 139, 253, 0); } }

.map-intro {
  position: absolute;
  z-index: 600;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  backdrop-filter: blur(3px);
}
.intro-card { width: 100%; max-width: 360px; padding: 26px 22px 14px; border-radius: 28px; background: var(--surface); box-shadow: var(--shadow); text-align: center; }
.intro-card h2 { font-size: 23px; margin-bottom: 8px; }
.intro-card p { margin: 0 0 18px; color: var(--muted); font-size: 15px; }
.intro-card .btn { width: 100%; }
.intro-art { width: 200px; max-width: 100%; margin: -10px auto 4px; }

/* Оживление заставки: котёнок моргает, сердечки всплывают, метка чуть подпрыгивает. */
.illus--anim .illus__eyes { transform-box: fill-box; transform-origin: center; animation: blink 4.5s infinite; }
@keyframes blink { 0%, 90%, 100% { transform: scaleY(1); } 93% { transform: scaleY(0.1); } 96% { transform: scaleY(1); } }
.illus--anim .illus__heart { transform-box: fill-box; transform-origin: center; animation: float-up 3.2s ease-in-out infinite; }
.illus--anim .illus__heart--2 { animation-delay: 1.4s; }
@keyframes float-up {
  0% { opacity: 0; transform: translateY(8px) scale(0.7); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-14px) scale(1.05); }
}
.illus--anim .illus__pin { transform-box: fill-box; transform-origin: 50% 100%; animation: pin-bob 2.4s ease-in-out infinite; }
.illus--anim .illus__bat { transform-box: fill-box; transform-origin: center; animation: bat-flap 0.5s ease-in-out infinite alternate; }
.illus--anim .illus__bat--2 { animation-duration: 0.62s; }
@keyframes bat-flap { from { transform: scaleY(1); } to { transform: scaleY(0.55) translateY(-1px); } }
@keyframes pin-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

.panel {
  position: absolute;
  z-index: 550;
  left: 10px;
  right: 10px;
  bottom: 10px;
  max-height: 46%;
  overflow-y: auto;
  padding: 6px 6px 8px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overscroll-behavior: contain;
}
.panel__head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 10px 12px 8px; }
.panel__head h3 { font-size: 17px; }
.panel__head span { font-size: 13px; color: var(--muted); font-weight: 700; }
.panel__note { margin: 4px 12px 6px; font-size: 12.5px; color: var(--muted); }
.panel .empty { padding: 14px 16px 16px; }
.panel .empty p { margin-bottom: 12px; }

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  text-align: left;
}
.row:active { background: var(--surface-2); }
.row__thumb { flex: none; width: 52px; height: 52px; border-radius: 14px; object-fit: cover; background: var(--bg-soft); }
.row__body { flex: 1; min-width: 0; }
.row__title, .row__meta { display: block; }
.row__title { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row__meta { font-size: 13px; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row__dist { flex: none; padding: 4px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); font-weight: 800; font-size: 13px; }
.row__chev { flex: none; width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2.2; stroke-linecap: round; }

/* --- Друзья --- */

.invite {
  position: relative;
  overflow: hidden;
  padding: 20px 18px 18px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--honey-soft), var(--accent-soft));
}
.invite h2 { font-size: 21px; margin-bottom: 4px; }
.invite p { margin: 0 0 14px; color: var(--muted); font-size: 14.5px; max-width: 290px; }
.invite__paw { position: absolute; right: -14px; top: -16px; color: var(--accent); opacity: 0.16; transform: rotate(18deg); }
.invite__paw .i { width: 120px; height: 120px; fill: currentColor; stroke: none; }
.invite__code {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding: 10px 14px;
  border: 2px dashed color-mix(in srgb, var(--accent) 50%, transparent);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}
.invite__code b { font-size: 21px; letter-spacing: 0.14em; font-weight: 900; }
.invite__actions { display: flex; gap: 8px; }
.invite__actions .btn { flex: 1; }

.list { padding: 6px; }
.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--av, var(--honey-soft));
  font-weight: 900;
  font-size: 19px;
  color: var(--text);
}
.back-link { display: inline-flex; align-items: center; gap: 4px; margin: 0 0 10px -6px; padding: 6px; border: 0; background: none; color: var(--accent-strong); font-weight: 800; }

/* --- Профиль --- */

.profile { display: flex; align-items: center; gap: 14px; padding: 18px; }
.profile .avatar { width: 64px; height: 64px; font-size: 26px; }
.profile h2 { font-size: 22px; }
.profile p { margin: 2px 0 0; color: var(--muted); font-weight: 600; font-size: 14px; }

.facts { padding: 6px 4px; }
.fact { display: flex; gap: 12px; padding: 10px 12px; }
.fact__icon { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 13px; background: var(--surface-2); font-size: 22px; }
.fact__icon--accent { background: var(--accent-soft); color: var(--accent); }
.fact__icon--honey { background: var(--honey-soft); color: var(--honey); }
.fact__icon--sage { background: var(--sage-soft); color: var(--sage); }
.fact b { display: block; font-weight: 800; }
.fact span { font-size: 14px; color: var(--muted); }

/* --- FAB и таббар --- */


.tabbar {
  position: fixed;
  z-index: 800;
  left: 50%;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr 1fr 1.25fr 1fr 1fr;
  width: 100%;
  max-width: 560px;
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding: 6px 8px var(--safe-b);
  transform: translateX(-50%);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 0; background: none; color: var(--muted); font-size: 11.5px; font-weight: 800; }
.tab svg { width: 26px; height: 26px; padding: 2px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linejoin: round; border-radius: 10px; transition: background 0.15s; }
.tab svg.is-fill { fill: currentColor; stroke: none; padding: 1px; }
.tab.is-on { color: var(--accent-strong); }
.tab.is-on svg { background: var(--accent-soft); width: 46px; }

/* --- Центральная кнопка «Снять кота» --- */

.snap-slot { position: relative; display: flex; justify-content: center; }
.snap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  margin-top: -26px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-strong);
  font-size: 11.5px;
  font-weight: 900;
}
.snap__btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border: 5px solid var(--surface);
  border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, var(--honey) 0%, var(--accent) 55%, var(--accent-strong) 100%);
  color: #fff;
  box-shadow: 0 8px 20px rgba(217, 115, 78, 0.45), inset 0 -3px 0 rgba(0, 0, 0, 0.08);
  transition: transform 0.15s ease;
}
.snap:active .snap__btn { transform: scale(0.92); }
.snap__icon {
  width: 32px;
  height: 32px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform-origin: 50% 80%;
  animation: snap-peek 6s ease-in-out 2s infinite;
}
.snap__label { white-space: nowrap; }

/* Иногда «котокамера» шевелит ушами — ненавязчиво напоминает о себе. */
@keyframes snap-peek {
  0%, 88%, 100% { transform: rotate(0); }
  91% { transform: rotate(-7deg); }
  94% { transform: rotate(6deg); }
  97% { transform: rotate(-3deg); }
}

/* Пока человек ни разу не нажимал кнопку — вокруг неё расходятся мягкие волны. */
.snap.is-new .snap__btn::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  animation: snap-ring 1.8s ease-out infinite;
}
@keyframes snap-ring {
  from { opacity: 0.7; transform: scale(1); }
  to { opacity: 0; transform: scale(1.45); }
}

.snap-hint {
  position: absolute;
  bottom: calc(100% + 46px);
  left: 50%;
  width: max-content;
  max-width: 230px;
  padding: 10px 14px;
  transform: translateX(-50%);
  border-radius: 16px;
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  box-shadow: var(--shadow);
  cursor: pointer;
  animation: hint-in 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}
.snap-hint { display: flex; align-items: center; gap: 10px; padding: 10px 8px 12px 16px; max-width: 270px; }
.snap-hint b { display: block; font-weight: 900; }
.snap-hint__text { flex: 1; }
.snap-hint__close {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: color-mix(in srgb, var(--bg) 16%, transparent);
  color: var(--bg);
}
.snap-hint__close:active { transform: scale(0.9); }
.snap-hint__close svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
/* Тонкая полоска внизу показывает, сколько подсказке осталось висеть. */
.snap-hint__timer {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 5px;
  height: 2px;
  border-radius: 1px;
  background: var(--accent);
  opacity: 0.8;
  transform-origin: left center;
  animation: hint-timer var(--hint-life, 7s) linear forwards;
}
@keyframes hint-timer { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.snap-hint.is-leaving { animation: hint-out 0.22s ease forwards; }
@keyframes hint-out { to { opacity: 0; transform: translate(-50%, 6px) scale(0.95); } }
.snap-hint::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -8px;
  border: 8px solid transparent;
  border-top-color: var(--text);
}
@keyframes hint-in { from { opacity: 0; transform: translate(-50%, 8px) scale(0.92); } }

/* --- Карточка (шторка) --- */

.sheet-backdrop { position: fixed; z-index: 900; inset: 0; background: rgba(40, 25, 15, 0.45); animation: fade 0.2s ease; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: fixed;
  z-index: 950;
  left: 50%;
  bottom: 0;
  width: 100%;
  max-width: 560px;
  max-height: calc(var(--vh) - 24px);
  overflow-y: auto;
  padding: 8px 18px calc(22px + var(--safe-b));
  transform: translateX(-50%);
  border-radius: 28px 28px 0 0;
  background: var(--bg);
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.18);
  animation: slide-up 0.26s cubic-bezier(0.2, 0.9, 0.3, 1);
  overscroll-behavior: contain;
}
@keyframes slide-up { from { transform: translate(-50%, 40%); opacity: 0.4; } }
.sheet__grip { width: 44px; height: 5px; margin: 2px auto 12px; border-radius: 3px; background: var(--line); }

.cat-photo { position: relative; padding: 10px 10px 0; border-radius: 8px; background: var(--polaroid); box-shadow: var(--shadow); transform: rotate(-0.8deg); }
.cat-photo img { width: 100%; aspect-ratio: 4 / 3.4; object-fit: cover; border-radius: 4px; background: var(--bg-soft); }
.cat-photo figcaption { padding: 10px 4px 12px; font-weight: 900; font-size: 24px; line-height: 1.15; overflow-wrap: anywhere; }
.cat-desc { margin: 16px 2px 0; font-size: 16px; white-space: pre-line; overflow-wrap: anywhere; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-sm); font-size: 13.5px; font-weight: 700; }
.tag .i { color: var(--muted); }
.tag--street { background: var(--sage-soft); }
.tag--street .i { color: var(--sage); }
.tag--home { background: var(--honey-soft); }
.tag--home .i { color: var(--honey); }

.place { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface); }
.place__icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); font-size: 22px; }
.place__text { flex: 1; font-size: 14.5px; }
.place__text b { display: block; }
.place__text span { color: var(--muted); font-size: 13px; }

.setting { margin-top: 18px; }
.setting__label { margin: 0 2px 8px; font-weight: 800; font-size: 15px; }
.setting__hint { margin: 8px 2px 0; font-size: 13.5px; color: var(--muted); }
.seg { display: grid; grid-auto-columns: 1fr; grid-auto-flow: column; gap: 4px; padding: 4px; border-radius: 16px; background: var(--bg-soft); }
.seg__btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 4px; white-space: nowrap; letter-spacing: -0.01em; border: 0; border-radius: 12px; background: transparent; font-weight: 800; font-size: 14px; color: var(--muted); }
.seg__btn.is-on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg__btn:disabled { opacity: 0.45; }

.notice { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--honey-soft); font-size: 14px; font-weight: 600; }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.sheet-actions .btn { flex: 1; }
.reasons { display: grid; gap: 8px; margin-top: 14px; }
.reasons .btn { justify-content: flex-start; background: var(--surface); }

/* --- Добавление кота --- */

.sheet-title { display: flex; align-items: center; gap: 8px; margin: 0 2px 14px; font-size: 24px; }
.photo-actions { display: flex; gap: 8px; margin-top: 14px; }
.field {
  display: block;
  width: 100%;
  padding: 13px 14px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 16px; /* меньше 16px — iOS приближает страницу при фокусе */
  resize: vertical;
  transition: border-color 0.15s ease;
}
.field::placeholder { color: var(--muted); opacity: 0.7; }
.field:focus { outline: none; border-color: var(--accent); }
.save-btn { margin-top: 24px; }

/* --- Тост и экран-заглушка --- */

.toast {
  position: fixed;
  z-index: 1000;
  left: 50%;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 18px);
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  transform: translateX(-50%);
  border-radius: 16px;
  background: var(--text);
  color: var(--bg);
  font-weight: 700;
  font-size: 14.5px;
  box-shadow: var(--shadow);
  animation: toast-in 0.2s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

.gate { display: grid; place-items: center; min-height: var(--vh); padding: 24px; text-align: center; }
.gate .intro-card { padding-bottom: 22px; }

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

/* --- Выбор темы --- */

.theme-grid { display: grid; grid-template-columns: repeat(var(--cols, 2), 1fr); gap: 10px; }
.theme-grid--3 { --cols: 3; }
.theme-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 8px 10px;
  border: 2px solid transparent;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  text-align: left;
  transition: transform 0.12s ease, border-color 0.15s ease;
}
.theme-card:active { transform: scale(0.97); }
.theme-card.is-on { border-color: var(--accent); }
.theme-card.is-on::after {
  content: "";
  position: absolute;
  top: 12px;
  right: 12px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 12.5 4 4 8-9' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat;
}
.theme-card__preview {
  position: relative;
  display: block;
  height: 64px;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid var(--line);
}
.theme-card__polaroid {
  position: absolute;
  left: 12px;
  top: 10px;
  width: 30px;
  height: 36px;
  padding: 3px 3px 9px;
  border-radius: 3px;
  transform: rotate(-6deg);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.18);
}
.theme-card__polaroid span { display: block; width: 100%; height: 100%; border-radius: 2px; }
.theme-card__button { position: absolute; right: 10px; bottom: 10px; width: 26px; height: 26px; border-radius: 50%; }
.theme-card__moon { position: absolute; left: 50%; top: 9px; width: 12px; height: 12px; border-radius: 50%; background: #f6e7b0; box-shadow: 0 0 10px #f6e7b0; }
.theme-card__label { display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: 14px; }
.theme-card__label .i { color: var(--accent); }
.theme-card__badge { margin-top: -4px; font-size: 11.5px; font-weight: 700; color: var(--muted); }
.theme-card--halloween .theme-card__label .i { color: #ff8a2b; }
.theme-auto { margin-top: 8px; }

/* --- Предложение включить Хэллоуин --- */

.season-offer {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
  padding: 14px 44px 14px 14px;
  background: linear-gradient(120deg, #2a1d3a, #3d2533);
  color: #f6eadb;
}
.season-offer__icon { display: grid; place-items: center; flex: none; width: 42px; height: 42px; border-radius: 14px; background: rgba(255, 138, 43, 0.18); color: #ff8a2b; font-size: 24px; }
.season-offer__body { display: flex; flex: 1; flex-direction: column; align-items: flex-start; gap: 10px; }
.season-offer__text { font-size: 13.5px; line-height: 1.3; color: #d9cbe6; }
.season-offer__text b { display: block; font-size: 15px; color: #f6eadb; }
.season-offer .btn--primary { background: #ff8a2b; color: #1a1020; box-shadow: none; }
.season-offer__close { position: absolute; top: 10px; right: 10px; background: rgba(255, 255, 255, 0.1); color: #f6eadb; }

/* --- Хэллоуин-оформление --- */

.spooky { position: fixed; z-index: 5; inset: 0 0 auto auto; width: 100%; max-width: 560px; left: 50%; transform: translateX(-50%); height: 0; pointer-events: none; color: var(--muted); }
.spooky__web { position: absolute; top: 0; right: 0; width: 110px; height: 110px; opacity: 0.35; }
.spooky__spider { position: absolute; top: 0; right: 46px; width: 2px; height: 70px; background: linear-gradient(var(--muted), var(--muted)) center / 1px 100% no-repeat; opacity: 0.85; transform-origin: top center; animation: spider-drop 5s ease-in-out infinite; }
.spooky__spider svg { position: absolute; bottom: -14px; left: 50%; width: 22px; height: 22px; margin-left: -11px; color: #0e0a14; }
@keyframes spider-drop { 0%, 100% { height: 54px; } 50% { height: 82px; } }
.spooky__bat { position: absolute; top: 64px; left: -40px; width: 28px; height: 14px; color: var(--muted); opacity: 0.55; animation: bat-fly 14s linear infinite; }
.spooky__bat--2 { top: 96px; width: 20px; height: 10px; animation-duration: 19s; animation-delay: 6s; }
@keyframes bat-fly {
  0% { transform: translate(0, 0) scaleY(1); }
  10% { transform: translate(60px, -10px) scaleY(0.6); }
  20% { transform: translate(120px, 4px) scaleY(1); }
  30% { transform: translate(180px, -8px) scaleY(0.6); }
  40% { transform: translate(240px, 2px) scaleY(1); }
  50% { transform: translate(300px, -12px) scaleY(0.6); }
  60%, 100% { transform: translate(640px, -40px) scaleY(1); }
}
/* На карте декор закрывал бы кнопки радиуса — там его не показываем. */
#view-map:not([hidden]) ~ .spooky { display: none; }

:root[data-theme="halloween"] .polaroid::before {
  background: repeating-linear-gradient(45deg, #ff8a2b 0 6px, #2a1f38 6px 12px);
  opacity: 0.85;
}
:root[data-theme="halloween"] .snap__btn {
  background: radial-gradient(circle at 32% 28%, #ffc067 0%, #ff8a2b 50%, #d9600f 100%);
  box-shadow: 0 8px 22px rgba(255, 138, 43, 0.45), inset 0 -3px 0 rgba(0, 0, 0, 0.12);
  color: #2a1608;
}
:root[data-theme="halloween"] .snap__btn::before {
  content: "";
  position: absolute;
  top: -11px;
  left: 50%;
  width: 7px;
  height: 12px;
  margin-left: -2px;
  border-radius: 3px 3px 1px 1px;
  background: #5b8a3a;
  transform: rotate(14deg);
}
:root[data-theme="halloween"] .pin--mine { background: #a879ff; }
:root[data-theme="halloween"] .demo-banner { background: #2e2340; color: #f6eadb; }

/* --- Подтверждение внутри страницы (вне Telegram) --- */

.dialog { position: fixed; z-index: 1100; inset: 0; display: grid; place-items: center; padding: 24px 16px; background: rgba(30, 18, 10, 0.5); animation: fade 0.15s ease; }
.dialog__card { width: 100%; max-width: 340px; padding: 22px 20px 16px; border-radius: 24px; background: var(--surface); box-shadow: var(--shadow); animation: hint-in 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.2); }
.dialog__text { margin: 0 0 18px; font-size: 16px; font-weight: 600; line-height: 1.4; text-wrap: pretty; }
.dialog__actions { display: flex; gap: 8px; }
.dialog__actions .btn { flex: 1; }

/* --- Подписи на рисованной карте --- */

.map-label {
  display: inline-block;
  transform: translate(-50%, -50%);
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}

/* Видимый фокус для клавиатуры. */
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; }

/* --- Уровень, задания, значки --- */

.level-card { padding: 16px 16px 14px; background: linear-gradient(135deg, var(--honey-soft), var(--accent-soft)); }
.level-card__top { display: flex; align-items: center; gap: 14px; }
.level-card__who { min-width: 0; }
.level-card__who h2 { font-size: 22px; overflow-wrap: anywhere; }
.level-card__title { display: flex; align-items: center; gap: 6px; margin: 2px 0 0; font-weight: 800; font-size: 14.5px; color: var(--accent-strong); }
.level-ring { position: relative; flex: none; width: 72px; height: 72px; display: grid; place-items: center; }
.level-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.level-ring circle { fill: none; stroke-width: 5; }
.level-ring__track { stroke: color-mix(in srgb, var(--surface) 70%, transparent); }
.level-ring__fill { stroke: var(--accent); stroke-linecap: round; transition: stroke-dasharray 0.8s ease; }
.level-ring .avatar { width: 54px; height: 54px; font-size: 23px; }
.level-ring__badge {
  position: absolute;
  right: -4px;
  bottom: -2px;
  display: grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  border: 3px solid var(--surface);
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.xpbar { height: 10px; margin-top: 14px; overflow: hidden; border-radius: 999px; background: color-mix(in srgb, var(--surface) 75%, transparent); }
.xpbar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--honey), var(--accent)); transition: width 1s cubic-bezier(0.3, 0.8, 0.3, 1); }
.xpbar--sm { height: 6px; margin-top: 6px; background: var(--bg-soft); }
.xpbar__meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 10px; margin-top: 6px; font-size: 13px; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.xpbar__meta b { color: var(--text); font-weight: 900; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.section-head .section-title { margin-right: 0; }
.section-note { margin: 22px 4px 10px; font-size: 12.5px; font-weight: 700; color: var(--muted); }

.quests { padding: 4px 4px; }
.quest { display: flex; align-items: center; gap: 12px; padding: 10px 10px; border-radius: var(--radius-sm); }
.quest + .quest { border-top: 1px solid var(--line); border-radius: 0; }
.quest__icon { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); font-size: 20px; }
.quest__body { flex: 1; min-width: 0; }
.quest__body b { display: block; font-size: 14.5px; font-weight: 800; line-height: 1.25; }
.quest__hint { display: block; margin-top: 2px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.quest__count { flex: none; font-size: 13px; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.quest.is-done .quest__icon { background: var(--sage-soft); color: var(--sage); }
.quest.is-done .xpbar span { background: var(--sage); }
.quest--chest .quest__icon { background: var(--honey-soft); color: var(--honey); }
.xp-pill { flex: none; min-width: 48px; padding: 4px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); font-size: 13px; font-weight: 900; text-align: center; font-variant-numeric: tabular-nums; }
.xp-pill--done { background: var(--sage-soft); color: var(--sage); }
.chest-dots { display: flex; gap: 4px; }
.chest-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.chest-dots i.is-on { background: var(--sage); }

.badge-cat { margin: 16px 4px 10px; font-size: 13px; font-weight: 800; color: var(--muted); }
.badges { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 6px; }
.badge { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 0; border: 0; background: none; text-align: center; }
.badge__medal { position: relative; display: grid; place-items: center; width: 62px; height: 62px; }
/* Кольцо прогресса повторяет контур пина: та же система координат, что у картинки (54px). */
.badge__ring { position: absolute; inset: 4px; width: 54px; height: 54px; overflow: visible; pointer-events: none; }
.badge__track { fill: var(--line); }
.badge__fill { fill: var(--accent); }
.badge__icon {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 22px;
  transition: transform 0.15s ease;
}
.badge:active .badge__icon { transform: scale(0.92); }
.badge { min-width: 0; }
.badge__name { max-width: 100%; font-size: 11.5px; font-weight: 800; line-height: 1.2; color: var(--muted); overflow-wrap: anywhere; hyphens: auto; }
.badge__progress { font-size: 11px; font-weight: 700; color: var(--muted); opacity: 0.85; font-variant-numeric: tabular-nums; }
.badge__tier {
  position: absolute;
  right: 0;
  bottom: 0;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 2px solid var(--bg);
  border-radius: 50%;
  background: var(--text);
  color: var(--bg);
  font-size: 11px;
  font-weight: 900;
}
.badge.is-locked .badge__icon { opacity: 0.75; }
.badge.is-secret .badge__icon { border: 2px dashed var(--line); background: transparent; color: var(--muted); }
.badge.is-secret .badge__progress { font-style: italic; }

/* Ступени: бронза, серебро, золото. Одноступенчатые получают «золото». */
.badge.tier-bronze .badge__icon, .badge-up__medal.tier-bronze { background: radial-gradient(circle at 30% 25%, #e9b48a, #b8693a); color: #fff; }
.badge.tier-silver .badge__icon, .badge-up__medal.tier-silver { background: radial-gradient(circle at 30% 25%, #eef1f4, #98a3ae); color: #3a4148; }
.badge.tier-gold .badge__icon, .badge-up__medal.tier-gold { background: radial-gradient(circle at 30% 25%, var(--honey), var(--accent)); color: #fff; }
.badge.tier-bronze .badge__icon, .badge.tier-silver .badge__icon, .badge.tier-gold .badge__icon { box-shadow: 0 5px 12px rgba(0, 0, 0, 0.15); }
.badge.tier-bronze .badge__name, .badge.tier-silver .badge__name, .badge.tier-gold .badge__name { color: var(--text); }
.badge.tier-gold .badge__ring { display: none; }

.closest { margin-bottom: 4px; padding: 6px 4px; }
.closest__title { display: flex; align-items: center; gap: 6px; margin: 6px 10px 4px; font-size: 13px; font-weight: 900; letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent-strong); }
.closest__row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 10px; border: 0; border-radius: var(--radius-sm); background: none; text-align: left; }
.closest__row:active { background: var(--surface-2); }
.closest__row .xpbar { display: block; }
.closest__left { flex: none; display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; }
.closest__left b { font-size: 14px; font-weight: 900; }
.closest__left span { font-size: 12px; color: var(--muted); font-weight: 700; }

.badge-up__medal { font-size: 44px; }
.badge-up__medal.is-secret { background: radial-gradient(circle at 30% 25%, #c7a6ff, #6f4bd8); color: #fff; }
.badge-up__tier { margin: -2px 0 6px; font-size: 13px; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

.level-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 4px;
  padding: 4px 10px 4px 8px;
  border: 0;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12.5px;
  font-weight: 900;
}
.level-chip__bar { width: 34px; height: 5px; overflow: hidden; border-radius: 999px; background: color-mix(in srgb, var(--accent) 22%, transparent); }
.level-chip__bar span { display: block; height: 100%; background: var(--accent); }

/* --- «+15 XP» после сохранения --- */

.xp-burst {
  position: fixed;
  z-index: 980;
  left: 50%;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 40px);
  width: calc(100% - 32px);
  max-width: 400px;
  padding: 16px 16px 14px;
  transform: translateX(-50%);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 16px 40px rgba(60, 30, 10, 0.25);
  animation: burst-in 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.25);
}
.xp-burst.is-leaving { animation: hint-out 0.22s ease forwards; }
@keyframes burst-in { from { opacity: 0; transform: translate(-50%, 24px) scale(0.9); } }
.xp-burst__close { position: absolute; top: 10px; right: 10px; background: var(--bg-soft); color: var(--muted); }
.xp-burst__head { display: flex; align-items: center; gap: 12px; }
.xp-burst__medal { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: radial-gradient(circle at 30% 25%, var(--honey), var(--accent)); color: #fff; font-size: 24px; animation: medal-pop 0.6s 0.15s cubic-bezier(0.2, 0.9, 0.3, 1.6) both; }
.xp-burst__medal .i { fill: currentColor; }
@keyframes medal-pop { from { transform: scale(0.3) rotate(-30deg); } }
.xp-burst__total { display: block; font-size: 24px; font-weight: 900; color: var(--accent-strong); line-height: 1.1; }
.xp-burst__level { font-size: 13px; color: var(--muted); font-weight: 700; }
.xp-burst__lines { display: grid; gap: 4px; margin: 12px 0 0; padding: 0; list-style: none; font-size: 14px; }
.xp-burst__lines li { display: flex; justify-content: space-between; gap: 12px; }
.xp-burst__lines b { color: var(--accent-strong); font-variant-numeric: tabular-nums; }
.xp-burst__note { margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.xp-burst .xpbar { margin-top: 12px; background: var(--bg-soft); }

/* --- Новый уровень --- */

.level-up { position: fixed; z-index: 1050; inset: 0; display: grid; place-items: center; padding: 24px 16px; overflow: hidden; background: rgba(40, 22, 10, 0.55); animation: fade 0.2s ease; }
.level-up__card { position: relative; width: 100%; max-width: 330px; padding: 26px 22px 18px; border-radius: 28px; background: var(--surface); box-shadow: var(--shadow); text-align: center; animation: burst-in-center 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.3); }
@keyframes burst-in-center { from { opacity: 0; transform: scale(0.8); } }
.level-up__medal {
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  margin: -64px auto 10px;
  border: 6px solid var(--surface);
  border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, var(--honey), var(--accent) 60%, var(--accent-strong));
  box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 40%, transparent);
  color: #fff;
  font-size: 42px;
  font-weight: 900;
  animation: medal-pop 0.7s 0.1s cubic-bezier(0.2, 0.9, 0.3, 1.6) both;
}
.level-up__eyebrow { margin: 0; font-size: 13px; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-strong); }
.level-up__card h2 { margin: 4px 0 6px; font-size: 26px; text-wrap: balance; }
.level-up__text { margin: 0 0 18px; color: var(--muted); font-size: 14.5px; }
.confetti { position: absolute; top: -40px; left: var(--x); color: var(--accent); font-size: 26px; opacity: 0.9; animation: confetti-fall 2.6s var(--d) ease-in forwards; }
.confetti:nth-child(3n) { color: var(--honey); }
.confetti:nth-child(3n + 1) { color: var(--sage); }
.confetti .i { fill: currentColor; stroke: none; }
@keyframes confetti-fall {
  from { transform: translateY(0) rotate(0); }
  to { transform: translateY(110vh) rotate(var(--r)); }
}

/* --- Характер: наклейки и выбор --- */

.polaroid__frame { position: relative; display: block; }
.polaroid__stickers { position: absolute; left: -4px; right: 4px; bottom: 6px; display: flex; flex-wrap: wrap; gap: 4px; pointer-events: none; }
.sticker {
  display: inline-block;
  padding: 3px 8px;
  border: 2px solid var(--polaroid);
  border-radius: 10px;
  font-size: 11.5px;
  font-weight: 900;
  line-height: 1.2;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  transform: rotate(-4deg);
  white-space: nowrap;
}
.sticker--0 { background: var(--honey); color: #3d2b1f; }
.sticker--1 { background: var(--sage); color: #fff; transform: rotate(3deg); }
.sticker--2 { background: var(--accent); color: #fff; transform: rotate(-2deg); }
.sheet-stickers { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.sheet-stickers .sticker { font-size: 13.5px; padding: 5px 11px; }

.traits { display: flex; flex-wrap: wrap; gap: 8px; }
.trait {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 38px;
  padding: 0 13px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  transition: transform 0.12s ease, background 0.15s ease;
}
.trait:active { transform: scale(0.95); }
.trait.is-on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); }
.trait .i { width: 1em; height: 1em; }
.trait:disabled { opacity: 0.4; }

.field-group { display: flex; gap: 8px; }
.field-group .field { flex: 1; min-width: 0; }
.field-group__btn { flex: none; min-height: 48px; padding: 0 14px; border-radius: 14px; }
.field.is-pop { animation: name-pop 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.5); }
@keyframes name-pop { 40% { transform: scale(1.03); border-color: var(--accent); } }

/* --- Мур --- */

.mur {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-top: 18px;
  padding: 12px 16px 12px 12px;
  border: 0;
  border-radius: 20px;
  background: linear-gradient(120deg, var(--accent-soft), var(--honey-soft));
  text-align: left;
  transition: transform 0.12s ease;
}
.mur:active { transform: scale(0.98); }
.mur__paw {
  display: grid;
  place-items: center;
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, var(--honey), var(--accent));
  color: #fff;
  font-size: 26px;
  box-shadow: 0 6px 14px color-mix(in srgb, var(--accent) 35%, transparent);
}
.mur.is-sending .mur__paw { animation: mur-press 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.6); }
@keyframes mur-press { 30% { transform: scale(0.8) rotate(-12deg); } 70% { transform: scale(1.15) rotate(6deg); } }
.mur__text { flex: 1; min-width: 0; }
.mur__text b { display: block; font-size: 17px; font-weight: 900; color: var(--accent-strong); }
.mur__text span { font-size: 13px; color: var(--muted); font-weight: 600; }
.mur__count { flex: none; padding: 4px 10px; border-radius: 999px; background: var(--surface); color: var(--accent-strong); font-weight: 900; font-size: 14px; font-variant-numeric: tabular-nums; }
.mur.is-done { background: var(--sage-soft); }
.mur.is-done .mur__paw { background: var(--sage); box-shadow: none; }
.mur.is-done .mur__text b { color: var(--sage); }
.mur:disabled { cursor: default; }
.tag--mur { background: var(--accent-soft); color: var(--accent-strong); }
.tag--mur .i { color: var(--accent); }

.paw-fly {
  position: fixed;
  z-index: 1200;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  color: var(--accent);
  pointer-events: none;
  animation: paw-fly 0.85s cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
}
.paw-fly:nth-child(odd) { color: var(--honey); }
.paw-fly .i { width: 100%; height: 100%; }
@keyframes paw-fly {
  0% { opacity: 1; transform: translate(0, 0) scale(0.4) rotate(0); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(1.1) rotate(var(--rot)); }
}

/* --- Проверка «на фото кот» --- */

.photo-check { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 11px 14px; border-radius: var(--radius-sm); font-size: 14.5px; font-weight: 700; }
.photo-check .i { width: 1.3em; height: 1.3em; flex: none; }
.photo-check.is-pending { background: var(--surface); color: var(--muted); }
.photo-check.is-ok { background: var(--sage-soft); color: var(--sage); animation: fade-in 0.25s ease; }
.photo-check.is-bad { flex-wrap: wrap; background: color-mix(in srgb, var(--danger) 12%, var(--surface)); color: var(--text); font-weight: 600; animation: fade-in 0.25s ease; }
.photo-check.is-bad .i { color: var(--danger); }
.photo-check.is-bad span { flex: 1; min-width: 180px; }
.photo-check.is-demo { background: var(--honey-soft); color: var(--text); font-weight: 600; font-size: 13.5px; }
.spinner { flex: none; width: 18px; height: 18px; border: 2.5px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }

/* --- Заставка при запуске --- */

.splash {
  position: fixed;
  z-index: 3000;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(env(safe-area-inset-top, 0px) + 24px) 16px calc(env(safe-area-inset-bottom, 0px) + 20px);
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  transition: opacity 0.45s ease, transform 0.45s ease;
}
.splash.is-leaving { opacity: 0; transform: scale(1.04); pointer-events: none; }
.splash__glow {
  position: absolute;
  top: 18%;
  left: 50%;
  width: 420px;
  height: 420px;
  margin-left: -210px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--honey-soft) 0%, transparent 68%);
  animation: glow-breathe 3s ease-in-out infinite;
}
@keyframes glow-breathe { 50% { transform: scale(1.08); opacity: 0.85; } }
.splash__center { position: relative; display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.splash__art { width: 220px; max-width: 70vw; animation: splash-pop 0.7s cubic-bezier(0.2, 0.9, 0.3, 1.3) both; }
@keyframes splash-pop { from { opacity: 0; transform: translateY(16px) scale(0.92); } }
.splash__title { margin-top: 6px; font-size: 38px; font-weight: 900; letter-spacing: -0.02em; animation: splash-pop 0.7s 0.12s cubic-bezier(0.2, 0.9, 0.3, 1.3) both; }
.splash__phrase { min-height: 1.4em; margin: 6px 0 22px; color: var(--muted); font-size: 16px; font-weight: 700; }
.splash__phrase.is-in { animation: fade-in 0.35s ease; }
.splash__paws { display: flex; gap: 10px; }
.splash__paws svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
  color: var(--line);
  transform: rotate(var(--tilt, -12deg));
  animation: paw-step 3s calc(var(--i) * 0.5s) ease forwards;
}
.splash__paws svg:nth-child(even) { --tilt: 12deg; margin-top: 8px; }
@keyframes paw-step {
  0% { color: var(--line); transform: rotate(var(--tilt, -12deg)) scale(1); }
  12% { color: var(--accent); transform: rotate(var(--tilt, -12deg)) scale(1.25); }
  20%, 100% { color: var(--accent); transform: rotate(var(--tilt, -12deg)) scale(1); }
}
.splash__by { position: relative; margin: 0; font-size: 11.5px; font-weight: 700; letter-spacing: 0.14em; color: var(--muted); opacity: 0.75; }
@media (prefers-reduced-motion: reduce) {
  .splash__paws svg { color: var(--accent); }
}

/* --- Мур как лайк --- */

.polaroid { width: 100%; }
.polaroid__like {
  position: absolute;
  top: 14px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 34px;
  height: 34px;
  padding: 0 9px;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s ease, background 0.15s ease, color 0.15s ease;
}
.polaroid__like .i { width: 18px; height: 18px; }
.polaroid__like span:empty { display: none; }
.polaroid__like:active { transform: scale(0.88); }
.polaroid__like.is-on { background: var(--accent); color: #fff; animation: like-pop 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.6); }
@keyframes like-pop { 40% { transform: scale(1.25); } }

.cat-photo { position: relative; cursor: default; }
.paw-pop {
  position: absolute;
  top: 42%;
  left: 50%;
  width: 96px;
  height: 96px;
  margin: -48px 0 0 -48px;
  color: #fff;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.3));
  pointer-events: none;
  animation: paw-pop 0.85s cubic-bezier(0.2, 0.9, 0.3, 1.3) forwards;
}
.paw-pop .i { width: 100%; height: 100%; }
@keyframes paw-pop {
  0% { opacity: 0; transform: scale(0.3) rotate(-15deg); }
  25% { opacity: 1; transform: scale(1.15) rotate(5deg); }
  60% { opacity: 1; transform: scale(1) rotate(0); }
  100% { opacity: 0; transform: scale(1.1) translateY(-20px); }
}

.liked-by { display: flex; align-items: center; gap: 8px; margin: 12px 2px 0; font-size: 14px; font-weight: 700; color: var(--accent-strong); }
.liked-by .i { flex: none; color: var(--accent); }

/* --- Значки: эмалевые пины --- */

.pin-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.badge-art { display: block; width: 100%; height: 100%; overflow: visible; }
.badge__art, .closest__art { display: block; flex: none; }
.badge__art { width: 54px; height: 54px; transition: transform 0.15s ease, filter 0.2s ease; }
.badge:active .badge__art { transform: scale(0.92); }
.closest__art { width: 44px; height: 44px; }

/* Ещё не получен — пин серый и полупрозрачный: видно, что можно собрать. */
.badge.is-locked .badge__art { filter: grayscale(1) contrast(0.9) brightness(1.1); opacity: 0.55; }
.badge.is-secret .badge__art { opacity: 0.9; }
/* Полученный пин чуть «блестит» тенью. */
.badge.tier-bronze .badge__art, .badge.tier-silver .badge__art, .badge.tier-gold .badge__art { filter: drop-shadow(0 4px 6px rgba(60, 35, 10, 0.25)); }

/* Праздничный экран: пин переворачивается, как монетка, и встаёт на место. */
.badge-up__medal {
  position: relative;
  width: 124px;
  height: 124px;
  margin: -84px auto 6px;
  perspective: 600px;
}
.badge-up__medal::before {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 220, 120, 0.55), transparent 65%);
  animation: glow-breathe 2.4s ease-in-out infinite;
}
.badge-up__medal .badge-art {
  position: relative;
  filter: drop-shadow(0 10px 14px rgba(40, 20, 5, 0.35));
  animation: pin-reveal 1s cubic-bezier(0.2, 0.9, 0.3, 1.15) both;
}
@keyframes pin-reveal {
  0% { opacity: 0; transform: rotateY(-200deg) scale(0.5); }
  60% { opacity: 1; transform: rotateY(25deg) scale(1.08); }
  100% { transform: rotateY(0) scale(1); }
}

/* --- Поиск и порядок в коллекции --- */

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.coll-tools { display: flex; gap: 8px; margin: 4px 0 10px; }
.coll-tools[hidden] { display: none; }
.search { position: relative; flex: 1; min-width: 0; }
.search svg { position: absolute; left: 13px; top: 50%; width: 19px; height: 19px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input,
.sort select {
  width: 100%;
  height: 44px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
}
.search input { padding: 0 14px 0 40px; -webkit-appearance: none; appearance: none; }
.search input::placeholder { color: var(--muted); font-weight: 600; opacity: 0.75; }
.search input:focus, .sort select:focus { outline: none; border-color: var(--accent); }
.sort { flex: none; width: 132px; }
.sort select {
  padding: 0 30px 0 14px;
  -webkit-appearance: none;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: right 16px top 20px, right 11px top 20px;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.coll-found { margin: -2px 4px 8px; min-height: 0; font-size: 13px; font-weight: 700; color: var(--muted); }
.coll-found:empty { display: none; }
@media (max-width: 360px) { .sort { width: 118px; } .search input { font-size: 14px; } }

/* --- Коты без сети --- */

.outbox { margin: 0 0 14px; padding: 14px; }
.outbox__head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.outbox__head > svg { width: 22px; height: 22px; color: var(--accent-strong); flex: none; }
.outbox__head b { flex: 1; font-size: 15px; }
.outbox__item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.outbox__item img { width: 46px; height: 46px; flex: none; border-radius: 10px; object-fit: cover; background: var(--surface-2); }
.outbox__text { flex: 1; min-width: 0; }
.outbox__text b, .outbox__text span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.outbox__text span { font-size: 13px; font-weight: 600; color: var(--muted); }
.outbox__text .outbox__error { color: var(--danger); white-space: normal; }
.outbox__btn { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border: 0; border-radius: 50%; background: var(--surface-2); color: var(--muted); }
.outbox__btn svg { width: 19px; height: 19px; }
.outbox__note { margin: 8px 0 0; font-size: 12.5px; font-weight: 600; color: var(--muted); }

/* --- Картинка для сторис --- */

.story-preview { display: grid; place-items: center; padding: 6px 0 4px; }
.story-preview img { width: min(68%, 300px); aspect-ratio: 9 / 16; border-radius: 16px; object-fit: cover; box-shadow: 0 12px 30px rgba(60, 35, 10, 0.25); }
.story-note { margin: 14px 4px 0; text-align: center; font-size: 14px; color: var(--muted); }
.story-privacy { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 10px 0 0; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.story-privacy svg { width: 16px; height: 16px; flex: none; }
a.btn { text-decoration: none; }
