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

:root {
  --bg:        #0d0f14;
  --bg2:       #13161e;
  --bg3:       #1a1d27;
  --border:    #252836;
  --border2:   #2f3347;
  --text:      #e8eaf0;
  --muted:     #6b7280;
  --muted2:    #4b5563;
  --accent:    #7c6aff;
  --accent2:   #5b4dd9;
  --success:   #22c55e;
  --danger:    #ef4444;
  --warning:   #f59e0b;
  --mono:      'JetBrains Mono', monospace;
  --sans:      'Space Grotesk', system-ui, sans-serif;
  --radius:    10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
}

html { font-size: 15px; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: 0.88em; }

/* ── Navbar ───────────────────────────────────────── */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 58px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13, 15, 20, 0.92);
  backdrop-filter: blur(12px);
}

.nav-logo {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.3px;
  text-decoration: none;
}
.nav-logo:hover { text-decoration: none; color: var(--accent); }

.nav-links { display: flex; align-items: center; gap: 6px; }

/* Hamburger toggle — hidden on desktop, shown on mobile */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 24px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  line-height: 1;
}
.nav-toggle:hover { background: var(--bg3); }

.nav-link {
  color: var(--muted);
  font-size: 14px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
}
.nav-link:hover { color: var(--text); background: var(--bg3); text-decoration: none; }
.nav-link--muted:hover { color: var(--danger); }

.nav-btn {
  color: var(--accent);
  font-size: 14px;
  padding: 5px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.nav-btn:hover { background: var(--accent); color: #fff; text-decoration: none; }

/* ── Landing ──────────────────────────────────────── */
.landing-body { overflow-x: hidden; }

#nodeCanvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.55;
}

.landing-main {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 2rem;
}

.landing-hero {
  text-align: center;
  padding: 7rem 0 5rem;
}

.hero-eyebrow {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent);
  margin-bottom: 1.25rem;
  font-weight: 500;
}

.hero-title {
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -1.5px;
  color: var(--text);
  margin-bottom: 1.25rem;
}

.hero-desc {
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 500px;
  margin: 0 auto 2.5rem;
  line-height: 1.7;
}

.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.btn-primary {
  padding: 11px 28px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, transform 0.1s;
  display: inline-block;
}
.btn-primary:hover { background: var(--accent2); text-decoration: none; transform: translateY(-1px); }

.btn-ghost {
  padding: 11px 24px;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  font-family: var(--sans);
  transition: border-color 0.15s, background 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-ghost:hover { border-color: var(--muted); background: var(--bg3); text-decoration: none; }

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  padding-bottom: 6rem;
}

.feature-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: border-color 0.15s;
}
.feature-card:hover { border-color: var(--border2); }

.feature-icon {
  width: 40px;
  height: 40px;
  background: var(--bg3);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.85rem;
  font-size: 20px;
  color: var(--accent);
}

.feature-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.feature-card p {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.6;
}

.feature-card code {
  background: var(--bg3);
  padding: 1px 5px;
  border-radius: 3px;
}

.landing-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 1.5rem;
  font-size: 13px;
  color: var(--muted2);
  border-top: 1px solid var(--border);
}

/* ── Auth ─────────────────────────────────────────── */
.auth-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.auth-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem 2rem 1.75rem;
}

.auth-logo { font-size: 18px; font-weight: 600; margin-bottom: 1.25rem; }
.auth-title { font-size: 20px; font-weight: 600; margin-bottom: 4px; letter-spacing: -0.3px; }
.auth-sub { font-size: 13.5px; color: var(--muted); margin-bottom: 1.5rem; line-height: 1.5; }
.auth-switch { font-size: 13px; color: var(--muted); margin-top: 1.25rem; text-align: center; }

.field { margin-bottom: 1rem; }
.field label { font-size: 12px; color: var(--muted); display: block; margin-bottom: 5px; font-weight: 500; }
.field-hint { font-size: 12px; color: var(--muted2); margin-top: 4px; display: block; }

.field input,
input[type="text"].slug-input {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.field input:focus, input[type="text"].slug-input:focus {
  border-color: var(--accent);
}

.btn-submit {
  width: 100%;
  padding: 10px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--sans);
  transition: background 0.15s;
  margin-top: 4px;
}
.btn-submit:hover { background: var(--accent2); }

.alert {
  padding: 9px 13px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 7px;
}
.alert-error   { background: rgba(239,68,68,0.12);  color: #f87171; border: 1px solid rgba(239,68,68,0.25); }
.alert-success { background: rgba(34,197,94,0.12);  color: #4ade80; border: 1px solid rgba(34,197,94,0.25); }

/* ── App layout ───────────────────────────────────── */
.app-body { min-height: 100vh; }

.app-layout {
  max-width: 860px;
  margin: 0 auto;
  padding: 2rem 1.5rem 5rem;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.page-title { font-size: 22px; font-weight: 600; letter-spacing: -0.4px; }
.page-sub   { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ── Stats ────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.stat-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 5px; }
.stat-value { font-size: 22px; font-weight: 600; letter-spacing: -0.5px; }

/* ── Upload ───────────────────────────────────────── */
.upload-section { margin-bottom: 1.25rem; }

.drop-zone {
  border: 2px dashed var(--border2);
  border-radius: var(--radius-lg);
  padding: 2.5rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  margin-bottom: 0;
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--accent);
  background: rgba(124,106,255,0.05);
}
.drop-icon  { font-size: 32px; color: var(--accent); margin-bottom: 10px; }
.drop-label { font-size: 15px; font-weight: 500; margin-bottom: 4px; }
.drop-sub   { font-size: 13px; color: var(--muted); }

.custom-slug-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  padding: 8px 14px;
}
.slug-prefix { font-size: 13px; color: var(--muted); white-space: nowrap; }
.slug-input  { flex: 1; background: transparent; border: none; outline: none; font-family: var(--mono); font-size: 13px; color: var(--text); padding: 0; }
.slug-input::placeholder { color: var(--muted2); }

.upload-progress { margin: 0.75rem 0; }
.progress-bar-wrap { height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; margin-bottom: 5px; }
.progress-bar { height: 100%; background: var(--accent); width: 0%; transition: width 0.2s; }
.progress-label { font-size: 12px; color: var(--muted); }

/* ── File list ────────────────────────────────────── */
.file-list { display: flex; flex-direction: column; gap: 5px; }

.file-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.1s;
}
.file-row:hover { border-color: var(--border2); }
.file-row--takendown { opacity: 0.55; }

.file-icon { font-size: 20px; color: var(--muted); flex-shrink: 0; }
.file-info { flex: 1; min-width: 0; }
.file-name { font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta { font-size: 12px; color: var(--muted); margin-top: 2px; font-family: var(--mono); }
.meta-user { color: var(--muted2); }

.file-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }

.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 17px;
  color: var(--muted);
  padding: 5px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  transition: background 0.1s, color 0.1s;
}
.icon-btn:hover { background: var(--bg3); color: var(--text); text-decoration: none; }

.copy-btn {
  font-size: 12px;
  padding: 4px 10px;
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  background: none;
  cursor: pointer;
  color: var(--muted);
  font-family: var(--sans);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.1s;
}
.copy-btn:hover { background: var(--bg3); color: var(--text); }
.copy-btn.copied { color: var(--accent); border-color: var(--accent); }

/* ── Badges ───────────────────────────────────────── */
.badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  vertical-align: middle;
  margin-left: 6px;
}
.badge-danger  { background: rgba(239,68,68,0.15);  color: #f87171; }
.badge-success { background: rgba(34,197,94,0.15);  color: #4ade80; }

/* ── Empty state ──────────────────────────────────── */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty-state i { font-size: 36px; margin-bottom: 10px; display: block; }

/* ── Admin tabs ───────────────────────────────────── */
.admin-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem; }
.admin-tab {
  padding: 9px 18px;
  font-size: 13px;
  cursor: pointer;
  color: var(--muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-family: var(--sans);
  transition: color 0.15s;
}
.admin-tab:hover { color: var(--text); }
.admin-tab.active { color: var(--text); border-bottom-color: var(--accent); }

.tab-search input {
  width: 100%;
  max-width: 360px;
  padding: 8px 12px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  outline: none;
  margin-bottom: 1rem;
}
.tab-search input:focus { border-color: var(--accent); }

.per-user-storage { margin-bottom: 1.25rem; }
.user-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.user-name { flex: 1; display: flex; align-items: center; gap: 6px; color: var(--text); }
.user-meta { color: var(--muted); }
.user-storage { font-family: var(--mono); font-size: 12px; color: var(--muted2); min-width: 70px; text-align: right; }

.invite-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(124,106,255,0.08);
  border: 1px solid rgba(124,106,255,0.3);
  border-radius: var(--radius);
  font-size: 13px;
}
.invite-result code {
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 1px;
  color: var(--accent);
  flex: 1;
}

/* ── Share page ───────────────────────────────────── */
.share-outer {
  max-width: 680px;
  margin: 0 auto;
  padding: 2rem 1.5rem 5rem;
}

.preview-wrap {
  margin-bottom: 1.25rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg2);
  border: 1px solid var(--border);
  text-align: center;
}
.preview-wrap--audio { padding: 2rem; }
.preview-image { max-width: 100%; max-height: 600px; display: block; margin: 0 auto; }
.preview-video { max-width: 100%; max-height: 500px; display: block; margin: 0 auto; background: #000; }

.share-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
}
.file-card-icon {
  width: 52px;
  height: 52px;
  background: var(--bg3);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  font-size: 26px;
  color: var(--accent);
}
.file-card-name { font-size: 17px; font-weight: 600; letter-spacing: -0.3px; word-break: break-all; margin-bottom: 4px; }
.file-card-meta { font-size: 13px; color: var(--muted); margin-bottom: 1.5rem; font-family: var(--mono); }

.dl-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--sans);
  text-decoration: none;
  transition: background 0.15s;
  margin-bottom: 1.25rem;
}
.dl-btn:hover { background: var(--accent2); text-decoration: none; }

.link-section { display: flex; flex-direction: column; gap: 8px; }
.link-row { display: flex; flex-direction: column; gap: 4px; }
.link-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); font-weight: 500; }
.link-hint  { font-size: 10px; color: var(--muted2); text-transform: none; letter-spacing: 0; }
.link-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
}
.link-val {
  flex: 1;
  font-family: var(--mono);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}
.copy-btn-sm {
  font-size: 11px;
  padding: 3px 8px;
  border: 1px solid var(--border2);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
  font-family: var(--sans);
  flex-shrink: 0;
  transition: all 0.1s;
}
.copy-btn-sm:hover { background: var(--bg2); color: var(--text); }

/* ── Error pages ──────────────────────────────────── */
.error-page {
  max-width: 480px;
  margin: 6rem auto 0;
  text-align: center;
  padding: 2rem;
}
.error-code  { font-size: 72px; font-weight: 600; letter-spacing: -3px; color: var(--border2); margin-bottom: 0.5rem; }
.error-icon  { font-size: 56px; color: var(--danger); margin-bottom: 0.75rem; }
.error-title { font-size: 22px; font-weight: 600; margin-bottom: 0.5rem; }
.error-desc  { font-size: 14px; color: var(--muted); }

/* ── Flash messages ───────────────────────────────── */
.flash {
  padding: 9px 13px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.flash-success { background: rgba(34,197,94,0.12); color: #4ade80; border: 1px solid rgba(34,197,94,0.2); }
.flash-error   { background: rgba(239,68,68,0.12); color: #f87171; border: 1px solid rgba(239,68,68,0.2); }

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 600px) {
  .stats-row { grid-template-columns: 1fr 1fr; }
  .app-layout { padding: 1.5rem 1rem 4rem; }
  .navbar { padding: 0 1rem; }
  .hero-title { letter-spacing: -1px; }
}

/* ── Mobile navigation (hamburger) ────────────────── */
@media (max-width: 760px) {
  .nav-toggle { display: inline-flex; align-items: center; }

  .nav-links {
    display: none;
    position: absolute;
    top: 58px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 6px;
    background: rgba(13, 15, 20, 0.98);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 12px 24px rgba(0,0,0,0.4);
  }
  .nav-links.open { display: flex; }

  .nav-links .nav-link,
  .nav-links .nav-btn {
    width: 100%;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    font-size: 15px;
    text-align: left;
    border: none;
  }
  .nav-links .nav-btn {
    color: var(--accent);
    margin-top: 4px;
  }
  .nav-links .nav-btn:hover { background: var(--bg3); color: var(--accent); }
}

/* ── Reaction images ──────────────────────────────── */
.reaction-upload-area { margin-bottom: 0.5rem; }

.paste-hint {
  font-size: 12px;
  color: var(--muted2);
  text-align: center;
  padding: 7px 0 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.paste-hint i { font-size: 14px; }
kbd {
  font-family: var(--mono);
  font-size: 11px;
  padding: 1px 5px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 3px;
  color: var(--muted);
}

.reaction-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.reaction-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.15s;
}
.reaction-card:hover { border-color: var(--border2); }

.reaction-preview {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--bg3);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.reaction-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}

.reaction-meta {
  padding: 8px 10px 4px;
}
.reaction-name {
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reaction-info {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--mono);
  margin-top: 2px;
}

.reaction-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px 8px;
}
.react-copy-btn {
  flex: 1;
  font-size: 11px;
  padding: 4px 6px;
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  background: none;
  cursor: pointer;
  color: var(--muted);
  font-family: var(--sans);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  transition: all 0.1s;
  white-space: nowrap;
}
.react-copy-btn:hover { background: var(--bg3); color: var(--text); }
.react-copy-btn.copied { color: var(--accent); border-color: var(--accent); }

/* ── Folders ──────────────────────────────────────── */
.folder-section {
  margin-bottom: 8px;
}
.folder-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 3px;
}
.folder-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 500;
  padding: 0;
}
.folder-chevron { transition: transform 0.15s; color: var(--muted); font-size: 15px; }
.folder-name { }
.folder-count { color: var(--muted); font-size: 12px; font-weight: 400; }
.folder-actions { display: flex; gap: 2px; }
.folder-contents { margin-bottom: 4px; }
.folder-contents .file-list { border-left: 2px solid var(--border2); padding-left: 8px; margin-left: 8px; }
.folder-empty { font-size: 12px; color: var(--muted2); padding: 10px 12px; font-style: italic; }

.section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted2);
  padding: 10px 2px 6px;
}

/* ── Drag handle & ghost ──────────────────────────── */
.drag-handle {
  color: var(--muted2);
  cursor: grab;
  padding: 0 4px;
  font-size: 16px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.drag-handle:active { cursor: grabbing; }
.sortable-ghost { opacity: 0.35; background: var(--bg3) !important; }

/* ── Image thumbnail ──────────────────────────────── */
.file-thumb {
  width: 36px;
  height: 36px;
  border-radius: 5px;
  overflow: hidden;
  flex-shrink: 0;
  cursor: pointer;
  background: var(--bg3);
  border: 1px solid var(--border2);
}
.file-thumb .thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.15s;
}
.file-thumb:hover .thumb-img { transform: scale(1.05); }

/* Expanded preview */
.file-row.preview-expanded {
  flex-wrap: wrap;
}
.file-row.preview-expanded .file-thumb {
  width: 100%;
  height: auto;
  max-height: 240px;
  border-radius: 8px;
  order: -1;
  margin-bottom: 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg3);
}
.file-row.preview-expanded .file-thumb .thumb-img {
  width: 100%;
  height: auto;
  max-height: 240px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

/* ── Folder picker popup ──────────────────────────── */
.folder-picker {
  position: absolute;
  z-index: 200;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 6px;
  min-width: 180px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.fp-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  padding: 4px 8px 6px;
}
.fp-opt {
  display: block;
  width: 100%;
  text-align: left;
  padding: 7px 10px;
  font-size: 13px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  font-family: var(--sans);
  transition: background 0.1s;
}
.fp-opt:hover { background: var(--bg3); }

/* ── Button size variant ──────────────────────────── */
.btn-sm {
  font-size: 12px;
  padding: 6px 12px;
}

/* ── Badge warning colour ─────────────────────────── */
.badge-warn { background: rgba(245,158,11,0.15); color: #fbbf24; }

/* ── Deep fryer ───────────────────────────────────── */
.deepfry-layout { max-width: 1000px; }

.deepfry-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 18px;
  align-items: start;
}

.fry-canvas-wrap {
  background: var(--bg2);
  border: 2px dashed var(--border2);
  border-radius: var(--radius-lg);
  min-height: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: border-color 0.15s, background 0.15s;
}
.fry-canvas-wrap.dragover { border-color: var(--accent); background: rgba(124,106,255,0.06); }

.fry-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 3rem 2rem;
  cursor: pointer;
  color: var(--muted);
  text-align: center;
}
.fry-placeholder i { font-size: 40px; color: var(--accent); }
.fry-placeholder p { font-size: 14px; }

#fryCanvas {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius);
}

.fry-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.fry-controls {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.control-group { margin-bottom: 18px; }
.control-group:last-child { margin-bottom: 0; }

.cg-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.cg-title i { font-size: 15px; color: var(--accent); }

.cg-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
}
.cg-toggle input { accent-color: var(--accent); width: 15px; height: 15px; }
.cg-toggle span { display: flex; align-items: center; gap: 6px; }

.slider-row {
  display: block;
  margin-bottom: 11px;
}
.slider-row > span {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--text);
  margin-bottom: 5px;
}
.slider-row em {
  font-style: normal;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
}
.slider-row input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}

.checkbox-row {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
}
.checkbox-row span { margin-bottom: 0; }
.checkbox-row input { accent-color: var(--accent); width: 15px; height: 15px; }

.emoji-controls {
  padding-top: 4px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

.reseed-btn { width: 100%; justify-content: center; margin-top: 4px; }

.fry-it-btn {
  width: 100%;
  justify-content: center;
  font-size: 15px;
  padding: 11px;
}

@media (max-width: 760px) {
  .deepfry-grid { grid-template-columns: 1fr; }
  .fry-controls { order: 2; }
}

/* ── Liquify ──────────────────────────────────────── */
.liquify-controls {
  padding-top: 4px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.liquify-hint {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}
.liquify-modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin-bottom: 12px;
}
.lq-mode {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 12px;
  padding: 7px 6px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: pointer;
  font-family: var(--sans);
  transition: all 0.12s;
}
.lq-mode:hover { color: var(--text); border-color: var(--muted); }
.lq-mode.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.lq-mode i { font-size: 14px; }

/* Brush cursor ring that follows the mouse over the canvas */
.lq-brush-ring {
  position: absolute;
  border: 1.5px solid rgba(124,106,255,0.9);
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.4), inset 0 0 0 1px rgba(255,255,255,0.3);
  z-index: 10;
}

/* canvasWrap needs relative positioning for the ring */
.fry-canvas-wrap { position: relative; }

/* ── URL shortener ────────────────────────────────── */
.link-create-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 1.5rem;
}
.link-create-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
  margin-top: 4px;
}
.link-create-row .custom-slug-row { margin: 0; }
.link-create-row .btn-primary { white-space: nowrap; }
.link-target {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 320px;
  display: inline-block;
  vertical-align: bottom;
  font-weight: 400;
}

/* ── Avatar cropper ───────────────────────────────── */
#avCanvas {
  border-radius: var(--radius);
  touch-action: none;
}

.size-presets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}
.size-preset {
  padding: 7px;
  font-size: 12px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: pointer;
  font-family: var(--mono);
  transition: all 0.12s;
}
.size-preset:hover { color: var(--text); border-color: var(--muted); }
.size-preset.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.av-previews {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  justify-content: center;
  padding: 8px 0 4px;
  /* checkerboard so transparency is visible */
  background-image:
    linear-gradient(45deg, var(--bg3) 25%, transparent 25%),
    linear-gradient(-45deg, var(--bg3) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--bg3) 75%),
    linear-gradient(-45deg, transparent 75%, var(--bg3) 75%);
  background-size: 12px 12px;
  background-position: 0 0, 0 6px, 6px -6px, -6px 0;
  border-radius: var(--radius);
}
.av-preview-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}
.av-preview-item canvas {
  border-radius: 50%;
  background: transparent;
}
.av-preview-item span {
  font-size: 10px;
  color: var(--muted);
  font-family: var(--mono);
}

/* Ensure empty folder lists remain valid drop targets for drag-and-drop */
.folder-contents .file-list { min-height: 38px; }
.sortable-ghost { opacity: 0.4; }

/* ── GIF studio ───────────────────────────────────── */
.gif-tabs { flex-wrap: wrap; }
.gif-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 18px;
  align-items: start;
}
.gif-main { min-width: 0; }
.gif-preview-img {
  max-width: 100%;
  max-height: 380px;
  border-radius: var(--radius);
  display: block;
  margin: 0 auto;
}
#previewArea { width: 100%; text-align: center; }

.gif-result {
  margin-top: 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
}
.gif-result-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  margin-bottom: 10px;
}
.gif-result-label span { color: var(--accent); font-family: var(--mono); text-transform: none; }

.gif-vinfo {
  font-size: 12px;
  color: var(--muted);
  font-family: var(--mono);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.crop-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}
.crop-fields label {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.crop-fields input {
  width: 100%;
  padding: 6px 8px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  outline: none;
}
.crop-fields input:focus { border-color: var(--accent); }

.crop-box {
  position: absolute;
  border: 2px solid var(--accent);
  background: rgba(124,106,255,0.18);
  pointer-events: none;
  z-index: 5;
}

/* Spinner animation for the processing button */
@keyframes spin { to { transform: rotate(360deg); } }
#processBtn .ti-loader-2 { display: inline-block; animation: spin 0.8s linear infinite; }

@media (max-width: 760px) {
  .gif-grid { grid-template-columns: 1fr; }
}

/* ── GIF crop aspect toggles ──────────────────────── */
.aspect-toggles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  margin: 10px 0;
}
.aspect-toggles .lq-mode {
  font-size: 11px;
  padding: 6px 4px;
}

/* Prevent native image dragging while cropping */
#previewArea img {
  -webkit-user-drag: none;
  user-select: none;
}
/* crosshair cursor only when crop tab is active (toggled via body class) */
body.gif-crop-mode #previewArea img { cursor: crosshair; }
