@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

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

:root {
  /* 深邃太空渐变背景 */
  --bg-gradient: linear-gradient(135deg, #0a0e27 0%, #1a1040 30%, #0d1f3c 60%, #0a0e27 100%);
  --bg-dot: radial-gradient(circle at 1px 1px, rgba(255,255,255,0.05) 1px, transparent 0);
  --bg: #0a0e27;

  /* 玻璃态表面 */
  --surface: rgba(255, 255, 255, 0.06);
  --surface-hover: rgba(255, 255, 255, 0.10);
  --surface-active: rgba(255, 255, 255, 0.14);
  --surface-card: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-hover: rgba(255, 255, 255, 0.18);

  /* 霓虹色彩 */
  --primary: #6366f1;
  --primary-hover: #818cf8;
  --primary-glow: rgba(99, 102, 241, 0.3);
  --secondary: #06b6d4;
  --accent: #f472b6;
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;
  --info: #60a5fa;

  /* 文字系统 */
  --text: rgba(255, 255, 255, 0.92);
  --text-secondary: rgba(255, 255, 255, 0.55);
  --text-hint: rgba(255, 255, 255, 0.25);
  --text-muted: rgba(255, 255, 255, 0.1);

  /* 圆角 */
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;

  /* 阴影 */
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 30px var(--primary-glow);

  /* 动画 */
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  background-image: var(--bg-gradient), var(--bg-dot);
  background-size: 100% 100%, 24px 24px;
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

/* 背景装饰粒子 */
body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(6, 182, 212, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(244, 114, 182, 0.04) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
  animation: ambientGlow 15s ease-in-out infinite alternate;
}

@keyframes ambientGlow {
  0% { transform: translate(0, 0) rotate(0deg); }
  50% { transform: translate(2%, 1%) rotate(1deg); }
  100% { transform: translate(-1%, -1%) rotate(-1deg); }
}

/* ── Header ── */
.header {
  background: rgba(10, 14, 39, 0.8);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 14px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo-icon {
  font-size: 30px;
  filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.4));
  animation: logoFloat 3s ease-in-out infinite;
}
@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}
.logo-text {
  font-size: 22px;
  font-weight: 800;
  background: linear-gradient(135deg, #fff 0%, #a5b4fc 50%, #818cf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.5px;
}
.logo-badge {
  font-size: 10px;
  padding: 3px 10px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(6, 182, 212, 0.2));
  border: 1px solid rgba(99, 102, 241, 0.25);
  color: #a5b4fc;
  border-radius: 20px;
  font-weight: 500;
  letter-spacing: 0.3px;
}

/* ── Layout ── */
.layout {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px 28px;
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 24px;
  min-height: calc(100vh - 80px);
  position: relative;
  z-index: 1;
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .header-inner { padding: 12px 16px; }
  .layout { padding: 16px; }
}

/* ── Cards ── */
.card {
  background: var(--surface-card);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  transition: all var(--transition);
}
.card:hover {
  border-color: var(--glass-border-hover);
  box-shadow: var(--shadow), var(--shadow-glow);
}
.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.card-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-body { padding: 18px 22px; }

/* 特殊卡片效果 */
.config-card {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.06), rgba(6, 182, 212, 0.04));
  border-color: rgba(99, 102, 241, 0.15);
}

.badge {
  font-size: 10px;
  padding: 3px 10px;
  background: var(--text-muted);
  border-radius: 20px;
  color: var(--text-secondary);
  font-weight: 500;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.badge-required {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(6, 182, 212, 0.15));
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.2);
}

/* ── Inputs ── */
.input-group {
  display: flex;
  gap: 8px;
}
.input, .select {
  width: 100%;
  padding: 11px 16px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  transition: all var(--transition);
  font-family: inherit;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow), 0 0 20px rgba(99, 102, 241, 0.1);
  background: rgba(255, 255, 255, 0.06);
}
.select option {
  background: #1a1040;
  color: #fff;
}
.textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  resize: vertical;
  min-height: 100px;
  font-family: inherit;
  transition: all var(--transition);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  line-height: 1.7;
}
.textarea::placeholder { color: var(--text-hint); }
.textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
  background: rgba(255, 255, 255, 0.06);
}
.hint {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 8px;
  padding-left: 2px;
}
.chars-count {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  padding: 4px 10px;
  background: var(--text-muted);
  border-radius: 12px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  transition: all var(--transition);
  font-family: inherit;
  font-weight: 500;
}
.btn:hover {
  border-color: var(--glass-border-hover);
  background: var(--surface-hover);
  transform: translateY(-1px);
}
.btn:active {
  transform: translateY(0);
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), #4f46e5);
  color: white;
  border: none;
  box-shadow: 0 4px 16px var(--primary-glow);
  position: relative;
  overflow: hidden;
}
.btn-primary::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 60%);
  animation: btnShine 4s ease-in-out infinite;
  opacity: 0;
  transition: opacity 0.5s;
  pointer-events: none;
}
.btn-primary:hover::before {
  opacity: 1;
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-hover), #6366f1);
  box-shadow: 0 6px 24px var(--primary-glow);
  color: white;
  transform: translateY(-2px);
}
.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px var(--primary-glow);
}
@keyframes btnShine {
  0%, 100% { transform: translate(-30%, -30%); }
  50% { transform: translate(30%, 30%); }
}
.btn-lg {
  padding: 14px 36px;
  font-size: 16px;
  border-radius: var(--radius);
  font-weight: 600;
  letter-spacing: 0.5px;
}
.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
  border-radius: var(--radius-xs);
}
.btn-ghost {
  border: none;
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.btn-icon {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  transition: all var(--transition);
}
.btn-icon:hover {
  background: var(--surface-hover);
  border-color: var(--glass-border-hover);
  box-shadow: 0 0 16px var(--primary-glow);
}

/* ── Submit Area ── */
.submit-area {
  margin: 24px 0;
  display: flex;
  justify-content: center;
}
#generateBtn {
  min-width: 240px;
}

/* ── Params ── */
.params-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.params-grid .param-item:last-child {
  grid-column: 1 / -1;
}
.param-item label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-weight: 500;
  letter-spacing: 0.2px;
}
.param-slider {
  display: flex;
  align-items: center;
  gap: 14px;
}
.param-slider input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: var(--text-muted);
  border-radius: 3px;
  outline: none;
}
.param-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: linear-gradient(135deg, var(--primary), #4f46e5);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 12px var(--primary-glow);
  transition: all var(--transition);
}
.param-slider input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 0 20px var(--primary-glow);
}
.param-slider input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: linear-gradient(135deg, var(--primary), #4f46e5);
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 0 12px var(--primary-glow);
}
.param-value {
  font-size: 15px;
  font-weight: 700;
  min-width: 48px;
  text-align: right;
  color: #a5b4fc;
}

/* Ratio buttons */
.ratio-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.ratio-btn {
  padding: 7px 14px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xs);
  font-size: 13px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  transition: all var(--transition);
  font-family: inherit;
  font-weight: 500;
}
.ratio-btn:hover {
  border-color: var(--glass-border-hover);
  color: var(--text);
  background: var(--surface-hover);
}
.ratio-btn.active {
  background: linear-gradient(135deg, var(--primary), #4f46e5);
  color: white;
  border-color: transparent;
  box-shadow: 0 2px 12px var(--primary-glow);
}

/* Checkboxes */
.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
  margin-right: 20px;
  margin-bottom: 8px;
  color: var(--text-secondary);
  transition: color var(--transition);
}
.checkbox-label:hover {
  color: var(--text);
}
.checkbox-label input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--glass-border);
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  transition: all var(--transition);
  background: rgba(255, 255, 255, 0.04);
  flex-shrink: 0;
}
.checkbox-label input[type="checkbox"]:checked {
  background: linear-gradient(135deg, var(--primary), #4f46e5);
  border-color: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
}
.checkbox-label input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 12px;
  font-weight: 700;
}
.checkbox-label input[type="checkbox"]:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ── Reference Tabs ── */
.ref-tabs {
  display: flex;
  gap: 3px;
  margin-bottom: 16px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  padding: 4px;
  border: 1px solid var(--glass-border);
}
.ref-tab {
  flex: 1;
  padding: 9px 14px;
  border: none;
  background: transparent;
  border-radius: var(--radius-xs);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-secondary);
  font-family: inherit;
  font-weight: 500;
}
.ref-tab:hover {
  color: var(--text);
}
.ref-tab.active {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.ref-panel { display: none; }
.ref-panel.active { display: block; }

/* Upload areas */
.ref-upload-area {
  border: 2px dashed var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: rgba(255, 255, 255, 0.02);
}
.ref-upload-area:hover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.06);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.08);
}
.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.upload-placeholder.small {
  flex-direction: row;
  gap: 10px;
}
.upload-icon { font-size: 32px; }
.upload-hint {
  font-size: 12px;
  color: var(--text-hint);
}

.ref-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.ref-item {
  position: relative;
  width: 84px;
  height: 84px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--glass-border);
  transition: all var(--transition);
}
.ref-item:hover {
  border-color: var(--glass-border-hover);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.ref-item img, .ref-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ref-item .ref-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  opacity: 0;
}
.ref-item:hover .ref-remove {
  opacity: 1;
}
.ref-item .ref-remove:hover {
  background: var(--danger);
  transform: scale(1.1);
}

/* Frames grid */
.frames-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.frame-upload {
  position: relative;
  border: 2px dashed var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  min-height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.02);
}
.frame-upload:hover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.06);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.08);
}
.frame-preview {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.frame-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ── Results Panel ── */
.results-panel {
  background: var(--surface-card);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  height: fit-content;
  position: sticky;
  top: 88px;
  max-height: calc(100vh - 110px);
  display: flex;
  flex-direction: column;
}
.results-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.results-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.results-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
}
.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--text-secondary);
}
.empty-icon {
  font-size: 56px;
  display: block;
  margin-bottom: 16px;
  opacity: 0.5;
}
.empty-state p {
  font-size: 14px;
}
.empty-hint {
  font-size: 12px;
  color: var(--text-hint);
  margin-top: 6px;
}

/* Task cards */
.task-card {
  padding: 16px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  transition: all var(--transition);
  cursor: pointer;
  background: rgba(255, 255, 255, 0.02);
}
.task-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.12);
  background: rgba(99, 102, 241, 0.04);
  transform: translateX(4px);
}
.task-card .task-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.task-card .task-id {
  font-size: 10px;
  font-family: 'SF Mono', 'Monaco', 'Menlo', monospace;
  color: var(--text-hint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
  letter-spacing: 0.3px;
}
.task-card .task-status {
  font-size: 10px;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.task-status.submitted {
  background: rgba(96, 165, 250, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(96, 165, 250, 0.2);
}
.task-status.queued {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.2);
}
.task-status.running {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.2);
}
.task-status.succeeded {
  background: rgba(52, 211, 153, 0.15);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.2);
}
.task-status.failed {
  background: rgba(248, 113, 113, 0.15);
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, 0.2);
}
.task-status.expired {
  background: var(--text-muted);
  color: var(--text-hint);
  border: 1px solid var(--text-muted);
}
.task-card .task-prompt {
  font-size: 13px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  margin-bottom: 8px;
  line-height: 1.6;
}
.task-card .task-meta {
  font-size: 11px;
  color: var(--text-hint);
  display: flex;
  gap: 14px;
}
.task-card .task-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}
.task-card .task-result {
  margin-top: 10px;
}
.task-card .task-result video {
  width: 100%;
  border-radius: var(--radius-sm);
  max-height: 200px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.task-card .task-result img {
  width: 100%;
  border-radius: var(--radius-sm);
  max-height: 200px;
  object-fit: cover;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

/* ── Toast ── */
.toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  padding: 14px 22px;
  background: rgba(10, 14, 39, 0.9);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  animation: slideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  min-width: 280px;
}
.toast.error {
  border-left: 3px solid var(--danger);
  box-shadow: var(--shadow-lg), 0 0 20px rgba(248, 113, 113, 0.15);
}
.toast.success {
  border-left: 3px solid var(--success);
  box-shadow: var(--shadow-lg), 0 0 20px rgba(52, 211, 153, 0.15);
}
.toast.info {
  border-left: 3px solid var(--primary);
  box-shadow: var(--shadow-lg), 0 0 20px rgba(99, 102, 241, 0.15);
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(40px) scale(0.95); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open {
  display: flex;
  animation: modalFadeIn 0.3s ease;
}
@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.modal-content {
  background: rgba(10, 14, 39, 0.95);
  backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  overflow: auto;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(99, 102, 241, 0.15);
}
.modal-overlay.open .modal-content {
  animation: modalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
  padding: 18px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--text-muted);
}
.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}
.modal-body {
  padding: 22px;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ── Selection ── */
::selection {
  background: rgba(99, 102, 241, 0.3);
  color: #fff;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .params-grid { grid-template-columns: 1fr; }
  .logo-badge { display: none; }
  .logo-text { font-size: 18px; }
  .frames-grid { grid-template-columns: 1fr; }
  .ratio-btns .ratio-btn { padding: 6px 10px; font-size: 12px; }
}
