/* ================= Темы ================= */
:root {
  --bg0: #040a1c;
  --bg1: #0a1a44;
  --bg2: #12306f;
  --accent: #4f86ff;
  --accent-2: #9ec2ff;
  --accent-glow: rgba(79, 134, 255, .55);
  --blob1: #2457ff;
  --blob2: #00b3ff;
  --blob3: #5b34ff;

  --text: #f1f5ff;
  --muted: rgba(225, 234, 255, .62);
  --faint: rgba(225, 234, 255, .38);
  --danger: #ff5c72;
  --ok: #3ddc97;
  --warn: #ffc857;

  --glass-top: rgba(255, 255, 255, .17);
  --glass-bot: rgba(255, 255, 255, .05);
  --stroke: rgba(255, 255, 255, .17);
  --hi: rgba(255, 255, 255, .42);

  --r-lg: 26px;
  --r-md: 18px;
  --r-sm: 12px;

  --safe-top: calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px));
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
  --tabbar-h: 64px;
  --app-h: var(--tg-viewport-stable-height, 100dvh);

  color-scheme: dark;
}

:root[data-theme="burgundy"] {
  --bg0: #11030a;
  --bg1: #3a0a1d;
  --bg2: #62102e;
  --accent: #c8365c;
  --accent-2: #ffa3b8;
  --accent-glow: rgba(200, 54, 92, .55);
  --blob1: #8c1238;
  --blob2: #e0506f;
  --blob3: #5c0b31;
}

/* ================= База ================= */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg0);
  color: var(--text);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea { font: inherit; color: inherit; user-select: text; -webkit-user-select: text; }
svg { display: block; }
h1, h2, h3, p { margin: 0; }

.bg {
  position: fixed; inset: 0; overflow: hidden; z-index: 0;
  background:
    radial-gradient(120% 80% at 50% -10%, var(--bg2) 0%, transparent 60%),
    linear-gradient(180deg, var(--bg1) 0%, var(--bg0) 70%);
  transition: background .5s;
}
.blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55; transition: background .5s; }
.b1 { width: 70vw; height: 70vw; left: -20vw; top: 8vh; background: var(--blob1); animation: float 18s ease-in-out infinite; }
.b2 { width: 55vw; height: 55vw; right: -18vw; top: 42vh; background: var(--blob2); opacity: .35; animation: float 22s ease-in-out infinite reverse; }
.b3 { width: 60vw; height: 60vw; left: 10vw; bottom: -25vw; background: var(--blob3); animation: float 26s ease-in-out infinite; }
@keyframes float { 50% { transform: translate(6vw, -4vh) scale(1.1); } }

#view { position: fixed; inset: 0; z-index: 1; }

/* ================= Liquid Glass ================= */
.glass {
  position: relative;
  background: linear-gradient(150deg, var(--glass-top), var(--glass-bot) 55%, rgba(255, 255, 255, .09));
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--stroke);
  box-shadow:
    inset 0 1px 0 var(--hi),
    inset 0 -1px 1px rgba(255, 255, 255, .07),
    inset 0 0 18px rgba(255, 255, 255, .05),
    0 10px 30px rgba(0, 0, 0, .32);
  isolation: isolate;
}
/* блик сверху — эффект «жидкого стекла» */
.glass::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1;
  background: radial-gradient(130% 70% at 25% -10%, rgba(255, 255, 255, .26), transparent 55%);
}
.press { transition: transform .18s cubic-bezier(.3, 1.5, .5, 1); }
.press:active { transform: scale(.94); }

/* ================= Таб-бар ================= */
.tabbar {
  position: fixed; z-index: 20;
  left: 50%; transform: translateX(-50%);
  bottom: calc(10px + var(--safe-bottom));
  display: grid; grid-template-columns: repeat(3, 64px); gap: 6px;
  padding: 6px; border-radius: 999px;
}
.tabbar button {
  height: 50px; border-radius: 999px; display: grid; place-items: center;
  color: var(--muted); transition: color .2s, transform .2s;
  position: relative; z-index: 1;
}
.tabbar button svg { width: 25px; height: 25px; }
.tabbar button.active { color: var(--text); }
.tabbar button:active { transform: scale(.9); }
.tabbar .tab-plus svg { width: 22px; height: 22px; }
.tabbar .tab-plus::after {
  content: ""; position: absolute; inset: 7px 12px; border-radius: 14px; z-index: -1;
  background: linear-gradient(160deg, var(--accent-2), var(--accent));
  box-shadow: 0 4px 16px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, .6);
  opacity: .9;
}
.tabbar .tab-plus { color: #fff; }
.tab-thumb {
  position: absolute; top: 6px; left: 6px; width: 64px; height: 50px; border-radius: 999px;
  background: rgba(255, 255, 255, .13); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3);
  transition: transform .35s cubic-bezier(.3, 1.3, .5, 1), opacity .2s;
}
body.hide-tabbar .tabbar { transform: translate(-50%, 140%); }
.tabbar { transition: transform .3s; }

/* ================= Лента ================= */
.feed-wrap { position: absolute; inset: 0; }
.feed {
  position: absolute; inset: 0; overflow-y: scroll; scroll-snap-type: y mandatory;
  overscroll-behavior: contain; scrollbar-width: none;
}
.feed::-webkit-scrollbar { display: none; }
.slide {
  position: relative; height: 100%; scroll-snap-align: start; scroll-snap-stop: always;
  overflow: hidden; background: #000;
}
.slide .bgimg {
  position: absolute; inset: -60px; background-size: cover; background-position: center;
  filter: blur(42px) brightness(.5) saturate(1.4); transform: scale(1.1);
}
.slide .photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.slide .shade {
  position: absolute; inset: auto 0 0 0; height: 48%; pointer-events: none;
  background: linear-gradient(0deg, rgba(0, 0, 0, .78), rgba(0, 0, 0, .35) 45%, transparent);
}
.slide .shade-top {
  position: absolute; inset: 0 0 auto 0; height: 22%; pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, .45), transparent);
}

.seg {
  position: absolute; z-index: 6; left: 50%; transform: translateX(-50%);
  top: calc(var(--safe-top) + 12px);
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 4px; border-radius: 999px;
  width: 272px;
}
.seg button { position: relative; z-index: 1; height: 34px; padding: 0 8px; font-size: 13px; font-weight: 600; color: var(--muted); transition: color .25s; white-space: nowrap; }
.seg button.on { color: var(--text); }
.seg .seg-thumb {
  position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 999px;
  background: linear-gradient(160deg, rgba(255, 255, 255, .28), rgba(255, 255, 255, .1));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 4px 14px rgba(0, 0, 0, .25);
  transition: transform .4s cubic-bezier(.3, 1.35, .5, 1);
}
.seg[data-on="1"] .seg-thumb { transform: translateX(100%); }

.corner-btn {
  position: absolute; z-index: 5; left: 10px; top: calc(var(--safe-top) + 15px);
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  opacity: .5; transition: opacity .2s;
}
.corner-btn:active { opacity: 1; }
.corner-btn svg { width: 17px; height: 17px; }

.rail {
  position: absolute; z-index: 4; right: 12px;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 30px);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.ritem { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.rbtn { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; }
.rbtn svg { width: 25px; height: 25px; transition: transform .25s cubic-bezier(.3, 1.8, .5, 1); }
.rbtn.sm { width: 42px; height: 42px; }
.rbtn.sm svg { width: 20px; height: 20px; }
.rbtn.liked { color: #ff4d6d; }
.rbtn.liked svg { transform: scale(1.12); fill: currentColor; }
.cnt { font-size: 12.5px; font-weight: 600; text-shadow: 0 1px 4px rgba(0, 0, 0, .6); min-height: 16px; }

.meta {
  position: absolute; z-index: 4; left: 16px; right: 84px;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 30px);
  text-shadow: 0 1px 6px rgba(0, 0, 0, .55);
}
.author { display: inline-flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 700; max-width: 100%; }
.author b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta .rule { height: 2px; width: min(240px, 80%); margin: 7px 0 7px; border-radius: 2px; background: linear-gradient(90deg, rgba(255, 255, 255, .7), transparent); }
.caption { font-size: 13.5px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; word-break: break-word; }
.caption.open { -webkit-line-clamp: unset; max-height: 40vh; overflow-y: auto; }
.when { margin-top: 5px; font-size: 11.5px; color: var(--muted); }

.badge-ok { width: 16px; height: 16px; color: var(--accent-2); flex: none; }

.heart-burst {
  position: absolute; z-index: 3; left: 50%; top: 45%; width: 110px; height: 110px; margin: -55px 0 0 -55px;
  color: #fff; opacity: 0; pointer-events: none; filter: drop-shadow(0 6px 24px rgba(255, 77, 109, .7));
}
.heart-burst svg { width: 100%; height: 100%; fill: #ff4d6d; }
.heart-burst.go { animation: burst .8s ease-out; }
@keyframes burst {
  0% { opacity: 0; transform: scale(.3); }
  20% { opacity: 1; transform: scale(1.15); }
  40% { transform: scale(.95); }
  70% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.3) translateY(-30px); }
}

.reminder {
  position: absolute; z-index: 7; left: 14px; right: 14px; top: calc(var(--safe-top) + 62px);
  border-radius: var(--r-md); padding: 12px 14px; display: flex; gap: 12px; align-items: center;
  animation: drop .5s cubic-bezier(.3, 1.4, .5, 1);
}
.reminder .ico { font-size: 26px; }
.reminder p { font-size: 13.5px; line-height: 1.3; flex: 1; }
.reminder .x { width: 28px; height: 28px; display: grid; place-items: center; color: var(--muted); }
@keyframes drop { from { opacity: 0; transform: translateY(-20px) scale(.96); } }

.empty {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 40px;
}
.empty .card { padding: 28px 22px; border-radius: var(--r-lg); max-width: 320px; }
.empty .big { font-size: 44px; margin-bottom: 8px; }
.empty p { color: var(--muted); margin: 6px 0 16px; }
.landing { padding: 34px 26px; }
.landing h3 { font-size: 26px; font-weight: 800; }
.landing-icon {
  width: 84px; height: 84px; margin: 0 auto 14px; border-radius: 24px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(150deg, var(--accent-2), var(--accent));
  box-shadow: 0 10px 30px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, .6);
}
.landing-icon svg { width: 42px; height: 42px; }
.landing a.btn { text-decoration: none; }

/* ================= Страницы ================= */
.page {
  position: absolute; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: calc(var(--safe-top) + 18px) 16px calc(var(--tabbar-h) + var(--safe-bottom) + 34px);
  scrollbar-width: none;
}
.page::-webkit-scrollbar { display: none; }
.page > * + * { margin-top: 12px; }
.page-title { font-size: 28px; font-weight: 800; letter-spacing: -.02em; padding: 4px 4px 6px; }
.page-title small { display: block; font-size: 14px; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-top: 2px; }
.card { border-radius: var(--r-lg); padding: 16px; }
.row { display: flex; align-items: center; gap: 12px; }
.row > .grow { flex: 1; min-width: 0; }
.label { font-weight: 650; }
.sub { font-size: 13px; color: var(--muted); }
.section-title { font-size: 19px; font-weight: 750; padding: 12px 4px 2px; display: flex; align-items: baseline; gap: 8px; }
.section-title span { font-size: 14px; color: var(--muted); font-weight: 500; }

.btn {
  height: 46px; padding: 0 18px; border-radius: 999px; font-weight: 650; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .18s, opacity .2s;
}
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn.primary {
  color: #fff;
  background: linear-gradient(160deg, var(--accent-2) -40%, var(--accent) 60%);
  box-shadow: 0 8px 24px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, .55), inset 0 -2px 6px rgba(0, 0, 0, .15);
}
.btn.ghost { background: rgba(255, 255, 255, .1); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25); border: 1px solid var(--stroke); }
.btn.danger { background: rgba(255, 92, 114, .16); color: #ff8b9b; border: 1px solid rgba(255, 92, 114, .35); }
.btn.ok { background: rgba(61, 220, 151, .16); color: #6cf0b6; border: 1px solid rgba(61, 220, 151, .35); }
.btn.block { width: 100%; }
.btn.big { height: 54px; font-size: 16.5px; }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13.5px; }
.btn svg { width: 18px; height: 18px; }

.icon-btn { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .1); border: 1px solid var(--stroke); flex: none; }
.icon-btn svg { width: 17px; height: 17px; }

/* аватар */
.ava {
  border-radius: 50%; flex: none; display: grid; place-items: center; overflow: hidden; font-weight: 700; color: #fff;
  background: linear-gradient(150deg, var(--accent-2), var(--accent)); box-shadow: 0 0 0 2px rgba(255, 255, 255, .35);
}
.ava { position: relative; }
.ava img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.overlay .corner-btn { left: auto; right: 14px; }

/* создание */
.picker {
  display: block; border-radius: var(--r-lg); overflow: hidden; aspect-ratio: 4 / 5; max-height: 52vh; width: 100%;
  margin-left: auto; margin-right: auto;
}
.picker .ph { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; color: var(--muted); text-align: center; }
.picker .ph .circle { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .1); border: 1px solid var(--stroke); color: var(--text); }
.picker .ph svg { width: 32px; height: 32px; }
.picker img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.picker .change { position: absolute; right: 12px; bottom: 12px; z-index: 2; }

textarea.field, input.field {
  width: 100%; background: rgba(0, 0, 0, .18); border: 1px solid var(--stroke); border-radius: var(--r-md);
  padding: 12px 14px; outline: none; resize: none; transition: border-color .2s, background .2s;
}
textarea.field:focus, input.field:focus { border-color: var(--accent-2); background: rgba(0, 0, 0, .25); }
.field::placeholder { color: var(--faint); }
.counter { text-align: right; font-size: 12px; color: var(--faint); margin-top: 6px; }
.err { color: #ff8b9b; font-size: 13px; min-height: 18px; margin-top: 6px; }

/* переключатель */
.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: rgba(255, 255, 255, .16); border: 1px solid var(--stroke); transition: background .25s; }
.switch span::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); transition: transform .3s cubic-bezier(.3, 1.4, .5, 1);
}
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(20px); }

/* лимит */
.meter { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .12); overflow: hidden; margin: 10px 0 8px; }
.meter i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent-2), var(--accent)); box-shadow: 0 0 12px var(--accent-glow); transition: width .5s; }
.dots { display: flex; gap: 6px; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: rgba(255, 255, 255, .18); }
.dots i.on { background: var(--accent-2); box-shadow: 0 0 10px var(--accent-glow); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 650; background: rgba(255, 255, 255, .1); border: 1px solid var(--stroke); }
.chip.ok { color: #6cf0b6; border-color: rgba(61, 220, 151, .35); background: rgba(61, 220, 151, .12); }
.chip.warn { color: var(--warn); border-color: rgba(255, 200, 87, .35); background: rgba(255, 200, 87, .1); }
.chip.bad { color: #ff8b9b; border-color: rgba(255, 92, 114, .35); background: rgba(255, 92, 114, .1); }
.notice { border-radius: var(--r-md); padding: 12px 14px; font-size: 13.5px; background: rgba(255, 92, 114, .12); border: 1px solid rgba(255, 92, 114, .3); color: #ffb3bf; }

/* профиль */
.phead { display: flex; align-items: center; gap: 14px; }
.phead > .grow { flex: 1; min-width: 0; }
.phead .name { font-size: 21px; font-weight: 800; display: flex; align-items: center; gap: 6px; }
.phead .name .badge-ok { width: 20px; height: 20px; }
code.tgid { font: 600 15px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .02em; }
.theme-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.theme-pick button {
  height: 54px; border-radius: var(--r-md); display: flex; align-items: center; gap: 8px; padding: 0 10px; font-weight: 600; font-size: 14px; white-space: nowrap;
  background: rgba(255, 255, 255, .06); border: 1px solid var(--stroke); transition: border-color .2s, background .2s;
}
.theme-pick button.on { border-color: var(--accent-2); background: rgba(255, 255, 255, .14); }
.theme-pick .sw { width: 26px; height: 26px; border-radius: 50%; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 0 0 2px rgba(255, 255, 255, .2); }
.admin-entry { width: 100%; text-align: left; }
.pill-count { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 99px; background: var(--danger); color: #fff; font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; border-radius: var(--r-md); overflow: hidden; }
.tile { position: relative; aspect-ratio: 4 / 5; overflow: hidden; background: rgba(255, 255, 255, .06); }
.tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.tile:active img { transform: scale(1.05); }
.tile .tm { position: absolute; left: 6px; bottom: 6px; right: 6px; display: flex; justify-content: space-between; font-size: 11.5px; font-weight: 650; text-shadow: 0 1px 4px rgba(0, 0, 0, .8); }
.tile .tm span { display: inline-flex; align-items: center; gap: 3px; }
.tile .tm svg { width: 12px; height: 12px; fill: currentColor; }
.tile.hidden-post::after { content: "скрыт"; position: absolute; top: 6px; left: 6px; font-size: 11px; padding: 2px 6px; border-radius: 6px; background: rgba(255, 92, 114, .8); }
.muted-box { padding: 26px 16px; text-align: center; color: var(--muted); border-radius: var(--r-lg); }

/* ================= Слои: оверлеи, шторки ================= */
#layers { position: fixed; inset: 0; z-index: 30; pointer-events: none; }
/* каждый слой — отдельный контекст наложения: кнопки поста (z-index 4–5) внутри окна просмотра
   не должны «пробивать» шторку, открытую поверх него */
#layers > * { pointer-events: auto; isolation: isolate; }
.overlay {
  position: absolute; inset: 0; background: var(--bg0); overflow: hidden;
  animation: slideIn .35s cubic-bezier(.2, .9, .3, 1);
}
.overlay > .bg { position: absolute; }
.overlay.closing { animation: slideOut .25s ease-in forwards; }
@keyframes slideIn { from { transform: translateX(100%); } }
@keyframes slideOut { to { transform: translateX(100%); } }
.overlay .page { padding-bottom: calc(var(--safe-bottom) + 30px); }
.back-btn {
  position: absolute; z-index: 8; left: 14px; top: calc(var(--safe-top) + 12px);
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
}
.back-btn svg { width: 20px; height: 20px; }
.has-back { padding-top: calc(var(--safe-top) + 64px) !important; }
.overlay .rail, .overlay .meta { bottom: calc(var(--safe-bottom) + 28px); }

.backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); animation: fade .25s; }
.backdrop.closing { animation: fadeOut .2s forwards; }
@keyframes fade { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 86%;
  border-radius: 28px 28px 0 0; display: flex; flex-direction: column;
  padding: 8px 16px calc(var(--safe-bottom) + 14px);
  background: linear-gradient(160deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, .06)), color-mix(in srgb, var(--bg1) 70%, transparent);
  animation: up .38s cubic-bezier(.2, .95, .3, 1);
}
.sheet.closing { animation: down .22s ease-in forwards; }
@keyframes up { from { transform: translateY(100%); } }
@keyframes down { to { transform: translateY(100%); } }
.sheet .grab { width: 40px; height: 5px; border-radius: 99px; background: rgba(255, 255, 255, .3); margin: 2px auto 10px; flex: none; }
.sheet h3 { font-size: 18px; font-weight: 750; }
.sheet .sheet-head { display: flex; align-items: center; gap: 10px; padding-bottom: 10px; flex: none; }
.sheet .sheet-head h3 { flex: 1; }
.sheet .sheet-body { overflow-y: auto; flex: 1; min-height: 0; }
.sheet .sheet-body > * + * { margin-top: 10px; }
.sheet .desc { color: var(--muted); font-size: 14px; }
.sheet .opt {
  width: 100%; text-align: left; padding: 14px 16px; border-radius: var(--r-md); font-weight: 600;
  background: rgba(255, 255, 255, .07); border: 1px solid var(--stroke); display: flex; align-items: center; gap: 12px;
}
.sheet .opt:active { background: rgba(255, 255, 255, .14); }
.sheet .opt.red { color: #ff8b9b; }
.sheet .opt svg { width: 20px; height: 20px; }

/* комментарии */
.sheet.comments { height: 78%; }
.clist { display: flex; flex-direction: column; gap: 14px; padding: 4px 2px 10px; }
.cmt { display: flex; gap: 10px; animation: fade .3s; }
.cmt .body { flex: 1; min-width: 0; }
.cmt .top { display: flex; align-items: center; gap: 6px; font-size: 13.5px; flex-wrap: wrap; }
.cmt .top b { font-weight: 700; }
.cmt .top .uname, .cmt .top .t { color: var(--faint); font-size: 12.5px; }
.cmt .txt { white-space: pre-wrap; word-break: break-word; margin-top: 2px; user-select: text; -webkit-user-select: text; }
.cmt .del { color: var(--faint); width: 30px; height: 30px; display: grid; place-items: center; flex: none; }
.cmt .del svg { width: 16px; height: 16px; }
.cform { display: flex; gap: 8px; align-items: flex-end; padding-top: 10px; flex: none; border-top: 1px solid rgba(255, 255, 255, .08); }
.cform textarea { flex: 1; max-height: 120px; min-height: 44px; border-radius: 22px; padding: 11px 16px; }
.cform .send { width: 44px; height: 44px; border-radius: 50%; flex: none; display: grid; place-items: center; }
.cform .send svg { width: 20px; height: 20px; }
.off-note { text-align: center; color: var(--muted); padding: 14px; font-size: 14px; }

/* админка */
.tabs3 { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 4px; border-radius: 999px; position: relative; }
.tabs3 button { height: 36px; border-radius: 999px; font-size: 13.5px; font-weight: 650; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.tabs3 button.on { color: var(--text); background: rgba(255, 255, 255, .16); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { padding: 12px; border-radius: var(--r-md); text-align: center; }
.stat b { display: block; font-size: 20px; }
.stat span { font-size: 11.5px; color: var(--muted); }
.mod-card { display: flex; gap: 12px; }
.mod-card .thumb { width: 92px; aspect-ratio: 4/5; border-radius: var(--r-sm); object-fit: cover; flex: none; background: rgba(255, 255, 255, .08); }
.mod-card .doc { width: 100%; max-height: 50vh; object-fit: contain; border-radius: var(--r-sm); background: rgba(0, 0, 0, .3); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.reasons { margin: 6px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--muted); }
.ulist > * + * { margin-top: 8px; }

/* тост */
.toast {
  position: fixed; z-index: 100; left: 50%; top: calc(var(--safe-top) + 14px); transform: translate(-50%, -150%);
  max-width: calc(100% - 32px); padding: 11px 18px; border-radius: 999px; font-size: 14px; font-weight: 600;
  transition: transform .4s cubic-bezier(.3, 1.3, .5, 1), opacity .25s, visibility .4s; pointer-events: none; text-align: center;
  opacity: 0; visibility: hidden;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; transition: transform .4s cubic-bezier(.3, 1.3, .5, 1), opacity .15s; }
.toast.bad { color: #ffb3bf; }

.spinner {
  width: 30px; height: 30px; margin: 30px auto; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .15); border-top-color: var(--accent-2);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.slide .spinner { position: absolute; left: 50%; top: 50%; margin: -15px 0 0 -15px; }

/* ================= Ник: цвет и префиксы ================= */
.nick { font-weight: 700; }
.nc-gold { color: #ffd166; }
.nc-rose { color: #ff9fb6; }
.nc-pink { color: #ff6fd0; }
.nc-violet { color: #bca4ff; }
.nc-sky { color: #82cfff; }
.nc-mint { color: #5ef2c2; }
.nc-lime { color: #c9f56f; }
.nc-orange { color: #ffa45c; }
.nc-red { color: #ff6b6b; }
.nc-grad_sunset, .nc-grad_aurora, .nc-grad_candy {
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: none; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .55));
}
.nc-grad_sunset { background-image: linear-gradient(90deg, #ffc35a, #ff6b8b); }
.nc-grad_aurora { background-image: linear-gradient(90deg, #5ef2c2, #82cfff, #bca4ff); }
.nc-grad_candy { background-image: linear-gradient(90deg, #ff9ad5, #ffe0f4, #9ad0ff); }

.pfx {
  display: inline-flex; align-items: center; flex: none; margin-left: 5px;
  font-size: 10.5px; font-weight: 800; letter-spacing: .02em; line-height: 1;
  padding: 3px 7px; border-radius: 999px; text-shadow: none; white-space: nowrap;
}
.pfx-premium {
  color: #3d2100; background: linear-gradient(135deg, #fff0b8, #ffc94d 45%, #ff9a3c);
  box-shadow: 0 0 12px rgba(255, 190, 70, .55), inset 0 1px 0 rgba(255, 255, 255, .7);
}
.pfx-girl {
  color: #520033; background: linear-gradient(135deg, #ffd6ec, #ff8fcb 50%, #ff5fae);
  box-shadow: 0 0 12px rgba(255, 111, 181, .55), inset 0 1px 0 rgba(255, 255, 255, .7);
}
.author, .nick-wrap, .phead .name, .cmt .top { align-items: center; }
.nick-wrap { display: inline-flex; flex-wrap: wrap; gap: 0; min-width: 0; }
.author .badge-ok, .nick-wrap .badge-ok { margin-left: 4px; }

/* ================= Карусель ================= */
.slide .photos {
  position: absolute; inset: 0; display: flex; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain;
}
.slide .photos::-webkit-scrollbar { display: none; }
.ph-item { position: relative; flex: 0 0 100%; height: 100%; scroll-snap-align: center; scroll-snap-stop: always; }
.dots-bar {
  position: absolute; z-index: 5; left: 50%; transform: translateX(-50%); top: calc(var(--safe-top) + 58px);
  display: flex; gap: 6px; padding: 6px 9px; border-radius: 999px; background: rgba(0, 0, 0, .3);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); pointer-events: none;
}
.dots-bar i { width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, .45); transition: all .25s; }
.dots-bar i.on { width: 16px; border-radius: 3px; background: #fff; }

.strip { display: flex; gap: 10px; align-items: center; min-height: 20px; padding: 0 2px; }
.strip .sub { padding: 0 4px; }
.thumb-item, .thumb-add { position: relative; width: 74px; height: 92px; border-radius: 14px; overflow: hidden; flex: none; }
.thumb-item img { width: 100%; height: 100%; object-fit: cover; }
.thumb-item button {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(0, 0, 0, .6); color: #fff;
}
.thumb-item button svg { width: 12px; height: 12px; }
.thumb-item span { position: absolute; left: 0; right: 0; bottom: 0; font-size: 10px; text-align: center; padding: 3px; background: rgba(0, 0, 0, .55); }
.thumb-add {
  display: grid; place-content: center; justify-items: center; gap: 2px; cursor: pointer;
  border: 1.5px dashed var(--stroke); background: rgba(255, 255, 255, .06); color: var(--muted); font-size: 12px;
}
.thumb-add svg { width: 22px; height: 22px; }

/* ================= Ответы в комментариях ================= */
.reply-line { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--accent-2); margin-top: 2px; }
.reply-line svg { width: 13px; height: 13px; }
.reply-btn { font-size: 12px; color: var(--faint); margin-top: 3px; font-weight: 600; }
.reply-chip {
  display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted);
  padding: 8px 4px 0;
}
.reply-chip[hidden] { display: none; }
.reply-chip svg { width: 15px; height: 15px; }
.reply-chip span { flex: 1; }
.reply-chip button { width: 26px; height: 26px; display: grid; place-items: center; }

/* ================= Профиль: списки, правила, согласие ================= */
.menu-list { padding: 6px 8px; }
.menu-list > button { width: 100%; text-align: left; padding: 10px 6px; gap: 12px; }
.menu-list > button + button { border-top: 1px solid rgba(255, 255, 255, .07); }
.rule-item { display: flex; gap: 12px; align-items: flex-start; }
.rule-item span { font-size: 22px; line-height: 1.2; }
.rule-item p { font-size: 14.5px; }
.link { color: var(--accent-2); text-decoration: underline; }
.consent { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--muted); cursor: pointer; }
.consent input { width: 20px; height: 20px; margin: 1px 0 0; flex: none; accent-color: var(--accent); }
.sheet .opt .grow { flex: 1; min-width: 0; }

/* ================= Админка: оформление ника, журнал ================= */
.style-preview { padding: 18px; border-radius: var(--r-md); display: flex; align-items: center; justify-content: center; font-size: 18px; }
.seg-opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.seg-opts button {
  height: 44px; border-radius: var(--r-sm); background: rgba(255, 255, 255, .07); border: 1px solid var(--stroke);
  display: grid; place-items: center; font-weight: 600;
}
.seg-opts button.on, .swatches button.on { border-color: #fff; box-shadow: 0 0 0 2px var(--accent-2); }
.seg-opts .pfx { margin: 0; }
.swatches { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }
.swatches button { aspect-ratio: 1; border-radius: 50%; border: 2px solid transparent; }
.sw-none { display: grid; place-items: center; background: rgba(255, 255, 255, .08); color: var(--muted); }
.sw-none svg { width: 16px; height: 16px; }
.sw-gold { background: #ffd166; } .sw-rose { background: #ff9fb6; } .sw-pink { background: #ff6fd0; }
.sw-violet { background: #bca4ff; } .sw-sky { background: #82cfff; } .sw-mint { background: #5ef2c2; }
.sw-lime { background: #c9f56f; } .sw-orange { background: #ffa45c; } .sw-red { background: #ff6b6b; }
.sw-grad_sunset { background: linear-gradient(135deg, #ffc35a, #ff6b8b); }
.sw-grad_aurora { background: linear-gradient(135deg, #5ef2c2, #82cfff, #bca4ff); }
.sw-grad_candy { background: linear-gradient(135deg, #ff9ad5, #ffe0f4, #9ad0ff); }
.log-list { padding: 4px 14px; }
.log-item { padding: 10px 0; font-size: 14px; }
.log-item + .log-item { border-top: 1px solid rgba(255, 255, 255, .07); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media (min-width: 640px) {
  .page { padding-left: calc(50% - 300px); padding-right: calc(50% - 300px); }
  .sheet { left: calc(50% - 300px); right: calc(50% - 300px); }
}
