:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --text: #0f172a;
  --muted: #475569;
  --border: #e2e8f0;
  --primary: #0f766e;
  --primary-hover: #115e59;
  --primary-soft: #ccfbf1;
  --primary-text: #134e4a;
  --accent: #ea580c;
  --danger: #dc2626;
  --shadow: 0 8px 28px rgba(15, 23, 42, 0.06);
  --radius: 14px;
}

[data-theme="dark"] {
  --bg: #090d16;
  --surface: #111827;
  --surface-2: #1e293b;
  --text: #f8fafc;
  --muted: #94a3b8;
  --border: #263244;
  --primary: #14b8a6;
  --primary-hover: #0d9488;
  --primary-soft: rgba(20, 184, 166, 0.16);
  --primary-text: #5eead4;
  --accent: #f97316;
  --danger: #ef4444;
  --shadow: 0 10px 32px rgba(0, 0, 0, 0.35);
}

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

body {
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.08rem;
  letter-spacing: -0.02em;
}

.brand svg {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.brand-tag {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-text);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 16px 48px;
}

.stepper {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.step-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.step-tab.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-text);
}

.step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 800;
  flex-shrink: 0;
}

.step-tab.active .step-num {
  background: var(--primary);
  color: #ffffff;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.card h2 {
  font-size: 1.15rem;
  margin-bottom: 6px;
}

.card p.hint {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 16px;
}

.dropzone {
  border: 2px dashed var(--border);
  border-radius: 14px;
  padding: 28px 18px;
  text-align: center;
  background: var(--surface-2);
  transition: border-color 0.15s ease;
}

.dropzone.dragover {
  border-color: var(--primary);
}

.dropzone h3 {
  font-size: 1.02rem;
  margin-bottom: 6px;
}

.dropzone p {
  font-size: 0.86rem;
  color: var(--muted);
  margin-bottom: 16px;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.15s ease, transform 0.08s ease;
}

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

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}

.btn-accent {
  background: var(--accent);
  color: #ffffff;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
}

.file-summary {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary-text);
  display: none;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.88rem;
  font-weight: 600;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.studio-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 20px;
  align-items: start;
}

.mode-box {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mode-box h3 {
  font-size: 0.98rem;
}

.mode-box p {
  font-size: 0.84rem;
  color: var(--muted);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.field label {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text);
}

.field input[type="text"],
.field input[type="password"],
.field input[type="number"],
.field select,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
}

.field textarea {
  min-height: 92px;
  resize: vertical;
}

.status-bar {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: none;
}

.status-bar-text {
  font-size: 0.86rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.progress-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--primary);
  transition: width 0.2s ease;
}

.moments-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.moment-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  background: var(--surface-2);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s ease;
}

.moment-card.selected {
  border: 2px solid var(--primary);
  background: var(--primary-soft);
}

.moment-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.score-pill {
  background: var(--primary);
  color: #ffffff;
  font-size: 0.76rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
}

.time-pill {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 700;
}

.moment-card h4 {
  font-size: 0.95rem;
  line-height: 1.35;
}

.moment-card p {
  font-size: 0.82rem;
  color: var(--muted);
}

.preview-column {
  position: sticky;
  top: 76px;
}

.phone-frame {
  width: 100%;
  max-width: 340px;
  margin: 0 auto;
  background: #09090b;
  border-radius: 22px;
  padding: 10px;
  border: 2px solid var(--border);
  box-shadow: var(--shadow);
}

.phone-frame canvas {
  width: 100%;
  aspect-ratio: 9 / 16;
  display: block;
  border-radius: 14px;
  background: #000000;
}

.preview-controls {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.preset-btn {
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}

.preset-btn.active {
  border: 2px solid var(--primary);
  background: var(--primary-soft);
}

.preset-btn strong {
  display: block;
  font-size: 0.88rem;
  margin-bottom: 2px;
}

.preset-btn span {
  display: block;
  font-size: 0.76rem;
  color: var(--muted);
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
  font-weight: 600;
}

.result-box {
  margin-top: 16px;
  padding: 16px;
  border-radius: 12px;
  border: 2px solid var(--primary);
  background: var(--primary-soft);
  display: none;
}

.result-box h3 {
  font-size: 1rem;
  color: var(--primary-text);
  margin-bottom: 6px;
}

.result-box video {
  width: 100%;
  max-width: 280px;
  border-radius: 12px;
  margin: 10px auto;
  display: block;
  background: #000;
}

.alert-error {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(220, 38, 38, 0.12);
  border: 1px solid var(--danger);
  color: var(--danger);
  font-size: 0.86rem;
  font-weight: 600;
  display: none;
}

@media (max-width: 860px) {
  .grid-2,
  .studio-grid {
    grid-template-columns: 1fr;
  }

  .preview-column {
    position: static;
  }

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

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