:root {
  --bg: #000000;
  --bg-elev: rgba(28, 28, 30, 0.72);
  --bg-soft: rgba(44, 44, 46, 0.65);
  --text: #f5f5f7;
  --muted: rgba(235, 235, 245, 0.6);
  --line: rgba(255, 255, 255, 0.12);
  --accent: #bf5af2;
  --accent-2: #7c3aed;
  --accent-glow: rgba(124, 58, 237, 0.35);
  --danger: #ff453a;
  --ok: #30d158;
  --radius: 14px;
  --radius-lg: 22px;
  --font-display: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
  --spring: cubic-bezier(0.25, 0.1, 0.25, 1);
  --spring-snappy: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: dark;
}

html[data-theme="purple"] {
  --bg: #08060d;
  --bg-elev: #120e1c;
  --bg-soft: #1b1428;
  --accent: #c4b5fd;
  --accent-2: #7c3aed;
  --accent-glow: rgba(124, 58, 237, 0.4);
}

html[data-theme="red"] {
  --bg: #0d0606;
  --bg-elev: #1a0c0c;
  --bg-soft: #261010;
  --accent: #fca5a5;
  --accent-2: #ef4444;
  --accent-glow: rgba(239, 68, 68, 0.4);
}

html[data-theme="green"] {
  --bg: #050d08;
  --bg-elev: #0b1810;
  --bg-soft: #102418;
  --accent: #86efac;
  --accent-2: #16a34a;
  --accent-glow: rgba(34, 197, 94, 0.35);
}

html[data-theme="navy"] {
  --bg: #050812;
  --bg-elev: #0b1220;
  --bg-soft: #121c30;
  --accent: #93c5fd;
  --accent-2: #2563eb;
  --accent-glow: rgba(37, 99, 235, 0.4);
}

*, *::before, *::after { box-sizing: border-box; }

[hidden] {
  display: none !important;
}

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body.in-gate .app,
body.in-gate #app {
  display: none !important;
}

body.in-app #gate {
  display: none !important;
}

body.in-app #app:not([hidden]) {
  display: grid !important;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  overflow-x: hidden;
}

html[data-lang="fa"] body {
  font-family: "Vazirmatn", system-ui, -apple-system, sans-serif;
}

html[data-lang="fa"] .gate-title,
html[data-lang="fa"] .step h2,
html[data-lang="fa"] .view-head h2 {
  font-family: "Vazirmatn", system-ui, sans-serif;
}

html[dir="rtl"] .gate-shell,
html[dir="rtl"] .view-head,
html[dir="rtl"] .panel-form,
html[dir="rtl"] .feed-item,
html[dir="rtl"] .topbar,
html[dir="rtl"] .album-actions {
  text-align: right;
}

.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.orb {
  pointer-events: none;
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  z-index: 0;
  opacity: 0.35;
}

.orb-a {
  width: 420px; height: 420px;
  top: -120px; right: -80px;
  background: var(--accent-glow);
  animation: drift 14s ease-in-out infinite alternate;
}

.orb-b {
  width: 360px; height: 360px;
  bottom: -100px; left: -60px;
  background: color-mix(in srgb, var(--accent-2) 40%, transparent);
  animation: drift 18s ease-in-out infinite alternate-reverse;
}

@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(-40px, 30px) scale(1.12); }
}

.brand-mark {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: var(--muted);
  margin: 0 0 1.25rem;
  text-transform: uppercase;
}

.brand-mark.small {
  letter-spacing: 0.22em;
  font-size: 0.75rem;
  margin: 0;
}

.gate {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: max(2rem, env(safe-area-inset-top)) 1.25rem max(3rem, env(safe-area-inset-bottom));
  overflow: hidden;
}

.gate-shell {
  width: min(520px, 100%);
  max-height: calc(100dvh - 3rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: rgba(28, 28, 30, 0.72);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 2rem 1.35rem 1.5rem;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  animation: gateEnter 0.45s var(--spring-snappy) both;
  transform-origin: center bottom;
}

.gate-exit {
  animation: gateLeave 0.42s var(--spring) forwards;
  pointer-events: none;
}

@keyframes gateEnter {
  from { opacity: 0; transform: translateY(16px) scale(0.985); filter: blur(4px); }
  to { opacity: 1; transform: none; filter: none; }
}

@keyframes gateLeave {
  from { opacity: 1; transform: translateY(0) scale(1); filter: none; }
  to { opacity: 0; transform: translateY(-12px) scale(0.96); filter: blur(6px); }
}

.app-enter {
  animation: appEnter 0.5s var(--spring-snappy) both;
}

@keyframes appEnter {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.gate-title {
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 5.5vw, 2.35rem);
  line-height: 1.08;
  margin: 0 0 0.45rem;
  letter-spacing: -0.03em;
  font-weight: 700;
  font-optical-sizing: auto;
}

.gate-sub, .hint, .view-head p, .empty p { color: var(--muted); margin: 0; }

.progress {
  margin: 1.35rem 0 1.5rem;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.progress-fill {
  display: block;
  height: 100%;
  width: 25%;
  background: var(--accent-2);
  transition: width 0.38s var(--spring-snappy);
  border-radius: inherit;
}

.step { display: none; }
.step.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  animation: stepIn 0.38s var(--spring-snappy) both;
}

.gate-pages {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.gate-pages .step.active {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
}

.member-list {
  display: grid;
  gap: 0.5rem;
}

.member-chip {
  width: 100%;
  border-radius: 12px;
  padding: 0.9rem 1rem;
  text-align: start;
  font: inherit;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 100ms ease-out, background 160ms var(--spring), border-color 160ms var(--spring);
}

.member-chip:hover { background: rgba(255, 255, 255, 0.12); }
.member-chip:active { transform: scale(0.98); transition-duration: 80ms; }
.member-chip.selected {
  border-color: var(--accent-2);
  background: color-mix(in srgb, var(--accent-2) 16%, rgba(255, 255, 255, 0.08));
}
.member-chip.rejected {
  border-color: var(--danger);
  animation: shake 0.42s ease;
}
.member-chip.trap:hover {
  border-color: color-mix(in srgb, var(--danger) 50%, transparent);
}

.back-step {
  margin-top: 1rem;
  align-self: flex-start;
}

@keyframes stepIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.step h2 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0 0 0.35rem;
}

.step .hint { margin-bottom: 1rem; font-size: 0.92rem; }

.choice-grid { display: grid; gap: 0.55rem; }
.choice-grid.two { grid-template-columns: 1fr 1fr; }

.choice, .btn, .tab {
  font: inherit;
  cursor: pointer;
  border: none;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition:
    transform 100ms ease-out,
    background 160ms var(--spring),
    box-shadow 160ms var(--spring),
    opacity 160ms ease;
}

.choice {
  border-radius: var(--radius);
  padding: 0.95rem 1rem;
  text-align: start;
  display: grid;
  gap: 0.25rem;
  min-height: 68px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.choice:hover, .btn:hover:not(:disabled), .tab:hover {
  background: rgba(255, 255, 255, 0.12);
}

.choice:active, .btn:active:not(:disabled), .tab:active:not(.active) {
  transform: scale(0.97);
  transition-duration: 80ms;
}

.choice:focus-visible, .btn:focus-visible, .tab:focus-visible,
.field input:focus-visible, .field textarea:focus-visible, .field select:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

.choice-kicker {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  color: var(--accent);
  font-weight: 700;
}

.theme-swatch { display: flex; align-items: center; gap: 0.75rem; }

.swatch {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--sw);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--sw) 25%, transparent);
  flex-shrink: 0;
}

.field { display: grid; gap: 0.45rem; margin-bottom: 1rem; }
.field span { font-size: 0.85rem; color: var(--muted); }

.field input, .field textarea, .field select {
  font: inherit;
  color: var(--text);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  width: 100%;
  resize: vertical;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.25);
}

.btn {
  border-radius: 12px;
  padding: 0.78rem 1.15rem;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid transparent;
}

.btn.primary {
  background: var(--accent-2);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.15) inset, 0 8px 24px color-mix(in srgb, var(--accent-2) 35%, transparent);
}

.btn.primary:active:not(:disabled) {
  background: color-mix(in srgb, var(--accent-2) 88%, #000);
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.08);
}

.identity-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

@media (min-width: 480px) {
  .identity-grid { grid-template-columns: repeat(3, 1fr); }
}

.identity-card {
  display: grid;
  gap: 0.55rem;
  justify-items: center;
  padding: 0.75rem 0.55rem 0.65rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform 100ms ease-out,
    background 180ms var(--spring),
    border-color 180ms var(--spring),
    box-shadow 180ms var(--spring);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.identity-card:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.14);
}

.identity-card:active {
  transform: scale(0.96);
  transition-duration: 80ms;
}

.identity-card.selected {
  border-color: var(--accent-2);
  background: color-mix(in srgb, var(--accent-2) 18%, rgba(255, 255, 255, 0.06));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent-2) 45%, transparent), 0 12px 32px rgba(0, 0, 0, 0.35);
}

.identity-card.rejected {
  border-color: var(--danger);
  animation: shake 0.42s ease;
}

.identity-card.trap:hover {
  border-color: color-mix(in srgb, var(--danger) 55%, transparent);
}

.identity-photo {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background: rgba(0, 0, 0, 0.25);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.identity-initial {
  display: grid;
  place-items: center;
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(145deg, color-mix(in srgb, var(--accent) 70%, #111), #0a0610);
}

.identity-name {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--muted);
}

.identity-card.selected .identity-name {
  color: var(--text);
}

.roast {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: rgba(255, 69, 58, 0.14);
  border: 1px solid rgba(255, 69, 58, 0.28);
  color: #ff6961;
  font-weight: 600;
  font-size: 0.92rem;
  animation: shake 0.42s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.app {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.page-stack {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.view.page {
  position: absolute;
  inset: 0;
  display: block;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(12px);
  transition:
    opacity 0.32s var(--spring),
    transform 0.32s var(--spring-snappy),
    visibility 0s linear 0.32s;
}

.view.page.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
  transition:
    opacity 0.32s var(--spring),
    transform 0.32s var(--spring-snappy),
    visibility 0s;
}

.page-scroll {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.5rem 1rem 4rem;
  width: min(1120px, 100%);
  margin: 0 auto;
}

main { width: 100%; margin: 0; padding: 0; min-height: 0; }
.view { display: block; animation: none; }
.view.active { display: block; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  background: rgba(0, 0, 0, 0.62);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.85rem 1rem 0.7rem;
  display: grid;
  gap: 0.75rem;
}
.view-head { margin-bottom: 1.25rem; }
.view-head.row { display: flex; align-items: end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.view-head h2 { font-family: var(--font-display); margin: 0 0 0.25rem; font-size: clamp(1.5rem, 3vw, 2rem); letter-spacing: -0.02em; }

.topbar-brand { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.topbar-right { display: flex; align-items: center; gap: 0.65rem; flex-wrap: wrap; justify-content: flex-end; }
.btn.tiny { padding: 0.45rem 0.75rem; font-size: 0.8rem; }
.whoami { color: var(--muted); font-size: 0.9rem; }

.tabs { display: flex; gap: 0.35rem; overflow-x: auto; padding-bottom: 0.15rem; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  border-radius: 999px;
  padding: 0.5rem 0.9rem;
  white-space: nowrap;
  background: transparent;
  font-size: 0.88rem;
  font-weight: 500;
  border: 1px solid transparent;
}
.tab.active {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.album-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.album-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
  background: var(--bg-elev);
  cursor: pointer;
  text-align: start;
  color: inherit;
  font: inherit;
  padding: 0;
  min-height: 220px;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.album-card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.album-card img,
.album-card .album-cover { width: 100%; height: 220px; object-fit: cover; display: block; filter: saturate(1.05); }
.album-card .video-cover {
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.12), transparent 55%),
    linear-gradient(145deg, #1a1030, #0a0610);
  position: relative;
}
.album-card .video-cover::after {
  content: "▶";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 2.5rem;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.album-card .meta { position: absolute; inset: auto 0 0 0; padding: 1.1rem 1rem 0.95rem; background: linear-gradient(transparent, rgba(0, 0, 0, 0.85)); }
.album-card h3 { margin: 0; font-size: 1.05rem; }
.album-card p { margin: 0.2rem 0 0; color: #d6d0e2; font-size: 0.85rem; }

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.7rem;
}

.photo-tile {
  position: relative;
  aspect-ratio: 1;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg-soft);
}

.photo-tile .open-photo {
  all: unset;
  display: block;
  width: 100%;
  height: 100%;
  cursor: zoom-in;
}

.photo-tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.35s ease; }
.photo-tile:hover img { transform: scale(1.06); }

.video-tile {
  display: grid !important;
  place-items: center;
  background: linear-gradient(135deg, var(--bg-soft), var(--bg-elev));
  cursor: pointer;
}

.video-play {
  font-size: 2rem;
  color: var(--accent);
  opacity: 0.9;
}

.video-label {
  position: absolute;
  bottom: 0.5rem;
  left: 0.5rem;
  right: 0.5rem;
  font-size: 0.7rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fav-btn {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 0;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
  display: grid;
  place-items: center;
  z-index: 2;
}

html[dir="rtl"] .fav-btn { right: auto; left: 0.45rem; }
.fav-btn.on { color: var(--accent); }

.fav-badge {
  position: absolute;
  bottom: 0.45rem;
  left: 0.45rem;
  z-index: 2;
  font-size: 0.72rem;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  color: var(--accent);
}

.back { margin-bottom: 1rem; }

.empty {
  margin-top: 2rem;
  padding: 2rem 1.25rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  text-align: center;
}

.empty.error-state { border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.empty-icon { font-size: 2.5rem; margin-bottom: 0.5rem; opacity: 0.7; }
.empty h3 { margin: 0 0 0.4rem; font-family: var(--font-display); }

.panel-form {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 1.1rem;
  margin-bottom: 1.25rem;
}

.feed { display: grid; gap: 0.75rem; }

.feed-item {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1rem 1.1rem;
}

.feed-item .meta { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; color: var(--muted); font-size: 0.82rem; margin-bottom: 0.45rem; }
.feed-item p { margin: 0; white-space: pre-wrap; }
.feed-item .note-target { color: var(--accent); font-size: 0.85rem; margin-bottom: 0.35rem !important; }
.feed-item .actions { margin-top: 0.75rem; }

.vote-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.85rem;
}

.stat-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.25rem 1rem;
  text-align: center;
  animation: rise 0.4s ease both;
}

.stat-value {
  display: block;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.1;
}

.stat-label { display: block; margin-top: 0.35rem; font-size: 0.82rem; color: var(--muted); }

.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.skeleton-grid.photos { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }

.skeleton-card, .skeleton-photo {
  border-radius: 18px;
  background: linear-gradient(90deg, var(--bg-soft) 25%, var(--bg-elev) 50%, var(--bg-soft) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s ease infinite;
}

.skeleton-card { height: 220px; }
.skeleton-photo { aspect-ratio: 1; }

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.lightbox {
  display: none;
}

/* ——— Full-screen media slider ——— */
body.slider-open {
  overflow: hidden;
  touch-action: none;
}

.media-slider {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-height: 100dvh;
  background: #000;
  color: var(--text);
  padding:
    max(0.5rem, env(safe-area-inset-top))
    max(0.25rem, env(safe-area-inset-right))
    max(0.75rem, env(safe-area-inset-bottom))
    max(0.25rem, env(safe-area-inset-left));
}

.slider-stage {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.slider-viewport {
  position: relative;
  flex: 1 1 0;
  height: 0;
  width: 100%;
  overflow: hidden;
  touch-action: pan-x pinch-zoom;
  user-select: none;
  -webkit-user-select: none;
  min-height: 180px;
}

.slider-top {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.35rem 0.5rem;
  z-index: 3;
}

.slider-counter {
  text-align: center;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.slider-spacer { width: 44px; }

.slider-btn {
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 50%;
  font-size: 1.5rem;
  line-height: 1;
}

.slider-track {
  display: flex;
  height: 100%;
  min-height: 100%;
  will-change: transform;
}

.slider-track.animating {
  transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}

.slider-slide {
  flex: 0 0 var(--slide-w, 100vw);
  width: var(--slide-w, 100vw);
  height: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
  box-sizing: border-box;
}

.slider-media {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.45);
  -webkit-user-drag: none;
}

.slider-slide video.slider-media {
  width: 100%;
  max-height: 100%;
  background: #111;
}

.slider-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 50%;
  font-size: 1.6rem;
  line-height: 1;
  z-index: 4;
  background: rgba(255, 255, 255, 0.1) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.slider-nav.prev { left: max(0.35rem, env(safe-area-inset-left)); }
.slider-nav.next { right: max(0.35rem, env(safe-area-inset-right)); }

html[dir="rtl"] .slider-nav.prev { left: auto; right: max(0.35rem, env(safe-area-inset-right)); }
html[dir="rtl"] .slider-nav.next { right: auto; left: max(0.35rem, env(safe-area-inset-left)); }

.slider-nav:disabled {
  opacity: 0.25;
  pointer-events: none;
}

.slider-dots {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.5rem 0.75rem;
  min-height: 28px;
}

.slider-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  background: rgba(255, 255, 255, 0.28);
  cursor: pointer;
  transition: transform 120ms ease, background 160ms ease;
}

.slider-dot.active {
  background: var(--accent-2);
  transform: scale(1.25);
}

.slider-bar {
  display: grid;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.55));
  z-index: 3;
}

.slider-meta {
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slider-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.slider-actions .btn {
  flex: 1;
  min-width: min(140px, 45%);
}

#sliderFav.on {
  background: color-mix(in srgb, var(--accent-2) 75%, #fff);
}

.fav-count { color: var(--accent); font-size: 0.85rem; }

@media (max-width: 640px) {
  .slider-nav { display: none; }
  .slider-actions .btn { min-width: 0; flex: 1 1 auto; }
}

@media (min-width: 641px) {
  .slider-viewport {
    margin: 0 3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .slider-track.animating { transition: none; }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  z-index: 50;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 0.75rem 1.1rem;
  border-radius: 999px;
  box-shadow: var(--shadow);
  animation: rise 0.25s ease both;
}

@media (max-width: 600px) {
  .choice-grid.two { grid-template-columns: 1fr; }
  .album-actions { width: 100%; }
  .album-actions .btn { flex: 1; }
  .nav-btn { width: 40px; height: 40px; font-size: 1.4rem; }
}

.upload-panel { margin-bottom: 1.25rem; }
.upload-panel.compact { margin-bottom: 1rem; padding: 1rem; background: var(--bg-elev); border: 1px solid var(--line); border-radius: 18px; }
.upload-create h3 { margin: 0 0 0.75rem; font-size: 1rem; font-weight: 600; }
.upload-row { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.upload-row input { flex: 1; min-width: 180px; }
.upload-hint { margin: 0 0 0.65rem; color: var(--muted); font-size: 0.88rem; }
.upload-dropzone {
  margin: 0.85rem 0;
  padding: 2rem 1rem;
  border: 2px dashed color-mix(in srgb, var(--accent) 45%, var(--line));
  border-radius: 18px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
  background: color-mix(in srgb, var(--bg-soft) 60%, transparent);
}
.upload-dropzone.small { padding: 1.1rem 0.85rem; }
.upload-dropzone:hover,
.upload-dropzone.dragover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.upload-dropzone p { margin: 0.35rem 0 0; }
.upload-icon { display: block; font-size: 1.8rem; line-height: 1; opacity: 0.85; }
.upload-types { color: var(--muted); font-size: 0.82rem; }
.upload-progress { margin-top: 0.85rem; }
.upload-progress-track { height: 8px; border-radius: 999px; background: var(--bg-soft); overflow: hidden; }
.upload-progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent-2), var(--accent)); transition: width 0.15s ease; }
#uploadProgressText { margin: 0.45rem 0 0; font-size: 0.85rem; color: var(--muted); }
.upload-status { margin: 0.65rem 0 0; font-size: 0.88rem; color: var(--muted); min-height: 1.2em; }
.upload-status.ok { color: var(--ok); }
.upload-status.error { color: var(--danger); }
.album-card .empty-cover {
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.08), transparent 55%),
    linear-gradient(145deg, color-mix(in srgb, var(--accent) 25%, #111), #0a0610);
  position: relative;
}
.album-card .empty-cover::after {
  content: "+";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 2.5rem;
  color: rgba(255, 255, 255, 0.5);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .gate-exit { opacity: 0; }
  .view.page { transform: none !important; }
}

@media (prefers-reduced-transparency: reduce) {
  .gate-shell,
  .topbar,
  .panel-form {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: #1c1c1e;
  }
}

@media (prefers-contrast: more) {
  .choice, .identity-card, .btn.ghost, .tab.active {
    border: 1px solid rgba(255, 255, 255, 0.35);
  }
}
