/* Inter — self-hosted (latin + cyrillic) */
@font-face { font-family:'Inter'; font-style:normal; font-weight:400; font-display:swap;
  src: url('/fonts/inter-cyrillic-400.woff2') format('woff2'); unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family:'Inter'; font-style:normal; font-weight:400; font-display:swap;
  src: url('/fonts/inter-latin-400.woff2') format('woff2'); unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

@font-face { font-family:'Inter'; font-style:normal; font-weight:500; font-display:swap;
  src: url('/fonts/inter-cyrillic-500.woff2') format('woff2'); unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family:'Inter'; font-style:normal; font-weight:500; font-display:swap;
  src: url('/fonts/inter-latin-500.woff2') format('woff2'); unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

@font-face { font-family:'Inter'; font-style:normal; font-weight:600; font-display:swap;
  src: url('/fonts/inter-cyrillic-600.woff2') format('woff2'); unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family:'Inter'; font-style:normal; font-weight:600; font-display:swap;
  src: url('/fonts/inter-latin-600.woff2') format('woff2'); unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

@font-face { font-family:'Inter'; font-style:normal; font-weight:700; font-display:swap;
  src: url('/fonts/inter-cyrillic-700.woff2') format('woff2'); unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family:'Inter'; font-style:normal; font-weight:700; font-display:swap;
  src: url('/fonts/inter-latin-700.woff2') format('woff2'); unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

@font-face { font-family:'Inter'; font-style:normal; font-weight:800; font-display:swap;
  src: url('/fonts/inter-cyrillic-800.woff2') format('woff2'); unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family:'Inter'; font-style:normal; font-weight:800; font-display:swap;
  src: url('/fonts/inter-latin-800.woff2') format('woff2'); unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

/* ═══════════════════════════════════════════════════════════════
   TOKENS
═══════════════════════════════════════════════════════════════ */
:root {
  /* Surfaces */
  --bg-0:   #07070E;
  --bg-1:   #0C0C18;
  --bg-2:   #111122;
  --bg-fog: rgba(255,255,255,.028);

  /* Borders */
  --bd:     rgba(255,255,255,.072);
  --bd-mid: rgba(255,255,255,.13);
  --bd-hi:  rgba(255,255,255,.22);

  /* Text */
  --t-0: #F0EDF8;
  --t-1: #857FA8;
  --t-2: #4E4A68;

  /* Brand accent */
  --a:      #5F24F5;
  --a-hi:   #8854FE;
  --a-lo:   #4D12DD;
  --a-glow: rgba(95,36,245,.24);
  --a-soft: rgba(95,36,245,.08);

  /* Semantic */
  --ok:   #10B981;
  --err:  #EF4444;
  --warn: #F59E0B;

  /* Shadows */
  --sh-sm: 0 2px 10px rgba(0,0,0,.36);
  --sh:    0 6px 24px rgba(0,0,0,.48);
  --sh-lg: 0 20px 60px rgba(0,0,0,.62);

  /* Motion */
  --spring: cubic-bezier(.34,1.56,.64,1);
  --ease:   cubic-bezier(.16,1,.3,1);
}

/* ═══════════════════════════════════════════════════════════════
   RESET
═══════════════════════════════════════════════════════════════ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

::selection { background: var(--a); color: #F7F5FF; }

html { height: 100%; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  background: var(--bg-0);
  color: var(--t-0);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ═══════════════════════════════════════════════════════════════
   AMBIENT ORBS
═══════════════════════════════════════════════════════════════ */
.ambient {
  position: fixed; inset: 0; z-index: 0;
  pointer-events: none; overflow: hidden;
}
.orb {
  position: absolute; border-radius: 50%;
  filter: blur(130px); opacity: .10;
  animation: drift 26s ease-in-out infinite;
}
.orb-1 { width: 660px; height: 660px; background: #5F24F5; top: -200px; left: -130px; animation-delay: 0s; }
.orb-2 { width: 580px; height: 580px; background: #8854FE; bottom: -200px; right: -110px; animation-delay: -11s; }

@keyframes drift {
  0%,100% { transform: translate(0,0) scale(1); }
  38%     { transform: translate(44px,-65px) scale(1.08); }
  72%     { transform: translate(-32px,44px) scale(.93); }
}

/* ═══════════════════════════════════════════════════════════════
   THREE.JS CANVAS
═══════════════════════════════════════════════════════════════ */
#threejs-canvas {
  position: fixed; inset: 0; z-index: 0;
  pointer-events: none; overflow: hidden;
  width: 100vw; height: 100vh;
}
#threejs-canvas canvas {
  display: block; width: 100% !important; height: 100% !important;
}

/* ═══════════════════════════════════════════════════════════════
   AUTH — SPLIT LAYOUT
═══════════════════════════════════════════════════════════════ */
#auth-screen {
  position: relative; z-index: 1;
  min-height: 100vh; overflow: hidden;
}

.auth-layout {
  display: grid;
  grid-template-columns: 55fr 45fr;
  min-height: 100vh;
}

/* ── Hero (left) ────────────────────────────────────────────── */
.auth-hero {
  position: relative; z-index: 1;
  display: flex; align-items: flex-end;
  padding: 64px 60px;
  overflow: hidden;
}
.auth-hero::before {
  content: '';
  position: absolute; inset: 0; z-index: 0;
  background: linear-gradient(
    160deg,
    rgba(7,7,14,.5)   0%,
    rgba(95,36,245,.06) 55%,
    rgba(7,7,14,.72)  100%
  );
  pointer-events: none;
}
.auth-hero-inner {
  position: relative; z-index: 1;
}
.auth-hero-logo {
  display: block; margin-bottom: 60px;
  height: 42px; width: auto; object-fit: contain;
}
.auth-hero-title {
  font-size: clamp(28px, 3.6vw, 46px);
  font-weight: 800;
  letter-spacing: -1.8px;
  line-height: 1.10;
  margin-bottom: 22px;
  display: flex; flex-direction: column; gap: 2px;
}
.auth-hero-sub {
  font-size: 16px;
  color: rgba(240,237,248,.5);
  line-height: 1.7;
}

/* Reveal animation */
.reveal-line {
  display: block;
  opacity: 0;
  transform: translateY(20px);
  animation: revealUp .75s var(--ease) forwards;
}
.reveal-line.delay-1 { animation-delay: .12s; }
.reveal-line.delay-2 { animation-delay: .26s; }

@keyframes revealUp {
  to { opacity: 1; transform: translateY(0); }
}

/* ── Form panel (right) ─────────────────────────────────────── */
.auth-panel {
  display: flex; align-items: center; justify-content: center;
  padding: 48px 44px;
  background: var(--bg-1);
  border-left: 1px solid var(--bd);
}
.auth-form-wrap {
  width: 100%; max-width: 370px;
  animation: fadeSlideUp .6s var(--ease) .05s both;
}
.auth-form-head { margin-bottom: 32px; }
.auth-form-head h2 {
  font-size: 22px; font-weight: 700;
  letter-spacing: -.55px; margin-bottom: 6px;
}
.auth-form-head p { font-size: 14px; color: var(--t-1); }

/* ── Form fields ────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block; margin-bottom: 7px;
  font-size: 11.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .9px;
  color: var(--t-1);
}
.form-group input {
  width: 100%;
  padding: 12px 15px;
  background: var(--bg-fog);
  border: 1px solid var(--bd);
  border-radius: 10px;
  color: var(--t-0);
  font-family: inherit; font-size: 15px;
  outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.form-group input::placeholder { color: var(--t-2); }
.form-group input:focus {
  border-color: var(--a);
  background: rgba(95,36,245,.06);
  box-shadow: 0 0 0 3px rgba(95,36,245,.18);
}
.auth-error {
  margin-top: 14px; padding: 10px 14px;
  font-size: 13px; color: var(--err);
  background: rgba(239,68,68,.08);
  border: 1px solid rgba(239,68,68,.22);
  border-radius: 9px; text-align: center;
}

/* ═══════════════════════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 22px;
  border: none; border-radius: 9px;
  font-family: inherit; font-size: 14px; font-weight: 500;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform .22s var(--spring), box-shadow .22s ease,
              background .18s ease, border-color .18s ease, color .18s ease;
}
.btn-primary {
  background: linear-gradient(135deg, var(--a), var(--a-hi));
  color: #fff;
  box-shadow: 0 4px 18px var(--a-glow);
}
.btn-primary:hover   { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(95,36,245,.42); }
.btn-primary:active  { transform: translateY(0); }
.btn-primary:disabled {
  opacity: .42; cursor: not-allowed;
  transform: none; box-shadow: none;
}
.btn-ghost {
  background: transparent;
  color: var(--t-1);
  border: 1px solid var(--bd);
}
.btn-ghost:hover {
  border-color: var(--bd-mid); color: var(--t-0);
  background: var(--bg-fog); transform: translateY(-1px);
}
.btn-sm   { padding: 6px 14px; font-size: 13px; }
.btn-full {
  width: 100%; justify-content: center;
  padding: 13px; font-size: 15px;
  margin-top: 8px; border-radius: 11px;
}

/* ═══════════════════════════════════════════════════════════════
   HEADER
═══════════════════════════════════════════════════════════════ */
.header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 40px;
  background: rgba(7,7,14,.90);
  border-bottom: 1px solid var(--bd);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  position: sticky; top: 0; z-index: 100;
}
.header-logo img { height: 30px; width: auto; display: block; }
.header-right { display: flex; align-items: center; gap: 14px; }

.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 14px;
  background: var(--bg-fog); border: 1px solid var(--bd);
  border-radius: 10px; font-size: 13px;
}
.user-name { color: var(--t-0); font-weight: 500; }
.renders-badge {
  background: linear-gradient(135deg, var(--a), var(--a-hi));
  padding: 2px 9px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════════
   MAIN LAYOUT
═══════════════════════════════════════════════════════════════ */
#main-app { position: relative; z-index: 1; min-height: 100vh; }

.main {
  max-width: 1200px; margin: 0 auto;
  padding: 52px 40px;
}

/* ═══════════════════════════════════════════════════════════════
   UPLOAD
═══════════════════════════════════════════════════════════════ */
.section-upload { margin-bottom: 56px; }

.upload-zone {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  gap: 22px; padding: 44px 40px;
  border: 1.5px dashed var(--bd);
  border-radius: 20px;
  background: var(--bg-fog);
  cursor: pointer; overflow: hidden;
  transition: border-color .28s ease, background .28s ease,
              box-shadow .28s ease, transform .22s var(--spring);
}
.upload-zone::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 115%, rgba(95,36,245,.1) 0%, transparent 60%);
  opacity: 0; pointer-events: none;
  transition: opacity .3s ease;
}
.upload-zone:hover::after,
.upload-zone.dragover::after { opacity: 1; }
.upload-zone:hover,
.upload-zone.dragover {
  border-color: rgba(95,36,245,.42);
  background: rgba(95,36,245,.035);
  box-shadow: 0 0 0 1px rgba(95,36,245,.10), 0 10px 44px rgba(95,36,245,.07);
}
.upload-zone.dragover { transform: scale(1.01); }

.upload-icon {
  flex-shrink: 0; color: var(--t-2);
  transition: color .28s ease, transform .3s var(--spring);
}
.upload-zone:hover .upload-icon,
.upload-zone.dragover .upload-icon {
  color: var(--a-hi);
  transform: translateY(-4px) scale(1.08);
}
.upload-text {
  display: flex; flex-direction: column; gap: 5px;
}
.upload-title {
  font-size: 16px; font-weight: 600; letter-spacing: -.25px;
}
.upload-hint { font-size: 13.5px; color: var(--t-1); }

.upload-zone input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
}

/* ═══════════════════════════════════════════════════════════════
   PREVIEW
═══════════════════════════════════════════════════════════════ */
.section-preview {
  margin-bottom: 56px;
  animation: fadeSlideUp .4s var(--ease);
}
.section-preview.hidden { display: none; }

.preview-card {
  background: var(--bg-1); border: 1px solid var(--bd);
  border-radius: 22px; padding: 24px;
  box-shadow: var(--sh);
}
.preview-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 16px; margin-bottom: 18px;
}
.preview-pane {
  position: relative;
  border-radius: 14px; overflow: hidden;
  background: var(--bg-fog); border: 1px solid var(--bd);
  aspect-ratio: 4/3;
  display: flex; align-items: center; justify-content: center;
}
.preview-pane img {
  width: 100%; height: 100%; object-fit: contain;
}
.pane-label {
  position: absolute; top: 10px; left: 10px;
  padding: 3px 10px;
  background: rgba(0,0,0,.62); backdrop-filter: blur(10px);
  border-radius: 6px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .8px;
}
.pane-overlay {
  display: none;
  position: absolute; inset: 0;
  background: rgba(7,7,14,.88); backdrop-filter: blur(14px);
  flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; border-radius: 14px;
  font-size: 13.5px; color: var(--t-1);
}
.pane-overlay.active { display: flex; }
.pane-spinner {
  width: 36px; height: 36px;
  border: 2.5px solid var(--bd); border-top-color: var(--a);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.pane-placeholder {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  color: var(--t-2); font-size: 13px;
}
.pane-placeholder svg { opacity: .38; }

.preview-actions { display: flex; gap: 10px; align-items: center; }
.preview-actions .btn-primary { flex: 1; justify-content: center; }

/* ═══════════════════════════════════════════════════════════════
   GALLERY
═══════════════════════════════════════════════════════════════ */
.gallery-head {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 16px; margin-bottom: 24px;
}
.gallery-title {
  font-size: 18px; font-weight: 600; letter-spacing: -.35px;
}
.gallery-controls {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.ctrl-group { display: flex; gap: 4px; }
.ctrl-sep   { width: 1px; height: 22px; background: var(--bd); margin: 0 2px; align-self: center; }

.ctrl-btn {
  padding: 5px 13px;
  background: transparent; border: 1px solid var(--bd);
  border-radius: 8px; font-family: inherit; font-size: 12.5px; font-weight: 500;
  color: var(--t-1); cursor: pointer;
  transition: all .18s ease;
}
.ctrl-btn:hover { border-color: var(--bd-mid); color: var(--t-0); background: var(--bg-fog); }
.ctrl-btn.active {
  background: var(--a-soft); border-color: rgba(95,36,245,.32);
  color: var(--a-hi); font-weight: 600;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

/* ── Gallery card ───────────────────────────────────────────── */
.g-card {
  background: var(--bg-1); border: 1px solid var(--bd);
  border-radius: 16px; overflow: hidden; cursor: pointer;
  transition: transform .28s var(--spring), box-shadow .28s ease, border-color .28s ease;
}
.g-card:hover {
  transform: translateY(-5px);
  border-color: rgba(136,84,254,.24);
  box-shadow: var(--sh), 0 0 0 1px rgba(95,36,245,.08);
}

.g-thumb {
  position: relative;
  aspect-ratio: 16/10; overflow: hidden;
  background: var(--bg-fog);
}
.g-thumb img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .45s ease, opacity .35s ease;
  opacity: .25;
}
.g-thumb img.loaded { opacity: 1; }
.g-card:hover .g-thumb img { transform: scale(1.06); }

.g-thumb-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(7,7,14,.65) 0%, rgba(7,7,14,.25) 60%, transparent 100%);
  display: flex; align-items: center; justify-content: center; gap: 10px;
  opacity: 0; transition: opacity .22s ease;
}
.g-card:hover .g-thumb-overlay { opacity: 1; }

.g-overlay-btn {
  width: 38px; height: 38px;
  background: rgba(255,255,255,.12); backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 9px; color: white;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .15s, transform .18s var(--spring);
}
.g-overlay-btn:hover { background: rgba(255,255,255,.24); transform: scale(1.1); }

.g-info { padding: 13px 14px; }
.g-name {
  font-size: 13.5px; font-weight: 500; margin-bottom: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  letter-spacing: -.1px;
}
.g-meta {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: var(--t-2);
}

/* Status chips */
.chip {
  padding: 2px 8px; border-radius: 6px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .3px;
}
.chip-done       { background: rgba(16,185,129,.12); color: #34D399; }
.chip-processing { background: rgba(95,36,245,.12);  color: var(--a-hi); }
.chip-failed     { background: rgba(239,68,68,.12);  color: #FC8181; }
.chip-pending    { background: rgba(245,158,11,.1);  color: #FCD34D; }

/* ═══════════════════════════════════════════════════════════════
   EMPTY STATE
═══════════════════════════════════════════════════════════════ */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  gap: 12px; padding: 72px 20px;
  color: var(--t-2); text-align: center;
}
.empty-state svg { opacity: .3; }
.empty-state h3 { font-size: 17px; font-weight: 500; color: var(--t-1); }
.empty-state p  { font-size: 14px; }

/* ═══════════════════════════════════════════════════════════════
   LIGHTBOX
═══════════════════════════════════════════════════════════════ */
.lightbox {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: stretch;
}
.lightbox.hidden { display: none; }

.lb-backdrop {
  position: absolute; inset: 0;
  background: rgba(4,4,10,.93);
  backdrop-filter: blur(10px);
}

.lb-shell {
  position: relative; z-index: 1;
  display: flex; flex-direction: column;
  width: 100%; height: 100%;
  animation: lbIn .2s var(--ease);
}
@keyframes lbIn {
  from { opacity: 0; transform: scale(.975); }
  to   { opacity: 1; transform: scale(1); }
}

/* Topbar */
.lb-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 20px; flex-shrink: 0;
  background: rgba(7,7,14,.86);
  border-bottom: 1px solid var(--bd);
  backdrop-filter: blur(20px);
  gap: 16px;
}
.lb-filename {
  font-size: 13.5px; font-weight: 500; color: var(--t-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 320px; flex-shrink: 1;
}
.lb-actions {
  display: flex; align-items: center; gap: 5px; flex-shrink: 0;
}
.lb-sep { width: 1px; height: 22px; background: var(--bd); margin: 0 3px; }

.lb-mode-group { display: flex; gap: 3px; }
.lb-mode-btn {
  padding: 5px 11px;
  background: transparent; border: 1px solid var(--bd);
  border-radius: 7px; font-family: inherit; font-size: 12.5px; font-weight: 500;
  color: var(--t-1); cursor: pointer;
  transition: all .15s ease;
}
.lb-mode-btn:hover { border-color: var(--bd-mid); color: var(--t-0); }
.lb-mode-btn.active {
  background: var(--a-soft); border-color: rgba(95,36,245,.32); color: var(--a-hi);
}

.lb-icon-btn {
  width: 34px; height: 34px;
  background: transparent; border: 1px solid var(--bd);
  border-radius: 8px; color: var(--t-1);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 13px; font-family: inherit; font-weight: 500;
  transition: all .15s ease;
}
.lb-icon-btn:hover { border-color: var(--bd-mid); color: var(--t-0); background: var(--bg-fog); }
.lb-close-btn:hover { border-color: rgba(239,68,68,.38); color: var(--err); }

/* Body */
.lb-body {
  flex: 1; display: flex; align-items: center; justify-content: center;
  overflow: hidden; position: relative;
}

/* Single image */
.lb-img-wrap {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%;
  overflow: auto; cursor: default;
}
.lb-img-wrap img {
  max-width: 90vw; max-height: 86vh;
  object-fit: contain;
  user-select: none; pointer-events: none;
  transform-origin: center center;
  transition: transform .22s var(--ease);
}

/* Before / After slider */
.ba-container {
  position: relative;
  width: min(88vw, 900px);
  height: min(78vh, 700px);
  overflow: hidden; border-radius: 10px;
  user-select: none;
}
.ba-base {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: contain;
}
.ba-overlay-clip {
  position: absolute; inset: 0; overflow: hidden;
}
.ba-overlay-clip img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: contain;
}
.ba-divider {
  position: absolute; top: 0; bottom: 0;
  width: 2px; background: rgba(255,255,255,.75);
  cursor: ew-resize; z-index: 10;
  transform: translateX(-50%);
  transition: background .15s;
}
.ba-divider:hover { background: white; }
.ba-knob {
  position: absolute; top: 50%;
  transform: translate(-50%, -50%);
  width: 38px; height: 38px;
  background: white; border-radius: 50%;
  box-shadow: 0 2px 14px rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
  color: var(--bg-0); font-size: 14px; font-weight: 600;
  cursor: ew-resize; pointer-events: none;
}
.ba-label {
  position: absolute; bottom: 14px;
  padding: 3px 10px;
  background: rgba(0,0,0,.6); backdrop-filter: blur(8px);
  border-radius: 6px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .7px;
  pointer-events: none; color: rgba(255,255,255,.8);
}
.ba-label-before { left: 14px; }
.ba-label-after  { right: 14px; }

/* Loader */
.lb-loader {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%;
}
.lb-spinner {
  width: 38px; height: 38px;
  border: 2.5px solid var(--bd); border-top-color: var(--a);
  border-radius: 50%; animation: spin .8s linear infinite;
}

/* ═══════════════════════════════════════════════════════════════
   TOAST
═══════════════════════════════════════════════════════════════ */
.toast-container {
  position: fixed; top: 20px; right: 20px;
  z-index: 2000; display: flex; flex-direction: column; gap: 8px;
}
.toast {
  padding: 12px 18px;
  background: rgba(12,12,24,.95); border: 1px solid var(--bd);
  border-radius: 12px; font-size: 14px; line-height: 1.45;
  backdrop-filter: blur(20px); box-shadow: var(--sh);
  max-width: 360px;
  animation: toastSlide .3s var(--ease);
}
.toast.error   { border-color: rgba(239,68,68,.36); }
.toast.success { border-color: rgba(16,185,129,.36); }

@keyframes toastSlide {
  from { transform: translateX(110%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .auth-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .auth-hero {
    align-items: center; justify-content: center;
    text-align: center; padding: 52px 32px 36px;
    min-height: 42vh;
  }
  .auth-hero-inner { display: flex; flex-direction: column; align-items: center; }
  .auth-hero-logo  { margin-bottom: 36px; }
  .auth-hero-title { font-size: clamp(24px,6vw,34px); letter-spacing: -1.1px; }
  #threejs-canvas  { height: 42vh; }
  .auth-panel { border-left: none; border-top: 1px solid var(--bd); padding: 36px 28px 52px; }
}

@media (max-width: 768px) {
  .header { padding: 14px 20px; }
  .main   { padding: 28px 20px; }
  .upload-zone { flex-direction: column; text-align: center; padding: 44px 24px; gap: 16px; }
  .preview-grid { grid-template-columns: 1fr; }
  .gallery-head { flex-direction: column; align-items: flex-start; gap: 14px; }
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 10px; }
  .lb-topbar { padding: 10px 12px; gap: 6px; }
  .lb-filename { max-width: 100px; min-width: 0; flex: 1 1 0; }
  .lb-mode-btn { padding: 4px 8px; font-size: 12px; }
  .lb-actions  { gap: 4px; min-width: 0; flex-shrink: 1; overflow: hidden; }
  .lb-icon-btn { width: 32px; height: 32px; flex-shrink: 0; }
  .lb-close-btn { flex-shrink: 0; }
}

@media (max-width: 480px) {
  .gallery-grid { grid-template-columns: 1fr; }
  .gallery-controls { gap: 8px; }
  /* Тесный экран — прячем зум и разделители, оставляем режим/скачать/закрыть */
  .lb-topbar   { padding: 8px 10px; gap: 4px; }
  .lb-filename { display: none; }
  .lb-sep      { display: none; }
  #lb-zoom-in, #lb-zoom-out, #lb-zoom-reset { display: none; }
  .lb-icon-btn { width: 30px; height: 30px; border-radius: 7px; }
  .lb-mode-btn { padding: 4px 7px; font-size: 11.5px; }
  .ba-container { width: 100vw; max-width: 100%; height: min(70vh, 520px); border-radius: 0; box-sizing: border-box; }
  .lb-img-wrap img { max-width: 100vw; max-height: 78vh; }
}

/* ═══════════════════════════════════════════════════════════════
   SCROLLBAR
═══════════════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 7px; }
::-webkit-scrollbar-track { background: var(--bg-0); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.14); }

/* ═══════════════════════════════════════════════════════════════
   UTILS
═══════════════════════════════════════════════════════════════ */
.hidden { display: none !important; }
