/* ==========================================================================
   狐神的画册 (Gallery) - Flickr/Instagram Level UI CSS (v3 Deep Polish)
   ========================================================================== */

/* 1. Theme Variables & Base Setup */
[hidden] {
  display: none !important;
}

:root, html {
  /* Light Theme Defaults */
  --bg-main: #f8fafc;
  --bg-navbar: rgba(255, 255, 255, 0.85);
  --bg-card: #ffffff;
  --bg-elevated: #f1f5f9;
  --bg-input: #f1f5f9;
  --bg-badge: #e2e8f0;
  --bg-backdrop: rgba(15, 23, 42, 0.58);
  
  --border-subtle: rgba(226, 232, 240, 0.85);
  --border-strong: #cbd5e1;
  --border-accent: rgba(249, 115, 22, 0.35);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;

  --accent-orange: #f97316;
  --accent-orange-hover: #ea580c;
  --accent-orange-light: rgba(249, 115, 22, 0.1);
  --accent-glow: rgba(249, 115, 22, 0.28);

  --status-success: #10b981;
  --status-success-bg: rgba(16, 185, 129, 0.12);
  --status-error: #f43f5e;
  --status-error-bg: rgba(244, 63, 94, 0.12);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 14px -2px rgba(0, 0, 0, 0.08), 0 2px 6px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 28px -4px rgba(0, 0, 0, 0.12), 0 4px 12px -2px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 24px 48px -8px rgba(0, 0, 0, 0.18);
  --shadow-drawer: -16px 0 48px rgba(0, 0, 0, 0.35), -4px 0 16px rgba(0, 0, 0, 0.15);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --font-sans: 'Plus Jakarta Sans', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'Fira Code', SFMono-Regular, Consolas, monospace;

  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 0.15s var(--ease-smooth);
  --transition-normal: 0.25s var(--ease-smooth);
}

/* Dark Theme Overrides */
:root.theme-dark, html.theme-dark, body.theme-dark {
  --bg-main: #0b0c10;
  --bg-navbar: rgba(17, 19, 24, 0.88);
  --bg-card: #15171e;
  --bg-elevated: #1e212b;
  --bg-input: #1a1c24;
  --bg-badge: #262936;
  --bg-backdrop: rgba(0, 0, 0, 0.78);

  --border-subtle: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.18);
  --border-accent: rgba(255, 158, 59, 0.4);

  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  --text-inverse: #0f172a;

  --accent-orange: #ff9e3b;
  --accent-orange-hover: #f97316;
  --accent-orange-light: rgba(255, 158, 59, 0.15);
  --accent-glow: rgba(255, 158, 59, 0.35);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.6);
  --shadow-xl: 0 24px 56px rgba(0, 0, 0, 0.75);
  --shadow-drawer: -20px 0 60px rgba(0, 0, 0, 0.65), -4px 0 20px rgba(0, 0, 0, 0.3);
}

/* Reset & Accessibility Setup */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: var(--bg-main);
  color: var(--text-primary);
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  transition: background-color var(--transition-normal), color var(--transition-normal);
  overflow-x: hidden;
}

/* Accessible Focus States */
:focus-visible {
  outline: 2px solid var(--accent-orange);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  user-select: none;
}

input {
  font-family: inherit;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* 2. Top Navigation Bar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--bg-navbar);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.navbar-container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  user-select: none;
  text-decoration: none;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-orange), #f43f5e);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px var(--accent-glow);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.brand:hover .brand-icon {
  transform: rotate(-8deg) scale(1.06);
  box-shadow: 0 6px 20px var(--accent-glow);
}

.brand-icon svg {
  width: 23px;
  height: 23px;
}

.brand-text {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-orange) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  background: var(--accent-orange-light);
  color: var(--accent-orange);
  letter-spacing: 0.04em;
  border: 1px solid var(--border-accent);
  display: flex;
  align-items: center;
  gap: 5px;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--status-success);
  box-shadow: 0 0 8px var(--status-success);
  animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.6; }
}

/* Nav Controls: Search & Filters */
.nav-controls {
  flex: 1;
  max-width: 620px;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.search-box {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: 0.55rem 2.2rem 0.55rem 2.5rem;
  font-size: 0.9rem;
  background-color: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  outline: none;
  transition: all var(--transition-fast);
}

.search-box input:focus {
  border-color: var(--accent-orange);
  box-shadow: 0 0 0 3px var(--accent-orange-light);
  background-color: var(--bg-card);
}

.btn-clear {
  position: absolute;
  right: 10px;
  padding: 4px;
  border-radius: 50%;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-clear:hover {
  color: var(--text-primary);
  background-color: var(--bg-badge);
}

.btn-clear svg {
  width: 14px;
  height: 14px;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background-color: var(--bg-input);
  padding: 3px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

.filter-pill {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.filter-pill:hover {
  color: var(--text-primary);
}

.filter-pill.active {
  background-color: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.pill-dot.success { background-color: var(--status-success); }
.pill-dot.error { background-color: var(--status-error); }

/* Nav Actions: Counter & Theme */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.stats-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.stats-badge svg {
  width: 16px;
  height: 16px;
  color: var(--accent-orange);
}

#image-count {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-primary);
  transition: transform 0.2s var(--ease-smooth);
}

.count-unit {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  transition: all var(--transition-fast);
}

.icon-btn:hover {
  color: var(--text-primary);
  background-color: var(--bg-badge);
  transform: translateY(-1px);
}

.theme-btn svg {
  width: 18px;
  height: 18px;
  transition: transform 0.4s var(--ease-spring);
}

.theme-btn:active svg {
  transform: rotate(180deg) scale(0.85);
}

html.theme-dark .sun-icon, body.theme-dark .sun-icon { display: block; }
html.theme-dark .moon-icon, body.theme-dark .moon-icon { display: none; }
html:not(.theme-dark) .sun-icon, body:not(.theme-dark) .sun-icon { display: none; }
html:not(.theme-dark) .moon-icon, body:not(.theme-dark) .moon-icon { display: block; }

/* Mobile Sub-Nav */
.mobile-subnav {
  display: none;
  padding: 0.75rem 1rem;
  background-color: var(--bg-navbar);
  border-bottom: 1px solid var(--border-subtle);
  flex-direction: column;
  gap: 0.75rem;
}

/* 3. Main Content Layout & Grid */
.main-content {
  max-width: 1600px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 70px);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.35rem;
  align-items: start;
}

@media (max-width: 640px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
  }
}

/* 4. Gallery Card Design (P3: Blur-Up Loading & Overlay Actions) */
.card {
  border-radius: var(--radius-lg);
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  position: relative;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform var(--ease-spring) 0.35s, box-shadow 0.35s ease, border-color 0.35s ease;
  animation: cardFadeIn 0.4s var(--ease-smooth) both;
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-6px) scale(1.015);
  box-shadow: var(--shadow-xl), 0 0 24px var(--accent-glow);
  border-color: var(--border-accent);
}

@keyframes cardFadeIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card-media-wrapper {
  position: relative;
  width: 100%;
  background-color: var(--bg-elevated);
  overflow: hidden;
  aspect-ratio: 4 / 3;
}

/* Blur-Up Image Transition */
.card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  filter: blur(12px);
  transform: scale(1.06);
  transition: opacity 0.45s ease, filter 0.45s ease, transform 0.5s var(--ease-smooth);
}

.card-img.loaded {
  opacity: 1;
  filter: blur(0px);
  transform: scale(1);
}

.card:hover .card-img {
  transform: scale(1.06);
}

/* Overlay & Quick Action Badges */
.card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(15, 23, 42, 0.9) 0%, rgba(15, 23, 42, 0.35) 50%, rgba(15, 23, 42, 0.15) 100%);
  opacity: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1rem;
  color: #ffffff;
  transition: opacity 0.3s ease;
}

.card:hover .card-overlay {
  opacity: 1;
}

.overlay-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.badge-status {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 4px;
}

.badge-status.done {
  background: rgba(16, 185, 129, 0.9);
  color: #ffffff;
}

.badge-status.error {
  background: rgba(244, 63, 94, 0.9);
  color: #ffffff;
}

.badge-time {
  font-size: 0.75rem;
  font-weight: 500;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

/* Centered Quick Actions on Card Hover */
.card-quick-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.3s var(--ease-spring);
}

.card:hover .card-quick-actions {
  opacity: 1;
  transform: translateY(0);
}

.quick-act-btn {
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all var(--transition-fast);
}

.quick-act-btn:hover {
  background: rgba(255, 255, 255, 0.95);
  color: #0f172a;
  transform: scale(1.05);
}

.quick-act-btn svg {
  width: 13px;
  height: 13px;
}

.overlay-bottom {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.card-prompt-preview {
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.card-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.85);
  margin-top: 0.1rem;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.badge-multi {
  background: var(--accent-orange);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

/* Card Bottom Info */
.card-info {
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.card-title-text {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-footer-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.tag-action {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background-color: var(--bg-elevated);
  color: var(--text-secondary);
}

/* 5. Skeleton Shimmer State */
.skeleton-card {
  pointer-events: none;
}

.skeleton-thumb {
  width: 100%;
  height: 220px;
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-badge) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.skeleton-thumb.tall { height: 280px; }
.skeleton-thumb.medium { height: 240px; }

.skeleton-info {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.skeleton-line {
  height: 12px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-badge) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.skeleton-line.short { width: 40%; }

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

/* 6. Hand-Crafted Brand Empty State (P1 Refined) */
.empty-state {
  max-width: 580px;
  margin: 3.5rem auto;
  text-align: center;
  width: 100%;
}

.empty-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow-xl), 0 0 30px var(--accent-glow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.empty-illustration-box {
  width: 180px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-fox-art {
  width: 100%;
  height: 100%;
}

.empty-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.empty-desc {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

.empty-samples {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.5rem;
  padding: 1rem;
  background-color: var(--bg-elevated);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.sample-hint {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: left;
}

.sample-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.sample-chip {
  font-size: 0.78rem;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: var(--radius-full);
  background-color: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  transition: all var(--transition-fast);
  text-align: left;
}

.sample-chip:hover {
  border-color: var(--accent-orange);
  color: var(--accent-orange);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.empty-actions {
  margin-top: 0.5rem;
}

.btn-primary {
  padding: 0.7rem 1.6rem;
  font-size: 0.92rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--accent-orange), var(--accent-orange-hover));
  color: #ffffff;
  box-shadow: 0 4px 16px var(--accent-glow);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition-fast);
}

.btn-primary:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 20px var(--accent-glow);
}

.btn-primary svg {
  width: 16px;
  height: 16px;
}

/* Footer Styling */
.app-footer {
  margin-top: auto;
  padding-top: 3rem;
  padding-bottom: 1rem;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
}

.footer-container {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.footer-text {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.footer-subtext {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* 7. Detail Slide-over Drawer */
.drawer-container {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  visibility: hidden;
  transition: visibility 0.35s ease;
}

.drawer-container.active {
  pointer-events: auto;
  visibility: visible;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background-color: var(--bg-backdrop);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.35s ease;
}

.drawer-container.active .drawer-backdrop {
  opacity: 1;
}

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 520px;
  max-width: 100vw;
  background-color: var(--bg-card);
  border-left: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-drawer);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.38s var(--ease-spring);
  z-index: 210;
}

.drawer-container.active .drawer-panel {
  transform: translateX(0);
}

/* Mobile Pull Handle */
.drawer-drag-handle {
  display: none;
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background-color: var(--border-strong);
  margin: 10px auto 2px;
}

.drawer-header {
  padding: 1.1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  background-color: var(--bg-card);
}

.drawer-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.status-tag {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  letter-spacing: 0.05em;
}

.status-tag.done {
  background-color: var(--status-success-bg);
  color: var(--status-success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-tag.error {
  background-color: var(--status-error-bg);
  color: var(--status-error);
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.id-tag {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.close-btn:hover {
  transform: rotate(90deg);
}

/* Drawer Body Content */
.drawer-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: relative;
}

.drawer-scroll-hint {
  display: none;
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  height: 32px;
  margin-top: -32px;
  background: linear-gradient(to top, var(--bg-card) 20%, transparent);
  pointer-events: none;
  z-index: 10;
}

/* Mobile Quick Action Toolbar */
.mobile-action-bar {
  display: none;
  gap: 0.6rem;
  margin-top: -0.5rem;
}

.mobile-action-btn {
  flex: 1;
  padding: 0.6rem;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  background-color: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.mobile-action-btn.primary {
  background-color: var(--accent-orange);
  color: #ffffff;
  border-color: var(--accent-orange);
}

.mobile-action-btn svg {
  width: 15px;
  height: 15px;
}

/* Hero Image Box */
.hero-image-box {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.hero-image-wrapper {
  position: relative;
  width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  max-height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-img {
  width: 100%;
  height: auto;
  max-height: 420px;
  object-fit: contain;
  display: block;
}

.hero-expand-btn {
  position: absolute;
  bottom: 12px;
  right: 12px;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(8px);
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all var(--transition-fast);
}

.hero-expand-btn:hover {
  background: rgba(15, 23, 42, 0.95);
  transform: scale(1.04);
}

.hero-expand-btn svg {
  width: 14px;
  height: 14px;
}

.thumbs-strip {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 4px;
}

.strip-thumb {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  cursor: pointer;
  border: 2px solid transparent;
  opacity: 0.6;
  transition: all var(--transition-fast);
}

.strip-thumb:hover { opacity: 0.9; }
.strip-thumb.active {
  border-color: var(--accent-orange);
  opacity: 1;
}

/* Sections & Typography */
.detail-section {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-icon {
  width: 16px;
  height: 16px;
  color: var(--accent-orange);
}

.copy-btn {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all var(--transition-fast);
}

.copy-btn:hover {
  color: var(--accent-orange);
  border-color: var(--border-accent);
}

.copy-btn.copied {
  color: var(--status-success) !important;
  background-color: var(--status-success-bg) !important;
  border-color: rgba(16, 185, 129, 0.4) !important;
}

.copy-btn svg {
  width: 12px;
  height: 12px;
}

.copy-btn.icon-only {
  padding: 4px;
}

.hidden-label {
  display: none;
}

.content-box {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Reference Image Box */
.ref-image-wrapper {
  position: relative;
  width: 120px;
  height: 120px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-elevated);
  cursor: pointer;
}

.ref-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ref-badge {
  position: absolute;
  bottom: 4px;
  left: 4px;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.7);
  color: #ffffff;
}

/* Fox Comment Section */
.fox-comment-section {
  position: relative;
}

.fox-title {
  color: var(--accent-orange);
}

.fox-icon {
  color: var(--accent-orange);
}

.fox-comment-box {
  position: relative;
  padding: 1rem 1.2rem;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-orange-light), transparent 85%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-accent);
}

.comment-quote {
  position: absolute;
  top: 4px;
  right: 12px;
  font-size: 2.5rem;
  font-family: serif;
  color: var(--accent-orange);
  opacity: 0.25;
  line-height: 1;
  pointer-events: none;
}

.comment-text {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.6;
  position: relative;
  z-index: 1;
}

/* Accordion Component */
.accordion-item {
  border-radius: var(--radius-md);
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}

.accordion-header {
  padding: 0.85rem 1rem;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
  user-select: none;
}

.accordion-header::-webkit-details-marker { display: none; }

.accordion-body {
  padding: 0 1rem 1rem;
}

.code-block {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-secondary);
  background-color: var(--bg-input);
  padding: 0.85rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  border: 1px solid var(--border-subtle);
}

/* Technical Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
}

.metric-card {
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.metric-label {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.metric-value {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.font-mono {
  font-family: var(--font-mono);
}

/* Footer Meta */
.meta-footer {
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-row strong {
  color: var(--text-secondary);
}

/* 8. Lightbox Modal */
.lightbox-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.lightbox-toolbar {
  position: relative;
  z-index: 310;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #ffffff;
}

.lightbox-title {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.85);
}

.lightbox-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.lightbox-actions .icon-btn {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
}

.lightbox-actions .icon-btn:hover {
  background: rgba(255, 255, 255, 0.28);
}

.lightbox-viewport {
  position: relative;
  z-index: 310;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 2rem 3rem;
}

.lightbox-viewport img {
  max-width: 95vw;
  max-height: 88vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.85);
  animation: lightboxZoomIn 0.3s var(--ease-spring);
}

@keyframes lightboxZoomIn {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}

/* 9. Toast Notification */
.toast-container {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  padding: 0.65rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  background: var(--text-primary);
  color: var(--text-inverse);
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s var(--ease-spring), toastOut 0.3s ease 2.2s forwards;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(-12px) scale(0.9); }
}

/* Responsive Adjustments for Mobile */
@media (max-width: 768px) {
  .navbar-container { padding: 0.75rem 1rem; }
  .nav-controls { display: none; }
  .mobile-subnav { display: flex; }

  .drawer-panel {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: 90vh;
    height: auto;
    border-radius: 20px 20px 0 0;
    border-left: none;
    border-top: 1px solid var(--border-subtle);
    transform: translateY(100%);
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
  }

  .drawer-container.active .drawer-panel {
    transform: translateY(0);
  }

  .drawer-drag-handle { display: block; }
  .drawer-scroll-hint { display: block; }
  .mobile-action-bar { display: flex; }
  .metrics-grid { grid-template-columns: 1fr; }
}

/* Reduced Motion Mode */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
