/* iophoto — purple / black UI */
@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap");

:root {
  --bg: #07060c;
  --bg-elev: #100e18;
  --bg-card: #151221;
  --bg-soft: #1c1730;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(167, 139, 250, 0.35);
  --text: #f3f0ff;
  --muted: #a39bb8;
  --faint: #6f6788;
  /* accent (kept as --orange* for compatibility) */
  --orange: #b56bff;
  --orange-2: #7c3aed;
  --orange-dim: rgba(167, 85, 247, 0.14);
  --accent-soft: #e9d5ff;
  --accent-glow: rgba(139, 92, 246, 0.32);
  --discord: #5865f2;
  --danger: #ff6b7a;
  --ok: #3dd68c;
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  --font: "Manrope", "Segoe UI", system-ui, sans-serif;
  --wrap: 1100px;
  --ink-on-accent: #12081f;
  --topbar-bg: rgba(7, 6, 12, 0.82);
  --body-glow-1: rgba(139, 92, 246, 0.22);
  --body-glow-2: rgba(88, 28, 180, 0.16);
  --body-glow-3: rgba(124, 58, 237, 0.1);
  --body-grad: linear-gradient(180deg, #0c0a14 0%, #07060c 42%, #05040a 100%);
  --footer-color: #6f6788;
}

/* Светлая тема */
html[data-theme="light"] {
  --bg: #f6f4fb;
  --bg-elev: #ffffff;
  --bg-card: #ffffff;
  --bg-soft: #efeaf8;
  --line: rgba(40, 20, 70, 0.1);
  --line-strong: rgba(124, 58, 237, 0.28);
  --text: #1a1230;
  --muted: #5c5470;
  --faint: #8a829e;
  --orange: #7c3aed;
  --orange-2: #6d28d9;
  --orange-dim: rgba(124, 58, 237, 0.1);
  --accent-soft: #5b21b6;
  --accent-glow: rgba(124, 58, 237, 0.22);
  --shadow: 0 18px 48px rgba(40, 20, 80, 0.12);
  --ink-on-accent: #ffffff;
  --topbar-bg: rgba(246, 244, 251, 0.88);
  --body-glow-1: rgba(167, 139, 250, 0.22);
  --body-glow-2: rgba(124, 58, 237, 0.1);
  --body-glow-3: rgba(196, 181, 253, 0.2);
  --body-grad: linear-gradient(180deg, #faf8ff 0%, #f6f4fb 45%, #f0ecf8 100%);
  --footer-color: #7a7390;
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(900px 520px at 12% -8%, var(--body-glow-1), transparent 55%),
    radial-gradient(700px 420px at 92% 8%, var(--body-glow-2), transparent 52%),
    radial-gradient(620px 400px at 50% 100%, var(--body-glow-3), transparent 55%),
    var(--body-grad);
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.accent { color: var(--orange); }

.wrap {
  width: min(var(--wrap), calc(100% - 2rem));
  margin: 0 auto;
}

/* ——— Topbar ——— */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--line);
  background: var(--topbar-bg);
  backdrop-filter: blur(18px) saturate(1.2);
}

.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  font-size: 1.05rem;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.theme-toggle:hover {
  border-color: rgba(167, 139, 250, 0.4);
  background: var(--orange-dim);
}
html[data-theme="light"] .theme-toggle-moon { display: none; }
html[data-theme="light"] .theme-toggle-sun { display: inline; }
html:not([data-theme="light"]) .theme-toggle-sun { display: none; }
html:not([data-theme="light"]) .theme-toggle-moon { display: inline; }

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 64px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.03em;
}

.logo-icon {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  color: var(--ink-on-accent);
  background: linear-gradient(145deg, #d8b4fe, var(--orange-2));
  box-shadow: 0 8px 22px var(--accent-glow);
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-link {
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  transition: 0.15s ease;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.nav-link.muted { opacity: 0.7; }

.nav-logout {
  border-color: var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}
.nav-logout:hover {
  border-color: rgba(255, 107, 122, 0.45);
  color: var(--danger);
  background: rgba(255, 107, 122, 0.1);
}

.user-pill {
  display: inline-flex !important;
  align-items: center;
  gap: 0.5rem;
  margin-left: 0.25rem;
  padding: 0.28rem 0.75rem 0.28rem 0.28rem !important;
  border-radius: 999px !important;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.88rem;
  font-weight: 600;
}

.user-pill img,
.av-fallback {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
}

.av-fallback {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--orange), var(--orange-2));
  color: var(--ink-on-accent);
  font-weight: 800;
  font-size: 0.78rem;
}

/* ——— Buttons ——— */
.btn,
label.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 0.75rem 1.2rem;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: 0.18s ease;
  background: transparent;
  white-space: nowrap;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  text-decoration: none;
  color: inherit;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn-primary {
  color: var(--ink-on-accent);
  background: linear-gradient(135deg, #c084fc, var(--orange-2));
  box-shadow: 0 12px 32px var(--accent-glow);
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.btn-ghost {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}

.btn-ghost:hover:not(:disabled) {
  border-color: rgba(167, 139, 250, 0.4);
  background: var(--orange-dim);
}

.btn-discord {
  background: var(--discord);
  color: #fff;
  box-shadow: 0 10px 28px rgba(88, 101, 242, 0.3);
}

.btn-discord:hover { filter: brightness(1.08); }

.btn-danger {
  border-color: rgba(255, 107, 122, 0.35);
  background: rgba(255, 107, 122, 0.1);
  color: #ffb0b8;
}

.btn-sm { padding: 0.5rem 0.9rem; font-size: 0.86rem; border-radius: 11px; }
.btn-lg { width: 100%; padding: 0.95rem 1.25rem; font-size: 1rem; border-radius: 16px; }
.btn-wide { min-width: 180px; }

.btn-link {
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  padding: 0.4rem 0.85rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
}
.btn-link.danger:hover { color: var(--danger); }

/* ——— Flashes / layout ——— */
.flashes { padding-top: 0.85rem; display: grid; gap: 0.45rem; }
.flash {
  padding: 0.8rem 1rem;
  border-radius: 14px;
  font-size: 0.92rem;
  font-weight: 500;
  border: 1px solid var(--line);
  background: var(--bg-card);
}
.flash-ok { border-color: rgba(61, 214, 140, 0.3); background: rgba(61, 214, 140, 0.08); color: #b8f5d4; }
.flash-error { border-color: rgba(255, 107, 122, 0.35); background: rgba(255, 107, 122, 0.08); color: #ffc4ca; }
.flash-warn { border-color: rgba(255, 180, 60, 0.35); background: rgba(255, 180, 60, 0.08); color: #ffe0a8; }

.main { padding: 1.5rem 0 3rem; }
.footer {
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 0.85rem;
  padding: 1.4rem 0 2rem;
  text-align: center;
}

.section { margin-top: 2rem; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.9rem;
}
.section-head h2 { margin: 0; font-size: 1.2rem; letter-spacing: -0.02em; }

.empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.015);
}

/* ——— Cards / grids ——— */
.grid { display: grid; gap: 1rem; }
.photo-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.albums-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: 0.18s ease;
}
.card:hover {
  border-color: rgba(167, 139, 250, 0.28);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}
.thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #0a0b10;
  overflow: hidden;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-empty {
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--faint);
}
.badge {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(167, 139, 250, 0.3);
  color: #e9d5ff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  backdrop-filter: blur(8px);
}
.card-body { padding: 0.85rem 0.95rem 1rem; }
.card-body h3 {
  margin: 0;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-body p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

/* ——— Forms ——— */
.field { margin-top: 0.85rem; }
.field label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
}
.field input,
.field textarea,
.bio-form input,
.share input {
  width: 100%;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.8rem 0.95rem;
  outline: none;
  transition: 0.15s ease;
}
.field input:focus,
.field textarea:focus,
.bio-form input:focus {
  border-color: rgba(167, 139, 250, 0.45);
  box-shadow: 0 0 0 3px var(--orange-dim);
}
.form-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.panel {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.panel.compact { margin-top: 1rem; }

/* ——— Fullscreen pages ——— */
.page-fullscreen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.page-fullscreen .footer {
  display: block;
  margin-top: auto;
  flex-shrink: 0;
}
.fullscreen-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 0;
  position: relative;
  z-index: 1;
}
.page-upload .up-screen {
  min-height: calc(100dvh - 64px - 72px);
}

/* ——— Login / landing (product-style) ——— */
.login-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem 3rem;
  gap: 2.5rem;
}

.hero-block {
  width: min(720px, 100%);
  text-align: center;
  padding-top: 1rem;
}

.hero-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--orange-dim);
  color: #e9d5ff;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 1.1rem;
}

.hero-block h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.12;
  letter-spacing: -0.04em;
  font-weight: 800;
}

.hero-block h1 span {
  background: linear-gradient(120deg, #d8b4fe, var(--orange-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-block > p {
  margin: 1rem auto 0;
  max-width: 34rem;
  color: var(--muted);
  font-size: 1.05rem;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1.6rem;
}

.feature-row {
  width: min(960px, 100%);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.9rem;
}

.feature {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.2rem 1.15rem;
  text-align: left;
  transition: 0.18s ease;
}

.feature:hover {
  border-color: rgba(167, 139, 250, 0.25);
  transform: translateY(-2px);
}

.feature-ico {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  margin-bottom: 0.85rem;
  background: var(--orange-dim);
  color: var(--orange);
  border: 1px solid rgba(167, 139, 250, 0.2);
}

.feature h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.feature p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.login-card-mini {
  width: min(400px, 100%);
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
  text-align: center;
}

.login-card-mini h2 {
  margin: 0 0 0.4rem;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}

.login-card-mini p {
  margin: 0 0 1.15rem;
  color: var(--muted);
  font-size: 0.92rem;
}

/* ——— Upload ——— */
.up-screen {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem 1rem 1.75rem;
  min-height: calc(100dvh - 64px);
  width: 100%;
}

.up-form {
  width: min(920px, 100%);
  display: flex;
  min-height: 0;
}

.up-stage {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Прямоугольная зона только для пустого состояния */
.up-stage-rect {
  min-height: 280px;
  max-height: min(70vh, 560px);
  aspect-ratio: 16 / 9;
}

/* После выбора файлов — без обрезки, контент виден целиком */
.up-stage.has-files {
  max-height: none;
  min-height: 0;
  aspect-ratio: auto;
  overflow: visible;
}

.up-stage.dragover {
  border-color: rgba(167, 139, 250, 0.55);
  box-shadow: 0 0 0 3px var(--orange-dim), var(--shadow);
}

/* iOS: input type=file с display:none/hidden часто ломает выбор */
.file-input-visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none;
}

.up-stage-inner {
  flex: 1;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  text-align: left;
  padding: 1.75rem 2rem;
  cursor: pointer;
  background:
    radial-gradient(520px 240px at 20% 40%, rgba(139, 92, 246, 0.12), transparent 70%);
  min-height: 0;
}

.up-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  max-width: 28rem;
}

.up-copy .up-pills { justify-content: flex-start; margin: 0.4rem 0 0.7rem; }
.up-copy .up-footnote { margin-top: 0.55rem !important; }

.up-icon {
  width: 88px;
  height: 88px;
  flex-shrink: 0;
  border-radius: 22px;
  display: grid;
  place-items: center;
  color: var(--orange);
  background: linear-gradient(160deg, rgba(192, 132, 252, 0.16), rgba(124, 58, 237, 0.04));
  border: 1px solid rgba(167, 139, 250, 0.28);
  box-shadow: 0 14px 36px rgba(124, 58, 237, 0.12);
}

.up-icon svg { width: 40px; height: 40px; }

.up-stage-inner h1,
.up-copy h1 {
  margin: 0;
  font-size: clamp(1.4rem, 2.8vw, 1.85rem);
  letter-spacing: -0.035em;
  font-weight: 800;
}

.up-stage-inner > p,
.up-copy > p {
  margin: 0;
  color: var(--muted);
  max-width: 28rem;
}

.up-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
  margin: 0.7rem 0 1rem;
}

.pill {
  font-size: 0.75rem;
  font-weight: 700;
  color: #e9d5ff;
  background: var(--orange-dim);
  border: 1px solid rgba(167, 139, 250, 0.2);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
}

.pill-alt {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--line);
}

.up-pick {
  margin-top: 0.2rem;
  min-width: 190px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  cursor: pointer;
}

.up-lead-mobile { display: none !important; }
.up-lead-desktop { display: block; }

@media (max-width: 700px) {
  .up-lead-desktop { display: none !important; }
  .up-lead-mobile { display: block !important; }
}

.up-footnote {
  margin: 0.9rem 0 0 !important;
  font-size: 0.8rem !important;
  color: var(--faint) !important;
}

.up-selected {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.15rem 1.2rem 1.2rem;
  min-height: 0;
  width: 100%;
}

.up-selected-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.up-selected-head h2 {
  margin: 0;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}

.mode-hint {
  margin: 0.25rem 0 0;
  color: var(--orange);
  font-weight: 700;
  font-size: 0.9rem;
}

.up-head-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.up-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 0.7rem;
  overflow-y: auto;
  flex: 1;
  max-height: min(44vh, 400px);
  align-content: start;
  padding: 2px;
}

.up-card {
  position: relative;
  aspect-ratio: 1;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #0a0b10;
  animation: pop 0.25s ease;
}

@keyframes pop {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: none; }
}

.up-card img { width: 100%; height: 100%; object-fit: cover; }

.up-card-meta {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 1.3rem 0.45rem 0.4rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  font-size: 0.68rem;
  color: #ddd;
  font-weight: 600;
}

.up-card-x {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
  display: grid;
  place-items: center;
  backdrop-filter: blur(6px);
}

.up-card-x:hover { background: var(--danger); }

.up-panel {
  margin-top: auto;
  padding: 1rem;
  border-radius: 16px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
}

.up-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}

.up-meta .field { margin-top: 0; }
.up-meta .field.dim { opacity: 0.4; }

.up-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-top: 0.9rem;
}

.upload-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  flex: 1;
  min-height: 1.2em;
  font-weight: 600;
}

.upload-status.show { color: #e9d5ff; }
.upload-status.show.is-error { color: #ffb0b8; }

/* Срок хранения */
.up-settings {
  margin-bottom: 0.85rem;
}
.retention-field label {
  display: block;
  margin-bottom: 0.45rem;
  font-weight: 700;
  color: var(--muted);
  font-size: 0.88rem;
}
.retention-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.retention-chip {
  display: inline-flex;
  cursor: pointer;
  user-select: none;
}
.retention-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.retention-chip span {
  display: inline-flex;
  align-items: center;
  padding: 0.42rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  transition: 0.15s ease;
}
.retention-chip:hover span,
.retention-chip.is-active span {
  border-color: rgba(167, 139, 250, 0.45);
  background: var(--orange-dim);
  color: var(--accent-soft);
}
.retention-hint {
  margin: 0.45rem 0 0;
  font-size: 0.75rem;
  color: var(--faint);
  font-weight: 600;
}

.media-expire {
  margin: -0.35rem 0 0;
  color: #c4b5fd;
  font-size: 0.86rem;
  font-weight: 700;
}

.media-views {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: -0.25rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.media-views svg {
  flex-shrink: 0;
  opacity: 0.85;
}

/* Toast уведомления — всегда поверх topbar */
.toast-host {
  position: fixed;
  top: calc(64px + 0.75rem);
  right: 1rem;
  left: auto;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  width: min(400px, calc(100vw - 1.5rem));
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.9rem 0.95rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 107, 122, 0.45);
  background: rgba(40, 12, 20, 0.97);
  color: #ffe4e8;
  font-size: 0.92rem;
  font-weight: 650;
  line-height: 1.4;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: auto;
  backdrop-filter: blur(14px);
}
.toast.is-show {
  opacity: 1;
  transform: none;
}
.toast-warn {
  border-color: rgba(167, 139, 250, 0.5);
  background: rgba(28, 18, 48, 0.97);
  color: #f0e7ff;
}
.toast-ok {
  border-color: rgba(61, 214, 140, 0.4);
  background: rgba(10, 32, 22, 0.97);
  color: #c6f6d5;
}
.toast-icon { flex-shrink: 0; margin-top: 0.05rem; }
.toast-text { min-width: 0; flex: 1; }
.toast-close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}
.toast-close:hover { background: rgba(255, 255, 255, 0.16); }

html[data-theme="light"] .toast {
  background: rgba(255, 245, 246, 0.98);
  color: #9f1239;
  border-color: rgba(244, 63, 94, 0.35);
  box-shadow: 0 16px 40px rgba(80, 20, 40, 0.15);
}
html[data-theme="light"] .toast-warn {
  background: rgba(248, 245, 255, 0.98);
  color: #5b21b6;
  border-color: rgba(124, 58, 237, 0.3);
}
html[data-theme="light"] .toast-ok {
  background: rgba(236, 253, 245, 0.98);
  color: #065f46;
  border-color: rgba(16, 185, 129, 0.35);
}

/* Удаление альбома в профиле */
.rail-card-actions {
  display: flex;
  gap: 0.45rem;
  padding: 0 0.85rem 0.9rem;
  flex-wrap: wrap;
}
.rail-card-actions form { margin: 0; flex: 1; min-width: 0; }
.rail-card-actions .btn {
  width: 100%;
  min-height: 38px;
  font-size: 0.82rem;
}
.rail-card-actions > .btn { flex: 1; }

/* Legal pages */
.legal-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 0.5rem 0 2.5rem;
}
.legal-kicker {
  margin: 0 0 0.35rem;
  color: var(--orange);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.legal-page h1 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  letter-spacing: -0.03em;
}
.legal-updated {
  margin: 0 0 1.1rem;
  color: var(--faint);
  font-size: 0.86rem;
  font-weight: 600;
}
.legal-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1.4rem;
}
.legal-nav a {
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}
.legal-nav a:hover,
.legal-nav a.is-active {
  border-color: rgba(167, 139, 250, 0.4);
  color: var(--text);
  background: var(--orange-dim);
}
.legal-body {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1.35rem 1.4rem 1.5rem;
  box-shadow: var(--shadow);
  line-height: 1.65;
}
.legal-body h2 {
  margin: 1.35rem 0 0.5rem;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}
.legal-body h2:first-child { margin-top: 0; }
.legal-body p { margin: 0.55rem 0; color: var(--muted); }
.legal-body ul,
.legal-body ol { margin: 0.5rem 0 0.75rem; padding-left: 1.25rem; color: var(--muted); }
.legal-body li { margin: 0.3rem 0; }
.legal-body a { color: var(--orange); font-weight: 700; }
.legal-body a:hover { text-decoration: underline; }

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
}
.footer-links a {
  color: var(--footer-color);
  font-size: 0.86rem;
  font-weight: 650;
}
.footer-links a:hover { color: var(--orange); }

/* ——— Light theme: читаемость текста и UI ——— */
html[data-theme="light"] .media-view {
  background:
    radial-gradient(900px 500px at 20% 0%, rgba(124, 58, 237, 0.08), transparent 55%),
    #f3f0fa;
}
html[data-theme="light"] .media-stage {
  background: #0b0a10;
  border-right-color: rgba(40, 20, 70, 0.08);
}
html[data-theme="light"] .media-panel {
  background: #ffffff;
  border-left-color: rgba(124, 58, 237, 0.12);
  color: var(--text);
}
html[data-theme="light"] .page-media .topbar {
  background: rgba(246, 244, 251, 0.92);
}

html[data-theme="light"] .pill {
  color: #5b21b6;
  border-color: rgba(124, 58, 237, 0.22);
  background: rgba(124, 58, 237, 0.08);
}
html[data-theme="light"] .pill-alt {
  color: var(--muted);
  background: rgba(40, 20, 70, 0.04);
}
html[data-theme="light"] .upload-status.show {
  color: #5b21b6;
}
html[data-theme="light"] .upload-status.show.is-error {
  color: #be123c;
}
html[data-theme="light"] .media-expire {
  color: #6d28d9;
}
html[data-theme="light"] .media-views {
  color: #5c5470;
}
html[data-theme="light"] .media-kicker,
html[data-theme="light"] .rail-kicker,
html[data-theme="light"] .legal-kicker,
html[data-theme="light"] .viewer-kicker,
html[data-theme="light"] .eyebrow {
  color: #6d28d9;
}
html[data-theme="light"] .media-title,
html[data-theme="light"] .media-panel h1,
html[data-theme="light"] .media-panel h2 {
  color: #1a1230;
}
html[data-theme="light"] .media-desc,
html[data-theme="light"] .media-hint,
html[data-theme="light"] .mode-hint {
  color: #5c5470;
}
html[data-theme="light"] .media-author {
  background: rgba(124, 58, 237, 0.05);
  border-color: rgba(124, 58, 237, 0.14);
  color: #1a1230;
}
html[data-theme="light"] .media-author strong {
  color: #1a1230;
}
html[data-theme="light"] .media-author small {
  color: #5c5470;
}
html[data-theme="light"] .media-share input,
html[data-theme="light"] .embed-input,
html[data-theme="light"] .media-share .embed-code {
  background: #f4f1fa;
  color: #1a1230;
  border-color: rgba(40, 20, 70, 0.12);
}
html[data-theme="light"] .embed-codes {
  background: rgba(124, 58, 237, 0.06);
  border-color: rgba(124, 58, 237, 0.18);
}
html[data-theme="light"] .embed-codes-title {
  color: #5b21b6;
}
html[data-theme="light"] .embed-label {
  color: #5c5470;
}
html[data-theme="light"] .btn-ghost {
  color: #1a1230;
  border-color: rgba(40, 20, 70, 0.14);
  background: #fff;
}
html[data-theme="light"] .btn-ghost:hover:not(:disabled) {
  color: #5b21b6;
  border-color: rgba(124, 58, 237, 0.35);
  background: rgba(124, 58, 237, 0.08);
}
html[data-theme="light"] .nav-logout {
  color: #1a1230;
  background: #fff;
  border-color: rgba(40, 20, 70, 0.14);
}
html[data-theme="light"] .nav-logout:hover {
  color: #be123c;
  border-color: rgba(244, 63, 94, 0.4);
  background: rgba(255, 228, 230, 0.9);
}
html[data-theme="light"] .flash-ok {
  color: #065f46;
  background: rgba(16, 185, 129, 0.1);
}
html[data-theme="light"] .flash-error {
  color: #9f1239;
  background: rgba(244, 63, 94, 0.08);
}
html[data-theme="light"] .flash-warn {
  color: #92400e;
  background: rgba(245, 158, 11, 0.1);
}
html[data-theme="light"] .up-card-meta {
  color: #fff;
}
html[data-theme="light"] .rail-meta h3,
html[data-theme="light"] .card-body h3 {
  color: #1a1230;
}
html[data-theme="light"] .rail-meta p,
html[data-theme="light"] .card-body p {
  color: #5c5470;
}
html[data-theme="light"] .profile-info h1,
html[data-theme="light"] .section-head h2 {
  color: #1a1230;
}
html[data-theme="light"] .uname,
html[data-theme="light"] .bio {
  color: #5c5470;
}
html[data-theme="light"] .stats strong {
  color: #6d28d9;
}
html[data-theme="light"] .stats span {
  color: #5c5470;
}
html[data-theme="light"] .field label,
html[data-theme="light"] .share label {
  color: #5c5470;
}
html[data-theme="light"] input,
html[data-theme="light"] textarea {
  color: #1a1230;
  background: #fff;
  border-color: rgba(40, 20, 70, 0.12);
}
html[data-theme="light"] .up-panel,
html[data-theme="light"] .panel,
html[data-theme="light"] .viewer-side {
  background: #fff;
  color: #1a1230;
}
html[data-theme="light"] .empty {
  color: #5c5470;
}
html[data-theme="light"] .lb-title,
html[data-theme="light"] .lb-hint {
  color: #f3f0ff;
}
html[data-theme="light"] .feature-slide figcaption strong {
  color: #fff;
}
html[data-theme="light"] .feature-slide figcaption span {
  color: #e9d5ff;
}
html[data-theme="light"] .retention-hint {
  color: #5c5470;
}
html[data-theme="light"] .retention-chip span {
  color: #5c5470;
  background: #fff;
}
html[data-theme="light"] .retention-chip.is-active span,
html[data-theme="light"] .retention-chip:hover span {
  color: #5b21b6;
  background: rgba(124, 58, 237, 0.1);
}
html[data-theme="light"] .up-footnote,
html[data-theme="light"] .up-copy > p,
html[data-theme="light"] .up-stage-inner > p {
  color: #5c5470 !important;
}
html[data-theme="light"] .up-copy h1,
html[data-theme="light"] .up-stage-inner h1 {
  color: #1a1230;
}
html[data-theme="light"] .mode-hint {
  color: #6d28d9;
}
html[data-theme="light"] .badge,
html[data-theme="light"] .rail-badge {
  color: #5b21b6;
  border-color: rgba(124, 58, 237, 0.3);
  background: rgba(255, 255, 255, 0.92);
}
html[data-theme="light"] .logo {
  color: #1a1230;
}
html[data-theme="light"] .nav-link {
  color: #5c5470;
}
html[data-theme="light"] .nav-link:hover,
html[data-theme="light"] .nav-link.active {
  color: #1a1230;
  background: rgba(124, 58, 237, 0.08);
}
html[data-theme="light"] .user-pill {
  color: #1a1230;
  background: #fff;
  border-color: rgba(40, 20, 70, 0.12);
}
html[data-theme="light"] .theme-toggle {
  background: #fff;
  color: #1a1230;
  border-color: rgba(40, 20, 70, 0.12);
}
html[data-theme="light"] .footer {
  color: var(--footer-color);
}
html[data-theme="light"] .up-stage {
  background: #fff;
}
html[data-theme="light"] .up-icon {
  color: #6d28d9;
  border-color: rgba(124, 58, 237, 0.25);
  background: linear-gradient(160deg, rgba(167, 139, 250, 0.18), rgba(124, 58, 237, 0.05));
}
html[data-theme="light"] .up-selected-head h2 {
  color: #1a1230;
}
html[data-theme="light"] .rail-btn,
html[data-theme="light"] .feature-nav,
html[data-theme="light"] .media-nav {
  color: #1a1230;
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(40, 20, 70, 0.12);
}
html[data-theme="light"] .rail-btn:hover,
html[data-theme="light"] .feature-nav:hover,
html[data-theme="light"] .media-nav:hover {
  color: #6d28d9;
  border-color: rgba(124, 58, 237, 0.35);
  background: #fff;
}

/* ——— Profile ——— */
.profile-hero {
  border: 1px solid var(--line);
  border-radius: 24px;
  overflow: hidden;
  background: var(--bg-card);
  box-shadow: var(--shadow);
}

.profile-cover {
  height: 150px;
  background:
    linear-gradient(120deg, rgba(139, 92, 246, 0.5), rgba(88, 28, 180, 0.22) 48%, transparent 78%),
    linear-gradient(180deg, #1a1530, #0e0c16);
}

.profile-main {
  display: flex;
  gap: 1.2rem;
  padding: 0 1.35rem 1.4rem;
  margin-top: -52px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.profile-avatar {
  width: 112px;
  height: 112px;
  border-radius: 28px;
  border: 4px solid var(--bg-card);
  overflow: hidden;
  background: linear-gradient(135deg, var(--orange), #5b21b6);
  display: grid;
  place-items: center;
  font-size: 2.3rem;
  font-weight: 800;
  color: var(--ink-on-accent);
  box-shadow: 0 14px 36px rgba(124, 58, 237, 0.25);
  flex-shrink: 0;
}

.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-info { flex: 1; min-width: 200px; padding-top: 2.5rem; }
.profile-info h1 { margin: 0; font-size: 1.7rem; letter-spacing: -0.03em; }
.uname { margin: 0.15rem 0 0.5rem; color: var(--muted); }
.bio { margin: 0 0 0.85rem; max-width: 40rem; }
.bio.muted { color: var(--muted); }

.stats {
  display: flex;
  gap: 1.3rem;
  margin-bottom: 0.95rem;
}

.stats div { display: flex; flex-direction: column; line-height: 1.15; }

/* ——— Profile carousels / rails ——— */
.profile-rail-section {
  margin-top: 1.6rem;
}

.rail-head {
  align-items: flex-end;
  margin-bottom: 0.9rem;
}

.rail-kicker {
  margin: 0 0 0.2rem;
  color: var(--orange);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.rail-head h2 {
  margin: 0;
  font-size: 1.45rem;
  letter-spacing: -0.03em;
}

.rail-nav {
  display: flex;
  gap: 0.45rem;
}

.rail-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(18, 20, 28, 0.9);
  color: #fff;
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.rail-btn:hover {
  border-color: rgba(167, 139, 250, 0.45);
  background: var(--orange-dim);
  color: var(--orange);
}

.media-rail {
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin: 0 -0.25rem;
  padding: 0.25rem 0.25rem 0.55rem;
  cursor: grab;
}

.media-rail::-webkit-scrollbar { display: none; }
.media-rail.is-dragging { cursor: grabbing; scroll-behavior: auto; }
.media-rail.is-dragging * { pointer-events: none; }

.media-rail-track {
  display: flex;
  gap: 1rem;
  width: max-content;
  padding-right: 0.5rem;
}

.rail-card {
  position: relative;
  flex: 0 0 auto;
  width: min(280px, 78vw);
  scroll-snap-align: start;
  border-radius: 20px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.rail-card:hover {
  transform: translateY(-3px);
  border-color: rgba(167, 139, 250, 0.28);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.38);
}

.rail-card-photo {
  width: min(200px, 62vw);
}

.rail-card-link {
  display: block;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font: inherit;
  text-decoration: none;
}

.rail-cover {
  position: relative;
  aspect-ratio: 16 / 11;
  background: #0a0b10;
  overflow: hidden;
}

.rail-cover-square { aspect-ratio: 1; }

.rail-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.45s ease;
}

.rail-card:hover .rail-cover img {
  transform: scale(1.05);
}

.rail-cover-empty {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--faint);
  font-weight: 700;
  background: linear-gradient(145deg, #161922, #0d0f16);
}

.rail-cover-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(0, 0, 0, 0.72) 100%);
  pointer-events: none;
}

.rail-badge {
  position: absolute;
  top: 0.7rem;
  left: 0.7rem;
  z-index: 1;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  background: rgba(8, 10, 16, 0.72);
  border: 1px solid rgba(167, 139, 250, 0.35);
  color: #e9d5ff;
  font-size: 0.74rem;
  font-weight: 800;
  backdrop-filter: blur(8px);
}

.rail-play {
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  z-index: 1;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #c084fc, var(--orange-2));
  color: var(--ink-on-accent);
  box-shadow: 0 10px 24px rgba(124, 58, 237, 0.35);
  opacity: 0.95;
  transform: scale(0.92);
  transition: transform 0.2s ease;
}

.rail-card:hover .rail-play { transform: scale(1); }

.rail-meta {
  padding: 0.85rem 0.95rem 1rem;
}

.rail-meta h3 {
  margin: 0;
  font-size: 0.98rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rail-meta p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.rail-delete {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  z-index: 2;
  margin: 0;
}

.rail-delete button {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 1.05rem;
  cursor: pointer;
  line-height: 1;
  backdrop-filter: blur(6px);
}

.rail-delete button:hover { background: var(--danger); }

/* Миниатюры под витриной — без старых карточек */
.feature-thumbs {
  display: flex;
  gap: 0.65rem;
  overflow-x: auto;
  padding: 0.35rem 0.15rem 0.5rem;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.feature-thumbs::-webkit-scrollbar { display: none; }

.feature-thumb {
  flex: 0 0 auto;
  width: 84px;
  height: 84px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  background: #0a0812;
  opacity: 0.62;
  scroll-snap-align: start;
  transition: opacity 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.feature-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.feature-thumb:hover {
  opacity: 0.9;
  transform: translateY(-2px);
}
.feature-thumb.is-active {
  opacity: 1;
  border-color: var(--orange);
  box-shadow: 0 0 0 2px var(--orange-dim);
}

.feature-delete {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  z-index: 4;
  margin: 0;
}

/* Большая витрина фото */
.feature-carousel {
  position: relative;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: #05060a;
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
  min-height: 280px;
}

.feature-stage {
  position: relative;
  min-height: 320px;
}

.feature-slide {
  display: none;
  margin: 0;
  position: relative;
}
.feature-slide.is-active { position: relative; }

.feature-slide.is-active {
  display: block;
  animation: featureIn 0.35s ease;
}

@keyframes featureIn {
  from { opacity: 0; transform: scale(1.02); }
  to { opacity: 1; transform: none; }
}

.feature-open {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: zoom-in;
  min-height: 320px;
}

.feature-open img {
  width: 100%;
  max-height: min(58vh, 520px);
  object-fit: contain;
  background: #05060a;
}

.feature-slide figcaption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.4rem 1.1rem 0.9rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.78));
  pointer-events: none;
}

.feature-slide figcaption strong {
  font-size: 1rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.feature-slide figcaption span {
  flex: 0 0 auto;
  color: #e9d5ff;
  font-size: 0.82rem;
  font-weight: 800;
}

.feature-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(10, 12, 18, 0.72);
  color: #fff;
  font-size: 1.7rem;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.feature-nav:hover {
  border-color: rgba(167, 139, 250, 0.45);
  background: rgba(167, 139, 250, 0.12);
  color: var(--orange);
}

.feature-nav.prev { left: 0.75rem; }
.feature-nav.next { right: 0.75rem; }

.media-rail-photos {
  margin-top: 0.15rem;
}

@media (max-width: 700px) {
  .feature-stage,
  .feature-open { min-height: 240px; }
  .feature-open img { max-height: min(48vh, 380px); }
  .feature-nav { width: 40px; height: 40px; font-size: 1.4rem; }
  .feature-nav.prev { left: 0.4rem; }
  .feature-nav.next { right: 0.4rem; }
  .rail-card { width: min(240px, 78vw); }
  .rail-card-photo { width: min(160px, 56vw); }
  .rail-btn { width: 38px; height: 38px; }
}
.stats strong { font-size: 1.3rem; color: var(--orange); }
.stats span { color: var(--muted); font-size: 0.8rem; font-weight: 600; }

.bio-form label {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

/* ——— Viewer / album ——— */
.album-layout {
  display: grid;
  grid-template-columns: 1.55fr 0.9fr;
  gap: 1.15rem;
  align-items: start;
}
.album-side { position: sticky; top: 84px; }
.side-title {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}
.side-actions {
  display: grid;
  gap: 0.55rem;
}
.side-actions .btn { width: 100%; }

.viewer {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 1.15rem;
  align-items: start;
}

/* Страница после загрузки — крупный просмотр */
.viewer-xl {
  grid-template-columns: minmax(0, 1.85fr) minmax(280px, 0.85fr);
  gap: 1.35rem;
  width: 100%;
}

.page-photo .main {
  width: min(var(--wrap), calc(100% - 2rem));
  max-width: none;
}

.viewer-kicker {
  margin: 0;
  color: var(--orange);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.viewer-image {
  background: #05060a;
  border-radius: 20px;
  border: 1px solid var(--line);
  overflow: hidden;
  min-height: 280px;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow);
}

.viewer-xl .viewer-image {
  min-height: min(72vh, 640px);
  border-radius: 24px;
}

.viewer-image img {
  width: 100%;
  max-height: 78vh;
  object-fit: contain;
}

.viewer-xl .viewer-image img,
.viewer-xl .stage-open img {
  max-height: min(82vh, 860px);
}

.viewer-xl .stage-open {
  min-height: min(72vh, 640px);
  width: 100%;
  display: grid;
  place-items: center;
}

.viewer-xl .viewer-side {
  padding: 1.55rem 1.45rem;
  border-radius: 24px;
  gap: 1.15rem;
  position: sticky;
  top: 84px;
}

.viewer-xl .viewer-side h1 {
  font-size: clamp(1.45rem, 2.2vw, 1.85rem);
}

.viewer-xl .side-actions .btn,
.viewer-xl .share-row .btn {
  min-height: 48px;
  font-size: 1rem;
}

.viewer-xl .share-row input {
  min-height: 48px;
  font-size: 0.95rem;
}

.viewer-side {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1.25rem;
  display: grid;
  gap: 0.95rem;
  box-shadow: var(--shadow);
}

.viewer-side h1 { margin: 0; font-size: 1.3rem; letter-spacing: -0.02em; }

.author {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--muted);
  font-weight: 600;
}

.author img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
}

.author:hover { color: var(--orange); }

.share label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.share-row { display: flex; gap: 0.5rem; }

.album-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1.1rem;
  flex-wrap: wrap;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--orange);
  font-weight: 800;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.album-head h1 { margin: 0; font-size: 1.7rem; letter-spacing: -0.03em; }
.lead { color: var(--muted); margin: 0.5rem 0 0; }

.stage-carousel {
  position: relative;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: #05060a;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.stage-frame { position: relative; min-height: 360px; }
.stage-slide {
  display: none;
  flex-direction: column;
  align-items: center;
}
.stage-slide.is-active { display: flex; }
.stage-slide img {
  width: 100%;
  max-height: 72vh;
  object-fit: contain;
  background: #05060a;
}
.stage-slide figcaption {
  width: 100%;
  padding: 0.8rem 1rem;
  color: #c8cdd8;
  font-size: 0.9rem;
  font-weight: 600;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
  margin-top: -2.6rem;
  position: relative;
}

.stage-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(10, 12, 18, 0.7);
  color: var(--orange);
  font-size: 1.5rem;
  cursor: pointer;
  backdrop-filter: blur(8px);
}
.stage-nav:hover { border-color: rgba(167, 139, 250, 0.4); background: var(--orange-dim); }
.stage-nav.prev { left: 0.8rem; }
.stage-nav.next { right: 0.8rem; }

.thumbs {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.95rem 0 0.2rem;
}

.thumb-btn {
  flex: 0 0 auto;
  width: 74px;
  height: 74px;
  padding: 0;
  border-radius: 12px;
  border: 2px solid transparent;
  overflow: hidden;
  cursor: pointer;
  background: #111;
  opacity: 0.6;
}
.thumb-btn img { width: 100%; height: 100%; object-fit: cover; }
.thumb-btn.is-active,
.thumb-btn:hover {
  opacity: 1;
  border-color: var(--orange);
}

/* legacy unused bits */
.bg-noise, .bg-glow, .up-grid-bg, .up-stage-glow { display: none; }

@media (max-width: 900px) {
  .feature-row { grid-template-columns: 1fr; }
  .viewer,
  .album-layout { grid-template-columns: 1fr; }
  .album-side { position: static; }
  /* На телефоне прячем «Загрузить/Профиль», но «Выйти» и админ остаются */
  .nav-desktop { display: none !important; }
  .user-pill-name { display: none; }
  .user-pill { padding-right: 0.35rem !important; margin-left: 0; }
  .nav-logout {
    display: inline-flex !important;
    min-height: 36px;
    padding: 0.4rem 0.7rem;
    font-size: 0.82rem;
    white-space: nowrap;
  }
  .nav-admin-mobile {
    display: inline-grid !important;
    place-items: center;
    min-width: 36px;
    min-height: 36px;
    padding: 0.35rem 0.55rem;
  }
  .nav {
    gap: 0.35rem;
  }
  .theme-toggle {
    width: 36px;
    height: 36px;
  }
}

.nav-admin-mobile { display: none; }

/* Admin panel */
.admin-page { padding-bottom: 2rem; }
.admin-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.admin-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}
.admin-head-actions form { margin: 0; }
.admin-head h1 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2rem);
  letter-spacing: -0.03em;
}
.admin-sub {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-weight: 600;
}
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.admin-stat {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.95rem 1rem;
  box-shadow: var(--shadow);
}
.admin-stat strong {
  display: block;
  font-size: 1.35rem;
  color: var(--orange);
  letter-spacing: -0.02em;
}
.admin-stat span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}
.admin-section {
  margin-bottom: 1.6rem;
}
.admin-section h2 {
  margin: 0 0 0.7rem;
  font-size: 1.15rem;
}
.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg-card);
  box-shadow: var(--shadow);
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
  font-size: 0.9rem;
}
.admin-table th,
.admin-table td {
  padding: 0.75rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.admin-table th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 800;
  background: rgba(0, 0, 0, 0.12);
}
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table a { color: var(--text); font-weight: 700; }
.admin-table a:hover { color: var(--orange); }
.admin-muted {
  color: var(--faint);
  font-size: 0.78rem;
  font-weight: 600;
}
.admin-mono {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.78rem;
  color: var(--muted);
}
.admin-thumb {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0a0812;
}
html[data-theme="light"] .admin-table th {
  background: rgba(124, 58, 237, 0.05);
}

/* ——— Fullscreen Lightbox ——— */
body.lb-open { overflow: hidden; }

.lb {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  opacity: 0;
  transition: opacity 0.22s ease;
}
.lb[hidden] { display: none !important; }
.lb.is-visible { opacity: 1; }

.lb-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(900px 500px at 50% 20%, rgba(167, 139, 250, 0.08), transparent 55%),
    rgba(3, 4, 8, 0.92);
  backdrop-filter: blur(16px) saturate(1.1);
}

.lb-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  padding: 0;
}

.lb-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent);
}

.lb-top-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.lb-chip {
  flex: 0 0 auto;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  border: 1px solid rgba(167, 139, 250, 0.35);
  background: rgba(167, 139, 250, 0.12);
  color: var(--orange);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.lb-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(50vw, 420px);
}

.lb-top-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.lb-icon-btn {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(18, 20, 28, 0.72);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, transform 0.15s ease;
  backdrop-filter: blur(10px);
}
.lb-icon-btn:hover {
  border-color: rgba(167, 139, 250, 0.45);
  color: var(--orange);
  background: rgba(167, 139, 250, 0.1);
  transform: translateY(-1px);
}
.lb-icon-btn.is-ok {
  border-color: rgba(61, 214, 140, 0.5);
  color: var(--ok);
}

.lb-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 0.5rem 4.2rem 0.75rem;
  cursor: zoom-out;
}

.lb-stage img {
  max-width: min(96vw, 1400px);
  max-height: min(78vh, 860px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 14px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 30px 80px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transform: scale(0.97);
  transition: opacity 0.22s ease, transform 0.28s ease;
  cursor: default;
  user-select: none;
  -webkit-user-drag: none;
}
.lb-stage img.is-ready {
  opacity: 1;
  transform: scale(1);
}

.lb-loader {
  position: absolute;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--orange);
  animation: lb-spin 0.7s linear infinite;
}
.lb-loader[hidden] { display: none !important; }

@keyframes lb-spin {
  to { transform: rotate(360deg); }
}

.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(12, 14, 20, 0.72);
  color: #fff;
  font-size: 1.85rem;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.lb-nav:hover {
  border-color: rgba(167, 139, 250, 0.45);
  background: rgba(167, 139, 250, 0.12);
  color: var(--orange);
}
.lb-nav.lb-prev { left: 0.85rem; }
.lb-nav.lb-next { right: 0.85rem; }
.lb-nav[hidden] { display: none !important; }

.lb-bottom {
  display: flex;
  justify-content: center;
  padding: 0.55rem 1rem 1rem;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.45), transparent);
}
.lb-hint {
  margin: 0;
  color: var(--faint);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-align: center;
}

/* zoom affordance on page previews */
.zoom-hint {
  position: absolute;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(8, 10, 16, 0.72);
  color: #e8ebf2;
  font-size: 0.82rem;
  font-weight: 700;
  backdrop-filter: blur(10px);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  white-space: nowrap;
}
.stage-open:hover .zoom-hint,
.viewer-image:hover .zoom-hint {
  opacity: 1;
  transform: translateX(-50%) translateY(-2px);
}

.thumb-btn-card {
  display: block;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: zoom-in;
  font: inherit;
}

.stage-open {
  position: relative;
  display: block;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: zoom-in;
}
.stage-open img {
  width: 100%;
  max-height: 72vh;
  object-fit: contain;
  background: #05060a;
}

.viewer-image .stage-open {
  min-height: 280px;
  display: grid;
  place-items: center;
}
.viewer-image .stage-open img {
  max-height: 78vh;
}

@media (max-width: 800px) {
  .lb-stage { padding: 0.35rem 0.65rem 0.5rem; }
  .lb-stage img { max-height: min(72vh, 720px); border-radius: 10px; }
  .lb-nav { width: 44px; height: 44px; font-size: 1.55rem; }
  .lb-nav.lb-prev { left: 0.35rem; }
  .lb-nav.lb-next { right: 0.35rem; }
  .lb-title { max-width: 42vw; font-size: 0.92rem; }
  .lb-hint { font-size: 0.7rem; }
  .zoom-hint { font-size: 0.75rem; bottom: 0.7rem; opacity: 0.95; }
  .up-stage-inner {
    flex-direction: column;
    text-align: center;
    padding: 1.35rem 1.1rem;
    gap: 1rem;
  }
  .up-copy { align-items: center; max-width: 100%; }
  .up-copy .up-pills { justify-content: center; }
  .up-stage-rect {
    aspect-ratio: auto;
    max-height: none;
    min-height: min(52dvh, 420px);
  }
  .up-stage.has-files {
    min-height: 0;
    max-height: none;
  }
}

@media (max-width: 700px) {
  .page-upload .topbar { position: sticky; }
  .up-screen {
    align-items: stretch;
    justify-content: flex-start;
    padding: 0.65rem 0.65rem 1.25rem;
    min-height: calc(100dvh - 64px);
  }
  .up-form { width: 100%; }
  .up-stage { border-radius: 18px; overflow: visible; }
  .up-stage:not(.has-files) { overflow: hidden; }
  .up-selected {
    padding: 1rem 0.85rem 1.1rem;
    gap: 0.85rem;
  }
  .up-preview {
    max-height: none;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 0.55rem;
  }
  .up-meta { grid-template-columns: 1fr; }
  .up-actions {
    flex-direction: column;
    align-items: stretch;
    position: sticky;
    bottom: 0;
    z-index: 5;
    margin: 0.5rem -0.15rem 0;
    padding: 0.65rem 0.15rem 0.15rem;
    background: linear-gradient(180deg, transparent, var(--bg-elev) 28%);
  }
  .up-actions .btn {
    width: 100%;
    min-height: 48px;
    font-size: 1rem;
  }
  .up-selected-head { flex-direction: column; gap: 0.65rem; }
  .up-head-actions { width: 100%; }
  .up-head-actions .btn { flex: 1; min-height: 42px; }
  .up-pick {
    width: 100%;
    min-width: 0;
    min-height: 48px;
  }
  .up-icon {
    width: 72px;
    height: 72px;
    border-radius: 18px;
  }
  .up-panel {
    padding: 0.85rem;
  }
  .upload-status {
    width: 100%;
    text-align: center;
    min-height: 1.4em;
  }
  .profile-info { padding-top: 0.6rem; }
  .hero-cta { flex-direction: column; }
  .hero-cta .btn { width: 100%; }
  .feature-thumb { width: 72px; height: 72px; border-radius: 14px; }
}

/* ——— Media viewer (photo / album) — cinematic, like full-screen host ——— */
.page-media {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.page-media .topbar {
  background: rgba(7, 6, 12, 0.88);
  border-bottom-color: rgba(167, 139, 250, 0.12);
}

.media-main {
  flex: 1;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.media-view {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  min-height: calc(100dvh - 64px);
  background:
    radial-gradient(900px 500px at 20% 0%, rgba(124, 58, 237, 0.12), transparent 55%),
    radial-gradient(700px 400px at 100% 100%, rgba(88, 28, 180, 0.1), transparent 50%),
    #05040a;
}

.media-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: #030208;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.media-frame {
  flex: 1;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: calc(100dvh - 64px);
  margin: 0;
  padding: 1.25rem 1.5rem;
  border: 0;
  background: transparent;
  cursor: zoom-in;
  position: relative;
}

.media-frame img {
  max-width: 100%;
  max-height: calc(100dvh - 64px - 2.5rem);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.05),
    0 28px 80px rgba(0, 0, 0, 0.55);
  user-select: none;
  -webkit-user-drag: none;
}

.media-panel {
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #12101c 0%, #0c0a14 100%);
  border-left: 1px solid rgba(167, 139, 250, 0.12);
  min-height: 0;
}

.media-panel-inner {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  padding: 1.6rem 1.4rem 1.5rem;
  height: 100%;
  overflow-y: auto;
}

.media-kicker {
  margin: 0;
  color: var(--orange);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.media-title {
  margin: 0;
  font-size: clamp(1.35rem, 1.8vw, 1.75rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  word-break: break-word;
}

.media-desc {
  margin: -0.35rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.media-author {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.media-author:hover {
  border-color: rgba(167, 139, 250, 0.35);
  background: var(--orange-dim);
}

.media-author img,
.media-author-fallback {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.media-author-fallback {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--orange), var(--orange-2));
  color: var(--ink-on-accent);
  font-weight: 800;
}

.media-author span {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.media-author strong {
  font-size: 0.98rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.media-author small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.media-block label {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.media-share {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.media-share input,
.media-share .embed-code {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.35);
  padding: 0.65rem 0.85rem;
  color: var(--text);
  font-size: 0.82rem;
  font-family: ui-monospace, "Cascadia Code", "Segoe UI Mono", Consolas, monospace;
  resize: vertical;
  line-height: 1.4;
}

.media-share .btn {
  flex-shrink: 0;
  min-height: 48px;
  align-self: stretch;
}

.media-share .btn.is-ok {
  border-color: rgba(61, 214, 140, 0.45);
  color: var(--ok);
}

.media-share-code {
  flex-direction: column;
}

.media-share-code .btn {
  width: 100%;
  min-height: 42px;
}

.embed-codes {
  display: grid;
  gap: 0.85rem;
  padding: 0.95rem 0.9rem 1rem;
  border-radius: 16px;
  border: 1px solid rgba(167, 139, 250, 0.18);
  background: rgba(124, 58, 237, 0.07);
}

.embed-codes-title {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-soft);
}

.embed-code {
  width: 100%;
  min-height: 64px;
}

/* Компактные коды — без прокрутки панели */
.embed-codes-compact {
  gap: 0.5rem;
  padding: 0.75rem 0.7rem 0.8rem;
}

.embed-row {
  display: grid;
  grid-template-columns: 88px 1fr auto;
  gap: 0.4rem;
  align-items: center;
}

.embed-label {
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.embed-input {
  min-width: 0;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.4);
  color: var(--text);
  padding: 0 0.55rem;
  font-size: 0.72rem;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.embed-row .btn {
  min-height: 36px;
  padding: 0.35rem 0.55rem;
  font-size: 0.75rem;
}

@media (max-width: 960px) {
  .embed-row {
    grid-template-columns: 1fr auto;
  }
  .embed-label {
    grid-column: 1 / -1;
  }
}

.media-actions {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.25rem;
}

.media-actions .btn,
.media-actions form .btn {
  width: 100%;
  min-height: 52px;
}

.media-actions form { margin: 0; }

.media-hint {
  margin: auto 0 0;
  padding-top: 0.75rem;
  color: var(--faint);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.4;
}

/* Album carousel inside media stage */
.media-stage-album {
  display: flex;
  flex-direction: column;
}

.media-carousel {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  min-height: 0;
}

.media-carousel-frame {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: calc(100dvh - 64px - 96px);
}

.media-slide {
  display: none;
  margin: 0;
  height: 100%;
}

.media-slide.is-active {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  animation: featureIn 0.3s ease;
}

.media-slide .media-frame {
  min-height: calc(100dvh - 64px - 96px);
  max-height: calc(100dvh - 64px - 96px);
  padding: 1rem 3.5rem;
}

.media-slide .media-frame img {
  max-height: calc(100dvh - 64px - 96px - 2rem);
}

.media-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 4;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(10, 8, 18, 0.75);
  color: #fff;
  font-size: 1.75rem;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.media-nav:hover {
  border-color: rgba(167, 139, 250, 0.5);
  background: rgba(167, 85, 247, 0.16);
  color: var(--orange);
}

.media-nav.prev { left: 0.85rem; }
.media-nav.next { right: 0.85rem; }

.media-thumbs {
  display: flex;
  gap: 0.55rem;
  overflow-x: auto;
  padding: 0.75rem 1rem 1rem;
  background: rgba(0, 0, 0, 0.35);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  scrollbar-width: none;
}

.media-thumbs::-webkit-scrollbar { display: none; }

.media-thumb {
  flex: 0 0 auto;
  width: 68px;
  height: 68px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  background: #0a0812;
  opacity: 0.55;
  transition: opacity 0.15s ease, border-color 0.15s ease;
}

.media-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-thumb:hover { opacity: 0.9; }
.media-thumb.is-active {
  opacity: 1;
  border-color: var(--orange);
  box-shadow: 0 0 0 2px var(--orange-dim);
}

@media (max-width: 960px) {
  .media-view {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .media-stage {
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }
  .media-frame {
    min-height: min(62dvh, 520px);
    padding: 0.85rem;
  }
  .media-frame img {
    max-height: min(58dvh, 480px);
  }
  .media-carousel-frame,
  .media-slide .media-frame {
    min-height: min(58dvh, 480px);
    max-height: none;
  }
  .media-slide .media-frame {
    padding: 0.75rem 2.8rem;
  }
  .media-slide .media-frame img {
    max-height: min(52dvh, 440px);
  }
  .media-panel {
    border-left: 0;
  }
  .media-panel-inner {
    padding: 1.25rem 1.1rem 1.4rem;
  }
  .media-hint { margin-top: 0.5rem; }
}

@media (min-width: 1100px) {
  .media-view {
    grid-template-columns: minmax(0, 1fr) minmax(340px, 420px);
  }
  .media-panel-inner {
    padding: 2rem 1.65rem 1.75rem;
    gap: 1.3rem;
  }
  .media-title { font-size: 1.85rem; }
  .media-frame {
    padding: 1.5rem 2rem;
  }
  .media-frame img {
    max-height: calc(100dvh - 64px - 3rem);
  }
  .media-nav {
    width: 58px;
    height: 58px;
    font-size: 1.9rem;
  }
  .media-thumb {
    width: 78px;
    height: 78px;
    border-radius: 14px;
  }
}

@media (min-width: 1400px) {
  .media-view {
    grid-template-columns: minmax(0, 1fr) minmax(360px, 440px);
  }
  .media-title { font-size: 2rem; }
  .media-actions .btn { min-height: 56px; font-size: 1.05rem; }
}

/* ——— Desktop: larger upload + interface ——— */
@media (min-width: 1100px) {
  :root {
    --wrap: 1320px;
    --radius: 24px;
  }

  body { font-size: 17px; }

  .topbar-inner { min-height: 74px; }
  .logo { font-size: 1.28rem; }
  .logo-icon { width: 42px; height: 42px; border-radius: 13px; font-size: 0.95rem; }
  .nav-link { padding: 0.55rem 1.05rem; font-size: 0.98rem; }
  .btn {
    padding: 0.9rem 1.45rem;
    font-size: 1.02rem;
    border-radius: 16px;
  }
  .btn-sm { padding: 0.58rem 1.05rem; font-size: 0.92rem; }
  .btn-lg { padding: 1.1rem 1.5rem; font-size: 1.08rem; }

  .main { padding-top: 1.6rem; padding-bottom: 3rem; }

  .up-screen {
    padding: 1.75rem 1.5rem 2.25rem;
    min-height: calc(100dvh - 74px);
  }
  .up-form { width: min(1180px, 100%); }
  .up-stage-rect {
    min-height: 460px;
    max-height: min(78vh, 720px);
    aspect-ratio: 16 / 9;
  }
  .up-stage.has-files {
    min-height: 520px;
    max-height: none;
  }
  .up-stage-inner { padding: 2.4rem 2.8rem; gap: 2rem; }
  .up-icon { width: 110px; height: 110px; border-radius: 28px; }
  .up-icon svg { width: 50px; height: 50px; }
  .up-copy h1,
  .up-stage-inner h1 { font-size: clamp(1.9rem, 2.4vw, 2.35rem); }
  .up-copy > p,
  .up-stage-inner > p { font-size: 1.08rem; max-width: 34rem; }
  .up-pick {
    min-width: 240px;
    min-height: 54px;
    font-size: 1.05rem;
    margin-top: 0.4rem;
  }
  .pill { font-size: 0.84rem; padding: 0.42rem 0.9rem; }
  .up-selected { padding: 1.5rem 1.6rem 1.55rem; gap: 1.2rem; }
  .up-selected-head h2 { font-size: 1.45rem; }
  .up-preview {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.9rem;
    max-height: min(48vh, 480px);
  }
  .up-panel { padding: 1.25rem; border-radius: 18px; }
  .up-actions .btn-wide { min-width: 220px; min-height: 52px; font-size: 1.05rem; }

  .profile-hero { border-radius: 28px; }
  .profile-cover { height: 180px; }
  .profile-avatar { width: 128px; height: 128px; border-radius: 32px; }
  .profile-info h1 { font-size: 2rem; }
  .rail-card { width: min(320px, 32vw); }
  .feature-carousel { border-radius: 28px; min-height: 360px; }
  .feature-stage,
  .feature-open { min-height: 420px; }
  .feature-open img { max-height: min(62vh, 620px); }
  .feature-thumb { width: 96px; height: 96px; border-radius: 18px; }
  .feature-nav { width: 56px; height: 56px; font-size: 1.9rem; }

  .viewer { gap: 1.4rem; }
  .viewer-side { padding: 1.5rem; border-radius: 24px; }
  .viewer-side h1 { font-size: 1.5rem; }
  .album-head h1 { font-size: 2rem; }

  .page-photo .main {
    width: min(1480px, calc(100% - 2.5rem));
    padding-top: 1.5rem;
    padding-bottom: 2.5rem;
  }
  .viewer-xl {
    grid-template-columns: minmax(0, 2.1fr) minmax(320px, 0.75fr);
    gap: 1.6rem;
  }
  .viewer-xl .viewer-image {
    min-height: min(78vh, 780px);
    border-radius: 28px;
  }
  .viewer-xl .stage-open {
    min-height: min(78vh, 780px);
  }
  .viewer-xl .viewer-image img,
  .viewer-xl .stage-open img {
    max-height: min(86vh, 900px);
  }
  .viewer-xl .viewer-side {
    padding: 1.85rem 1.65rem;
    border-radius: 28px;
    gap: 1.25rem;
  }
  .viewer-xl .viewer-side h1 {
    font-size: 2rem;
  }
  .viewer-xl .author {
    font-size: 1.05rem;
  }
  .viewer-xl .author img {
    width: 42px;
    height: 42px;
  }
  .viewer-xl .side-actions .btn,
  .viewer-xl .share-row .btn {
    min-height: 54px;
    font-size: 1.05rem;
  }
  .viewer-xl .share-row input {
    min-height: 54px;
    font-size: 1rem;
  }
}

@media (min-width: 1400px) {
  :root { --wrap: 1440px; }
  .up-form { width: min(1280px, 100%); }
  .up-stage-rect {
    min-height: 520px;
    max-height: min(80vh, 780px);
  }
  .page-photo .main {
    width: min(1600px, calc(100% - 3rem));
  }
  .viewer-xl {
    grid-template-columns: minmax(0, 2.25fr) minmax(340px, 0.7fr);
  }
  .viewer-xl .viewer-image,
  .viewer-xl .stage-open {
    min-height: min(82vh, 860px);
  }
  .viewer-xl .viewer-image img,
  .viewer-xl .stage-open img {
    max-height: min(88vh, 960px);
  }
}
