@import url('https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,400;0,500;0,600;0,700;0,800;1,400&display=swap');

/* ═══════════════════════════════════════════════════════════
   CSS VARIABLES & RESET
═══════════════════════════════════════════════════════════ */
:root {
  --bg:           #0b0804;
  --surface:      #111009;
  --surface-2:    #1a1812;
  --surface-3:    #24201a;
  --border:       rgba(255, 190, 80, 0.08);
  --accent:       #d97706;
  --accent-hover: #b45309;
  --accent-light: #fbbf24;
  --accent-glow:  rgba(217, 119, 6, 0.25);
  --text:         #f5ede0;
  --text-muted:   #a89070;
  --text-faint:   #5c4f3c;
  --green:        #4ade80;
  --red:          #f87171;
  --radius:       10px;
  --radius-lg:    16px;
  --nav-h:        60px;
  --max-w:        1200px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3 { line-height: 1.3; font-weight: 700; }
a { color: var(--accent-light); text-decoration: none; }
a:hover { color: var(--accent-light); text-decoration: underline; }
img { max-width: 100%; display: block; }
ul { list-style: none; }

/* ═══════════════════════════════════════════════════════════
   NAVBAR
═══════════════════════════════════════════════════════════ */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: rgba(11, 8, 4, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
}

.nav-logo {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.5px;
  text-decoration: none;
  white-space: nowrap;
  margin-right: auto;
}
.nav-logo span {
  background: linear-gradient(135deg, #fbbf24, #fb923c);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.nav-logo:hover { text-decoration: none; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
}

/* Dropdown */
.nav-dropdown { position: relative; }

.nav-dropdown-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.925rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: background 0.15s, color 0.15s;
}
.nav-dropdown-btn:hover,
.nav-dropdown:hover .nav-dropdown-btn,
.nav-dropdown.open .nav-dropdown-btn {
  background: var(--surface-2);
  color: var(--text);
}

.nav-dropdown-btn .caret {
  font-size: 0.6rem;
  transition: transform 0.2s;
  opacity: 0.6;
}
.nav-dropdown:hover .nav-dropdown-btn .caret,
.nav-dropdown.open .nav-dropdown-btn .caret { transform: rotate(180deg); }

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 210px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
  z-index: 200;
  padding: 0.4rem 0;
  /* 6px top padding bridges the visual gap without breaking hover */
  padding-top: 6px;
  margin-top: 0;
}
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown.open .nav-dropdown-menu { display: block; }

.nav-dropdown-menu a {
  display: block;
  padding: 0.5rem 1rem;
  color: var(--text-muted);
  font-size: 0.925rem;
  transition: background 0.1s, color 0.1s;
}
.nav-dropdown-menu a:hover {
  background: var(--surface-3);
  color: var(--text);
  text-decoration: none;
}
.nav-dropdown-menu .dropdown-section-header {
  display: block;
  padding: 0.6rem 1rem 0.3rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.2rem;
  cursor: default;
}
.nav-dropdown-menu .dropdown-view-all {
  font-weight: 700;
  color: var(--accent-light);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.6rem;
  margin-bottom: 0.2rem;
}
.nav-dropdown-menu .dropdown-view-all:hover { color: var(--text); }

/* Hamburger (mobile) */
.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 6px;
}
.nav-hamburger span {
  width: 22px;
  height: 2px;
  background: var(--text-muted);
  border-radius: 2px;
  transition: all 0.3s;
}

.nav-mobile-menu {
  display: none;
  position: fixed;
  top: var(--nav-h);
  left: 0;
  right: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1rem 1rem;
  z-index: 99;
  flex-direction: column;
  gap: 0.2rem;
  max-height: calc(100vh - var(--nav-h));
  overflow-y: auto;
}
.nav-mobile-menu.open { display: flex; }
.nav-mobile-section {
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.75rem 0 0.25rem;
  border-top: 1px solid var(--border);
  margin-top: 0.25rem;
}
.nav-mobile-section:first-child { border-top: none; margin-top: 0; }
.nav-mobile-menu a {
  color: var(--text-muted);
  padding: 0.35rem 0.5rem;
  font-size: 0.95rem;
  border-radius: var(--radius);
}
.nav-mobile-menu a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav-mobile-menu .mobile-view-all { font-weight: 700; color: var(--accent-light); }

@media (max-width: 640px) {
  .nav-links { display: none; }
  .nav-hamburger { display: flex; }
}

/* ═══════════════════════════════════════════════════════════
   PAGE WRAPPER
═══════════════════════════════════════════════════════════ */
.page {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ═══════════════════════════════════════════════════════════
   INDEX PAGE — USER PICKER
═══════════════════════════════════════════════════════════ */
.index-hero {
  text-align: center;
  padding: 4.5rem 0 3rem;
}
.index-hero h1 {
  font-size: clamp(1.85rem, 5vw, 2.85rem);
  color: var(--text);
  margin-bottom: 0.6rem;
}
.index-hero h1 span {
  background: linear-gradient(135deg, #fbbf24, #fb923c);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.index-hero p {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 420px;
  margin: 0 auto;
}

.user-cards {
  display: flex;
  gap: 2rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 2.5rem;
}

.user-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 290px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  text-decoration: none;
  color: inherit;
  display: block;
}
.user-card:hover {
  transform: translateY(-5px);
  border-color: var(--accent);
  box-shadow: 0 12px 40px var(--accent-glow);
  text-decoration: none;
}

.user-card-banner {
  height: 100px;
  background: linear-gradient(135deg, #92400e 0%, #d97706 55%, #c2410c 100%);
}
.user-card-body {
  padding: 0 1.25rem 1.25rem;
}
.user-card-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 3px solid var(--surface);
  background: var(--surface-2);
  margin-top: -36px;
  overflow: hidden;
}
.user-card-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-card-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-top: 0.5rem;
}
.user-card-handle {
  font-size: 0.85rem;
  color: var(--accent-light);
  margin-bottom: 0.5rem;
}
.user-card-bio {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.user-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
.user-card-count { font-size: 0.85rem; color: var(--text-faint); }
.user-card-count strong { color: var(--text-muted); }
.user-card-cta { font-size: 0.85rem; font-weight: 600; color: var(--accent-light); }

/* ═══════════════════════════════════════════════════════════
   USER PAGE — PROFILE + CHARACTER GRID
═══════════════════════════════════════════════════════════ */
.user-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 2rem;
}
.user-banner {
  height: 150px;
  background: linear-gradient(135deg, #92400e 0%, #d97706 55%, #c2410c 100%);
}
.user-header-body {
  padding: 0 1.75rem 1.5rem;
  display: flex;
  align-items: flex-end;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.user-avatar-wrap { margin-top: -48px; flex-shrink: 0; }
.user-avatar {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  border: 4px solid var(--surface);
  background: var(--surface-2);
  overflow: hidden;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-info { padding-top: 0.75rem; min-width: 0; }
.user-display-name { font-size: 1.55rem; font-weight: 800; color: var(--text); }
.user-handle { font-size: 0.9rem; color: var(--accent-light); margin-bottom: 0.35rem; }
.user-bio { color: var(--text-muted); font-size: 0.95rem; }

.user-content { display: flex; gap: 1.5rem; align-items: flex-start; }
.user-sidebar { width: 220px; flex-shrink: 0; }
.user-main { flex: 1; min-width: 0; }

.sidebar-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 1rem;
}
.sidebar-card-title {
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  padding: 0.6rem 1rem;
  font-size: 0.77rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
}
.sidebar-stat {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.925rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.sidebar-stat:last-child { border-bottom: none; }
.sidebar-stat-icon { color: var(--accent-light); font-size: 0.95rem; }
.sidebar-stat-value { font-weight: 700; color: var(--text); margin-left: auto; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.section-title { font-size: 1.05rem; font-weight: 700; color: var(--text); }
.section-badge {
  font-size: 0.83rem;
  color: var(--text-faint);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 0.15rem 0.6rem;
  border-radius: 100px;
}

.char-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 1rem;
}
.char-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-decoration: none;
  display: block;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  color: inherit;
}
.char-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 8px 32px var(--accent-glow);
  text-decoration: none;
}
.char-card-image { width: 100%; aspect-ratio: 1; background: var(--surface-2); overflow: hidden; }
.char-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}
.char-card:hover .char-card-image img { transform: scale(1.05); }
.char-card-info { padding: 0.65rem 0.8rem 0.75rem; }
.char-card-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.char-card-species {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 720px) {
  .user-content { flex-direction: column; }
  .user-sidebar { width: 100%; }
}

/* ═══════════════════════════════════════════════════════════
   CHARACTER PAGE
═══════════════════════════════════════════════════════════ */
.char-page-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.back-btn {
  color: var(--text-muted);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.back-btn:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }

.char-page-title { font-size: 1.75rem; font-weight: 800; color: var(--text); line-height: 1.2; }
.char-page-subtitle { font-size: 0.95rem; color: var(--text-muted); margin-top: 0.15rem; }

.char-layout { display: flex; gap: 1.5rem; align-items: flex-start; }
.char-sidebar { width: 270px; flex-shrink: 0; }
.char-main { flex: 1; min-width: 0; }

/* Stats card */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 1rem;
}
.stat-card-title {
  background: var(--surface-2);
  padding: 0.6rem 1rem;
  font-size: 0.77rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
  border-bottom: 1px solid var(--border);
  border-left: 3px solid var(--accent);
}
.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0.55rem 1rem;
  border-bottom: 1px solid var(--border);
  gap: 0.75rem;
}
.stat-row:last-child { border-bottom: none; }
.stat-label {
  font-size: 0.8rem;
  color: var(--text-faint);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
  padding-top: 0.1rem;
}
.stat-value { font-size: 0.925rem; color: var(--text); text-align: right; word-break: break-word; }

/* Colour palette */
.palette-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  padding: 0.85rem 1rem;
}
.palette-grid--wide {
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  padding: 1rem 1.25rem;
}
.palette-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  position: relative;
}
.swatch-color {
  width: 100%;
  height: 52px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: transform 0.15s, box-shadow 0.15s;
}
.palette-swatch:hover .swatch-color {
  transform: scale(1.06);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}
.swatch-name { font-size: 0.77rem; color: var(--text-muted); font-weight: 600; }
.swatch-hex {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  font-size: 0.77rem;
  font-family: monospace;
  font-weight: 700;
  white-space: nowrap;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.25rem 0.55rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s, transform 0.15s;
  text-shadow: 0 1px 4px rgba(0,0,0,0.7);
  z-index: 10;
}
.swatch-hex::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--surface-3);
}
.palette-swatch:hover .swatch-hex {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
/* Copied feedback */
.palette-swatch.copied .swatch-hex {
  opacity: 1;
  color: var(--green) !important;
}

/* Social media buttons */
.social-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.6rem 0.75rem;
}
.social-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.social-btn:hover {
  background: var(--surface-3);
  color: var(--accent-light);
  border-color: rgba(217, 119, 6, 0.35);
  text-decoration: none;
}
.social-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.social-icon-img {
  width: 16px;
  height: 16px;
  object-fit: contain;
  border-radius: 3px;
}

.tag-list { display: flex; flex-wrap: wrap; gap: 0.35rem; padding: 0.6rem 1rem; }
.tag {
  background: rgba(217, 119, 6, 0.12);
  color: var(--accent-light);
  font-size: 0.8rem;
  padding: 0.2rem 0.65rem;
  border-radius: 100px;
  border: 1px solid rgba(217, 119, 6, 0.25);
}

/* Main area */
.char-ref-image {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 1.25rem;
}
.char-ref-image img {
  width: 100%;
  max-height: 540px;
  object-fit: contain;
  background: var(--surface-2);
}

.content-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 1.25rem;
  overflow: hidden;
}
.content-card-header {
  background: var(--surface-2);
  padding: 0.65rem 1.25rem;
  font-weight: 700;
  font-size: 0.83rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.content-card-body {
  padding: 1.25rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.75;
}

/* Likes / Dislikes */
.likes-dislikes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}
.ld-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.ld-header {
  padding: 0.65rem 1rem;
  font-size: 0.83rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
}
.ld-header.likes   { background: rgba(74, 222, 128, 0.07); color: #4ade80; }
.ld-header.dislikes{ background: rgba(248, 113, 113, 0.07); color: #f87171; }
.ld-list { padding: 0.5rem 1rem; }
.ld-list li {
  font-size: 0.925rem;
  color: var(--text-muted);
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.ld-list li:last-child { border-bottom: none; }
.ld-list li::before { content: '·'; color: var(--text-faint); font-size: 1.25rem; line-height: 1; }

@media (max-width: 520px) {
  .likes-dislikes { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════
   GALLERY
═══════════════════════════════════════════════════════════ */
.gallery-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-2);
  padding: 0.65rem 1.25rem;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid var(--accent);
}
.gallery-title {
  font-weight: 700;
  font-size: 0.83rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* NSFW Toggle switch */
.nsfw-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-faint);
  cursor: pointer;
  user-select: none;
}
.toggle-input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-slider {
  width: 36px;
  height: 20px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 100px;
  position: relative;
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-faint);
  top: 2px;
  left: 2px;
  transition: transform 0.2s, background 0.2s;
}
.toggle-input:checked + .toggle-slider { background: var(--accent); border-color: var(--accent); }
.toggle-input:checked + .toggle-slider::before { transform: translateX(16px); background: #fff; }

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 0.75rem;
  padding: 1rem 1.25rem 1.25rem;
}
.gallery-item {
  background: var(--surface-2);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: border-color 0.15s;
  cursor: pointer;
}
.gallery-item:hover { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 4px 20px var(--accent-glow); }
.gallery-item .img-wrap {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--surface-3);
}
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}
.gallery-item:hover img { transform: scale(1.06); }
.gallery-item .caption {
  padding: 0.4rem 0.65rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* NSFW state */
.gallery-grid .gallery-item.nsfw { display: none; }
.gallery-grid.nsfw-on .gallery-item.nsfw { display: block; }
.gallery-grid.nsfw-on .gallery-item.nsfw .img-wrap::after {
  content: 'NSFW';
  position: absolute;
  top: 5px;
  right: 5px;
  background: rgba(248, 113, 113, 0.9);
  color: #fff;
  font-size: 0.67rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.04em;
}

@media (max-width: 900px) {
  .char-layout { flex-direction: column; }
  .char-sidebar { width: 100%; }
}

/* ═══════════════════════════════════════════════════════════
   LIGHTBOX
═══════════════════════════════════════════════════════════ */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  align-items: stretch;
  justify-content: stretch;
}
.lightbox.open { display: flex; }

.lightbox-inner {
  display: flex;
  align-items: stretch;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
.lightbox-inner img {
  display: block;
  flex: 1 1 0;
  min-width: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: transparent;
  transform-origin: center center;
  transition: transform 0.05s linear;
  will-change: transform;
  cursor: zoom-in;
  user-select: none;
  -webkit-user-drag: none;
}

.lightbox-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.lightbox-sidebar-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  border-left: 3px solid var(--accent);
}
.lightbox-caption {
  color: var(--text);
  font-size: 0.93rem;
  font-weight: 600;
  line-height: 1.4;
  flex: 1;
  min-width: 0;
}
.lightbox-close {
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 1.25rem;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
  transition: color 0.15s;
}
.lightbox-close:hover { color: var(--text); }

.lightbox-chars {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.85rem 1rem;
}
.lightbox-context {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}
.lightbox-context-user {
  font-size: 0.77rem;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.lightbox-context-user:hover { color: var(--text); text-decoration: none; }
.lightbox-context-char {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--accent-light);
  text-decoration: none;
  line-height: 1.2;
}
.lightbox-context-char:hover { color: var(--text); text-decoration: none; }
.lightbox-chars-label {
  font-size: 0.73rem;
  color: var(--text-faint);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 0.15rem;
}
.lightbox-char-tag {
  font-size: 0.87rem;
  color: var(--accent-light);
  background: rgba(217, 119, 6, 0.12);
  border: 1px solid rgba(217, 119, 6, 0.25);
  border-radius: var(--radius);
  padding: 0.3rem 0.7rem;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
  display: block;
}
a.lightbox-char-tag:hover {
  background: rgba(217, 119, 6, 0.25);
  border-color: rgba(217, 119, 6, 0.5);
  text-decoration: none;
}

@media (max-width: 600px) {
  .lightbox-inner { flex-direction: column; }
  .lightbox-sidebar { width: 100%; flex-shrink: 0; border-left: none; border-top: 1px solid var(--border); }
}

/* ═══════════════════════════════════════════════════════════
   LOADING / ERROR STATES
═══════════════════════════════════════════════════════════ */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5rem 1rem;
  color: var(--text-faint);
  gap: 1rem;
}
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error-state {
  text-align: center;
  padding: 5rem 1rem;
  color: var(--text-muted);
}
.error-state h2 { color: var(--red); margin-bottom: 0.55rem; font-size: 1.45rem; }
.error-state p { margin-top: 0.5rem; }

/* ═══════════════════════════════════════════════════════════
   FOOTER
═══════════════════════════════════════════════════════════ */
footer {
  margin-top: 4rem;
  border-top: 1px solid var(--border);
  padding: 1.5rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-faint);
}

/* ═══════════════════════════════════════════════════════════
   AUTH BUTTON & MODAL
═══════════════════════════════════════════════════════════ */
#nav-auth-slot { display: flex; align-items: center; }

.nav-auth-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.nav-auth-btn:hover {
  background: var(--surface-3);
  color: var(--text);
  border-color: var(--accent);
}

.nav-auth-signed {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(217, 119, 6, 0.12);
  border: 1px solid rgba(217, 119, 6, 0.3);
  border-radius: var(--radius);
  padding: 0.3rem 0.5rem 0.3rem 0.75rem;
}
.nav-auth-username {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-light);
}
.nav-auth-signout {
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0 0.1rem;
  line-height: 1;
  transition: color 0.15s;
}
.nav-auth-signout:hover { color: var(--red); }

/* Auth modal overlay */
.auth-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.auth-modal.open { display: flex; }

.auth-modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 380px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}
.auth-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.25rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}
.auth-modal-close {
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 1.25rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 0.2rem;
  transition: color 0.15s;
}
.auth-modal-close:hover { color: var(--text); }

.auth-modal-body { padding: 1.25rem; display: flex; flex-direction: column; gap: 0.9rem; }
.auth-modal-hint { font-size: 0.87rem; color: var(--text-faint); margin: 0; }

.auth-error {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: var(--red);
  font-size: 0.87rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
}

.auth-field { display: flex; flex-direction: column; gap: 0.3rem; }
.auth-field label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.auth-field input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.95rem;
  padding: 0.5rem 0.75rem;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}
.auth-field input:focus { border-color: var(--accent); }
.auth-field input::placeholder { color: var(--text-faint); }

.auth-submit-btn {
  background: linear-gradient(135deg, var(--accent), #c2410c);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 0.6rem 1rem;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  width: 100%;
  margin-top: 0.2rem;
}
.auth-submit-btn:hover:not(:disabled) { opacity: 0.88; transform: translateY(-1px); }
.auth-submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }
