/* ================================================
   AWT Visual Effects — Design System
   ================================================ */

/* === CSS Variables === */
:root {
  /* Color Palette */
  --bg-primary: #08090d;
  --bg-secondary: #0f1117;
  --bg-surface: #161821;
  --bg-surface-hover: #1c1e2a;
  --bg-elevated: #1f2233;

  --text-primary: #e8eaf0;
  --text-secondary: #8b8fa3;
  --text-muted: #555770;

  --accent-primary: #6e56cf;
  --accent-primary-hover: #7c67d6;
  --accent-secondary: #0ea5e9;
  --accent-success: #22c55e;
  --accent-warning: #f59e0b;
  --accent-error: #ef4444;

  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-default: rgba(255, 255, 255, 0.1);

  --glow-accent: 0 0 20px rgba(110, 86, 207, 0.3);
  --glow-success: 0 0 15px rgba(34, 197, 94, 0.3);

  /* Typography */
  --font-sans: 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* Subtle animated background */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(110, 86, 207, 0.12), transparent),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(14, 165, 233, 0.08), transparent);
  pointer-events: none;
  z-index: 0;
}

/* === Header === */
#app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-xl);
  background: rgba(8, 9, 13, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border-subtle);
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.logo-icon {
  font-size: 1.5rem;
  color: var(--accent-primary);
  animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 1; text-shadow: 0 0 10px rgba(110, 86, 207, 0.5); }
  50% { opacity: 0.7; text-shadow: 0 0 20px rgba(110, 86, 207, 0.8); }
}

.logo h1 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.logo .accent {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.stats-bar {
  display: flex;
  gap: var(--space-lg);
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.stat-value {
  font-size: 1.3rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
  line-height: 1;
}

.stat-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* === Control Panel === */
#control-panel {
  position: relative;
  z-index: 10;
  padding: var(--space-md) var(--space-xl);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.controls-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.providers-row {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.provider-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  transition: all var(--duration-fast) var(--ease-out);
}

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

.provider-badge:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  letter-spacing: -0.01em;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), #8b5cf6);
  color: white;
  box-shadow: var(--glow-accent);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(110, 86, 207, 0.4);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent-secondary), #38bdf8);
  color: white;
}

.btn-accent:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(14, 165, 233, 0.4);
}

.btn-icon-only {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  transition: all var(--duration-fast) var(--ease-out);
}

.btn-icon-only:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
}

.btn-small {
  font-size: 0.75rem;
  padding: var(--space-xs) var(--space-sm);
  background: var(--accent-primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-sans);
  font-weight: 600;
  transition: all var(--duration-fast) var(--ease-out);
}

.btn-small:hover {
  background: var(--accent-primary-hover);
}

.btn-icon {
  font-size: 0.75rem;
}

.interval-control {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-left: auto;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.interval-control label {
  font-weight: 500;
}

.interval-control input {
  width: 70px;
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  text-align: center;
  transition: border-color var(--duration-fast);
}

.interval-control input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

/* Status Indicator */
.status-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background var(--duration-normal);
}

.status-indicator.active .status-dot {
  background: var(--accent-success);
  box-shadow: var(--glow-success);
  animation: status-pulse 1.5s ease-in-out infinite;
}

.status-indicator.generating .status-dot {
  background: var(--accent-warning);
  animation: status-pulse 0.8s ease-in-out infinite;
}

@keyframes status-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* === Gallery === */
#gallery {
  position: relative;
  z-index: 1;
  padding: var(--space-xl);
  min-height: calc(100vh - 180px);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: var(--space-lg);
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  gap: var(--space-md);
}

.empty-state.hidden {
  display: none;
}

.empty-icon {
  font-size: 4rem;
  color: var(--accent-primary);
  opacity: 0.3;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.empty-state h2 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.empty-state p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* === Effect Card === */
.effect-card {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  transition: all var(--duration-normal) var(--ease-out);
  animation: card-enter 0.5s var(--ease-spring) both;
}

@keyframes card-enter {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.effect-card:hover {
  border-color: rgba(110, 86, 207, 0.3);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(110, 86, 207, 0.15);
  transform: translateY(-2px);
}

.card-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  cursor: pointer;
  background: #050507;
}

.card-preview iframe {
  width: 100%;
  height: 100%;
  border: none;
  pointer-events: none;
}

.card-preview-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 60%, rgba(0, 0, 0, 0.6));
  opacity: 0;
  transition: opacity var(--duration-fast);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: var(--space-md);
}

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

.card-preview-expand {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration-fast);
}

.card-preview-expand:hover {
  background: rgba(255, 255, 255, 0.25);
}

.card-info {
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.card-model {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.card-model .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.card-theme {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-md) var(--space-md);
}

.card-technique {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  padding: 2px var(--space-sm);
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
}

.card-rating {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--accent-success);
  padding: 2px var(--space-sm);
  background: rgba(34, 197, 94, 0.12);
  border-radius: var(--radius-sm);
}

.card-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.card-actions {
  display: flex;
  gap: var(--space-xs);
}

.card-actions button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: var(--space-xs);
  border-radius: var(--radius-sm);
  transition: all var(--duration-fast);
}

.card-actions button:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.card-actions button.favorited {
  color: #f43f5e;
}

.card-actions button.btn-delete {
  color: var(--accent-error);
}

.card-actions button.btn-delete:hover {
  color: #fff;
  background: var(--accent-error);
}

/* === Fullscreen Modal === */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--bg-primary);
  display: none;
  flex-direction: column;
}

.modal-overlay.active {
  display: flex;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-xl);
  background: rgba(8, 9, 13, 0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 1;
}

.modal-info {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.modal-info .modal-model {
  font-weight: 600;
  font-size: 0.9rem;
}

.modal-info .modal-theme {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.modal-actions {
  display: flex;
  gap: var(--space-sm);
}

#modal-iframe {
  flex: 1;
  width: 100%;
  border: none;
  background: #050507;
}

/* === Code Viewer Modal === */
.code-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl);
}

.code-modal-overlay.active {
  display: flex;
}

.code-modal {
  width: 100%;
  max-width: 900px;
  max-height: 80vh;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.code-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-subtle);
}

.code-modal-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
}

.code-modal-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.code-content {
  flex: 1;
  overflow: auto;
  padding: var(--space-lg);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.7;
  color: var(--text-secondary);
  tab-size: 2;
  white-space: pre-wrap;
  word-break: break-word;
}

/* === Toast Notifications === */
.toast-container {
  position: fixed;
  bottom: var(--space-xl);
  right: var(--space-xl);
  z-index: 2000;
  display: flex;
  flex-direction: column-reverse;
  gap: var(--space-sm);
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 500;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  animation: toast-in 0.4s var(--ease-spring) both;
  max-width: 400px;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
  }
}

.toast.toast-out {
  animation: toast-out 0.3s var(--ease-out) both;
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
  }
}

.toast-success { border-left: 3px solid var(--accent-success); }
.toast-error { border-left: 3px solid var(--accent-error); }
.toast-info { border-left: 3px solid var(--accent-secondary); }

/* === Settings Modal === */
.settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
}

.settings-overlay.active {
  display: flex;
}

.settings-modal {
  width: 100%;
  max-width: 680px;
  max-height: 85vh;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: settings-in 0.35s var(--ease-spring) both;
}

@keyframes settings-in {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(10px);
  }
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border-subtle);
}

.settings-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
}

.settings-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

.settings-section h4 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: var(--space-sm);
  color: var(--text-primary);
}

.settings-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: var(--space-md);
  line-height: 1.5;
}

.settings-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

/* Provider Config Cards */
.provider-configs {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.provider-config-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color var(--duration-fast);
}

.provider-config-card.enabled {
  border-color: rgba(34, 197, 94, 0.3);
}

.provider-config-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  user-select: none;
  transition: background var(--duration-fast);
}

.provider-config-card-header:hover {
  background: rgba(255, 255, 255, 0.04);
}

.provider-config-card-name {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-weight: 600;
  font-size: 0.85rem;
}

.provider-config-card-name .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.provider-config-card-status {
  font-size: 0.7rem;
  padding: 2px var(--space-sm);
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.provider-config-card-status.active {
  background: rgba(34, 197, 94, 0.15);
  color: var(--accent-success);
}

.provider-config-card-status.inactive {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
}

.provider-config-card-body {
  padding: var(--space-md);
  display: none;
  flex-direction: column;
  gap: var(--space-sm);
  border-top: 1px solid var(--border-subtle);
}

.provider-config-card.expanded .provider-config-card-body {
  display: flex;
}

.provider-config-card-header .expand-icon {
  font-size: 0.7rem;
  color: var(--text-muted);
  transition: transform var(--duration-fast);
}

.provider-config-card.expanded .expand-icon {
  transform: rotate(180deg);
}

/* Form inputs inside settings */
.settings-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.settings-field label {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.settings-field input[type="text"],
.settings-field input[type="password"],
.settings-field input[type="url"] {
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  transition: border-color var(--duration-fast);
}

.settings-field input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.settings-field input::placeholder {
  color: var(--text-muted);
  font-style: italic;
}

.provider-config-card-actions {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-error);
  border: 1px solid rgba(239, 68, 68, 0.2);
  font-size: 0.75rem;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-sans);
  font-weight: 600;
  transition: all var(--duration-fast);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

.btn-save-provider {
  background: rgba(34, 197, 94, 0.15);
  color: var(--accent-success);
  border: 1px solid rgba(34, 197, 94, 0.2);
  font-size: 0.75rem;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-sans);
  font-weight: 600;
  transition: all var(--duration-fast);
}

.btn-save-provider:hover {
  background: rgba(34, 197, 94, 0.25);
}

/* Concurrency */
.concurrency-control {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.concurrency-control label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.concurrency-input-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.concurrency-input-row input[type="range"] {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border-default);
  border-radius: 2px;
  outline: none;
}

.concurrency-input-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-primary);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(110, 86, 207, 0.4);
}

.concurrency-input-row input[type="number"] {
  width: 60px;
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  text-align: center;
}

/* === Scrollbar === */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* === Pagination Bar === */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-xl) 0 var(--space-md);
  flex-wrap: wrap;
}

.pagination-pages {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 var(--space-sm);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  user-select: none;
}

.pagination-btn:hover:not(:disabled):not(.active) {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-default);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.pagination-btn.active {
  background: linear-gradient(135deg, var(--accent-primary), #8b5cf6);
  color: white;
  border-color: transparent;
  box-shadow: var(--glow-accent);
  font-weight: 700;
}

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

.pagination-nav {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  gap: 4px;
  padding: 0 var(--space-md);
}

.pagination-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 36px;
  color: var(--text-muted);
  font-size: 0.9rem;
  user-select: none;
}

.pagination-info {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-left: var(--space-sm);
  letter-spacing: 0.03em;
}

/* === Topic Input === */
.controls-row-extra {
  gap: var(--space-lg);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border-subtle);
}

.topic-control {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex: 1;
  min-width: 200px;
}

.topic-control label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.topic-control input {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  transition: all var(--duration-fast);
}

.topic-control input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(110, 86, 207, 0.15);
}

.topic-control input::placeholder {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: var(--space-xs);
  font-size: 0.75rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--duration-fast);
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

/* === Dimension Toggle === */
.dimension-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.dimension-toggle label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.toggle-group {
  display: flex;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.toggle-btn {
  padding: var(--space-sm) var(--space-md);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  position: relative;
}

.toggle-btn:first-child {
  border-right: 1px solid var(--border-subtle);
}

.toggle-btn.active {
  background: linear-gradient(135deg, var(--accent-primary), #8b5cf6);
  color: white;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.2);
}

.toggle-btn:not(.active):hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
}

/* === Evolution Mode Toggle === */
.evolution-control {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.evolution-control label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.switch-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

.switch-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  transition: all var(--duration-normal) var(--ease-out);
}

.switch-slider::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: all var(--duration-normal) var(--ease-spring);
}

.switch-input:checked + .switch-slider {
  background: linear-gradient(135deg, #10b981, #34d399);
  border-color: transparent;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.3);
}

.switch-input:checked + .switch-slider::before {
  transform: translateX(20px);
  background: white;
}

/* === Evolution Info Bar === */
.evolution-info {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(52, 211, 153, 0.04));
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--radius-md);
  animation: evo-fade-in 0.4s var(--ease-spring) both;
}

@keyframes evo-fade-in {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
}

.evolution-info.hidden {
  display: none;
}

.evolution-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: #34d399;
  white-space: nowrap;
  padding: 2px var(--space-sm);
  background: rgba(16, 185, 129, 0.12);
  border-radius: var(--radius-sm);
  letter-spacing: 0.02em;
}

.evolution-stats {
  display: flex;
  gap: var(--space-lg);
  flex-wrap: wrap;
}

.evo-stat {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.evo-stat strong {
  color: var(--text-primary);
  font-weight: 700;
}

.evo-feedback {
  font-family: var(--font-sans);
  font-style: italic;
  color: var(--text-muted);
  max-width: 400px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* === Responsive === */
@media (max-width: 768px) {
  #app-header {
    flex-direction: column;
    gap: var(--space-md);
    padding: var(--space-md);
  }

  .header-left {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-xs);
  }

  .controls-row {
    flex-wrap: wrap;
  }

  .controls-row-extra {
    flex-direction: column;
    align-items: stretch;
  }

  .topic-control {
    min-width: 100%;
  }

  .interval-control {
    margin-left: 0;
    width: 100%;
  }

  .gallery-grid {
    grid-template-columns: 1fr;
  }

  #gallery {
    padding: var(--space-md);
  }

  .evolution-info {
    flex-direction: column;
    align-items: flex-start;
  }

  .evolution-stats {
    gap: var(--space-sm);
  }
}

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

/* === Select (Hub) === */
.select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  height: 40px;
  min-width: 140px;
  padding: 8px 36px 8px 14px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
  background-image: linear-gradient(45deg, transparent 50%, var(--text-secondary) 50%),
    linear-gradient(135deg, var(--text-secondary) 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% - 2px), calc(100% - 12px) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.select:hover {
  border-color: var(--border-default);
  background-color: var(--bg-surface);
}

.select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(110, 86, 207, 0.2);
}
