/* ---------------------------------------------------------------
   Rythe's Junk — design tokens
  Ink-black ground, two electric-blue functional accents,
   a stamped slab-serif wordmark against clean sans-serif UI text.
----------------------------------------------------------------*/

@import url('https://fonts.googleapis.com/css2?family=Zilla+Slab:wght@500;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --ink: #0a0d12;
  --surface: #12161d;
  --surface-2: #1a2029;
  --surface-3: #232a35;
  --border: #262e3a;
  --paper: #eceef2;
  --fog: #8b93a1;
  --fog-dim: #5c6572;

  --ember: #00a8ff;
  --ember-dim: rgba(0, 168, 255, 0.16);
  --harbor: #39d5ff;
  --harbor-dim: rgba(57, 213, 255, 0.16);
  --danger: #c56a63;
  --danger-dim: rgba(197, 106, 99, 0.16);

  --radius-sm: 7px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-pill: 999px;

  --font-display: 'Zilla Slab', Georgia, serif;
  --font-body: 'Inter', -apple-system, 'Segoe UI', Roboto, sans-serif;

  --shadow-lift: 0 12px 32px rgba(0, 0, 0, 0.45);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-body);
  min-height: 100vh;
}

body {
  display: flex;
  flex-direction: column;
  background-image:
    radial-gradient(circle at 15% 0%, rgba(0, 168, 255, 0.08), transparent 45%),
    radial-gradient(circle at 100% 20%, rgba(57, 213, 255, 0.06), transparent 40%);
  background-attachment: fixed;
}

a { color: inherit; }

img, video { max-width: 100%; display: block; }

button, input, select {
  font-family: inherit;
  color: inherit;
}

::selection {
  background: var(--ember-dim);
  color: var(--paper);
}

:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---------------------------------------------------------------
   Nav
----------------------------------------------------------------*/

.site-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 28px;
  background: rgba(10, 13, 18, 0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: 0.2px;
  text-decoration: none;
  color: var(--paper);
  white-space: nowrap;
}

.brand .dot { color: var(--ember); }

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

.nav-links a {
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--fog);
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  transition: color 0.15s var(--ease), background 0.15s var(--ease);
}

.nav-links a:hover { color: var(--paper); background: var(--surface-2); }
.nav-links a.active { color: var(--ink); background: var(--ember); }

.nav-actions { display: flex; align-items: center; gap: 10px; }

/* ---------------------------------------------------------------
   Buttons
----------------------------------------------------------------*/

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--paper);
  font-size: 0.92rem;
  font-weight: 500;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s var(--ease), transform 0.1s var(--ease), background 0.15s var(--ease);
}

.btn:hover { border-color: var(--fog-dim); background: var(--surface-3); }
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--ember);
  border-color: var(--ember);
  color: #001525;
  font-weight: 600;
}

.btn-primary:hover { background: #33bbff; border-color: #33bbff; }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--fog);
}

.btn-ghost:hover { color: var(--paper); background: var(--surface-2); }

.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-dim); border-color: var(--danger); }

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------------------------------------------------------------
   Splash / home page
----------------------------------------------------------------*/

.hero {
  flex: 1;
  min-height: calc(100vh - 65px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px;
  position: relative;
}

.hero::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 640px;
  height: 640px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(0, 168, 255, 0.14), transparent 65%);
  pointer-events: none;
}

.hero-title {
  position: relative;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(3rem, 9vw, 6.5rem);
  line-height: 1;
  margin: 0 0 20px;
  letter-spacing: -1px;
}

.hero-title .dot { color: var(--ember); }

.hero-tagline {
  position: relative;
  max-width: 480px;
  color: var(--fog);
  font-size: 1.08rem;
  line-height: 1.6;
  margin: 0 0 36px;
}

.hero-subheader { position: relative; min-height: 1.5em; color: var(--ember); font-family: var(--font-display); font-size: 1.15rem; }

.site-footer { margin-top: auto; padding: 28px 24px 34px; text-align: center; border-top: 1px solid var(--border); background: rgba(18, 22, 29, .72); }
.footer-line, .footer-subline { margin: 0; }
.footer-line { color: var(--ember); font-family: var(--font-display); font-size: 1.3rem; }
.footer-subline { min-height: 1.4em; margin-top: 4px; color: var(--fog); font-size: .9rem; }
.legal-links, .page-footer { display: flex; justify-content: center; flex-wrap: wrap; gap: 14px; margin-top: 14px; font-size: .78rem; }
.legal-links a, .page-footer a { color: var(--fog-dim); text-decoration: none; }
.legal-links a:hover, .page-footer a:hover { color: var(--ember); }
.page-footer { padding: 24px 28px 36px; border-top: 1px solid var(--border); }
.legal-page { width: min(100% - 40px, 820px); margin: 0 auto; padding: 56px 0 80px; line-height: 1.7; }
.legal-page h1, .legal-page h2 { font-family: var(--font-display); line-height: 1.2; }
.legal-page h1 { font-size: clamp(2.4rem, 6vw, 4rem); }
.legal-page h2 { margin-top: 32px; color: var(--ember); }
.legal-page p { color: var(--fog); }
.legal-warning { padding: 18px 20px; color: var(--paper); background: var(--surface); border: 1px solid var(--ember); border-radius: var(--radius-md); }

.hero-actions { position: relative; display: flex; gap: 12px; }

.images-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); max-width: 1600px; margin: 0 auto; }
.tag-rail { padding: 28px 12px 60px 28px; border-right: 1px solid var(--border); }
.rail-heading { color: var(--fog); font-size: .75rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 12px; }
.popular-tags { display: grid; gap: 2px; }
.popular-tag { display: flex; align-items: center; gap: 3px; width: 100%; border-radius: var(--radius-sm); }
.popular-tag:hover { background: var(--surface-2); }
.popular-tag-name { flex: 1; padding: 8px 7px 8px 10px; color: var(--fog); background: transparent; border: 0; text-align: left; cursor: pointer; }
.popular-tag-name span { color: var(--fog-dim); font-size: .8rem; }
.popular-tag-action { width: 25px; height: 25px; padding: 0; color: var(--fog); background: transparent; border: 1px solid transparent; border-radius: 50%; cursor: pointer; font-size: 1rem; line-height: 1; }
.popular-tag-action:hover { color: var(--ember); border-color: var(--ember); }
.images-content { min-width: 0; }

/* ---------------------------------------------------------------
   Toolbar (search + sort) on the images page
----------------------------------------------------------------*/

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 24px 28px 8px;
  max-width: 1400px;
  margin: 0 auto;
}

.search-wrap {
  flex: 1 1 320px;
  position: relative;
}

.search-input-row { position: relative; display: flex; align-items: center; }
.search-token-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.search-token { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px 5px 10px; color: #001525; background: var(--ember); border-radius: var(--radius-pill); font-size: .8rem; font-weight: 600; }
.search-token.excluded { color: var(--paper); background: var(--danger); }
.search-token-count { opacity: .7; font-variant-numeric: tabular-nums; }
.search-token button { width: 18px; height: 18px; padding: 0; border: 0; border-radius: 50%; color: inherit; background: rgba(0, 0, 0, .14); cursor: pointer; line-height: 1; }
.search-clear { position: absolute; right: 9px; width: 28px; height: 28px; border: 0; border-radius: 50%; color: var(--fog); background: transparent; font-size: 1.35rem; cursor: pointer; }
.search-clear:hover { color: var(--paper); background: var(--surface-3); }
.search-clear:disabled { opacity: .35; cursor: default; pointer-events: none; }

.search-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 12px 48px 12px 18px;
  font-size: 0.95rem;
  color: var(--paper);
}

.search-input::placeholder { color: var(--fog-dim); }
.search-input:focus { border-color: var(--ember); }

.tag-suggest {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-lift);
  z-index: 30;
  max-height: 260px;
  overflow-y: auto;
  display: none;
}

.tag-suggest.open { display: block; }

.tag-suggest button {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--paper);
  padding: 10px 16px;
  font-size: 0.88rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.tag-suggest button:hover,
.tag-suggest button.hl { background: var(--surface-3); }

.tag-suggest .count { color: var(--fog-dim); font-variant-numeric: tabular-nums; }

.sort-select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 12px 18px;
  font-size: 0.9rem;
  color: var(--paper);
  cursor: pointer;
}

.result-meta {
  max-width: 1400px;
  margin: 0 auto;
  padding: 4px 28px 0;
  color: var(--fog-dim);
  font-size: 0.85rem;
}

/* ---------------------------------------------------------------
  Row gallery
----------------------------------------------------------------*/

.gallery {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 28px 80px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  align-items: start;
  gap: 16px;
}

@media (max-width: 760px) { .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .gallery { grid-template-columns: 1fr; } }

.card {
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  position: relative;
  transition: border-color 0.15s var(--ease), transform 0.15s var(--ease);
}

.card:hover { border-color: var(--fog-dim); transform: translateY(-2px); }

.card .media-wrap { position: relative; background: #000; }

.media-loading {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #000;
}

.media-loading img,
.media-loading video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity .18s ease;
}

.media-loading.loaded img,
.media-loading.loaded video { opacity: 1; }

.loading-spinner {
  position: absolute;
  z-index: 1;
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255, 255, 255, .24);
  border-top-color: var(--ember);
  border-radius: 50%;
  animation: media-spin .8s linear infinite;
}

.media-loading.loaded .loading-spinner { display: none; }

@keyframes media-spin { to { transform: rotate(360deg); } }

.card img, .card video { width: 100%; height: auto; }

.card .kind-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(10, 13, 18, 0.72);
  color: var(--paper);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  backdrop-filter: blur(4px);
}

.card .overlay {
  position: absolute;
  inset: auto 0 0 0;
  padding: 22px 12px 10px;
  background: linear-gradient(to top, rgba(10, 13, 18, 0.92), transparent);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  opacity: 1;
  transition: opacity 0.15s var(--ease);
}

.card:hover .overlay, .card:focus-visible .overlay { opacity: 1; }

.card .card-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.card .name {
  font-size: 0.82rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card .uploader {
  display: block;
  color: var(--fog);
  font-size: 0.7rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--ember);
  background: rgba(10, 13, 18, 0.72);
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  flex-shrink: 0;
}

.empty-state {
  max-width: 1400px;
  margin: 60px auto;
  padding: 0 28px;
  text-align: center;
  color: var(--fog);
}

.empty-state h2 {
  font-family: var(--font-display);
  color: var(--paper);
  font-weight: 700;
  font-size: 1.6rem;
  margin-bottom: 8px;
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 0 28px 70px;
}

.pagination span {
  align-self: center;
  color: var(--fog-dim);
  font-size: 0.85rem;
}

.auth-card { position: relative; width: min(100%, 430px); padding: 32px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lift); display: grid; gap: 14px; }
.auth-card h2 { margin: 0; font-family: var(--font-display); font-size: 1.8rem; }
.auth-card p { margin: 0; color: var(--fog); line-height: 1.5; }
.auth-card form { display: grid; gap: 10px; }
.auth-card .btn { justify-content: center; }
.auth-card .modal-close { top: 12px; right: 12px; }
.profile-card { max-width: 480px; }
.profile-current { font-size: .88rem; color: var(--ember) !important; }
.captcha-box { display: grid; gap: 8px; padding: 16px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-md); text-align: center; }
.captcha-label, .captcha-prompt { color: var(--fog-dim); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }
.captcha-question { color: var(--ember); font-size: 2rem; letter-spacing: .08em; }
.captcha-answer { text-align: center; font-size: 1.1rem; }
.field { width: 100%; padding: 11px 13px; color: var(--paper); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.field-hint { color: var(--fog-dim); font-size: .78rem; }
.field:focus { border-color: var(--ember); outline: none; }
.check-row { display: flex; gap: 9px; align-items: center; color: var(--fog); }
.auth-error { color: var(--danger) !important; min-height: 1.3em; }
.nav-user { color: var(--fog); font-size: .85rem; }
.user-page { max-width: 1000px; margin: 0 auto; padding: 40px 28px; }
.user-page h1 { font-family: var(--font-display); }
.user-search { display: flex; gap: 10px; margin: 20px 0; }
.user-search .field { flex: 1; }
.user-results { display: grid; gap: 8px; }
.user-result { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); text-decoration: none; }
.user-result:hover { border-color: var(--ember); }
.user-result small { display: block; color: var(--fog-dim); margin-top: 3px; }
.user-post-count { margin-left: 24px; color: var(--fog); white-space: nowrap; }
.user-posts { margin-top: 30px; }
.profile-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.profile-settings { max-width: 520px; margin: 16px 0; padding: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); }
.profile-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.profile-tab.active { color: var(--ink); background: var(--ember); border-color: var(--ember); }
.admin-page { max-width: 900px; margin: 0 auto; padding: 48px 28px; }
.admin-page h1 { font-family: var(--font-display); }
.admin-section { margin: 24px 0; padding: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); }
.admin-section h2 { margin-top: 0; font-family: var(--font-display); }
.admin-textarea { min-height: 100px; resize: vertical; }
.admin-number-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.admin-list { display: grid; gap: 8px; margin-top: 24px; }
.admin-user-results { max-height: 360px; overflow-y: auto; margin-top: 14px; padding: 8px; background: var(--ink); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.admin-user-results .admin-list { margin-top: 0; }
.admin-image-choice { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; color: var(--paper); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); text-align: left; cursor: pointer; }
.admin-image-choice:hover { border-color: var(--ember); }
.admin-image-choice small { color: var(--fog-dim); }
.admin-user { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.admin-user span { display: grid; gap: 3px; }
.admin-user small { color: var(--fog-dim); }

@media (max-width: 760px) {
  .images-layout { display: block; }
  .tag-rail { padding: 16px 20px 0; border-right: 0; }
  .popular-tags { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
  .popular-tag { width: auto; white-space: nowrap; background: var(--surface); border: 1px solid var(--border); }
  .site-nav { flex-wrap: wrap; padding: 12px 16px; gap: 10px; }
  .nav-links { order: 3; width: 100%; justify-content: center; flex-wrap: wrap; }
  .nav-actions { margin-left: auto; }
  .brand { font-size: 1.15rem; }
  .hero { padding: 28px 18px; }
  .hero-actions { flex-direction: column; width: min(100%, 260px); }
  .site-footer { padding-left: 18px; padding-right: 18px; }
  .legal-links, .page-footer { gap: 10px; }
  .toolbar { padding: 18px 16px 8px; }
  .search-wrap { flex-basis: 100%; }
  .sort-select { width: 100%; }
  .gallery { padding: 12px 16px 60px; }
  .user-page, .admin-page { padding-left: 16px; padding-right: 16px; }
  .profile-heading { flex-direction: column; align-items: flex-start; }
  .user-result, .admin-user { flex-direction: column; align-items: flex-start; }
  .user-result { width: 100%; }
  .admin-user .admin-actions { width: 100%; display: flex; gap: 8px; flex-wrap: wrap; }
  .admin-user .admin-actions .btn { flex: 1 1 140px; }
  .auth-card, .upload-card { padding: 20px 18px; }
  .modal-backdrop { padding: 12px; }
  .lightbox { max-height: 96vh; }
  .lightbox-panel { padding: 18px; }
  .panel-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-actions .btn { justify-content: center; }
  .comment-compose { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .site-nav { padding: 10px 12px; }
  .nav-links a { padding: 7px 10px; font-size: 0.85rem; }
  .brand { font-size: 1.05rem; }
  .hero-title { font-size: clamp(2.5rem, 17vw, 4rem); }
  .hero-tagline { font-size: 0.98rem; }
  .btn { padding: 9px 14px; font-size: 0.85rem; }
  .toolbar { padding-left: 12px; padding-right: 12px; }
  .gallery { grid-template-columns: 1fr; padding-left: 12px; padding-right: 12px; }
  .search-token { font-size: 0.74rem; }
  .user-page, .admin-page { padding-left: 12px; padding-right: 12px; }
  .admin-section { padding: 16px 14px; }
  .field, .search-input, .sort-select { font-size: 0.9rem; }
  .lightbox-media { min-height: 220px; }
  .lightbox-panel h2 { font-size: 1.1rem; }
}

/* ---------------------------------------------------------------
   Modal shell (shared by lightbox + upload)
----------------------------------------------------------------*/

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(6, 8, 11, 0.82);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
}

.modal-backdrop[hidden] { display: none; }

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(18, 22, 29, 0.9);
  color: var(--paper);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
}

.modal-close:hover { background: var(--surface-3); }

/* ---------------------------------------------------------------
   Lightbox
----------------------------------------------------------------*/

.lightbox {
  position: relative;
  width: 100%;
  max-width: 1200px;
  max-height: 92vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
}

@media (max-width: 860px) {
  .lightbox { grid-template-columns: 1fr; max-height: 94vh; overflow-y: auto; }
}

.lightbox-media {
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  max-height: 92vh;
  cursor: zoom-in;
}

.comments-list { display: grid; gap: 8px; max-height: 180px; overflow-y: auto; }
.comment { padding: 9px 10px; background: var(--surface-2); border-radius: var(--radius-sm); }
.comment strong { font-size: .82rem; }
.comment time { margin-left: 8px; color: var(--fog-dim); font-size: .72rem; }
.comment p { margin: 5px 0 0; color: var(--fog); font-size: .85rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-compose { display: grid; gap: 8px; margin-top: 10px; }

.lightbox-media img, .lightbox-media video {
  max-width: 100%;
  max-height: 92vh;
  width: auto;
  height: auto;
  object-fit: contain;
}

.lightbox-panel {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
  border-left: 1px solid var(--border);
}

@media (max-width: 860px) { .lightbox-panel { border-left: none; border-top: 1px solid var(--border); } }

.lightbox-panel h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  word-break: break-word;
}

.vote-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.vote-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  font-size: 1rem;
  color: var(--fog);
}

.vote-btn:hover { border-color: var(--fog-dim); }

.vote-btn.up.active { background: var(--ember-dim); border-color: var(--ember); color: var(--ember); }
.vote-btn.down.active { background: var(--harbor-dim); border-color: var(--harbor); color: var(--harbor); }

.vote-score {
  font-size: 1.05rem;
  font-weight: 700;
  min-width: 32px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }

.tag-chip {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--fog);
  font-size: 0.78rem;
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  text-decoration: none;
  cursor: pointer;
}

.tag-chip:hover { color: var(--ember); border-color: var(--ember); }

.panel-section { display: flex; flex-direction: column; gap: 8px; }

.panel-label {
  font-size: 0.72rem;
  color: var(--fog-dim);
  font-weight: 600;
}

.panel-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 8px; }

.field {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--paper);
  font-size: 0.88rem;
  width: 100%;
}

.field:focus { border-color: var(--ember); }

.meta-line { color: var(--fog-dim); font-size: 0.78rem; }

/* ---------------------------------------------------------------
   Custom context menu
----------------------------------------------------------------*/

.context-menu {
  position: fixed;
  z-index: 200;
  min-width: 210px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lift);
  padding: 6px;
  display: none;
}

.context-menu.open { display: block; }

.context-menu button {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--paper);
  font-size: 0.86rem;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
}

.context-menu button:hover { background: var(--surface-3); }
.context-menu button.danger { color: var(--danger); }
.context-menu hr { border: none; border-top: 1px solid var(--border); margin: 6px 0; }

/* ---------------------------------------------------------------
   Upload modal
----------------------------------------------------------------*/

.upload-card {
  width: 100%;
  max-width: 560px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.upload-card h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.4rem;
  margin: 0 0 18px;
}

.dropzone {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 32px 20px;
  text-align: center;
  color: var(--fog);
  cursor: pointer;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}

.dropzone.drag { border-color: var(--ember); background: var(--ember-dim); color: var(--paper); }
.dropzone strong { color: var(--paper); }

.upload-supported {
  margin: 10px 0 0;
  color: var(--fog);
  font-size: 0.78rem;
  line-height: 1.5;
}

.upload-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 14px;
  color: var(--paper);
  font-size: 0.84rem;
}

.upload-option input { margin-top: 3px; }
.upload-option span { color: var(--fog); font-size: 0.76rem; }
.upload-safe-badge {
  color: var(--harbor);
  font-size: 0.68rem;
  white-space: nowrap;
}

.file-list { display: flex; flex-direction: column; gap: 8px; margin: 16px 0; }

.upload-metadata-row { display: grid; gap: 7px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.upload-metadata-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.82rem; color: var(--fog); }

.post-description {
  margin: 14px 0 0;
  color: var(--paper);
  font-size: 0.88rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.post-description a { color: var(--harbor); }
.post-description code { color: var(--harbor); font-family: monospace; }

.file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.84rem;
}

.file-row .file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .file-size { color: var(--fog-dim); flex-shrink: 0; }
.file-row button { background: none; border: none; color: var(--fog); cursor: pointer; font-size: 1rem; }
.file-row button:hover { color: var(--danger); }

.field-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field-group label { font-size: 0.8rem; color: var(--fog); font-weight: 500; }

.progress-track {
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  overflow: hidden;
  margin: 6px 0 4px;
  display: none;
}

.progress-track.active { display: block; }

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--ember);
  transition: width 0.15s var(--ease);
}

.upload-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

/* ---------------------------------------------------------------
   Toast
----------------------------------------------------------------*/

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--paper);
  padding: 11px 20px;
  border-radius: var(--radius-pill);
  font-size: 0.86rem;
  box-shadow: var(--shadow-lift);
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s var(--ease), transform 0.18s var(--ease);
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
