@import url("/fonts/fonts.css");
/* цифры в изящном шрифте — с привычным «0», а не «о» */
@font-face { font-family: "Digits"; src: local("Times New Roman"), local("TimesNewRomanPSMT"), local("Didot"), local("Baskerville"); unicode-range: U+0030-0039; }
@font-face { font-family: "Digits"; font-style: italic; src: local("Times New Roman Italic"), local("TimesNewRomanPS-ItalicMT"), local("Baskerville-Italic"); unicode-range: U+0030-0039; }

/* ---------- темы ---------- */
:root, [data-theme="film"] {
  --bg: #f6efe6;
  --bg-elev: #fbf7f1;
  --bg-sunk: #efe6da;
  --line: #e3d7c8;
  --text: #2b1d1a;
  --text-2: #7d6b62;
  --accent: #8c2333;
  --accent-soft: #f1dcdc;
  --heart: #c8243b;
  --bubble-me: #8c2333;
  --bubble-me-text: #fff7f2;
  --bubble-them: #ece2d5;
  --ring: conic-gradient(from 200deg, #d9a35f, #c8243b, #8c2333, #d9a35f);
  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  --font-serif: "Digits", "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --font-logo: "Marck Script", "Cormorant Garamond", cursive;
  --grain: 0.06;
  color-scheme: light;
}
[data-theme="classic"] {
  --bg: #ffffff;
  --bg-elev: #ffffff;
  --bg-sunk: #efefef;
  --line: #dbdbdb;
  --text: #0c0c0c;
  --text-2: #737373;
  --accent: #0095f6;
  --accent-soft: #e0f1ff;
  --heart: #ff3040;
  --bubble-me: #3797f0;
  --bubble-me-text: #ffffff;
  --bubble-them: #efefef;
  --ring: conic-gradient(from 200deg, #feda75, #fa7e1e, #d62976, #962fbf, #4f5bd5, #feda75);
  --grain: 0;
  color-scheme: light;
}
[data-theme="night"] {
  --bg: #0f0b0b;
  --bg-elev: #191313;
  --bg-sunk: #241c1b;
  --line: #2f2625;
  --text: #f3e9e1;
  --text-2: #a8978d;
  --accent: #e0a35f;
  --accent-soft: #3a2a1f;
  --heart: #ff4d62;
  --bubble-me: #8c2333;
  --bubble-me-text: #fff7f2;
  --bubble-them: #2a2120;
  --ring: conic-gradient(from 200deg, #e0a35f, #c8243b, #8c2333, #e0a35f);
  --grain: 0.04;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-variant-numeric: lining-nums;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
body::after { /* лёгкое зерно плёнки */
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 9999;
  opacity: var(--grain);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: var(--text); }
a { color: inherit; text-decoration: none; }
svg.i { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; display: block; }
svg.i.fill { fill: currentColor; stroke: none; }
.hidden { display: none !important; }

#app { max-width: 480px; margin: 0 auto; min-height: 100%; position: relative; background: var(--bg); }

/* ---------- верх и низ ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: calc(env(safe-area-inset-top) + 8px) 14px 8px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.topbar .title { font-weight: 700; font-size: 18px; flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar .title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logo { font-family: var(--font-logo); font-size: 34px; line-height: 1; letter-spacing: .5px; flex: 1; padding-top: 2px; }
[data-theme="classic"] .logo { font-weight: 400; }
.icon-btn { position: relative; padding: 4px; }
.badge {
  position: absolute; top: -2px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--heart); color: #fff; font-size: 11px; font-weight: 700;
  display: grid; place-items: center; border: 2px solid var(--bg);
}
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; z-index: 30;
  display: flex; justify-content: space-around; align-items: center;
  padding: 8px 6px calc(env(safe-area-inset-bottom) + 8px);
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.tabbar button { padding: 6px 12px; position: relative; opacity: .9; }
.tabbar button.on { opacity: 1; }
.tabbar .me-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; display: block; border: 2px solid transparent; }
.tabbar button.on .me-avatar { border-color: var(--text); }
.tabbar .badge { top: 0; right: 4px; }
main.view { padding-bottom: calc(env(safe-area-inset-bottom) + 72px); }

/* ---------- аватары и кольца ---------- */
.av { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: var(--bg-sunk); display: block; flex: none; }
.ring { padding: 2.5px; border-radius: 50%; background: var(--ring); display: inline-block; flex: none; }
.ring.seen { background: var(--line); }
.ring > .av, .ring > .inner { border: 2.5px solid var(--bg); }
.ring.none { background: transparent; }

/* ---------- сторис-лента ---------- */
.tray { display: flex; gap: 14px; overflow-x: auto; padding: 6px 14px 12px; scrollbar-width: none; }
.tray::-webkit-scrollbar { display: none; }
.tray .item { display: flex; flex-direction: column; align-items: center; gap: 5px; width: 74px; flex: none; }
.tray .item .av { width: 66px; height: 66px; }
.tray .item small { font-size: 12px; max-width: 74px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.tray .plus {
  position: absolute; right: -2px; bottom: -2px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); color: #fff; display: grid; place-items: center; border: 2.5px solid var(--bg);
  font-size: 16px; font-weight: 600; line-height: 1;
}
.tray .rel { position: relative; }
.divider { height: 1px; background: var(--line); margin: 0; }

/* ---------- пост ---------- */
.post { padding-bottom: 14px; }
.post-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.post-head .who { flex: 1; min-width: 0; }
.post-head .name { font-weight: 600; font-size: 14px; }
.post-head .sub { font-size: 12.5px; color: var(--text); opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-head .ring .av { width: 32px; height: 32px; }

.carousel { position: relative; background: var(--bg-sunk); }
.slides { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; aspect-ratio: 4 / 5; }
.slides::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; scroll-snap-align: center; position: relative; overflow: hidden; }
.slide img, .slide video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.slide img { background: var(--bg-sunk); }
.counter {
  position: absolute; top: 12px; right: 12px; padding: 3px 9px; border-radius: 12px;
  background: rgba(20, 14, 12, .62); color: #fff; font-size: 12px; font-weight: 600;
}
.mute {
  position: absolute; right: 12px; bottom: 12px; width: 30px; height: 30px; border-radius: 50%;
  background: rgba(20, 14, 12, .62); color: #fff; display: grid; place-items: center;
}
.mute svg { width: 16px; height: 16px; }
.song-pill {
  position: absolute; left: 12px; bottom: 12px; max-width: calc(100% - 64px);
  display: flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 14px;
  background: rgba(20, 14, 12, .62); color: #fff; font-size: 12.5px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.eq { display: inline-flex; gap: 2px; align-items: flex-end; height: 11px; flex: none; }
.eq i { width: 2.5px; background: currentColor; border-radius: 1px; height: 40%; }
.playing .eq i { animation: eq 0.9s ease-in-out infinite; }
.playing .eq i:nth-child(2) { animation-delay: .2s; }
.playing .eq i:nth-child(3) { animation-delay: .4s; }
@keyframes eq { 0%, 100% { height: 30%; } 50% { height: 100%; } }

.dots { display: flex; justify-content: center; gap: 4px; padding-top: 10px; height: 16px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--line); transition: background .2s, transform .2s; }
.dots i.on { background: var(--accent); }
.actions { display: flex; align-items: center; gap: 14px; padding: 8px 12px 4px; margin-top: -16px; }
.actions .sp { flex: 1; }
.actions .liked { color: var(--heart); }
.actions .pop { animation: pop .35s ease; }
@keyframes pop { 40% { transform: scale(1.25); } }
.likes { padding: 2px 14px; font-weight: 600; font-size: 14px; }
.caption { padding: 4px 14px 0; font-size: 14.5px; white-space: pre-wrap; word-wrap: break-word; }
.caption b { font-weight: 600; margin-right: 4px; }
.caption.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
[data-theme="film"] .caption, [data-theme="night"] .caption { font-size: 15px; }
.more-link { color: var(--text-2); padding: 0 14px; font-size: 14px; }
.cmt-preview { padding: 3px 14px 0; font-size: 14px; }
.cmt-preview b { font-weight: 600; margin-right: 4px; }
.date { padding: 6px 14px 0; color: var(--text-2); font-size: 11.5px; letter-spacing: .3px; text-transform: uppercase; }
[data-theme="film"] .date, [data-theme="night"] .date { font-family: var(--font-serif); font-size: 13.5px; text-transform: none; letter-spacing: .2px; font-style: italic; }

.burst { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.burst svg { width: 96px; height: 96px; fill: #fff; filter: drop-shadow(0 4px 18px rgba(0,0,0,.35)); animation: burst .9s ease forwards; }
@keyframes burst { 0% { transform: scale(0); opacity: 0; } 15% { transform: scale(1.2); opacity: 1; } 30% { transform: scale(.95); } 45%, 75% { transform: scale(1); opacity: 1; } 100% { transform: scale(.2) translateY(-60px); opacity: 0; } }

/* карточка-записка вместо фото */
.note {
  width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center;
  padding: 34px 30px; text-align: center; gap: 16px;
  background: radial-gradient(120% 90% at 50% 0%, #fffaf3 0%, #f3e6d4 70%, #ead9c2 100%);
  color: #3b2621;
}
.note .q { font-family: var(--font-serif); font-size: 27px; line-height: 1.22; font-weight: 500; white-space: pre-line; }
.note .s { font-family: var(--font-serif); font-style: italic; font-size: 17px; color: #8c2333; }
.note .orn { font-family: var(--font-logo); font-size: 30px; color: #8c2333; line-height: 1; }
.note.dark { background: radial-gradient(120% 90% at 50% 0%, #4a1520 0%, #2b0d14 80%); color: #f8eadf; }
.note.dark .s, .note.dark .orn { color: #e0a35f; }
.note.small .q { font-size: 22px; }

/* ---------- профиль ---------- */
.prof { padding: 8px 16px 0; }
.prof-top { display: flex; align-items: center; gap: 22px; }
.prof-top .ring .av { width: 86px; height: 86px; }
.prof-names { flex: 1; min-width: 0; }
.prof-names h1 { margin: 0; font-size: 20px; font-weight: 700; }
[data-theme="film"] .prof-names h1, [data-theme="night"] .prof-names h1 { font-family: var(--font-serif); font-size: 27px; font-weight: 600; }
.members { display: flex; align-items: center; margin-top: 6px; }
.members img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; border: 2px solid var(--bg); margin-right: -8px; }
.members span { margin-left: 14px; font-size: 13px; color: var(--text-2); }
.bio { margin-top: 12px; font-size: 14.5px; white-space: pre-wrap; }
.bio .escape { font-weight: 600; }
.prof-btns { display: flex; gap: 6px; margin-top: 14px; }
.prof-btns .btn { flex: 1; }
.btn {
  flex: none; padding: 8px 12px; border-radius: 9px; background: var(--bg-sunk); font-weight: 600; font-size: 14px; text-align: center;
}
.btn.primary { background: var(--accent); color: #fff; }
.btn.wide { width: 100%; padding: 12px; border-radius: 11px; font-size: 15px; }
.btn:disabled { opacity: .5; }
.hl-row { display: flex; gap: 16px; overflow-x: auto; padding: 18px 16px 10px; scrollbar-width: none; }
.hl-row::-webkit-scrollbar { display: none; }
.hl { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: none; width: 66px; }
.hl .cv { width: 62px; height: 62px; border-radius: 50%; padding: 2.5px; border: 1px solid var(--line); }
.hl .cv img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.hl small { font-size: 12px; text-align: center; max-width: 66px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ptabs { display: flex; border-bottom: 1px solid var(--line); margin-top: 6px; }
.ptabs button { flex: 1; display: grid; place-items: center; padding: 10px 0; color: var(--text-2); border-bottom: 1.5px solid transparent; }
.ptabs button.on { color: var(--text); border-bottom-color: var(--text); }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; }
.grid .cell { position: relative; aspect-ratio: 3 / 4; background: var(--bg-sunk); overflow: hidden; }
.grid .cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.grid .cell .note { padding: 10px; gap: 4px; }
.grid .cell .note .q { font-size: 13px; }
.grid .cell .note .s, .grid .cell .note .orn { display: none; }
.grid .cell .tag { position: absolute; top: 7px; right: 7px; color: #fff; filter: drop-shadow(0 1px 2px rgba(0,0,0,.5)); }
.grid .cell .tag svg { width: 18px; height: 18px; }

/* ---------- полноэкранные слои ---------- */
.layer { position: fixed; inset: 0; z-index: 50; display: flex; justify-content: center; }
.layer > .sheet-wrap { width: 100%; max-width: 480px; position: relative; }
.backdrop { position: fixed; inset: 0; background: rgba(10, 6, 5, .45); z-index: 49; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); width: 100%; max-width: 480px; z-index: 51;
  background: var(--bg-elev); border-radius: 16px 16px 0 0; max-height: 86vh; display: flex; flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom); animation: up .28s cubic-bezier(.2,.8,.2,1);
}
@keyframes up { from { transform: translate(-50%, 100%); } }
.sheet .grab { width: 38px; height: 4px; border-radius: 2px; background: var(--line); margin: 8px auto 4px; }
.sheet h3 { margin: 4px 0 8px; text-align: center; font-size: 15px; font-weight: 700; }
.sheet .body { overflow-y: auto; padding: 4px 16px 12px; }
.menu-list button { display: block; width: 100%; text-align: center; padding: 14px; border-top: 1px solid var(--line); font-size: 15px; }
.menu-list button.danger { color: var(--heart); font-weight: 600; }
.cmt { display: flex; gap: 10px; padding: 8px 0; align-items: flex-start; }
.cmt .t { flex: 1; font-size: 14px; white-space: pre-wrap; }
.cmt .t b { font-weight: 600; margin-right: 4px; }
.cmt .t small { display: block; color: var(--text-2); font-size: 12px; margin-top: 2px; }
.inputbar { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line); }
.inputbar input, .inputbar textarea {
  flex: 1; border: 1px solid var(--line); background: var(--bg); border-radius: 22px; padding: 10px 14px; outline: none; resize: none;
  max-height: 120px;
}
.inputbar .send { color: var(--accent); font-weight: 700; }
.inputbar .send:disabled { opacity: .4; }

/* ---------- сторис ---------- */
.story {
  position: fixed; inset: 0; z-index: 60; background: #000; color: #fff; display: flex; justify-content: center;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.story .frame { position: relative; width: 100%; max-width: 480px; height: 100%; overflow: hidden; background: #111; }
.story .frame > img, .story .frame > video, .story .frame > .note { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.story .frame > .note .q { font-size: 30px; }
.story .bars { position: absolute; top: calc(env(safe-area-inset-top) + 8px); left: 8px; right: 8px; display: flex; gap: 3px; z-index: 3; }
.story .bars i { flex: 1; height: 2.5px; border-radius: 2px; background: rgba(255,255,255,.35); overflow: hidden; }
.story .bars i b { display: block; height: 100%; width: 0; background: #fff; }
.story .shead { position: absolute; top: calc(env(safe-area-inset-top) + 20px); left: 12px; right: 8px; display: flex; align-items: center; gap: 9px; z-index: 3; text-shadow: 0 1px 4px rgba(0,0,0,.4); }
.story .shead .av { width: 32px; height: 32px; }
.story .shead .n { font-weight: 600; font-size: 14px; }
.story .shead .t { opacity: .75; font-size: 13px; }
.story .shead .sp { flex: 1; }
.story .shead button { color: #fff; padding: 6px; }
.story .shade { position: absolute; left: 0; right: 0; top: 0; height: 120px; background: linear-gradient(rgba(0,0,0,.45), transparent); z-index: 2; pointer-events: none; }
.story .stext {
  position: absolute; left: 20px; right: 20px; bottom: 120px; z-index: 3; text-align: center;
  font-family: var(--font-serif); font-size: 26px; line-height: 1.25; font-weight: 600;
  text-shadow: 0 2px 14px rgba(0,0,0,.55);
}
.story .tapzones { position: absolute; inset: 0; display: flex; z-index: 2; }
.story .tapzones div { flex: 1; }
.story .tapzones div:last-child { flex: 2; }
.story .sfoot { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 12px calc(env(safe-area-inset-bottom) + 12px); display: flex; gap: 12px; align-items: center; z-index: 4; }
.story .sfoot input { flex: 1; background: transparent; border: 1px solid rgba(255,255,255,.6); border-radius: 22px; padding: 11px 16px; color: #fff; outline: none; }
.story .sfoot input::placeholder { color: rgba(255,255,255,.8); }
.story .sfoot button { color: #fff; }
.story .song-pill { position: absolute; top: calc(env(safe-area-inset-top) + 60px); left: 12px; bottom: auto; z-index: 3; }

/* ---------- директ ---------- */
.chat { display: flex; flex-direction: column; height: 100dvh; }
.chat .topbar { border-bottom: 1px solid var(--line); }
.chat .topbar .who small { display: block; font-weight: 400; font-size: 12px; color: var(--text-2); }
.msgs { flex: 1; overflow-y: auto; padding: 14px 12px 6px; display: flex; flex-direction: column; gap: 3px; }
.msg { max-width: 76%; padding: 9px 13px; border-radius: 20px; font-size: 15px; white-space: pre-wrap; word-wrap: break-word; align-self: flex-start; background: var(--bubble-them); }
.msg.me { align-self: flex-end; background: var(--bubble-me); color: var(--bubble-me-text); }
.msg.media { padding: 0; background: none; overflow: hidden; border-radius: 18px; }
.msg.media img, .msg.media video { display: block; max-width: 230px; max-height: 320px; border-radius: 18px; }
.msg .card { width: 220px; border-radius: 16px; overflow: hidden; background: var(--bg-elev); color: var(--text); border: 1px solid var(--line); }
.msg .card .ch { display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-weight: 600; font-size: 13px; }
.msg .card .ch .av { width: 22px; height: 22px; }
.msg .card .cm { aspect-ratio: 4/5; background: var(--bg-sunk); }
.msg .card .cm img, .msg .card .cm .note { width: 100%; height: 100%; object-fit: cover; }
.msg .card .cm .note .q { font-size: 15px; }
.msg .card .cm .note .s, .msg .card .cm .note .orn { display: none; }
.msg .card .cc { padding: 8px 10px; font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.msg.withcard { padding: 0; background: none; }
.msg .sref { font-size: 12px; opacity: .75; margin-bottom: 5px; }
.msg .sref img { width: 90px; height: 150px; object-fit: cover; border-radius: 12px; display: block; margin-top: 4px; }
.msg-time { align-self: center; color: var(--text-2); font-size: 11.5px; margin: 12px 0 6px; }
.seen-mark { align-self: flex-end; color: var(--text-2); font-size: 11.5px; margin: 2px 6px 0; }
.chat .inputbar { padding-bottom: calc(env(safe-area-inset-bottom) + 10px); background: var(--bg); }
.chat .inputbar .pic { color: var(--text); }

/* ---------- новый пост ---------- */
.form { padding: 12px 16px 24px; display: flex; flex-direction: column; gap: 14px; }
.picks { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.picks .pk { position: relative; width: 92px; height: 115px; border-radius: 10px; overflow: hidden; flex: none; background: var(--bg-sunk); }
.picks .pk img, .picks .pk video { width: 100%; height: 100%; object-fit: cover; display: block; }
.picks .pk button { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; font-size: 14px; line-height: 1; }
.picks .add { width: 92px; height: 115px; border-radius: 10px; border: 1.5px dashed var(--line); display: grid; place-items: center; color: var(--text-2); flex: none; }
.field label { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 5px; }
.field input, .field textarea, .field select {
  width: 100%; border: 1px solid var(--line); background: var(--bg-elev); border-radius: 11px; padding: 11px 13px; outline: none;
}
.field textarea { min-height: 110px; resize: vertical; }
.seg { display: flex; background: var(--bg-sunk); border-radius: 11px; padding: 3px; }
.seg button { flex: 1; padding: 8px; border-radius: 9px; font-weight: 600; font-size: 14px; color: var(--text-2); }
.seg button.on { background: var(--bg-elev); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.progress { height: 4px; border-radius: 2px; background: var(--bg-sunk); overflow: hidden; }
.progress b { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.hint { font-size: 12.5px; color: var(--text-2); }

/* ---------- рилсы ---------- */
.reels { height: 100dvh; overflow-y: auto; scroll-snap-type: y mandatory; background: #000; }
.reel { height: 100dvh; scroll-snap-align: start; position: relative; display: flex; justify-content: center; }
.reel video { width: 100%; height: 100%; object-fit: cover; }
.reel .ov { position: absolute; left: 0; right: 0; bottom: 0; padding: 40px 70px calc(env(safe-area-inset-bottom) + 84px) 14px; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.55)); }
.reel .ov .n { display: flex; align-items: center; gap: 8px; font-weight: 600; margin-bottom: 8px; }
.reel .ov .c { font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.reel .side { position: absolute; right: 10px; bottom: calc(env(safe-area-inset-bottom) + 100px); display: flex; flex-direction: column; gap: 22px; color: #fff; align-items: center; }
.reel .side .liked { color: var(--heart); }
.reel .side small { display: block; text-align: center; font-size: 12px; font-weight: 600; margin-top: 2px; }
.reels-top { position: fixed; top: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; z-index: 5; padding: calc(env(safe-area-inset-top) + 12px) 16px 10px; color: #fff; font-weight: 700; font-size: 20px; pointer-events: none; text-shadow: 0 1px 6px rgba(0,0,0,.4); }
.reel .tap-sound { position: absolute; inset: 0; }

/* ---------- вход и приветствие ---------- */
.login { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 40px 34px; gap: 12px; }
.login .logo { text-align: center; font-size: 72px; flex: none; margin-bottom: 4px; }
.login .tag { text-align: center; color: var(--text-2); font-family: var(--font-serif); font-style: italic; font-size: 18px; margin-bottom: 26px; }
.login input { width: 100%; border: 1px solid var(--line); background: var(--bg-elev); border-radius: 10px; padding: 13px 14px; outline: none; font-size: 15px; }
.login input:focus { border-color: var(--text-2); }
.login .err { color: var(--heart); text-align: center; font-size: 13.5px; min-height: 18px; }
.login .foot { text-align: center; color: var(--text-2); font-size: 12.5px; margin-top: 30px; }

.welcome {
  position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(130% 80% at 50% 10%, #fbf4ea, #ead9c3); color: #3b2621; padding: 30px; text-align: center;
}
.welcome .hint2 { font-family: var(--font-serif); font-style: italic; font-size: 18px; color: #8c2333; margin-top: 34px; animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .45; } }
.env { position: relative; width: 290px; height: 190px; perspective: 900px; cursor: pointer; margin-top: 120px; }
.env .back { position: absolute; inset: 0; background: #b9454f; border-radius: 6px; box-shadow: 0 18px 40px rgba(80, 20, 20, .25); }
.env .letter {
  position: absolute; left: 14px; right: 14px; top: 10px; height: 170px; background: #fffaf2; border-radius: 4px;
  transition: transform 1.1s cubic-bezier(.3,.7,.2,1) .5s, height 1.1s ease .5s; z-index: 1;
  padding: 18px 16px; font-family: var(--font-serif); color: #3b2621; overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,.08);
}
.env .front {
  position: absolute; inset: 0; z-index: 2; border-radius: 6px; overflow: hidden; pointer-events: none;
  background:
    linear-gradient(to top right, #a83a45 49.5%, transparent 50%) left / 50.5% 100% no-repeat,
    linear-gradient(to top left, #a83a45 49.5%, transparent 50%) right / 50.5% 100% no-repeat,
    linear-gradient(to top, #9d333e 0 46%, transparent 46%);
}
.env .flap {
  position: absolute; left: 0; right: 0; top: 0; height: 110px; z-index: 3; transform-origin: top;
  transition: transform .6s ease, z-index 0s .3s;
  clip-path: polygon(0 0, 100% 0, 50% 100%); background: #c4525b;
}
.env .seal {
  position: absolute; left: 50%; top: 88px; width: 46px; height: 46px; margin-left: -23px; border-radius: 50%; z-index: 4;
  background: radial-gradient(circle at 35% 35%, #e0a35f, #a8722f); display: grid; place-items: center;
  font-family: var(--font-logo); color: #fff8ea; font-size: 22px; box-shadow: 0 2px 6px rgba(0,0,0,.25);
  transition: opacity .3s;
}
.env.open .flap { transform: rotateX(180deg); z-index: 0; }
.env.open .seal { opacity: 0; }
.env.open .letter { transform: translateY(-150px); }
.welcome .paper {
  position: fixed; inset: 0; z-index: 90; display: flex; flex-direction: column;
  padding: calc(env(safe-area-inset-top) + 30px) 30px calc(env(safe-area-inset-bottom) + 30px);
  background: radial-gradient(130% 80% at 50% 0%, #fffaf3, #f2e4d1); color: #3b2621; text-align: left;
  animation: fade 1s ease; overflow-y: auto;
}
.welcome .paper > .reveal { margin: auto 0; }
.welcome .paper .hi { font-family: var(--font-logo); font-size: 46px; color: #8c2333; line-height: 1.1; margin-bottom: 18px; }
.welcome .paper p { font-family: var(--font-serif); font-size: 19.5px; line-height: 1.4; margin: 0 0 14px; font-weight: 500; }
.welcome .paper .sign { font-family: var(--font-logo); font-size: 30px; color: #8c2333; margin-top: 10px; text-align: right; }
.welcome .paper .zero { font-family: var(--font-serif); font-style: italic; color: #8c2333; font-size: 19px; margin-top: 18px; }
.welcome .paper .btn { margin-top: 28px; background: #8c2333; color: #fff; }
.reveal > * { opacity: 0; transform: translateY(10px); animation: rise .8s ease forwards; }
@keyframes rise { to { opacity: 1; transform: none; } }

.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 90px); transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 100;
  animation: fade .2s; max-width: 90%; text-align: center;
}
.empty { text-align: center; color: var(--text-2); padding: 40px 30px; font-family: var(--font-serif); font-size: 18px; font-style: italic; }
.loader { display: grid; place-items: center; min-height: 60vh; font-family: var(--font-logo); font-size: 48px; color: var(--accent); animation: breathe 1.6s infinite; }

/* видео, снятые «боком» */
.r90, .r270 { position: absolute; top: 50%; left: 50%; max-width: none; }
.r90 { transform: translate(-50%, -50%) rotate(90deg); }
.r270 { transform: translate(-50%, -50%) rotate(-90deg); }
.slide .r90, .slide .r270 { width: 125% !important; height: 80% !important; }
.grid .cell .r90, .grid .cell .r270 { width: 133.34% !important; height: 75% !important; }
.msg .card .cm { position: relative; overflow: hidden; }
.msg .card .cm .r90, .msg .card .cm .r270 { width: 125% !important; height: 80% !important; }
.reel .r90, .reel .r270, .story .frame > video.r90, .story .frame > video.r270 { inset: auto; width: 100dvh !important; height: min(100vw, 480px) !important; }

/* письма: целиком, на бумажном фоне, с просмотром на весь экран */
.slide.paper { background: radial-gradient(120% 90% at 50% 0%, #f8efe3, #e8d9c4); cursor: zoom-in; }
.slide.paper img { object-fit: contain; background: transparent; padding: 10px 0; filter: drop-shadow(0 6px 14px rgba(60, 30, 20, .18)); }
.slide.paper .zoom-hint {
  position: absolute; left: 12px; top: 12px; padding: 4px 11px; border-radius: 12px;
  background: rgba(20, 14, 12, .55); color: #fff; font-size: 12px; white-space: nowrap; pointer-events: none;
}
.grid .cell img[src*="/letter_"] { object-position: top; }
.story .frame > img.contain { object-fit: contain; background: radial-gradient(120% 90% at 50% 0%, #f8efe3, #e8d9c4); }
.zoom { position: fixed; inset: 0; z-index: 70; background: #f3e8da; }
.zoom-scroll { position: absolute; inset: 0; overflow: auto; -webkit-overflow-scrolling: touch; display: flex; }
.zoom-scroll img { margin: auto; max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; display: block; }
.zoom.big .zoom-scroll img { max-width: none; max-height: none; width: 230%; cursor: zoom-out; }
.zoom-x {
  position: absolute; top: calc(env(safe-area-inset-top) + 10px); right: 10px; width: 40px; height: 40px; border-radius: 50%;
  background: rgba(20, 14, 12, .6); color: #fff; display: grid; place-items: center; z-index: 2;
}
.zoom-tip {
  position: absolute; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 18px); transform: translateX(-50%);
  padding: 6px 13px; border-radius: 14px; background: rgba(20, 14, 12, .6); color: #fff; font-size: 13px; white-space: nowrap;
}

/* подпись к конкретному слайду */
.slide-cap {
  padding: 0 14px 4px; font-family: var(--font-serif); font-style: italic; font-size: 16px; line-height: 1.3;
  color: var(--accent); min-height: 22px; transition: opacity .12s;
}
[data-theme="classic"] .slide-cap { font-family: var(--font-ui); font-size: 13.5px; color: var(--text-2); }
.slide-cap.empty { min-height: 0; padding: 0; }
.slide-cap.swap { opacity: 0; }
.story .stext.small { font-size: 19px; bottom: 100px; }

/* подборки: чуть шире, чтобы «Годовщина 🥂» и «Вкусняшки 🍔» помещались */
.hl { width: 78px; }
.hl small { max-width: 78px; font-size: 11.5px; letter-spacing: -0.1px; }
.hl-row { gap: 10px; }
