:root {
  --primary: #e3282c;
  --dark: #2b2a29;
  --blue: #3182ce;
  --bg: #f5f5f5;
  --white: #ffffff;
  --border: #ddd;
  --text: #333;
  --muted: #777;
  --radius: 8px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
}

/* ── Header ── */
header {
  background: var(--dark);
  color: white;
  padding: 0 24px;
  height: 54px;
  display: flex;
  align-items: center;
}
.header-inner {
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo { font-size: 17px; font-weight: 700; letter-spacing: 0.3px; }
.logo span { color: var(--primary); }
.reset-link { color: #aaa; font-size: 13px; text-decoration: none; }
.reset-link:hover { color: white; }

/* ── Steps bar ── */
.steps-bar {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
}
.steps-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
}
.step {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #bbb;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}
.step.active { color: var(--blue); }
.step.done   { color: var(--blue); }
.step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid #ddd;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.step.active .step-num { border-color: var(--blue); background: var(--blue); color: white; }
.step.done   .step-num { border-color: var(--blue); background: var(--blue); color: white; }
.step-connector {
  flex: 1;
  height: 2px;
  background: #e0e0e0;
  margin: 0 10px;
  min-width: 24px;
}
.step-connector.done { background: var(--blue); }

/* ── Main ── */
main { max-width: 900px; margin: 32px auto; padding: 0 24px 60px; }

/* ── Card ── */
.card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 28px 32px;
  margin-bottom: 20px;
}
.card-title { font-size: 19px; font-weight: 700; margin-bottom: 6px; color: var(--dark); }
.card-desc  { color: var(--muted); font-size: 13px; margin-bottom: 24px; line-height: 1.6; }

/* ── Form fields ── */
.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--dark);
}
.field label .req { color: var(--primary); margin-left: 2px; }
.field input[type="text"],
.field input[type="url"],
.field select {
  width: 100%;
  padding: 9px 13px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
  background: white;
  transition: border-color 0.15s;
}
.field input:focus,
.field select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(49,130,206,0.12); }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 22px;
  border-radius: 6px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
  font-family: inherit;
  line-height: 1;
}
.btn-primary { background: var(--blue); color: white; }
.btn-primary:hover { background: #2563eb; }
.btn-success { background: #16a34a; color: white; }
.btn-success:hover { background: #15803d; }
.btn-ghost   { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-lg { padding: 13px 30px; font-size: 15px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── Actions row ── */
.actions { display: flex; gap: 12px; align-items: center; margin-top: 24px; }
.actions .spacer { flex: 1; }

/* ── Upload zone ── */
.upload-zone {
  border: 2px dashed #ccc;
  border-radius: var(--radius);
  padding: 36px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: #fafafa;
  user-select: none;
}
.upload-zone:hover,
.upload-zone.drag-over { border-color: var(--blue); background: #eff6ff; }
.upload-zone .zone-icon  { font-size: 36px; margin-bottom: 10px; }
.upload-zone .zone-title { font-size: 15px; font-weight: 600; margin-bottom: 5px; }
.upload-zone .zone-sub   { font-size: 13px; color: var(--muted); }
.upload-zone input[type="file"] { display: none; }

/* ── Progress upload ── */
.upload-progress { display: none; margin-top: 12px; }
.progress-wrap { background: #e5e7eb; border-radius: 999px; height: 5px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--blue); width: 0%; transition: width 0.2s; border-radius: 999px; }
.progress-label { font-size: 12px; color: var(--muted); margin-top: 5px; text-align: center; }

/* ── Slide grid (step 2) ── */
.slide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 20px;
}
.slide-card {
  background: white;
  border: 2px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  cursor: grab;
  position: relative;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.slide-card:hover { border-color: var(--blue); box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.slide-card.sortable-ghost { opacity: 0.35; }
.slide-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: contain;
  background: #f0f0f0;
  display: block;
}
.slide-info {
  padding: 5px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid #eee;
}
.slide-num { font-size: 11px; font-weight: 700; color: var(--blue); }
.slide-del {
  background: none; border: none; cursor: pointer;
  color: #ccc; font-size: 15px; padding: 0; line-height: 1;
  transition: color 0.15s;
}
.slide-del:hover { color: var(--primary); }
.slide-card.selected { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(227,40,44,0.18); }
.slide-checkbox {
  position: absolute; top: 5px; left: 5px;
  width: 15px; height: 15px; cursor: pointer;
  accent-color: var(--primary); z-index: 2;
}
.sel-toolbar {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 0; font-size: 13px;
}
.btn-danger { background: var(--primary); color: white; }
.btn-danger:hover { background: #c0181c; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.slide-filename {
  font-size: 10px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding: 0 8px 5px;
}
.empty-msg { text-align: center; color: #bbb; padding: 40px 0; font-size: 14px; }

/* ── Timing table (step 3) ── */
.timing-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.timing-table th {
  text-align: left;
  padding: 9px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
  background: #fafafa;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.timing-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}
.timing-table tr:last-child td { border-bottom: none; }
.timing-table tr:hover td { background: #fafffe; }
.thumb-sm {
  width: 72px; height: 41px;
  object-fit: contain;
  border-radius: 4px;
  background: #f0f0f0;
  border: 1px solid #eee;
  display: block;
}
.timing-input, .title-input {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.timing-input { width: 80px; font-family: monospace; text-align: center; }
.title-input  { width: 100%; }
.timing-input:focus,
.title-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(49,130,206,0.12); }
.timing-input[readonly] { background: #f5f5f5; color: #aaa; cursor: default; }
.finisce-val { font-family: monospace; font-size: 13px; color: var(--muted); }

/* ── Step 4: download ── */
.success-box { text-align: center; padding: 12px 0 28px; }
.success-icon  { margin-bottom: 18px; }
.success-title { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.success-sub   { color: var(--muted); font-size: 14px; }
.summary { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 24px; }
.summary td { padding: 9px 0; border-bottom: 1px solid #f0f0f0; }
.summary td:first-child { color: var(--muted); width: 45%; }
.summary td:last-child  { font-weight: 600; }
.summary tr:last-child td { border-bottom: none; }

/* ── Alert ── */
.alert { padding: 13px 16px; border-radius: 6px; font-size: 13px; margin-bottom: 18px; }
.alert-error   { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; }
.alert-success { background: #f0fdf4; border: 1px solid #86efac; color: #15803d; }

/* ── Mode toggle (step 1) ── */
.mode-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 4px;
}
.mode-btn {
  flex: 1;
  padding: 9px 16px;
  border: none;
  background: white;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--muted);
  font-weight: 500;
}
.mode-btn:first-child { border-right: 1px solid var(--border); }
.mode-btn.active { background: var(--blue); color: white; font-weight: 600; }
.mode-btn:not(.active):hover { background: var(--bg); color: var(--text); }

/* ── Skipped steps (solo video) ── */
.step.skipped { color: #ccc; }
.step.skipped .step-num { border-color: #e0e0e0; background: white; color: #ccc; }
.step-connector.skipped { background: #e0e0e0; }

/* ── Responsive ── */
@media (max-width: 600px) {
  main { padding: 0 14px 40px; margin-top: 20px; }
  .card { padding: 18px; }
  .step-label { display: none; }
  .timing-table th:nth-child(2),
  .timing-table td:nth-child(2) { display: none; }
}
