/* ============================================
   AI APPRAISER — Premium Design System
   ============================================ */

:root {
  /* Colors */
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #1a1a24;
  --bg-elevated: #22222e;
  --bg-glass: rgba(26, 26, 36, 0.85);
  --text-primary: #f5f5f7;
  --text-secondary: #a1a1b0;
  --text-tertiary: #6e6e7e;
  --accent: #6366f1;
  --accent-light: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.3);
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;
  --info: #60a5fa;

  /* Gradients */
  --gradient-accent: linear-gradient(135deg, #6366f1, #8b5cf6);
  --gradient-gold: linear-gradient(135deg, #f59e0b, #fbbf24);
  --gradient-silver: linear-gradient(135deg, #9ca3af, #d1d5db);

  /* Typography */
  --font-display: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', sans-serif;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 999px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-accent: 0 4px 20px var(--accent-glow);

  /* Transitions */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Layout */
  --nav-height: 76px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ============================================
   Reset & Base
   ============================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  height: 100%;
  overscroll-behavior: none;
}

body {
  font-family: var(--font-body);
  background:
    radial-gradient(ellipse at 15% -10%, rgba(99, 102, 241, 0.1), transparent 55%),
    radial-gradient(ellipse at 85% 115%, rgba(139, 92, 246, 0.08), transparent 55%),
    var(--bg-primary);
  color: var(--text-primary);
  height: 100%;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
  -webkit-user-select: none;
}

#app {
  height: 100%;
  position: relative;
  overflow: hidden;
}

/* ============================================
   Views
   ============================================ */

.view {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: opacity var(--transition-base), transform var(--transition-base), visibility var(--transition-base);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom));
  scrollbar-width: none;
}

.view::-webkit-scrollbar {
  display: none;
}

.view.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* ============================================
   Bottom Navigation
   ============================================ */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
  transition: transform var(--transition-base);
}

.bottom-nav.hidden {
  transform: translateY(100%);
}

.nav-item {
  background: none;
  border: none;
  color: var(--text-tertiary);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  cursor: pointer;
  transition: color var(--transition-fast), transform var(--transition-fast);
  position: relative;
}

.nav-item svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
  transition: transform var(--transition-spring);
}

.nav-item span {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.nav-item.active {
  color: var(--accent-light);
}

.nav-item.active svg {
  transform: scale(1.1);
  filter: drop-shadow(0 0 8px var(--accent-glow));
}

.nav-item.active::before {
  content: '';
  position: absolute;
  top: -8px;
  width: 24px;
  height: 3px;
  border-radius: var(--radius-full);
  background: var(--gradient-accent);
  box-shadow: var(--shadow-accent);
  animation: navPulse 2s ease-in-out infinite;
}

@keyframes navPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.nav-item:active {
  transform: scale(0.92);
}

/* ============================================
   Headers
   ============================================ */

.view-header {
  padding: calc(var(--safe-top) + 20px) var(--space-lg) var(--space-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(to bottom, var(--bg-primary) 60%, transparent);
}

.view-header h1 {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #fff, #a1a1b0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-actions {
  display: flex;
  gap: var(--space-sm);
}

/* ============================================
   Buttons
   ============================================ */

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.btn-icon svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.btn-icon:active {
  transform: scale(0.9);
  background: var(--bg-elevated);
}

.btn-primary {
  background: var(--gradient-accent);
  color: white;
  border: none;
  padding: 14px 32px;
  border-radius: var(--radius-full);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-accent);
  letter-spacing: 0.01em;
}

.btn-primary:active {
  transform: scale(0.96);
  box-shadow: none;
}

.btn-primary.btn-block {
  width: 100%;
  border-radius: var(--radius-md);
}

.btn-text {
  background: none;
  border: none;
  color: var(--accent-light);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 12px;
  font-family: var(--font-body);
}

.btn-danger {
  background: rgba(248, 113, 113, 0.1);
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.3);
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-body);
  margin-top: var(--space-md);
}

.btn-danger:active {
  background: rgba(248, 113, 113, 0.2);
  transform: scale(0.97);
}

/* ============================================
   Camera / Scan View
   ============================================ */

#view-scan {
  padding-bottom: 0;
  background: #000;
}

#camera-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: calc(var(--nav-height) + var(--safe-bottom));
  overflow: hidden;
  background: #000;
}

#camera-feed {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#camera-canvas {
  display: none;
}

#camera-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.scan-frame {
  width: 280px;
  height: 280px;
  position: relative;
  border-radius: var(--radius-lg);
  background: radial-gradient(circle at center, rgba(99, 102, 241, 0.06), transparent 70%);
  box-shadow: 0 0 60px rgba(99, 102, 241, 0.08), inset 0 0 40px rgba(99, 102, 241, 0.04);
  animation: frameGlow 3s ease-in-out infinite;
}

@keyframes frameGlow {
  0%, 100% { box-shadow: 0 0 40px rgba(99, 102, 241, 0.06), inset 0 0 30px rgba(99, 102, 241, 0.03); }
  50% { box-shadow: 0 0 70px rgba(139, 92, 246, 0.14), inset 0 0 45px rgba(139, 92, 246, 0.07); }
}

.scan-line {
  position: absolute;
  left: 12px;
  right: 12px;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(129, 140, 248, 0.9), transparent);
  box-shadow: 0 0 12px rgba(129, 140, 248, 0.8);
  border-radius: var(--radius-full);
  animation: scanMove 2.5s ease-in-out infinite;
}

@keyframes scanMove {
  0% { top: 10px; opacity: 0; }
  15% { opacity: 1; }
  85% { opacity: 1; }
  100% { top: calc(100% - 12px); opacity: 0; }
}

.scan-corner {
  position: absolute;
  width: 40px;
  height: 40px;
  border: 3px solid rgba(129, 140, 248, 0.95);
  border-radius: 4px;
  filter: drop-shadow(0 0 6px rgba(99, 102, 241, 0.6));
}

.scan-corner.tl { top: 0; left: 0; border-right: none; border-bottom: none; border-top-left-radius: 16px; }
.scan-corner.tr { top: 0; right: 0; border-left: none; border-bottom: none; border-top-right-radius: 16px; }
.scan-corner.bl { bottom: 0; left: 0; border-right: none; border-top: none; border-bottom-left-radius: 16px; }
.scan-corner.br { bottom: 0; right: 0; border-left: none; border-top: none; border-bottom-right-radius: 16px; }

.scan-hint {
  margin-top: var(--space-lg);
  color: rgba(255, 255, 255, 0.9);
  font-size: 15px;
  font-weight: 500;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  letter-spacing: 0.02em;
  animation: hintPulse 2s ease-in-out infinite;
}

@keyframes hintPulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

.camera-controls {
  position: absolute;
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 20px);
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
}

.shutter-btn {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.15);
  border: 3px solid rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 0 24px rgba(99, 102, 241, 0.35), 0 4px 16px rgba(0, 0, 0, 0.4);
}

.shutter-inner {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: white;
  transition: all var(--transition-fast);
}

.shutter-btn:active {
  transform: scale(0.92);
}

.shutter-btn:active .shutter-inner {
  transform: scale(0.85);
}

/* Captured Preview */
#preview-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: calc(var(--nav-height) + var(--safe-bottom));
  background: rgba(10, 10, 15, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
  animation: fadeIn var(--transition-base);
}

#preview-overlay .hidden {
  display: none !important;
}

#captured-preview {
  width: auto;
  max-width: 90vw;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  box-shadow: var(--shadow-lg);
  animation: scaleIn var(--transition-spring);
  pointer-events: auto;
}

#captured-img {
  display: none;
}

.preview-info {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.preview-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.preview-thumbs {
  display: flex;
  gap: var(--space-xs);
}

.preview-thumbs img {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.preview-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-md);
}

.preview-actions .btn-primary {
  padding: 12px 28px;
  font-size: 15px;
}


/* Analysis Overlay */
#analysis-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 10, 15, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  animation: fadeIn var(--transition-base);
}

.analysis-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  text-align: center;
  padding: var(--space-xl);
}

.spinner-ring {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent-light);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.analysis-status {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.analysis-sub {
  font-size: 14px;
  color: var(--text-secondary);
}

.analysis-progress {
  width: 100%;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  margin-top: var(--space-md);
}

.analysis-progress-track {
  width: 100%;
  height: 6px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.analysis-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: var(--radius-full);
  background: var(--gradient-accent);
  box-shadow: 0 0 12px rgba(129, 140, 248, 0.6);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: progressShimmer 1.8s ease-in-out infinite;
}

@keyframes progressShimmer {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

.analysis-progress-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-secondary);
}

#analysis-progress-pct {
  font-weight: 700;
  color: var(--accent-light);
}

/* Image Request */
#image-request {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 10, 15, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  animation: fadeIn var(--transition-base);
}

.request-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  max-width: 340px;
  width: 90%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: scaleIn var(--transition-spring);
}

.request-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  background: var(--gradient-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-md);
  box-shadow: var(--shadow-accent);
}

.request-icon svg {
  width: 32px;
  height: 32px;
  fill: white;
}

.request-card h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

.request-card p {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.5;
  margin-bottom: var(--space-md);
}

.request-thumbs {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
}

.request-thumbs img {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.1);
}

/* ============================================
   Collection Grid
   ============================================ */

.collection-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
}

.collection-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  animation: cardIn var(--transition-spring);
  animation-fill-mode: both;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.collection-card:active {
  transform: scale(0.97);
}

.card-image {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--bg-elevated);
}

.card-body {
  padding: var(--space-md);
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: var(--space-xs);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-category {
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-sm);
}

.card-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent-light);
  margin-bottom: var(--space-sm);
}

.card-meta {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
}

.rarity-dot, .condition-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
}

.rarity-dot.legendary { background: var(--gradient-gold); box-shadow: 0 0 8px rgba(251, 191, 36, 0.5); }
.rarity-dot.rare { background: #a855f7; box-shadow: 0 0 8px rgba(168, 85, 247, 0.5); }
.rarity-dot.uncommon { background: #3b82f6; box-shadow: 0 0 8px rgba(59, 130, 246, 0.5); }
.rarity-dot.common { background: #6b7280; }

.condition-dot.mint { background: var(--success); }
.condition-dot.excellent { background: #4ade80; }
.condition-dot.very-good { background: #a3e635; }
.condition-dot.good { background: var(--warning); }
.condition-dot.fair { background: #fb923c; }
.condition-dot.poor { background: var(--danger); }

.card-date {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-left: auto;
}

/* ============================================
   Empty State
   ============================================ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-xl);
  min-height: 60vh;
  gap: var(--space-md);
}

.empty-icon {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-sm);
}

.empty-icon svg {
  width: 40px;
  height: 40px;
  fill: var(--text-tertiary);
}

.empty-state h3 {
  font-size: 20px;
  font-weight: 700;
}

.empty-state p {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
  max-width: 280px;
}

/* ============================================
   Search Bar
   ============================================ */

.search-bar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  animation: slideDown var(--transition-base);
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.search-bar input {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  padding: 12px 20px;
  color: var(--text-primary);
  font-size: 15px;
  font-family: var(--font-body);
  outline: none;
  transition: border-color var(--transition-fast);
}

.search-bar input:focus {
  border-color: var(--accent);
}

.search-bar input::placeholder {
  color: var(--text-tertiary);
}

/* ============================================
   Detail View
   ============================================ */

.detail-view {
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom));
  background: var(--bg-primary);
}

.detail-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: calc(var(--safe-top) + 12px) var(--space-md) var(--space-sm);
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.detail-header h2 {
  font-size: 18px;
  font-weight: 600;
}

.detail-actions {
  display: flex;
  gap: var(--space-sm);
}

.detail-hero {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
}

.detail-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-hero-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-xl);
  background: linear-gradient(to top, rgba(10, 10, 15, 0.9), transparent);
}

.detail-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-xs);
}

.detail-category {
  font-size: 13px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.detail-content {
  padding: var(--space-lg);
}

.detail-section {
  margin-bottom: var(--space-xl);
}

.detail-section h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: var(--space-md);
  color: var(--text-primary);
}

/* Value Card */
.value-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  border: 1px solid rgba(255, 255, 255, 0.04);
  position: relative;
  overflow: hidden;
}

.value-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-accent);
}

.value-main {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #fff, var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--space-xs);
}

.value-range {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: var(--space-md);
}

/* Confidence Bars */
.confidence-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
}

.confidence-item {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.confidence-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
  display: flex;
  justify-content: space-between;
}

.confidence-value {
  font-weight: 700;
  color: var(--text-primary);
}

.confidence-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.confidence-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--gradient-accent);
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.confidence-fill.low { background: var(--danger); }
.confidence-fill.medium { background: var(--warning); }
.confidence-fill.high { background: var(--success); }

/* Score Grid */
.score-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
}

.score-item {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.score-value {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: var(--space-xs);
}

.score-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Tags */
.tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.tag {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 13px;
  color: var(--text-secondary);
}

/* AI Report */
.report-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  border: 1px solid rgba(255, 255, 255, 0.04);
  line-height: 1.7;
  font-size: 15px;
  color: var(--text-secondary);
}

.report-card p {
  margin-bottom: var(--space-md);
}

.report-card p:last-child {
  margin-bottom: 0;
}

.report-card strong {
  color: var(--text-primary);
}

/* Facts */
.fact-item {
  display: flex;
  gap: var(--space-sm);
  align-items: flex-start;
  padding: var(--space-sm) 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.fact-item:last-child {
  border-bottom: none;
}

.fact-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 2px;
}

.fact-icon svg {
  width: 20px;
  height: 20px;
  fill: var(--accent-light);
}

.fact-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Photo Gallery */
.photo-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
}

.photo-gallery img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.photo-gallery img:active {
  transform: scale(0.95);
}

/* ============================================
   Edit View
   ============================================ */

.edit-view {
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom));
}

.edit-form {
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-group input,
.form-group select,
.form-group textarea {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  color: var(--text-primary);
  font-size: 15px;
  font-family: var(--font-body);
  outline: none;
  transition: border-color var(--transition-fast);
  resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent);
}

.form-group select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%236e6e7e'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

/* ============================================
   Insights
   ============================================ */

.insights-content {
  padding: var(--space-md) var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.insight-hero {
  background: var(--gradient-accent);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  color: white;
  position: relative;
  overflow: hidden;
  animation: cardIn var(--transition-spring);
}

.insight-hero::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 200px;
  height: 200px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.1);
}

.insight-hero .hero-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.8;
  margin-bottom: var(--space-xs);
}

.insight-hero .hero-value {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.insight-hero .hero-sub {
  font-size: 14px;
  opacity: 0.9;
  margin-top: var(--space-xs);
}

.insight-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  border: 1px solid rgba(255, 255, 255, 0.04);
  animation: cardIn var(--transition-spring);
  animation-fill-mode: both;
}

.insight-card h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: var(--space-md);
  color: var(--text-primary);
}

.insight-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm) 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.insight-stat:last-child {
  border-bottom: none;
}

.insight-stat .stat-label {
  color: var(--text-secondary);
  font-size: 14px;
}

.insight-stat .stat-value {
  font-weight: 700;
  font-size: 14px;
}

/* Distribution Bars */
.dist-bar {
  margin-bottom: var(--space-sm);
}

.dist-bar-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: var(--space-xs);
}

.dist-bar-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.dist-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--gradient-accent);
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Narrative */
.narrative-card {
  background: linear-gradient(135deg, var(--bg-card), var(--bg-elevated));
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  border: 1px solid rgba(255, 255, 255, 0.06);
  animation: cardIn var(--transition-spring);
  animation-fill-mode: both;
}

.narrative-card .narrative-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--gradient-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-md);
}

.narrative-card .narrative-icon svg {
  width: 20px;
  height: 20px;
  fill: white;
}

.narrative-card p {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-secondary);
}

.narrative-card p strong {
  color: var(--text-primary);
}

/* ============================================
   Settings
   ============================================ */

.settings-content {
  padding: var(--space-md) var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.settings-section {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.settings-section h3 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  margin-bottom: var(--space-md);
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm) 0;
}

.setting-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.setting-label span {
  font-size: 15px;
  font-weight: 500;
}

.setting-label small {
  font-size: 12px;
  color: var(--text-tertiary);
}

.about-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-top: var(--space-sm);
}

/* Toggle */
.toggle {
  width: 48px;
  height: 28px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.1);
  position: relative;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.toggle.active {
  background: var(--accent);
  box-shadow: 0 0 14px var(--accent-glow);
}

.toggle-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  background: white;
  transition: transform var(--transition-spring);
  box-shadow: var(--shadow-sm);
}

.toggle.active .toggle-knob {
  transform: translateX(20px);
}

/* ============================================
   Toast
   ============================================ */

.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 20px);
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: 12px 24px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg), 0 0 20px var(--accent-glow);
  border: 1px solid rgba(129, 140, 248, 0.25);
  z-index: 200;
  opacity: 0;
  transition: all var(--transition-spring);
  pointer-events: none;
  white-space: nowrap;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ============================================
   Animations
   ============================================ */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* ============================================
   Utility
   ============================================ */

.hidden {
  display: none !important;
}

/* ============================================
   Responsive
   ============================================ */

@media (min-width: 768px) {
  .collection-grid {
    grid-template-columns: repeat(3, 1fr);
    max-width: 900px;
    margin: 0 auto;
  }

  .view-header {
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
  }

  .settings-content,
  .insights-content,
  .detail-content,
  .edit-form {
    max-width: 700px;
    margin: 0 auto;
    width: 100%;
  }

  .search-bar {
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
  }
}

@media (min-width: 1024px) {
  .collection-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ============================================
   Reduced Motion
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}