/* ============================================================
   Creator Onboarding — styles
   Vanilla CSS, no build step. Light + dark via prefers-color-scheme.
   ============================================================ */

:root {
  /* palette (light) */
  --bg:        #f7f3ec;
  --surface:   #ffffff;
  --surface-2: #fbf8f2;
  --ink:       #23201b;
  --ink-soft:  #5c554b;
  --ink-faint: #8a8377;
  --line:      #e7e0d3;
  --line-soft: #efe9dd;

  --accent:      #1f6f5c;   /* deep emerald */
  --accent-ink:  #16523f;
  --accent-soft: #e4f0eb;
  --warm:        #c2703d;   /* terracotta highlight */
  --warm-soft:   #f6e8dd;

  --good:  #1f6f5c;
  --shadow: 0 1px 2px rgba(35,32,27,.04), 0 8px 24px rgba(35,32,27,.06);
  --shadow-lg: 0 12px 40px rgba(35,32,27,.14);
  --radius: 16px;
  --radius-sm: 10px;
  --maxw: 1120px;

  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #17150f;
    --surface:   #211e17;
    --surface-2: #1b1913;
    --ink:       #f3eee3;
    --ink-soft:  #c3bcae;
    --ink-faint: #8f887a;
    --line:      #322e24;
    --line-soft: #2a271f;

    --accent:      #4fbf9f;
    --accent-ink:  #b7e6d7;
    --accent-soft: #1d3a31;
    --warm:        #e0925f;
    --warm-soft:   #3a2a1d;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
    --shadow-lg: 0 16px 50px rgba(0,0,0,.5);
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { margin: 0; line-height: 1.15; }
p { margin: 0; }
button { font-family: inherit; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center; gap: 20px;
  padding: 14px 24px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  height: 32px; width: auto; flex: none; display: block; object-fit: contain;
}
.brand-name { font-weight: 600; font-size: 15px; white-space: nowrap; }

.stepper {
  display: flex; gap: 6px; margin: 0 auto; padding: 0; list-style: none;
  flex-wrap: wrap; justify-content: center;
}
.step {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px;
  color: var(--ink-faint); font-size: 13px; font-weight: 500;
  cursor: default; user-select: none;
  transition: background .15s, color .15s;
}
.step.clickable { cursor: pointer; }
.step.clickable:hover { background: var(--surface-2); color: var(--ink-soft); }
.step-dot {
  width: 22px; height: 22px; flex: none; display: grid; place-items: center;
  border-radius: 50%; border: 1.5px solid var(--line);
  font-size: 12px; font-weight: 600; background: var(--surface);
}
.step.is-current { color: var(--ink); }
.step.is-current .step-dot { border-color: var(--accent); color: var(--accent); }
.step.is-done { color: var(--ink-soft); }
.step.is-done .step-dot { background: var(--accent); border-color: var(--accent); color: #fff; }
.step.is-done .step-dot::after { content: "✓"; }
.step.is-done .step-dot { font-size: 0; }
.step.is-done .step-dot::after { font-size: 12px; }

.topbar-right { min-width: 90px; text-align: right; font-size: 13px; color: var(--ink-faint); }

.progress-track { height: 3px; background: var(--line-soft); }
.progress-fill { height: 100%; width: 0%; background: var(--accent); transition: width .4s ease; }

/* ---------- stage / screens ---------- */
.stage { max-width: var(--maxw); margin: 0 auto; padding: 40px 24px 80px; }
.screen { display: none; animation: fade .35s ease; }
.screen.is-active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.eyebrow {
  text-transform: uppercase; letter-spacing: .14em; font-size: 12px;
  font-weight: 600; color: var(--accent); margin-bottom: 10px;
}
.display { font-family: var(--font-display); font-weight: 500; font-size: clamp(30px, 5vw, 50px); letter-spacing: -.01em; }
.section-title { font-family: var(--font-display); font-weight: 500; font-size: clamp(26px, 4vw, 38px); }
.lede { font-size: 18px; color: var(--ink-soft); max-width: 60ch; margin-top: 16px; }

.screen-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px;
  margin-bottom: 28px; flex-wrap: wrap;
}
.section-sub { color: var(--ink-soft); margin-top: 8px; max-width: 62ch; }

/* ---------- buttons ---------- */
.btn {
  appearance: none; border: 1px solid transparent; cursor: pointer;
  font-size: 14px; font-weight: 600; border-radius: 10px;
  padding: 11px 18px; transition: transform .06s, background .15s, border-color .15s, opacity .15s;
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-lg { padding: 14px 24px; font-size: 15px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:not(:disabled):hover { background: var(--accent-ink); }
.btn-outline { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost { background: transparent; color: var(--ink-soft); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }

/* ---------- welcome ---------- */
.welcome {
  display: grid; grid-template-columns: 1.3fr .9fr; gap: 48px; align-items: start;
  margin-top: 8px;
}
.start-form { margin-top: 30px; display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field-label { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.field input {
  width: 280px; max-width: 100%; font-size: 15px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink);
}
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.fineprint { font-size: 13px; color: var(--ink-faint); margin-top: 14px; }

.welcome-steps {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow);
}
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 18px; }
.plan { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 20px; }
.plan li { display: flex; gap: 14px; }
.plan-num {
  flex: none; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
  background: var(--accent-soft); color: var(--accent);
}
.plan strong { font-size: 15px; }
.plan p { font-size: 13.5px; color: var(--ink-soft); margin-top: 3px; }

/* ---------- tutorials ---------- */
.watch-counter {
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 16px; font-weight: 600; font-size: 14px; color: var(--ink-soft); white-space: nowrap;
}
.watch-counter-sep { color: var(--ink-faint); margin: 0 2px; }
#watchedCount { color: var(--accent); }

.tut-layout { display: grid; grid-template-columns: 300px 1fr; gap: 28px; align-items: start; }

.tut-list ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tut-item {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 13px 14px; cursor: pointer; transition: border-color .15s, background .15s;
}
.tut-item:hover { border-color: var(--accent); }
.tut-item.is-current { border-color: var(--accent); background: var(--accent-soft); }
.tut-item.is-locked { opacity: .55; cursor: not-allowed; }
.tut-item.is-locked:hover { border-color: var(--line); }
.tut-index {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12.5px; font-weight: 700;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-soft);
}
.tut-item.is-watched .tut-index { background: var(--accent); border-color: var(--accent); color: #fff; }
.tut-item-body { min-width: 0; }
.tut-item-title { font-size: 14px; font-weight: 600; }
.tut-item-meta { font-size: 12px; color: var(--ink-faint); }
.tut-lock { margin-left: auto; font-size: 13px; color: var(--ink-faint); }

.tut-main { min-width: 0; }
.video-stage {
  position: relative; aspect-ratio: 16 / 9; width: 100%;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
.video-stage iframe, .video-stage video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-placeholder {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 24px;
  background:
    radial-gradient(120% 120% at 50% 0%, var(--accent-soft), transparent 60%),
    repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 14px, var(--surface) 14px, var(--surface) 28px);
}
.video-placeholder .play {
  width: 66px; height: 66px; border-radius: 50%; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 26px; box-shadow: var(--shadow-lg);
}
.video-placeholder .ph-title { font-weight: 600; font-size: 16px; }
.video-placeholder .ph-note {
  font-size: 12.5px; color: var(--ink-soft); background: var(--surface);
  border: 1px solid var(--line); padding: 5px 12px; border-radius: 999px;
}
.tut-meta { margin: 22px 2px 0; }
.video-title { font-size: 20px; font-weight: 600; }
.video-desc { color: var(--ink-soft); margin-top: 8px; }
.tut-actions { display: flex; align-items: center; gap: 12px; margin-top: 22px; }
.grow { flex: 1; }

.tut-footer {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  margin-top: 34px; padding-top: 24px; border-top: 1px solid var(--line);
}

/* ---------- avatars ---------- */
.batch-chip {
  background: var(--warm-soft); color: var(--warm); font-weight: 600; font-size: 13px;
  padding: 8px 15px; border-radius: 999px; white-space: nowrap; border: 1px solid transparent;
}
.avatar-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 18px; margin-bottom: 96px;
}
.avatar-card {
  position: relative; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; overflow: hidden; cursor: pointer; text-align: left;
  padding: 0; transition: border-color .15s, transform .08s, box-shadow .15s;
}
.avatar-card:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.avatar-card.is-selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.avatar-thumb { aspect-ratio: 3 / 4; width: 100%; background: var(--surface-2); position: relative; overflow: hidden; }
.avatar-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-thumb svg { width: 100%; height: 100%; display: block; }
.avatar-pending {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--ink-faint); background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 10px, var(--surface) 10px, var(--surface) 20px);
}
.avatar-meta { padding: 12px 14px; }
.avatar-name { font-size: 14px; font-weight: 600; }
.avatar-tags { font-size: 12px; color: var(--ink-faint); margin-top: 2px; }
.avatar-check {
  position: absolute; top: 10px; right: 10px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: #fff; display: none; place-items: center; font-size: 14px;
  box-shadow: var(--shadow);
}
.avatar-card.is-selected .avatar-check { display: grid; }

.avatar-empty {
  grid-column: 1 / -1; text-align: center; padding: 60px 20px;
  border: 1px dashed var(--line); border-radius: var(--radius); color: var(--ink-soft);
}

.select-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: none; align-items: center; gap: 18px;
  padding: 14px max(24px, calc(50% - var(--maxw) / 2 + 24px));
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(10px); border-top: 1px solid var(--line);
}
body[data-step="avatars"] .select-bar { display: flex; }
.select-bar-info { flex: 1; min-width: 0; }
.select-bar-label { font-size: 14px; font-weight: 500; color: var(--ink-soft); }
.select-bar-label strong { color: var(--ink); }

/* ---------- done ---------- */
.done { max-width: 640px; margin: 20px auto 0; text-align: center; }
.done-check {
  width: 72px; height: 72px; margin: 0 auto 24px; border-radius: 50%;
  background: var(--accent); color: #fff; display: grid; place-items: center;
  font-size: 34px; box-shadow: var(--shadow-lg);
}
.summary-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; margin: 28px 0; box-shadow: var(--shadow); text-align: left;
  display: flex; align-items: center; gap: 20px;
}
.summary-thumb { width: 84px; height: 112px; border-radius: 10px; overflow: hidden; flex: none; background: var(--surface-2); }
.summary-thumb img, .summary-thumb svg { width: 100%; height: 100%; object-fit: cover; display: block; }
.summary-info { min-width: 0; }
.summary-info dt { font-size: 12px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .08em; }
.summary-info dd { margin: 2px 0 12px; font-size: 16px; font-weight: 600; }
.summary-info dd:last-child { margin-bottom: 0; }
.done-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 36px; }
.next-steps { text-align: left; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.next-steps h3 { font-size: 15px; margin-bottom: 8px; }
.next-steps p { font-size: 14px; color: var(--ink-soft); }

/* ---------- footer ---------- */
.site-footer { max-width: var(--maxw); margin: 0 auto; padding: 28px 24px; color: var(--ink-faint); font-size: 13px; border-top: 1px solid var(--line); }

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--bg); padding: 12px 20px; border-radius: 10px;
  font-size: 14px; font-weight: 500; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .welcome { grid-template-columns: 1fr; gap: 32px; }
  .tut-layout { grid-template-columns: 1fr; }
  .tut-list ol { flex-direction: row; overflow-x: auto; padding-bottom: 6px; }
  .tut-item { min-width: 220px; }
  .stepper { display: none; }
}
@media (max-width: 560px) {
  .stage { padding: 28px 16px 90px; }
  .topbar-inner { padding: 12px 16px; }
  .field input { width: 100%; }
  .start-form { flex-direction: column; align-items: stretch; }
  .start-form .btn { width: 100%; justify-content: center; }
}

/* ---------- no-skip player ---------- */
.player { position: absolute; inset: 0; background: #000; }
.player video { width: 100%; height: 100%; object-fit: contain; background: #000; display: block; cursor: pointer; }
.player-overlay { position: absolute; inset: 0; margin: auto; width: 74px; height: 74px; border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 92%, #000); color: #fff; border: none; cursor: pointer;
  display: grid; place-items: center; font-size: 26px; box-shadow: var(--shadow-lg); }
.player-bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; background: linear-gradient(to top, rgba(0,0,0,.7), rgba(0,0,0,0)); }
.player-btn { background: none; border: none; color: #fff; cursor: pointer; font-size: 15px; line-height: 1; padding: 4px; }
.player-track { flex: 1; height: 6px; border-radius: 999px; background: rgba(255,255,255,.28); overflow: hidden; }
.player-fill { height: 100%; width: 0%; background: #fff; border-radius: 999px; transition: width .1s linear; }
.player-time { color: #fff; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.player-lock { position: absolute; top: 10px; left: 10px; background: rgba(0,0,0,.55); color: #fff;
  font-size: 11.5px; padding: 5px 10px; border-radius: 999px; }

/* ---------- assignment ---------- */
.assignment { display: grid; grid-template-columns: minmax(240px, 330px) 1fr; gap: 32px; align-items: start; }
.assign-video { position: sticky; top: 90px; background: #000; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.assign-video video { width: 100%; max-height: 72vh; display: block; background: #000; }
.assign-body { min-width: 0; }
.assign-h { font-size: 13px; font-weight: 700; margin: 0 0 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint); }
.script-box { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 12px; padding: 18px 20px; font-size: 16px; line-height: 1.7; color: var(--ink); margin-bottom: 26px; }
.assign-note { background: var(--warm-soft); color: var(--ink); border-radius: 12px; padding: 14px 16px; font-size: 14px; margin-bottom: 26px; }
.assign-rules { margin: 0 0 26px; padding-left: 22px; display: flex; flex-direction: column; gap: 12px; }
.assign-rules li { font-size: 15px; line-height: 1.55; }
.assign-rules strong { color: var(--warm); font-weight: 700; }
.assign-field { margin-bottom: 16px; display: block; }
.assign-field input { width: 100%; font-size: 15px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); }
.assign-field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.assign-actions { display: flex; align-items: center; gap: 12px; }

@media (max-width: 820px) {
  .assignment { grid-template-columns: 1fr; }
  .assign-video { position: static; max-width: 420px; margin: 0 auto; }
}
