/* ============================================================
   Color Motion WebGL - Premium UI
   Single consolidated stylesheet
   ============================================================ */

/* ===== CSS Variables ===== */
:root {
  --accent: #7c5cfc;
  --accent-light: #a78bfa;
  --accent-glow: rgba(124, 92, 252, 0.35);
  --accent-subtle: rgba(124, 92, 252, 0.12);
  --accent-gradient: linear-gradient(135deg, #7c5cfc 0%, #c084fc 50%, #38bdf8 100%);
  --accent-gradient-btn: linear-gradient(135deg, #7c5cfc 0%, #a855f7 100%);
  --surface: rgba(12, 12, 18, 0.88);
  --surface-hover: rgba(255, 255, 255, 0.07);
  --surface-active: rgba(255, 255, 255, 0.1);
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.16);
  --border-accent: rgba(124, 92, 252, 0.35);
  --text: rgba(255, 255, 255, 0.92);
  --text-secondary: rgba(255, 255, 255, 0.55);
  --text-muted: rgba(255, 255, 255, 0.35);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 7px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --green: #34d399;
  --green-glow: rgba(52, 211, 153, 0.25);
  --red: #f87171;
  --red-glow: rgba(248, 113, 113, 0.2);
  --amber: #fbbf24;
  --amber-glow: rgba(251, 191, 36, 0.25);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #050508;
  color: #fff;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== Canvas ===== */
canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
}

/* ===== Control Panel ===== */
.control-panel {
  position: fixed;
  top: 50%;
  right: 24px;
  transform: translateY(-50%);
  width: 360px;
  max-height: 92vh;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 10;

  background: var(--surface);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);

  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 24px 22px;

  box-shadow:
    0 0 0 1px rgba(255,255,255,0.04),
    0 20px 60px rgba(0, 0, 0, 0.5),
    0 4px 16px rgba(0, 0, 0, 0.3);

  animation: panelSlideIn 0.5s var(--ease);
}

@keyframes panelSlideIn {
  from {
    opacity: 0;
    transform: translateY(-50%) translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
  }
}

/* Scrollbar */
.control-panel::-webkit-scrollbar { width: 5px; }
.control-panel::-webkit-scrollbar-track { background: transparent; }
.control-panel::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.12);
  border-radius: 10px;
}
.control-panel::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.22);
}

/* ===== Panel Header ===== */
.panel-header {
  text-align: center;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.panel-header h1 {
  font-size: 22px;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
  letter-spacing: -0.5px;
}

.subtitle {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

/* ===== Control Groups ===== */
.control-group {
  margin-bottom: 18px;
}

.control-group label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.label-icon {
  margin-right: 6px;
  font-size: 14px;
}

.value-display {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-light);
  background: var(--accent-subtle);
  padding: 2px 10px;
  border-radius: 20px;
  font-variant-numeric: tabular-nums;
}

/* ===== Styled Select ===== */
.styled-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.25s var(--ease);
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23666' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.styled-select:hover {
  border-color: var(--border-hover);
  background: var(--surface-active);
}

.styled-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.styled-select option {
  background: #141418;
  color: #fff;
  padding: 10px;
}

/* ===== Styled Input ===== */
.styled-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  transition: all 0.25s var(--ease);
  outline: none;
}

.styled-input:hover {
  border-color: var(--border-hover);
}

.styled-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.styled-input::placeholder {
  color: var(--text-muted);
}

/* ===== Styled Slider ===== */
.styled-slider {
  width: 100%;
  height: 5px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  outline: none;
  cursor: pointer;
  transition: background 0.2s ease;
}

.styled-slider:hover {
  background: rgba(255, 255, 255, 0.12);
}

.styled-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: var(--accent-gradient-btn);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 10px var(--accent-glow), 0 2px 6px rgba(0,0,0,0.3);
  transition: all 0.2s var(--ease);
  border: 2px solid rgba(255,255,255,0.15);
}

.styled-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 16px var(--accent-glow), 0 4px 10px rgba(0,0,0,0.4);
}

.styled-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: var(--accent-gradient-btn);
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 10px var(--accent-glow), 0 2px 6px rgba(0,0,0,0.3);
  transition: all 0.2s var(--ease);
}

.styled-slider::-moz-range-thumb:hover {
  transform: scale(1.2);
}

/* ===== Section Divider ===== */
.section-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  margin: 20px 0;
}

/* ===== Collapsible Sections ===== */
.collapsible-section {
  margin-bottom: 12px;
}

.section-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.25s var(--ease);
  outline: none;
}

.section-header:hover {
  background: var(--surface-active);
  border-color: var(--border-hover);
}

.section-header.active {
  background: var(--accent-subtle);
  border-color: var(--border-accent);
  color: var(--accent-light);
}

.toggle-icon {
  font-size: 10px;
  transition: transform 0.3s var(--ease);
  opacity: 0.5;
}

.section-header.active .toggle-icon {
  transform: rotate(180deg);
  opacity: 1;
}

.section-content {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: all 0.35s var(--ease);
}

.section-content.open {
  max-height: 1000px;
  opacity: 1;
  padding-top: 14px;
}

/* ===== Toolbar ===== */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
  padding: 8px 12px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.fps-counter {
  font-size: 11px;
  font-weight: 700;
  color: var(--green);
  font-family: 'Courier New', monospace;
  background: rgba(52, 211, 153, 0.08);
  padding: 4px 10px;
  border-radius: 6px;
  font-variant-numeric: tabular-nums;
}

.fps-counter.warning {
  color: var(--amber);
  background: rgba(251, 191, 36, 0.08);
}

.fps-counter.critical {
  color: var(--red);
  background: rgba(248, 113, 113, 0.08);
}

.icon-btn {
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s var(--ease);
  outline: none;
}

.icon-btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-hover);
  color: var(--text);
  transform: scale(1.06);
}

.icon-btn:active { transform: scale(0.95); }

/* ===== Animation Controls ===== */
.animation-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.control-btn {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  background: var(--accent-subtle);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s var(--ease);
  outline: none;
}

.control-btn:hover {
  background: rgba(124, 92, 252, 0.2);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--accent-glow);
}

.control-btn:active { transform: translateY(0); }

.control-btn.paused {
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.25);
}

.time-display {
  flex: 1;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  font-family: 'Courier New', monospace;
  background: var(--surface-hover);
  padding: 10px;
  border-radius: var(--radius-xs);
  font-variant-numeric: tabular-nums;
}

/* ===== Quick Actions ===== */
.quick-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-bottom: 14px;
}

.mini-select {
  padding: 9px 12px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  outline: none;
}

.mini-select:hover {
  border-color: var(--border-hover);
  background: var(--surface-active);
}

.mini-select option {
  background: #141418;
  color: #fff;
}

.action-btn {
  padding: 9px 16px;
  background: linear-gradient(135deg, var(--green) 0%, #059669 100%);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 8px var(--green-glow);
  transition: all 0.25s var(--ease);
  outline: none;
}

.action-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px var(--green-glow);
}

.action-btn:active { transform: translateY(0); }

/* ===== Preset Actions ===== */
.preset-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.mini-btn {
  padding: 8px 12px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  outline: none;
}

.mini-btn:hover {
  background: var(--surface-active);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

.mini-btn:active { transform: translateY(0); }

/* ===== My Presets Panel ===== */
.my-presets-panel {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
  max-height: 280px;
  overflow-y: auto;
  animation: fadeSlideDown 0.3s var(--ease);
}

@keyframes fadeSlideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.presets-list { margin-bottom: 12px; }

.empty-state {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  padding: 20px;
  font-style: italic;
}

.preset-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  margin-bottom: 6px;
  cursor: pointer;
  transition: all 0.2s var(--ease);
}

.preset-item:hover {
  background: var(--surface-active);
  border-color: var(--border-hover);
  transform: translateX(3px);
}

.preset-item-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}

.preset-item-colors {
  display: flex;
  gap: 3px;
  margin: 0 10px;
}

.preset-color-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.15);
}

.preset-item-actions {
  display: flex;
  gap: 4px;
}

.preset-item-btn {
  width: 24px;
  height: 24px;
  background: rgba(255,255,255,0.06);
  border: none;
  border-radius: 6px;
  color: #fff;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  outline: none;
}

.preset-item-btn:hover {
  background: rgba(255,255,255,0.14);
  transform: scale(1.08);
}

.preset-item-btn.delete:hover {
  background: var(--red-glow);
  color: var(--red);
}

.preset-panel-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* ===== Color Swatches ===== */
.color-swatches {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.color-swatch-wrapper {
  position: relative;
  flex: 1;
}

.color-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.color-swatch {
  display: block;
  width: 100%;
  height: 44px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 2px solid rgba(255,255,255,0.12);
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  transition: all 0.25s var(--ease);
}

.color-swatch:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 6px 16px rgba(0,0,0,0.35);
  border-color: rgba(255,255,255,0.25);
}

.color-swatch:active { transform: translateY(0) scale(1); }

/* ===== Rainbow Slider ===== */
.rainbow-slider {
  background: linear-gradient(to right,
    hsl(0, 100%, 50%), hsl(60, 100%, 50%), hsl(120, 100%, 50%),
    hsl(180, 100%, 50%), hsl(240, 100%, 50%), hsl(300, 100%, 50%),
    hsl(360, 100%, 50%)) !important;
  height: 7px !important;
  border-radius: 10px !important;
}

.rainbow-slider::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  background: #fff;
  border: 2px solid rgba(0,0,0,0.15);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.rainbow-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: #fff;
  border: 2px solid rgba(0,0,0,0.15);
}

/* ===== Button Group ===== */
.button-group {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.button-group .action-btn,
.button-group .secondary-button {
  flex: 1;
}

/* ===== Secondary Button ===== */
.secondary-button {
  width: 100%;
  padding: 10px 18px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  margin-top: 10px;
  transition: all 0.25s var(--ease);
  outline: none;
}

.secondary-button:hover {
  background: var(--surface-active);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

.secondary-button:active { transform: translateY(0); }

/* ===== Description Text ===== */
.description-text {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.4;
}

/* ===== Checkbox Label ===== */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
}

.checkbox-label input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* ===== Info Icon ===== */
.info-icon {
  font-size: 13px;
  color: var(--text-muted);
  cursor: help;
  margin-left: 4px;
}

/* ===== Export Section ===== */
.export-section {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.export-section h3 {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ===== Export Button ===== */
.export-button {
  width: 100%;
  padding: 14px 20px;
  background: var(--accent-gradient-btn);
  border: none;
  border-radius: var(--radius);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 20px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.15);
  transition: all 0.3s var(--ease);
  outline: none;
  position: relative;
  overflow: hidden;
}

.export-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  transition: left 0.5s ease;
}

.export-button:hover:not(:disabled)::before {
  left: 100%;
}

.export-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.15);
}

.export-button:active:not(:disabled) { transform: translateY(0); }

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

/* ===== Export Grid ===== */
.export-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

/* ===== Progress ===== */
.progress-container { margin-top: 14px; }

.progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: 10px;
  width: 0%;
  transition: width 0.3s ease;
  box-shadow: 0 0 10px var(--accent-glow);
}

.progress-text {
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-light);
  font-variant-numeric: tabular-nums;
}

.stage-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  text-align: center;
}

.cancel-button {
  margin-top: 10px;
  padding: 8px 16px;
  background: var(--red-glow);
  border: 1px solid rgba(248, 113, 113, 0.3);
  border-radius: var(--radius-xs);
  color: var(--red);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  font-family: inherit;
  outline: none;
}

.cancel-button:hover {
  background: rgba(248, 113, 113, 0.25);
  border-color: rgba(248, 113, 113, 0.5);
}

.cancel-button:active { transform: scale(0.98); }

/* ===== Hint ===== */
.hint {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  color: var(--text-muted);
  font-style: italic;
}

/* ===== Keyboard Shortcuts ===== */
.shortcuts-info {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.shortcuts-info small {
  font-size: 11px;
  color: var(--text-muted);
}

kbd {
  display: inline-block;
  padding: 2px 6px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 10px;
  font-family: 'Courier New', monospace;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0 2px;
}

/* ===== Overlay Container ===== */
.overlay-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 40px;
}

.overlay-container h1 {
  font-size: 6vw;
  font-weight: 800;
  background: linear-gradient(135deg, #ffffff 0%, rgba(255,255,255,0.7) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0;
  letter-spacing: -2px;
  line-height: 1.1;
  text-shadow: none;
}

.overlay-container p {
  font-size: 2vw;
  color: rgba(255,255,255,0.7);
  margin-top: 1vh;
  font-weight: 500;
  letter-spacing: 3px;
  text-transform: uppercase;
}

/* ===== Fullscreen Mode ===== */
.control-panel.fullscreen-hidden {
  transform: translateY(-50%) translateX(420px);
  opacity: 0;
  pointer-events: none;
}

/* ===== Loading Animation ===== */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.export-button:disabled {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}


/* ============================================================
   MODE TOGGLE (Manual / AI)
   ============================================================ */
.mode-toggle-container {
  margin-bottom: 14px;
}

.mode-toggle {
  display: flex;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 3px;
}

.mode-toggle-btn {
  flex: 1;
  padding: 9px 12px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.25s var(--ease);
  outline: none;
  letter-spacing: 0.3px;
}

.mode-toggle-btn:hover {
  color: var(--text-secondary);
  background: rgba(255,255,255,0.04);
}

.mode-toggle-btn.active {
  background: var(--accent-gradient-btn);
  color: #fff;
  box-shadow: 0 2px 12px var(--accent-glow);
}


/* ============================================================
   AI PANEL
   ============================================================ */
.ai-panel {
  margin-bottom: 14px;
  animation: fadeSlideIn 0.3s var(--ease);
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.ai-prompt-input {
  width: 100%;
  min-height: 52px;
  padding: 10px 14px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  outline: none;
  transition: all 0.25s var(--ease);
  box-sizing: border-box;
  line-height: 1.5;
}

.ai-prompt-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

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

.ai-actions {
  display: flex;
  flex-direction: row;
  gap: 8px;
  margin-top: 12px;
}

.ai-actions .ai-generate-btn {
  flex: 2;
}

.ai-actions .ai-surprise-btn {
  flex: 1;
  margin-top: 0;
  font-size: 12px;
  padding: 14px 10px;
}

.ai-generate-btn {
  width: 100%;
  background: var(--accent-gradient-btn) !important;
  box-shadow: 0 4px 20px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.12);
}

.ai-generate-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.12);
}

.ai-generate-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ai-status {
  text-align: center;
  padding: 10px 14px;
  margin-top: 10px;
  background: var(--accent-subtle);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-light);
  animation: pulse 1.5s infinite;
}

.ai-result {
  margin-top: 10px;
  padding: 10px 14px;
  background: rgba(52, 211, 153, 0.06);
  border: 1px solid rgba(52, 211, 153, 0.18);
  border-radius: var(--radius-sm);
  animation: fadeSlideIn 0.3s var(--ease);
}

.ai-result-header {
  font-size: 10px;
  font-weight: 700;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}

.ai-result-details {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.8;
}

.ai-result-details span {
  display: inline-block;
  padding: 2px 8px;
  margin: 2px 3px 2px 0;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-weight: 500;
  color: var(--text);
  font-size: 10px;
}

/* API Key */
.api-key-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.api-key-input {
  flex: 1;
  padding-right: 40px !important;
}

.api-key-toggle {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  font-size: 16px;
  line-height: 1;
  opacity: 0.4;
  transition: opacity 0.2s ease;
  outline: none;
}

.api-key-toggle:hover { opacity: 0.85; }

/* Save Settings Button & Status */
.ai-save-btn {
  margin-top: 0;
  background: rgba(52, 211, 153, 0.1);
  border-color: rgba(52, 211, 153, 0.25);
  color: var(--green);
  font-size: 12px;
  padding: 9px 16px;
}

.ai-save-btn:hover {
  background: rgba(52, 211, 153, 0.18) !important;
  border-color: rgba(52, 211, 153, 0.4) !important;
  color: #6ee7b7 !important;
}

.ai-save-status {
  margin-top: 8px;
  padding: 7px 12px;
  border-radius: var(--radius-xs);
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  animation: fadeSlideIn 0.25s var(--ease);
}

.ai-save-status.success {
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.2);
  color: var(--green);
}

.ai-save-status.error {
  background: var(--red-glow);
  border: 1px solid rgba(248, 113, 113, 0.2);
  color: var(--red);
}


/* ============================================================
   BATCH EXPORT
   ============================================================ */
.batch-description {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 14px;
  line-height: 1.5;
}

.batch-count-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.batch-count-input {
  width: 70px;
  padding: 8px 10px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  text-align: center;
  outline: none;
  transition: all 0.2s var(--ease);
  font-variant-numeric: tabular-nums;
}

.batch-count-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.batch-vary-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.batch-vary-check {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 11px;
}

.batch-vary-check:hover {
  background: var(--surface-active);
  border-color: var(--border-hover);
}

.batch-vary-check input[type="checkbox"] {
  accent-color: var(--accent);
  cursor: pointer;
}

.batch-vary-check span {
  color: var(--text-secondary);
  font-weight: 500;
}

.batch-history-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  margin: 8px 0;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 11px;
  color: var(--text-muted);
}

.batch-history-info #batch-history-count {
  font-weight: 700;
  color: var(--text-secondary);
}

.batch-clear-history-btn {
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 600;
  font-family: inherit;
  color: var(--red);
  background: var(--red-glow);
  border: 1px solid rgba(248,113,113,0.15);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}

.batch-clear-history-btn:hover {
  background: rgba(248,113,113,0.2);
  color: #fca5a5;
}

.batch-summary {
  text-align: center;
  padding: 10px;
  margin: 10px 0;
  background: var(--accent-subtle);
  border: 1px solid rgba(124,92,252,0.12);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.batch-summary #batch-total-count {
  color: var(--accent-light);
  font-size: 15px;
  font-weight: 800;
}

.batch-export-button {
  background: linear-gradient(135deg, var(--amber) 0%, #d97706 100%) !important;
  box-shadow: 0 4px 16px var(--amber-glow), inset 0 1px 0 rgba(255,255,255,0.15) !important;
  color: #1a1a1a !important;
}

.batch-export-button:hover:not(:disabled) {
  box-shadow: 0 8px 28px var(--amber-glow), inset 0 1px 0 rgba(255,255,255,0.15) !important;
}

.batch-progress-panel {
  margin-top: 14px;
  padding: 14px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.batch-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.batch-progress-header span:first-child {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

#batch-progress-count {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-light);
  background: var(--accent-subtle);
  padding: 3px 10px;
  border-radius: 20px;
  font-variant-numeric: tabular-nums;
}

.batch-jobs-list {
  max-height: 180px;
  overflow-y: auto;
  margin-bottom: 12px;
}

.batch-jobs-list::-webkit-scrollbar { width: 4px; }
.batch-jobs-list::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
}

.batch-job-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  margin-bottom: 4px;
  background: rgba(255,255,255,0.02);
  border-radius: var(--radius-xs);
  font-size: 11px;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.batch-job-item.active {
  background: var(--accent-subtle);
  border-color: var(--border-accent);
}

.batch-job-item.done { opacity: 0.5; }

.batch-job-item.error {
  background: var(--red-glow);
  border-color: rgba(248,113,113,0.2);
}

.batch-job-status {
  flex-shrink: 0;
  width: 18px;
  text-align: center;
  font-size: 12px;
}

.batch-job-name {
  flex: 1;
  color: var(--text-secondary);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.batch-job-progress {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  font-family: 'Courier New', monospace;
  font-variant-numeric: tabular-nums;
}

.batch-overall-progress { margin-top: 8px; }

/* Batch chip (mode/preset selection) */
.batch-chip-container {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-height: 150px;
  overflow-y: auto;
  padding: 8px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.batch-chip-container::-webkit-scrollbar { width: 4px; }
.batch-chip-container::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
}

.batch-chip {
  padding: 4px 10px;
  font-size: 10px;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-muted);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
  white-space: nowrap;
}

.batch-chip:hover {
  background: var(--surface-hover);
  border-color: var(--border-hover);
  color: var(--text);
}

.batch-chip.selected {
  background: var(--accent-subtle);
  border-color: var(--border-accent);
  color: #fff;
  font-weight: 600;
}

.batch-select-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
}

.batch-select-btn {
  padding: 3px 10px;
  font-size: 10px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-muted);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.batch-select-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}


/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .control-panel {
    right: 50%;
    transform: translate(50%, -50%);
    width: calc(100% - 32px);
    max-width: 360px;
  }

  @keyframes panelSlideIn {
    from {
      opacity: 0;
      transform: translate(50%, -50%) translateY(20px);
    }
    to {
      opacity: 1;
      transform: translate(50%, -50%) translateY(0);
    }
  }
}

@media (max-width: 480px) {
  .control-panel {
    width: calc(100% - 16px);
    padding: 18px 16px;
    border-radius: 18px;
  }

  .export-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .panel-header h1 { font-size: 20px; }

  .color-swatches { gap: 6px; }
  .color-swatch { height: 36px; }
}
