/* Dkconvert — scene-based dark-void UI, cyan accent (inspired by DKmesh) */

:root {
  --bg-0: #07080a;
  --bg-1: #0e1014;
  --bg-2: #151820;
  --bg-3: #1e222c;
  --border: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.12);
  --fg-0: #eef0f3;
  --fg-1: #b8bcc4;
  --fg-2: #7a808c;
  --fg-3: #4a505c;
  --accent: #00d9ff;
  --accent-dim: #0088aa;
  --accent-bg: rgba(0, 217, 255, 0.08);
  --success: #4ade80;
  --warning: #fbbf24;
  --danger: #ef4444;
  --type-image: #a78bfa;
  --type-audio: #f472b6;
  --type-video: #fb923c;
  --type-youtube: #ef4444;
  --font-sans: 'Outfit', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius: 4px;
  --radius-lg: 10px;
  --scene-bg: rgba(10, 12, 16, 0.78);
  --scene-blur: 22px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font-sans);
  background: var(--bg-0);
  color: var(--fg-0);
  font-size: 14px;
  font-weight: 400;
}

.mono { font-family: var(--font-mono); font-size: 12px; }
.small { font-size: 11px; }
.dim { color: var(--fg-2); }
.hidden { display: none !important; }

/* ─── Stage (full viewport) ─── */
#stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse at 50% 45%, #101318 0%, #07080a 70%),
    var(--bg-0);
  overflow: hidden;
}

/* Soft animated glow blobs in the background */
#stage::before,
#stage::after {
  content: '';
  position: absolute;
  width: 60vmax;
  height: 60vmax;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.18;
  pointer-events: none;
  z-index: 0;
}
#stage::before {
  background: radial-gradient(circle, var(--accent) 0%, transparent 60%);
  top: -20vmax;
  left: -10vmax;
  animation: drift1 24s ease-in-out infinite;
}
#stage::after {
  background: radial-gradient(circle, #a78bfa 0%, transparent 60%);
  bottom: -25vmax;
  right: -15vmax;
  animation: drift2 32s ease-in-out infinite;
}
@keyframes drift1 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(8vmax, 4vmax); }
}
@keyframes drift2 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-6vmax, -3vmax); }
}

/* Subtle grid overlay */
#stage-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

/* ─── Top chrome overlay ─── */
#app-chrome {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 64px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
  pointer-events: none;
}
#app-chrome > * { pointer-events: auto; }
.app-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 20px;
  letter-spacing: -0.01em;
  color: var(--fg-0);
  background: transparent;
  border: none;
  padding: 6px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all 140ms;
}
.app-title:hover { background: rgba(0, 217, 255, 0.06); }
.app-title:hover i { transform: rotate(90deg); }
.app-title i {
  color: var(--accent);
  font-size: 28px;
  transition: transform 240ms cubic-bezier(0.2, 0.9, 0.25, 1);
  filter: drop-shadow(0 0 8px rgba(0, 217, 255, 0.4));
}
.app-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-2);
  text-transform: lowercase;
}
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--fg-3);
  box-shadow: 0 0 8px currentColor;
}
.status-dot.idle { background: var(--fg-3); }
.status-dot.ok { background: var(--success); color: var(--success); }
.status-dot.working { background: var(--warning); color: var(--warning); animation: pulse 1.2s ease-in-out infinite; }
.status-dot.error { background: var(--danger); color: var(--danger); }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ─── Scene container (centered card) ─── */
#scene-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 160px);
  z-index: 20;
}
.scene {
  display: none;
  background: var(--scene-bg);
  backdrop-filter: blur(var(--scene-blur));
  -webkit-backdrop-filter: blur(var(--scene-blur));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  overflow-y: auto;
  max-height: calc(100vh - 160px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}
.scene.active {
  display: block;
  animation: scene-in 240ms cubic-bezier(0.2, 0.9, 0.25, 1);
}
.scene.exiting {
  animation: scene-out 160ms ease-in forwards;
}
@keyframes scene-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes scene-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-8px); }
}

.scene-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 22px;
}
.scene-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.1em;
}
.scene h2 {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--fg-0);
  text-transform: lowercase;
}
.scene-sub {
  font-size: 12px;
  color: var(--fg-2);
  margin-left: auto;
  text-transform: lowercase;
}

/* ─── Fields ─── */
.field { margin-bottom: 18px; }
.field-label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--fg-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

/* ─── Inputs ─── */
.row { display: flex; align-items: center; gap: 10px; }

.text-input {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--fg-0);
  font-family: var(--font-sans);
  font-size: 13px;
  padding: 12px 14px;
  border-radius: var(--radius);
  outline: none;
  transition: border-color 120ms;
}
.text-input:focus { border-color: var(--accent); }
.text-input::placeholder { color: var(--fg-3); }

.select {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--fg-0);
  font-family: var(--font-sans);
  font-size: 13px;
  padding: 10px 12px;
  border-radius: var(--radius);
  outline: none;
  cursor: pointer;
}
.select:focus { border-color: var(--accent); }

/* ─── Buttons ─── */
.primary-btn {
  width: 100%;
  padding: 12px 16px;
  background: var(--accent);
  color: var(--bg-0);
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-transform: lowercase;
  transition: all 120ms;
}
.primary-btn:hover { box-shadow: 0 0 20px rgba(0, 217, 255, 0.4); }
.primary-btn:disabled {
  background: var(--bg-3);
  color: var(--fg-3);
  cursor: not-allowed;
  box-shadow: none;
}
.ghost-btn {
  padding: 8px 12px;
  background: transparent;
  color: var(--fg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-transform: lowercase;
  transition: all 120ms;
}
.ghost-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ─── Dropzone ─── */
.dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 160ms;
  text-align: center;
  background: rgba(255,255,255,0.01);
}
.dropzone:hover, .dropzone.dragging {
  border-color: var(--accent);
  background: var(--accent-bg);
}
.dropzone i { font-size: 28px; color: var(--fg-2); transition: color 160ms; }
.dropzone:hover i, .dropzone.dragging i { color: var(--accent); }
.dropzone .dz-title { font-size: 14px; color: var(--fg-0); font-weight: 500; }
.dropzone .dz-sub { font-size: 11px; color: var(--fg-3); font-family: var(--font-mono); }
.dropzone.loaded { border-style: solid; border-color: var(--success); background: rgba(74,222,128,0.04); }
.dropzone.loaded i { color: var(--success); }

/* ─── OR divider ─── */
.or-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: var(--fg-3);
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
}
.or-divider::before,
.or-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ─── YouTube button + paste row ─── */
.yt-button {
  width: 100%;
  padding: 14px 16px;
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: var(--fg-0);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 140ms;
  text-transform: lowercase;
}
.yt-button:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.5);
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.18);
}
.yt-button i { color: var(--type-youtube); font-size: 18px; }

.yt-input-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.yt-input-row .text-input { flex: 1; }
.yt-input-row .ghost-btn { padding: 8px 12px; }
.yt-input-row.invalid .text-input { border-color: var(--danger); }
.yt-input-row.loading .text-input {
  background: var(--bg-2);
  cursor: wait;
}

/* YouTube preview row on detected card */
.yt-preview {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  align-items: center;
}
.yt-preview img {
  width: 80px;
  height: 45px;
  object-fit: cover;
  border-radius: 3px;
  flex-shrink: 0;
  background: var(--bg-3);
}
.yt-preview .yt-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.yt-preview .yt-title {
  font-size: 12px;
  color: var(--fg-0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.yt-preview .yt-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-2);
}

/* ─── Detected input chip ─── */
.detected-card {
  margin-top: 18px;
  padding: 16px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  gap: 14px;
  align-items: center;
}
.detected-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: var(--bg-3);
  flex-shrink: 0;
}
.detected-icon.image { color: var(--type-image); box-shadow: inset 0 0 0 1px rgba(167,139,250,0.25); }
.detected-icon.audio { color: var(--type-audio); box-shadow: inset 0 0 0 1px rgba(244,114,182,0.25); }
.detected-icon.video { color: var(--type-video); box-shadow: inset 0 0 0 1px rgba(251,146,60,0.25); }
.detected-icon.youtube { color: var(--type-youtube); box-shadow: inset 0 0 0 1px rgba(239,68,68,0.25); }
.detected-info { flex: 1; min-width: 0; }
.detected-name {
  font-size: 13px;
  color: var(--fg-0);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.detected-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-2);
  margin-top: 2px;
  display: flex;
  gap: 8px;
}
.detected-meta .tag {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}
.detected-clear {
  background: transparent;
  border: none;
  color: var(--fg-3);
  cursor: pointer;
  font-size: 14px;
  padding: 6px;
  transition: color 120ms;
}
.detected-clear:hover { color: var(--danger); }

/* ─── Format grid (scene 2) ─── */
.format-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}
.format-card {
  position: relative;
  padding: 14px 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
  transition: all 120ms;
}
.format-card:hover { border-color: var(--border-strong); }
.format-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.format-card .fmt-name {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-0);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.format-card .fmt-desc {
  font-size: 10px;
  color: var(--fg-2);
  margin-top: 4px;
  text-transform: lowercase;
}
.format-card:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-bg);
}
.format-card:has(input:checked) .fmt-name { color: var(--accent); }

/* ─── Mode tabs (simple / advanced) ─── */
.mode-tabs {
  display: flex;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
  margin-bottom: 20px;
  gap: 2px;
}
.mode-tab {
  flex: 1;
  padding: 10px 12px;
  background: transparent;
  border: none;
  color: var(--fg-2);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 3px;
  transition: all 140ms;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-transform: lowercase;
}
.mode-tab:hover { color: var(--fg-1); }
.mode-tab.active {
  background: var(--accent);
  color: var(--bg-0);
  font-weight: 600;
  box-shadow: 0 0 12px rgba(0, 217, 255, 0.3);
}

/* ─── Option panels ─── */
.opt-panel { display: none; }
.opt-panel.active { display: block; animation: scene-in 200ms ease-out; }

/* ─── Slider ─── */
.slider {
  width: 100%;
  appearance: none;
  height: 6px;
  background: var(--bg-3);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  margin-top: 4px;
}
.slider::-webkit-slider-thumb {
  appearance: none;
  width: 18px; height: 18px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 10px var(--accent-bg), 0 0 0 4px rgba(0, 217, 255, 0.08);
  transition: transform 80ms;
}
.slider::-webkit-slider-thumb:hover { transform: scale(1.1); }
.slider::-moz-range-thumb {
  width: 18px; height: 18px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

.quality-ticks {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 10px;
  color: var(--fg-3);
  font-family: var(--font-mono);
  text-transform: lowercase;
  letter-spacing: 0.05em;
}

/* ─── Advanced sub-fields ─── */
.adv-group { display: flex; flex-direction: column; gap: 14px; }
.adv-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.adv-row .field { margin-bottom: 0; }

.num-input {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--fg-0);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 8px 10px;
  border-radius: var(--radius);
  outline: none;
  width: 100%;
  transition: border-color 120ms;
}
.num-input:focus { border-color: var(--accent); }

.check-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 12px;
  color: var(--fg-1);
  user-select: none;
}
.check-opt input[type="checkbox"] {
  appearance: none;
  width: 14px; height: 14px;
  border: 1.5px solid var(--fg-3);
  border-radius: 3px;
  cursor: pointer;
  position: relative;
  transition: all 120ms;
  flex-shrink: 0;
}
.check-opt input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.check-opt input[type="checkbox"]:checked::after {
  content: '\2713';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 10px;
  color: var(--bg-0);
  font-weight: 700;
}

/* ─── Estimate card ─── */
.estimate {
  margin-top: 22px;
  padding: 16px;
  background: rgba(0, 217, 255, 0.04);
  border: 1px solid rgba(0, 217, 255, 0.15);
  border-radius: var(--radius);
}
.estimate-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.estimate-row.out { margin-top: 4px; }
.est-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-2);
}
.est-val {
  font-size: 16px;
  font-weight: 600;
  color: var(--fg-0);
}
.estimate-row.out .est-val { color: var(--accent); }
.est-delta {
  margin-left: auto;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--bg-2);
  color: var(--fg-2);
}
.est-delta.gain { color: var(--success); background: rgba(74,222,128,0.08); }
.est-delta.loss { color: var(--warning); background: rgba(251,191,36,0.08); }
.estimate-arrow {
  text-align: center;
  font-size: 10px;
  color: var(--fg-3);
  margin: 6px 0;
}

/* ─── Result scene ─── */
.result-stage {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 6px;
}
.stage-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 6px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg-3);
  font-size: 11px;
  text-transform: lowercase;
  letter-spacing: 0.05em;
  transition: all 200ms;
}
.stage-step i { font-size: 16px; }
.stage-step.active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-bg);
  box-shadow: 0 0 12px rgba(0, 217, 255, 0.2);
}
.stage-step.done {
  color: var(--success);
  border-color: rgba(74, 222, 128, 0.3);
}
.stage-arrow {
  color: var(--fg-3);
  font-size: 10px;
}

.progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}
.progress-bar {
  flex: 1;
  height: 6px;
  background: var(--bg-3);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  width: 0%;
  transition: width 200ms;
  box-shadow: 0 0 12px var(--accent-bg);
}
.progress-fill.error {
  background: var(--danger);
  box-shadow: 0 0 12px rgba(239,68,68,0.3);
}

.error-box {
  padding: 14px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius);
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 12px;
  color: var(--fg-0);
}
.error-box i { color: var(--danger); margin-top: 2px; }

/* Retention info under download button */
.retention-note {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 11px;
  color: var(--fg-2);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}
.retention-note i { color: var(--fg-3); font-size: 10px; }

/* Batch chips on detected card */
.batch-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.batch-chip {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 6px;
  background: var(--bg-3);
  border-radius: 3px;
  color: var(--fg-1);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── Scene navigation ─── */
#scene-nav {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 24px;
  background: var(--scene-bg);
  backdrop-filter: blur(var(--scene-blur));
  -webkit-backdrop-filter: blur(var(--scene-blur));
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 10px 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
.nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  background: transparent;
  color: var(--fg-1);
  border: none;
  border-radius: 100px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-transform: lowercase;
  transition: all 120ms;
}
.nav-btn i { font-size: 13px; }
.nav-btn:hover:not(:disabled) { color: var(--accent); }
.nav-btn:disabled { color: var(--fg-3); cursor: not-allowed; }
.nav-btn.primary {
  background: var(--accent);
  color: var(--bg-0);
}
.nav-btn.primary:hover:not(:disabled) {
  color: var(--bg-0);
  box-shadow: 0 0 16px rgba(0, 217, 255, 0.5);
}
.nav-btn.primary:disabled { background: var(--bg-3); }
.scene-indicator { display: flex; gap: 6px; }
.scene-indicator .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--fg-3);
  transition: all 160ms;
}
.scene-indicator .dot.done { background: var(--accent-dim); }
.scene-indicator .dot.active { background: var(--accent); box-shadow: 0 0 8px var(--accent); width: 18px; border-radius: 3px; }

/* ─── Toast ─── */
.toast {
  position: fixed;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 18px;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--fg-0);
  font-size: 12px;
  z-index: 100;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
  animation: toast-in 200ms ease-out;
}
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }
.toast.info { border-color: var(--accent); }
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, -8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ─── Help text ─── */
.help-text {
  font-size: 10px;
  color: var(--fg-2);
  margin-top: 6px;
  line-height: 1.4;
}

/* ─── Scrollbar ─── */
.scene::-webkit-scrollbar { width: 6px; }
.scene::-webkit-scrollbar-track { background: transparent; }
.scene::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
.scene::-webkit-scrollbar-thumb:hover { background: var(--fg-3); }

/* ─── Auth overlay ─── */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(7, 8, 10, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.auth-card {
  width: min(380px, calc(100vw - 32px));
  padding: 32px 28px;
  background: var(--scene-bg);
  backdrop-filter: blur(var(--scene-blur));
  -webkit-backdrop-filter: blur(var(--scene-blur));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.auth-logo {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: rgba(0, 217, 255, 0.08);
  border: 1px solid rgba(0, 217, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}
.auth-logo i {
  font-size: 28px;
  color: var(--accent);
  filter: drop-shadow(0 0 12px rgba(0, 217, 255, 0.5));
}
.auth-card h1 {
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.auth-sub {
  font-size: 12px;
  color: var(--fg-2);
  text-transform: lowercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}
.auth-card .text-input {
  text-align: center;
  font-size: 16px; /* >=16px prevents iOS zoom-on-focus */
  padding: 14px;
}
.auth-card .primary-btn { padding: 14px; }
.auth-error {
  font-size: 12px;
  color: var(--danger);
  margin-top: 2px;
  font-family: var(--font-mono);
}

/* ─── Responsive (mobile-first refinements) ─── */
@media (max-width: 768px) {
  /* Allow vertical scrolling on small screens so cards aren't cropped */
  html, body { overflow-y: auto; }
  #scene-container {
    position: static;
    transform: none;
    margin: 88px auto 96px;
    width: calc(100vw - 16px);
    max-height: none;
  }
  .scene { padding: 20px; max-height: none; }
  .scene h2 { font-size: 20px; }
  #app-chrome { padding: 0 12px; height: 56px; }
  .app-title { font-size: 18px; gap: 10px; padding: 4px 8px; }
  .app-title i { font-size: 24px; }
  /* Bigger touch targets on phones */
  .nav-btn { padding: 14px 22px; font-size: 14px; min-height: 48px; }
  .format-card { padding: 18px 10px; min-height: 64px; }
  .format-card .fmt-name { font-size: 14px; }
  .mode-tab { padding: 14px 8px; min-height: 48px; }
  .yt-button { padding: 18px; font-size: 14px; min-height: 56px; }
  .dropzone { padding: 36px 16px; }
  .dropzone i { font-size: 32px; }
  .dropzone .dz-title { font-size: 15px; }
  .primary-btn { padding: 16px; min-height: 52px; font-size: 14px; }
  .ghost-btn { min-height: 40px; padding: 10px 14px; }
  /* Text inputs ≥16px on iOS to avoid the auto-zoom on focus */
  .text-input, .num-input, .select { font-size: 16px; padding: 12px; }
  .slider { height: 8px; }
  .slider::-webkit-slider-thumb { width: 22px; height: 22px; }
  .slider::-moz-range-thumb { width: 22px; height: 22px; }
  .check-opt { padding: 8px 0; }
  .check-opt input[type="checkbox"] { width: 18px; height: 18px; }
  /* Sliders and grids stack on narrow widths */
  .adv-row { grid-template-columns: 1fr; }
  /* Bottom nav: bigger and farther from notch / home bar */
  #scene-nav {
    bottom: max(16px, env(safe-area-inset-bottom, 16px));
    padding: 8px 12px;
    gap: 12px;
  }
  /* Format grid: 2 columns on phone */
  .format-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  /* Detected card padding tighter */
  .detected-card { padding: 12px; gap: 10px; }
  .detected-icon { width: 40px; height: 40px; font-size: 18px; }
  /* Result stage: smaller arrows, wraps if needed */
  .result-stage { gap: 4px; }
  .stage-step { padding: 12px 4px; font-size: 10px; }
  .stage-step i { font-size: 14px; }
  .stage-arrow { font-size: 9px; }
}

@media (max-width: 380px) {
  .format-grid { grid-template-columns: repeat(2, 1fr); }
  .nav-btn span { display: none; }
  .nav-btn { padding: 12px 18px; }
}
