/* NailShot · Miro-styled tokens + UI
   Fonts: Manrope (Miro substitute for Roobert PRO) + Pretendard (Korean) */

.palette-credit {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--stone);
  padding: 6px 10px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-full);
  background: var(--surface-2);
}
.ai-picker {
  display: inline-flex; align-items: center;
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--r-full);
  padding: 3px;
  gap: 2px;
}
.ai-opt {
  background: transparent; border: 0;
  padding: 6px 14px;
  font-size: 12.5px; font-weight: 500;
  color: var(--steel);
  border-radius: var(--r-full);
  cursor: pointer;
  font-family: inherit;
  transition: all 120ms;
}
.ai-opt:hover { color: var(--ink); }
.ai-opt.on { background: var(--ink); color: #fff; font-weight: 600; }
.an-input {
  flex: 1; min-width: 0;
  padding: 6px 10px;
  font-size: 12.5px;
  font-family: inherit;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--canvas);
  color: var(--ink);
  outline: none;
  transition: border-color 120ms;
}
.an-input:focus { border-color: var(--blue); border-width: 1px; }
.card.regen { animation: regenPulse 900ms ease-out; }
@keyframes regenPulse {
  0% { box-shadow: 0 0 0 0 rgba(255,208,47,0.5); }
  60% { box-shadow: 0 0 0 8px rgba(255,208,47,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,208,47,0); }
}

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700&display=swap');
@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.css');

:root {
  /* Miro brand */
  --yellow:       #ffd02f;
  --yellow-deep:  #fcb900;
  --yellow-light: #fff8e0;
  --rose:         #fde0f0;
  --rose-deep:    #ffd8f4;
  --coral:        #ffc6c6;
  --teal:         #c3faf5;
  --teal-deep:    #0fbcb0;
  --beige:        #ffe6cd;

  /* Neutrals */
  --canvas:       #ffffff;
  --surface:      #fafbfc;
  --surface-2:    #f7f8fa;
  --ink:          #1c1c1e;
  --ink-2:        #2c2c34;
  --slate:        #555a6a;
  --steel:        #6b6f7e;
  --stone:        #8e91a0;
  --muted:        #a5a8b5;
  --hairline:     #e0e2e8;
  --hairline-soft:#eef0f3;
  --blue:         #4262ff;
  --blue-pressed: #2a41b6;

  /* Radii (Miro) */
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-xxxl: 28px;
  --r-feature: 32px;
  --r-full: 9999px;

  /* Shadows (Miro indigo-tinted) */
  --shadow-1: 0 1px 2px 0 rgba(5,0,56,0.04);
  --shadow-2: 0 4px 12px 0 rgba(5,0,56,0.06);
  --shadow-3: 0 12px 32px -4px rgba(5,0,56,0.08);

  --font: 'Manrope', 'Pretendard', 'Noto Sans KR', -apple-system, system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11','ss01';
  letter-spacing: -0.005em;
}
body { overflow: hidden; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input, textarea { font: inherit; color: inherit; }

/* ─────────────────── Shell ─────────────────── */
.shell { display: flex; height: 100vh; }

/* ─────────────────── Sidebar ─────────────────── */
.sidebar {
  width: 232px; flex-shrink: 0;
  background: var(--canvas);
  border-right: 1px solid var(--hairline-soft);
  padding: 22px 14px 18px;
  display: flex; flex-direction: column; gap: 22px;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 6px;
  background: var(--yellow);
  display: grid; place-items: center;
  font-weight: 700; font-size: 14px; letter-spacing: -0.04em;
  color: var(--ink);
}
.brand-name { font-weight: 600; font-size: 15px; letter-spacing: -0.02em; }
.brand-ver { color: var(--muted); font-weight: 500; font-size: 11px; margin-left: 4px; }

.nav-group { display: flex; flex-direction: column; gap: 1px; }
.nav-label {
  font-size: 11px; font-weight: 600; color: var(--stone);
  text-transform: uppercase; letter-spacing: 0.5px;
  padding: 0 10px 8px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px;
  font-size: 13.5px; font-weight: 500; color: var(--slate);
  transition: background 150ms;
  cursor: pointer;
}
.nav-item:hover { background: var(--hairline-soft); color: var(--ink); }
.nav-item.active { background: var(--ink); color: #fff; }
.nav-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--hairline); }
.nav-item.active .nav-dot { background: var(--yellow); }
.nav-item.coming { opacity: 0.55; pointer-events: none; }
.nav-soon {
  font-size: 9px; font-weight: 700; letter-spacing: 0.5px;
  padding: 2px 6px; border-radius: var(--r-full);
  background: var(--hairline-soft); color: var(--steel);
}

/* ─────────────────── Main ─────────────────── */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 56px; border-bottom: 1px solid var(--hairline-soft);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px; background: var(--canvas);
}
.crumb { font-size: 13px; color: var(--steel); display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.crumb > * { flex-shrink: 0; }
.crumb b { color: var(--ink); font-weight: 600; }
.crumb-sep { color: var(--muted); }
.top-actions { display: flex; gap: 8px; align-items: center; }
.lang {
  font-size: 12px; color: var(--steel);
  border: 1px solid var(--hairline); padding: 6px 10px;
  border-radius: var(--r-full); font-weight: 500; font-family: var(--font);
}

/* Hero head */
.hero {
  padding: 36px 32px 24px;
  display: flex; align-items: end; justify-content: space-between; gap: 32px;
  border-bottom: 1px solid var(--hairline-soft);
}
.hero h1 {
  font-size: 40px; line-height: 1.05; letter-spacing: -1.2px;
  font-weight: 500;
}
.hero p {
  margin-top: 10px; color: var(--slate); font-size: 15px;
  max-width: 620px; line-height: 1.55; font-weight: 400;
}
.hero-meta {
  text-align: right; font-size: 12px; color: var(--stone); font-weight: 500;
  line-height: 1.5; min-width: 140px;
}
.hero-meta b { color: var(--ink); font-weight: 600; }

/* Stepper */
.stepper {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0;
  padding: 0 32px;
  border-bottom: 1px solid var(--hairline-soft);
  background: var(--canvas);
}
.step {
  padding: 16px 4px 18px;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: border-color 150ms, color 150ms;
  display: flex; flex-direction: column; gap: 2px;
}
.step .step-num {
  font-size: 11px; font-weight: 600; letter-spacing: 0.5px;
  text-transform: uppercase; color: var(--stone);
}
.step.done .step-num { color: var(--ink); }
.step.active .step-num { color: var(--ink); }
.step .step-name { font-size: 15px; font-weight: 500; letter-spacing: -0.01em; color: var(--ink); }
.step .step-sub  { font-size: 12.5px; color: var(--stone); }
.step.active { border-bottom-color: var(--yellow); }
.step.done   { border-bottom-color: var(--ink); }
.step:not(.active):not(.done) .step-name { color: var(--steel); }

/* Content */
.content {
  flex: 1; overflow-y: auto;
  padding: 32px 32px 100px;
  background: var(--canvas);
}
.content-inner { max-width: 1100px; margin: 0 auto; }

/* ─────────────────── Cards & primitives ─────────────────── */
.row { display: grid; gap: 20px; }
.row.split-7-5 { grid-template-columns: 7fr 5fr; }
.row.split-1-1 { grid-template-columns: 1fr 1fr; }

.card {
  background: var(--canvas);
  border: 1px solid var(--hairline-soft);
  border-radius: var(--r-xl);
  padding: 24px;
}
.card + .card { margin-top: 14px; }
.card-h {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 16px;
}
.card-h h3 {
  font-size: 17px; font-weight: 600; letter-spacing: -0.015em;
  white-space: nowrap; word-break: keep-all;
}
.card-h > div { min-width: 0; }
.card-h .chip { flex-shrink: 0; }
.card-h p { font-size: 12.5px; color: var(--stone); margin-top: 2px; font-weight: 500; word-break: keep-all; overflow-wrap: normal; }

/* Tag chip */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap; flex-shrink: 0;
  padding: 4px 10px;
  border-radius: var(--r-full);
  font-size: 12px; font-weight: 600;
  background: var(--hairline-soft); color: var(--ink-2);
  letter-spacing: -0.005em;
}
.chip.yellow { background: var(--yellow-light); color: #746019; }
.chip.rose   { background: var(--rose);         color: #80224f; }
.chip.teal   { background: var(--teal);         color: #0a5a55; }
.chip.coral  { background: var(--coral);        color: #7a1f1f; }
.chip.ink    { background: var(--ink);          color: #fff; }
.chip.line   { background: transparent; border: 1px solid var(--hairline); color: var(--steel); }

/* Buttons (Miro pill) */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px;
  border-radius: var(--r-full);
  font-size: 14px; font-weight: 500; letter-spacing: -0.005em;
  transition: all 150ms cubic-bezier(0.4,0,0.2,1);
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--ink-2); }
.btn-ghost { background: var(--canvas); color: var(--ink); border-color: var(--hairline); }
.btn-ghost:hover { background: var(--hairline-soft); }
.btn-yellow { background: var(--yellow); color: var(--ink); }
.btn-yellow:hover { background: var(--yellow-deep); }
.btn[disabled] { opacity: 0.35; cursor: not-allowed; }
.btn.sm { padding: 7px 14px; font-size: 12.5px; }

/* Form */
.field { display: flex; flex-direction: column; gap: 6px; }
.field + .field { margin-top: 14px; }
.field-h {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 8px;
}
.field-l { font-size: 12.5px; font-weight: 600; color: var(--ink); white-space: nowrap; word-break: keep-all; }
.field-tag { font-size: 11px; font-weight: 600; color: var(--stone); letter-spacing: 0.5px; text-transform: uppercase; white-space: nowrap; flex-shrink: 0; }
.field-tag.req { color: var(--blue); }
.input, .textarea {
  width: 100%; padding: 11px 13px;
  border: 1px solid var(--hairline); border-radius: var(--r-md);
  background: var(--canvas);
  font-size: 13.5px; color: var(--ink);
  transition: border-color 150ms;
}
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.input:focus, .textarea:focus { outline: none; border: 2px solid var(--blue); padding: 10px 12px; }
.textarea { resize: vertical; min-height: 76px; line-height: 1.55; }

/* ─────────────────── Upload zone ─────────────────── */
.upload {
  border: 1.5px dashed var(--hairline);
  border-radius: var(--r-lg);
  padding: 28px 20px;
  text-align: center;
  transition: all 200ms;
  cursor: pointer;
  background: var(--surface-2);
}
.upload:hover { border-color: var(--ink); background: var(--canvas); }
.upload-icon {
  width: 40px; height: 40px;
  border-radius: var(--r-md);
  background: var(--yellow);
  display: grid; place-items: center;
  margin: 0 auto 12px;
  color: var(--ink); font-size: 18px; font-weight: 600;
}
.upload-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.upload-sub { font-size: 12px; color: var(--stone); margin-top: 4px; font-weight: 500; }
.upload-thumbs {
  display: flex; gap: 8px; margin-top: 14px;
  justify-content: center; flex-wrap: wrap;
}
.thumb {
  width: 56px; height: 56px;
  border-radius: var(--r-md);
  border: 1px solid var(--hairline);
  display: grid; place-items: center;
  background: var(--canvas);
  position: relative; overflow: hidden;
  font-size: 11px; color: var(--muted); font-weight: 500;
}
.thumb.filled { border-color: transparent; }
.thumb.add { border-style: dashed; }

/* ─────────────────── Analysis ─────────────────── */
.analysis { display: flex; flex-direction: column; gap: 10px; }
.an-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.an-key {
  font-size: 11px; font-weight: 600; color: var(--stone);
  letter-spacing: 0.5px; text-transform: uppercase;
  min-width: 64px;
}
.an-foot {
  margin-top: 14px; padding-top: 12px;
  border-top: 1px dashed var(--hairline-soft);
  font-size: 12px; color: var(--steel); line-height: 1.55;
}
.an-foot b { color: var(--ink); font-weight: 600; }

/* Section divider */
.divider {
  margin-top: 28px; padding-top: 24px;
  border-top: 1px solid var(--hairline-soft);
}
.divider-h {
  font-size: 13px; font-weight: 600; color: var(--stone);
  text-transform: uppercase; letter-spacing: 0.6px;
}
.divider-t {
  font-size: 22px; font-weight: 500; letter-spacing: -0.02em;
  word-break: keep-all;
  margin-top: 6px;
}
.divider-s {
  font-size: 13.5px; color: var(--slate); margin-top: 6px;
  line-height: 1.6; max-width: 640px;
}

/* Branch toggle (segmented pill) */
.branch {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
  background: var(--hairline-soft);
  border-radius: var(--r-full);
  padding: 5px;
  margin: 20px 0 22px;
}
.branch-opt {
  padding: 11px 18px;
  border-radius: var(--r-full);
  text-align: center;
  font-size: 13.5px; font-weight: 600;
  color: var(--steel);
  transition: all 150ms;
}
.branch-opt:hover { color: var(--ink); }
.branch-opt.active { background: var(--canvas); color: var(--ink); box-shadow: var(--shadow-1); }
.branch-opt .badge {
  font-size: 10px; font-weight: 700; color: var(--stone);
  margin-right: 6px; letter-spacing: 0.5px;
}
.branch-opt.active .badge { color: var(--blue); }

/* ─────────────────── Match status (auto path hero card) ─────────────────── */
.match {
  display: flex; align-items: stretch; gap: 0;
  background: var(--yellow-light);
  border-radius: var(--r-xxxl);
  padding: 28px 28px;
  position: relative; overflow: hidden;
}
.match-body { flex: 1; padding-right: 24px; }
.match-side { width: 220px; flex-shrink: 0; display: flex; flex-direction: column; gap: 10px; }
.match-tag {
  font-size: 11px; font-weight: 700; color: #746019;
  text-transform: uppercase; letter-spacing: 0.5px;
  display: inline-flex; align-items: center; gap: 6px;
}
.match-tag::before {
  content: ''; width: 14px; height: 14px; border-radius: 50%;
  background: var(--ink); position: relative;
}
.match-tag::after {
  content: '✓'; position: absolute; color: var(--yellow);
  font-size: 9px; font-weight: 800; margin-left: -10px; margin-top: 1px;
}
.match-h { font-size: 28px; font-weight: 500; letter-spacing: -0.6px; margin-top: 8px; color: var(--ink); }
.match-d { margin-top: 10px; font-size: 14px; color: var(--ink-2); line-height: 1.55; max-width: 460px; }
.match-side-card {
  background: rgba(255,255,255,0.7);
  border-radius: var(--r-md);
  padding: 10px 12px;
  font-size: 12px; line-height: 1.5;
}
.match-side-k { font-size: 10.5px; font-weight: 700; color: var(--stone); text-transform: uppercase; letter-spacing: 0.5px; }
.match-side-v { color: var(--ink); font-weight: 600; margin-top: 2px; }

/* Cases preview (small horizontal strip) */
.cases-strip {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px;
  margin-top: 18px;
}
.case-tile {
  background: var(--canvas);
  border: 1px solid var(--hairline-soft);
  border-radius: var(--r-md);
  padding: 12px;
  transition: border-color 150ms;
}
.case-tile:hover { border-color: var(--ink); }
.case-tile-id { font-size: 10px; font-weight: 700; color: var(--stone); letter-spacing: 0.5px; font-family: ui-monospace, monospace; }
.case-tile-name { font-size: 13px; font-weight: 600; margin-top: 4px; letter-spacing: -0.005em; line-height: 1.3; }
.case-tile-cat { font-size: 11px; color: var(--steel); margin-top: 4px; font-weight: 500; }

/* Slot preview (manual path) */
.slots-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px;
  margin-top: 8px;
}
.slot {
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: var(--r-md);
}
.slot-k { font-size: 10.5px; font-weight: 700; color: var(--stone); text-transform: uppercase; letter-spacing: 0.5px; }
.slot-v { font-size: 13px; font-weight: 600; margin-top: 3px; }

/* ─────────────────── Step 2: Image set ─────────────────── */
.config-bar {
  display: flex; gap: 24px; align-items: center;
  padding: 16px 22px;
  background: var(--surface-2);
  border-radius: var(--r-lg);
  margin-bottom: 22px;
}
.config-group { display: flex; align-items: center; gap: 10px; }
.config-l { font-size: 11px; font-weight: 700; color: var(--stone); text-transform: uppercase; letter-spacing: 0.5px; }
.config-opts { display: flex; gap: 4px; }
.opt {
  font-size: 12.5px; font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--r-full);
  color: var(--steel);
  transition: all 150ms;
}
.opt:hover { color: var(--ink); }
.opt.on { background: var(--ink); color: #fff; }

.identity-card {
  display: flex; gap: 16px;
  background: var(--rose);
  border-radius: var(--r-xxxl);
  padding: 18px 22px;
  margin-bottom: 22px;
  align-items: center;
}
.identity-icon {
  width: 40px; height: 40px;
  border-radius: var(--r-md);
  background: var(--ink); color: var(--yellow);
  display: grid; place-items: center;
  font-size: 18px; flex-shrink: 0;
}
.identity-body { flex: 1; min-width: 0; }
.identity-h { font-size: 14px; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.identity-h .chip { background: rgba(255,255,255,0.6); color: var(--ink); }
.identity-s { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; line-height: 1.5; }
.identity-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.identity-chip { font-size: 11.5px; padding: 3px 9px; border-radius: var(--r-full); background: rgba(255,255,255,0.65); color: var(--ink); font-weight: 600; }

.image-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
}
.image-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.img-cell {
  aspect-ratio: var(--tile-ar, 9/16);
  border-radius: var(--r-xl);
  position: relative;
  overflow: hidden;
  display: flex; flex-direction: column; justify-content: end;
  cursor: pointer;
  transition: transform 200ms, box-shadow 200ms;
  background: var(--surface-2);
}
.img-cell:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.img-cell.loading { display: grid; place-items: center; }
.img-cell.empty {
  border: 1.5px dashed var(--hairline);
  background: transparent;
  display: grid; place-items: center;
  color: var(--muted); font-size: 12px; font-weight: 500;
}
.img-mock {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 32px; opacity: 0.7;
}
.img-overlay {
  position: relative; z-index: 2;
  padding: 14px;
  background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.55) 100%);
  color: #fff;
}
.img-case {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.6px;
  font-family: ui-monospace, monospace; opacity: 0.85;
}
.img-name { font-size: 13.5px; font-weight: 600; margin-top: 4px; line-height: 1.3; }
.img-actions {
  position: absolute; top: 10px; right: 10px; z-index: 3;
  display: flex; gap: 5px;
}
.img-action {
  width: 28px; height: 28px;
  border-radius: var(--r-md);
  background: rgba(255,255,255,0.92);
  color: var(--ink);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 600;
  backdrop-filter: blur(8px);
  transition: background 150ms;
}
.img-action:hover { background: #fff; }
.img-cell.locked .img-action.lock { background: var(--ink); color: var(--yellow); }

.spin {
  width: 24px; height: 24px;
  border: 2px solid var(--hairline);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-meta {
  position: absolute; bottom: 12px; left: 12px; right: 12px;
  text-align: center;
}
.loading-id { font-size: 10px; font-weight: 700; letter-spacing: 0.6px; color: var(--stone); font-family: ui-monospace, monospace; }
.loading-name { font-size: 12px; color: var(--steel); margin-top: 2px; font-weight: 500; }

/* Decision modal/panel */
.decision {
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--r-feature);
  padding: 32px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-3);
}
.decision-h { font-size: 22px; font-weight: 500; letter-spacing: -0.4px; }
.decision-s { font-size: 14px; color: var(--slate); margin-top: 6px; line-height: 1.55; }
.decision-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 22px; }
.decision-opt {
  padding: 22px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-xl);
  cursor: pointer;
  transition: all 150ms;
  background: var(--canvas);
}
.decision-opt:hover { border-color: var(--ink); }
.decision-opt.primary {
  background: var(--yellow-light);
  border-color: var(--yellow);
}
.decision-opt.primary:hover { background: var(--yellow); }
.dec-tag { font-size: 11px; font-weight: 700; color: var(--stone); text-transform: uppercase; letter-spacing: 0.5px; }
.decision-opt.primary .dec-tag { color: var(--ink); }
.dec-name { font-size: 17px; font-weight: 600; margin-top: 6px; letter-spacing: -0.01em; }
.dec-sub { font-size: 13px; color: var(--slate); margin-top: 6px; line-height: 1.55; }

/* ─────────────────── Step 3: Video ─────────────────── */
.v-split {
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px;
  margin-top: 22px;
  align-items: stretch;
}
.v-split > .card { margin-top: 0 !important; }
.v-left, .v-right { display: flex; flex-direction: column; }
.timeline-2col {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin-top: 4px;
  flex: 1;
}
.timeline-2col .bin { padding: 14px; }
.timeline-2col .bin-thumb { height: 120px; margin-top: 10px; }
.timeline-2col .bin-name { margin-top: 12px; font-size: 14px; }
.timeline-2col .bin-desc { font-size: 12px; margin-top: 6px; }

.v-stage {
  flex: 1;
  display: grid; place-items: start center;
  padding: 4px 0 0;
}
.v-frame {
  width: 100%;
  max-width: 100%;
  max-height: 460px;
  border-radius: var(--r-xl);
  background: linear-gradient(180deg, #f4f5f8, #eceef3);
  position: relative; overflow: hidden;
  display: grid; place-items: center;
  box-shadow: var(--shadow-2);
}
.v-frame.done { box-shadow: var(--shadow-3); }
.v-frame[style*="aspect-ratio: 16/9"], .v-frame[style*="aspect-ratio: 1/1"] { max-width: 520px; }
.v-frame[style*="aspect-ratio: 9/16"] { max-width: 280px; }
.v-frame[style*="aspect-ratio: 3/4"], .v-frame[style*="aspect-ratio: 4/5"] { max-width: 360px; }

.v-frame-glow {
  position: absolute; inset: -20%;
  filter: blur(50px); opacity: 0.6;
  z-index: 0;
}
.v-frame-play {
  width: 72px; height: 72px; border-radius: 50%;
  background: rgba(255,255,255,0.94);
  display: grid; place-items: center;
  font-size: 26px; color: var(--ink);
  position: relative; z-index: 2;
  padding-left: 4px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.18);
  cursor: pointer;
}
.v-frame-cap {
  position: absolute; bottom: 16px; left: 16px; right: 16px;
  z-index: 2; color: #fff;
  text-shadow: 0 1px 8px rgba(0,0,0,0.28);
}
.v-frame-time { font-size: 11px; font-weight: 700; opacity: 0.9; letter-spacing: 0.4px; font-family: ui-monospace, monospace; }
.v-frame-title { font-size: 14px; font-weight: 600; margin-top: 3px; line-height: 1.3; word-break: keep-all; }

.v-frame-loading {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  color: var(--steel);
}
.v-frame-prog { font-size: 14px; font-weight: 700; color: var(--ink); font-family: ui-monospace, monospace; letter-spacing: 0.5px; }
.v-frame-prog-track {
  width: 160px; height: 4px; border-radius: 2px;
  background: rgba(0,0,0,0.08); overflow: hidden;
}
.v-frame-prog-bar {
  height: 100%; background: var(--ink);
  transition: width 80ms linear;
}

.v-frame-idle {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  color: var(--stone);
}
.v-frame-idle-icon {
  width: 56px; height: 56px; border-radius: 50%;
  background: rgba(0,0,0,0.05);
  display: grid; place-items: center;
  font-size: 18px; color: var(--stone);
  padding-left: 3px;
  margin-bottom: 4px;
}
.v-frame-idle-t { font-size: 13.5px; font-weight: 600; color: var(--slate); word-break: keep-all; white-space: nowrap; }
.v-frame-idle-s { font-size: 11.5px; color: var(--stone); font-family: ui-monospace, monospace; letter-spacing: 0.4px; white-space: nowrap; }

.v-actions { margin-top: 4px; }

.timeline {
  display: grid; grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  position: relative;
}
.bin {
  background: var(--canvas);
  border: 1px solid var(--hairline-soft);
  border-radius: var(--r-lg);
  padding: 14px;
  display: flex; flex-direction: column; gap: 4px;
  position: relative;
}
.bin-time { font-size: 10.5px; font-weight: 700; color: var(--stone); letter-spacing: 0.4px; font-family: ui-monospace, monospace; }
.bin-role { font-size: 11.5px; font-weight: 600; color: var(--steel); text-transform: uppercase; letter-spacing: 0.4px; margin-top: 1px; word-break: keep-all; overflow-wrap: normal; white-space: nowrap; }
.bin-id { font-size: 11px; font-weight: 700; color: var(--ink); margin-top: 8px; font-family: ui-monospace, monospace; }
.bin-name { font-size: 13px; font-weight: 600; margin-top: 1px; letter-spacing: -0.01em; line-height: 1.3; }
.bin-desc { font-size: 12px; color: var(--steel); margin-top: 6px; line-height: 1.45; }
.bin-thumb {
  height: 64px; border-radius: var(--r-md);
  margin-top: 10px;
  position: relative; overflow: hidden;
}
.bin-thumb::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 50%, rgba(0,0,0,0.15));
}

.video-meta {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
  margin-top: 18px;
}
.meta-cell {
  padding: 14px 16px;
  background: var(--surface-2);
  border-radius: var(--r-lg);
}
.meta-k { font-size: 10.5px; font-weight: 700; color: var(--stone); text-transform: uppercase; letter-spacing: 0.5px; }
.meta-v { font-size: 13px; font-weight: 600; margin-top: 4px; line-height: 1.4; }

.model-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.model-card {
  padding: 18px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  background: var(--canvas);
  transition: all 150ms;
  cursor: pointer;
}
.model-card:hover { border-color: var(--ink); }
.model-card.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.model-card.on .model-sub { color: rgba(255,255,255,0.65); }
.model-card.on .model-tag { background: var(--yellow); color: var(--ink); }
.model-tag {
  display: inline-block;
  font-size: 10px; font-weight: 700; padding: 3px 8px;
  border-radius: var(--r-full);
  background: var(--surface-2); color: var(--steel);
  letter-spacing: 0.5px;
}
.model-name { font-size: 15px; font-weight: 600; margin-top: 8px; letter-spacing: -0.01em; }
.model-sub { font-size: 12.5px; color: var(--slate); margin-top: 4px; line-height: 1.5; }

.preview-card {
  background: var(--surface-2);
  border-radius: var(--r-xxxl);
  padding: 32px;
  display: flex; gap: 28px; align-items: center;
}
.preview-phone {
  width: 200px; aspect-ratio: 9/16;
  border-radius: 22px;
  background: var(--ink);
  position: relative; overflow: hidden;
  flex-shrink: 0;
  box-shadow: var(--shadow-3);
}
.preview-screen {
  position: absolute; inset: 6px;
  border-radius: 18px;
  overflow: hidden;
  display: grid; place-items: center;
}
.preview-play {
  width: 56px; height: 56px; border-radius: 50%;
  background: rgba(255,255,255,0.95);
  display: grid; place-items: center;
  font-size: 20px; color: var(--ink);
  position: relative; z-index: 2;
}
.preview-meta {
  position: absolute; bottom: 12px; left: 12px; right: 12px;
  z-index: 2; color: #fff;
}
.preview-time { font-size: 10px; font-weight: 700; opacity: 0.85; letter-spacing: 0.4px; font-family: ui-monospace, monospace; }
.preview-title { font-size: 12px; font-weight: 600; margin-top: 2px; line-height: 1.3; }
.preview-info { flex: 1; min-width: 0; }
.preview-info h3 { font-size: 24px; font-weight: 500; letter-spacing: -0.4px; }
.preview-info p { font-size: 13.5px; color: var(--slate); line-height: 1.6; margin-top: 8px; }
.preview-stats { display: flex; gap: 16px; margin-top: 18px; flex-wrap: wrap; }
.preview-stat { display: flex; flex-direction: column; gap: 2px; }
.preview-stat-k { font-size: 10.5px; font-weight: 700; color: var(--stone); text-transform: uppercase; letter-spacing: 0.5px; }
.preview-stat-v { font-size: 14px; font-weight: 600; }

/* Done state */
.done-state {
  padding: 80px 32px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.done-icon {
  width: 64px; height: 64px;
  border-radius: var(--r-xl);
  background: var(--yellow);
  display: grid; place-items: center;
  font-size: 28px;
}
.done-h { font-size: 24px; font-weight: 500; letter-spacing: -0.3px; }
.done-s { font-size: 14px; color: var(--slate); max-width: 420px; line-height: 1.6; }

/* Footer bar */
.footer-bar {
  position: sticky; bottom: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0) 0%, var(--canvas) 35%);
  padding: 24px 0 8px;
  margin-top: 32px;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
}
.footer-status { font-size: 12.5px; color: var(--stone); font-weight: 500; }
.footer-status b { color: var(--ink); font-weight: 600; }

/* Mock thumb visual (small) */
.mini-thumb {
  height: 100%; width: 100%;
  display: grid; place-items: center;
  position: relative;
}
.mini-thumb-emoji {
  font-size: 22px;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.1));
}

/* ─────────────────── Step 1 compact layout ─────────────────── */
.step1-head {
  display: flex; justify-content: space-between; align-items: end; gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.branch.branch-compact {
  margin: 0; min-width: 360px; padding: 4px;
}
.branch.branch-compact .branch-opt { padding: 8px 14px; font-size: 12.5px; }

.step1-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.85fr 1fr;
  gap: 14px;
  align-items: stretch;
}
.step1-grid > .card { display: flex; flex-direction: column; }
.step1-grid > .card.compact { padding: 22px; }
.step1-grid > .card.compact > .card-h { flex-shrink: 0; }
/* Pre-analyze: skeleton stretches; Post-analyze: content distributes vertically */
.step1-grid .analysis { display: flex; flex-direction: column; gap: 12px; flex: 1; }
.step1-grid .analysis .an-row { margin: 0; }
.step1-grid .rule-cases { gap: 6px; flex: 1; }
.step1-grid .rule-case { padding: 8px 10px; }
.step1-grid .match-d-sm { margin-top: 8px; line-height: 1.55; }
.step1-grid .rule-cases-h { margin-top: 16px; }
/* Push the analyze CTA to bottom + give breathing room from description */
.step1-grid > .card.compact .req-group { flex-shrink: 0; }
.step1-grid > .card.compact > .field.tight:last-of-type { margin-top: 14px; }
.step1-grid > .card.compact .btn.block { margin-top: auto; }
.step1-grid > .card.compact > .field.tight:last-of-type + .btn.block { margin-top: 22px; }

/* Skeleton balance for pre-analyze state */
.skeleton { position: relative; }
.skeleton .sk {
  display: inline-block;
  background: linear-gradient(90deg, var(--hairline-soft) 0%, #f4f5f8 50%, var(--hairline-soft) 100%);
  background-size: 200% 100%;
  animation: sk 1.8s ease-in-out infinite;
  border-radius: var(--r-full);
}
@keyframes sk { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.sk-chip { width: 84px; height: 18px; }
.sk-chip.sk-sm { width: 56px; }
.sk-line { display: block; height: 10px; border-radius: var(--r-sm); }
.sk-h { width: 65%; height: 16px; margin-bottom: 8px; border-radius: var(--r-sm); }
.sk-name { height: 9px; }
.skeleton .an-row { opacity: 0.7; }
.skeleton .an-key { opacity: 0.55; }
.sk-hint {
  margin-top: 14px; padding-top: 12px;
  border-top: 1px dashed var(--hairline);
  font-size: 11.5px; color: var(--stone); font-weight: 500;
  text-align: center; word-break: keep-all; line-height: 1.6;
}
.sk-hint b { color: var(--ink); font-weight: 600; }
.rule-skel { display: flex; flex-direction: column; }
.rule-skel .rule-cases-h { margin-top: 10px; }
.sk-rule-case { background: rgba(255,255,255,0.55); }
.sk-rule-case .sk-n { background: var(--stone); }

.card.compact { padding: 18px; border-radius: var(--r-lg); }
.card.compact .card-h { margin-bottom: 12px; }
.card.compact .card-h h3 { font-size: 14.5px; }
.card.compact.accent-ink { border-color: var(--ink); }
.card.compact.accent-yellow { background: var(--yellow-light); border-color: var(--yellow); }
.card.compact.dim { opacity: 0.92; }

.field.tight + .field.tight { margin-top: 10px; }
.field.tight .field-l { font-size: 11.5px; }
.field.tight .input { padding: 8px 11px; font-size: 12.5px; }
.field.tight .input:focus { padding: 7px 10px; }

.req-group {
  position: relative;
  padding: 12px 12px 14px;
  margin-bottom: 12px;
  background: #fffdf2;
  border: 1px dashed var(--yellow-deep);
  border-radius: var(--r-md);
}
.req-group-h {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 10px;
}
.req-group-l {
  font-size: 10px; font-weight: 700; color: var(--ink);
  text-transform: uppercase; letter-spacing: 0.6px;
  background: var(--yellow); padding: 3px 8px; border-radius: var(--r-full);
}
.req-group-sub {
  font-size: 10.5px; font-weight: 600; color: var(--steel);
  white-space: nowrap;
}
.req-group .field.tight + .field.tight { margin-top: 0; }
.or-divider {
  position: relative; margin: 10px 0; text-align: center;
}
.or-divider::before {
  content: ''; position: absolute; left: 0; right: 0; top: 50%;
  height: 1px; background: var(--hairline);
}
.or-divider span {
  position: relative; display: inline-block;
  background: #fffdf2; padding: 0 8px;
  font-size: 9.5px; font-weight: 700; color: var(--stone);
  letter-spacing: 1px;
}
.field-tag.done { color: var(--teal-deep); }

.upload.upload-mini { padding: 12px; border-radius: var(--r-md); }
.upload.upload-mini .upload-thumbs { gap: 5px; margin-top: 0; }
.thumb.thumb-sm { width: 30px; height: 30px; border-radius: 5px; font-size: 11px; }
.upload.upload-mini .upload-sub { font-size: 11px; }

.btn.block { width: 100%; margin-top: 20px; padding: 12px 16px; font-size: 13px; }

.empty-state {
  padding: 48px 20px; text-align: center;
  background: var(--surface-2); border-radius: var(--r-md);
  color: var(--stone); font-size: 13px; font-weight: 500; line-height: 1.7;
  flex: 1; display: flex; align-items: center; justify-content: center;
  word-break: keep-all; overflow-wrap: break-word;
}
.empty-state > span { display: block; }
.empty-state b { color: var(--ink); font-weight: 600; }

.analysis.tight .an-row { font-size: 12.5px; gap: 6px; }
.analysis.tight .an-key { min-width: 50px; font-size: 10.5px; }
.analysis.tight .chip { font-size: 11px; padding: 3px 8px; }

.match-h-sm { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); margin-top: 2px; }
.match-d-sm { font-size: 12px; color: var(--ink-2); line-height: 1.5; margin-top: 6px; }
.rule-cases-h {
  margin-top: 14px; margin-bottom: 8px;
  font-size: 10px; font-weight: 700; color: var(--steel);
  text-transform: uppercase; letter-spacing: 0.6px;
}
.rule-cases { display: flex; flex-direction: column; gap: 4px; }
.rule-case {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  background: rgba(255,255,255,0.75);
  border-radius: var(--r-md);
}
.rule-case-n {
  width: 18px; height: 18px; flex-shrink: 0;
  border-radius: var(--r-full);
  background: var(--ink); color: #fff;
  font-size: 10px; font-weight: 700;
  display: grid; place-items: center;
}
.rule-case-name {
  font-size: 12.5px; font-weight: 600; color: var(--ink);
  letter-spacing: -0.005em;
}

.textarea.tight { font-size: 12.5px; padding: 10px 12px; }

.prompt-fixed { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--hairline-soft); }
.prompt-fixed-l {
  font-size: 10px; font-weight: 700; color: var(--stone);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px;
}
.prompt-fixed-chips { display: flex; gap: 5px; flex-wrap: wrap; }
.prompt-fixed-chips .chip { font-size: 10.5px; padding: 3px 8px; }

.cases-row {
  margin-top: 22px; padding: 18px;
  background: var(--surface-2); border-radius: var(--r-lg);
}
.cases-row-h { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.cases-row-sub { font-size: 12px; color: var(--steel); font-weight: 500; }
.cases-row .cases-strip { margin-top: 0; }
.cases-row .case-tile { padding: 10px; }
.cases-row .case-tile-name { font-size: 12px; }
.cases-row .case-tile-cat { font-size: 10.5px; }

@media (max-width: 1100px) {
  .step1-grid { grid-template-columns: 1fr 1fr; }
  .step1-grid > :nth-child(3) { grid-column: span 2; }
  .step1-head { flex-direction: column; align-items: stretch; gap: 14px; }
}
/* legacy responsive guardrails */

/* Library */
.lib-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 22px; }
.lib-card { background: var(--surface); border: 1px solid var(--hairline-soft); border-radius: var(--r-xl); overflow: hidden; cursor: pointer; transition: box-shadow 180ms, transform 180ms; }
.lib-card:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); }
.lib-cover { position: relative; aspect-ratio: 4 / 3; background: var(--surface-2); }
.lib-cover-grid { position: absolute; inset: 0; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 2px; }
.lib-cover-cell { width: 100%; height: 100%; }
.lib-cover-badge { position: absolute; bottom: 10px; left: 10px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.3px; background: rgba(28,28,30,0.86); color: #fff; padding: 4px 8px; border-radius: 999px; }
.lib-body { padding: 16px 18px 18px; }
.lib-title { font-size: 15px; font-weight: 600; letter-spacing: -0.2px; color: var(--ink); }
.lib-sub { font-size: 12.5px; color: var(--slate); margin-top: 3px; }
.lib-meta { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.lib-date { font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: 0.3px; margin-top: 10px; text-transform: uppercase; }
.new-creative { white-space: nowrap; }

/* Library detail */
.lib-detail-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.lib-tabs { display: flex; gap: 4px; margin-top: 24px; border-bottom: 1px solid var(--hairline-soft); }
.lib-tab { appearance: none; border: 0; background: transparent; padding: 10px 14px; font-size: 13px; font-weight: 500; color: var(--slate); cursor: pointer; border-bottom: 2px solid transparent; transition: color 120ms, border-color 120ms; font-family: inherit; }
.lib-tab.on { color: var(--ink); border-bottom-color: var(--ink); }
.lib-detail-grid { display: grid; gap: 12px; margin-top: 20px; }
.lib-detail-cell { position: relative; border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-2); }
.lib-detail-cell-num { position: absolute; top: 10px; left: 12px; font-size: 11px; font-weight: 600; letter-spacing: 0.4px; color: rgba(28,28,30,0.7); background: rgba(255,255,255,0.7); padding: 3px 7px; border-radius: 999px; }
.lib-detail-cell-actions { position: absolute; top: 10px; right: 10px; display: flex; gap: 4px; opacity: 0; transition: opacity 160ms; }
.lib-detail-cell:hover .lib-detail-cell-actions { opacity: 1; }
.lib-mini { width: 26px; height: 26px; border-radius: 999px; background: rgba(28,28,30,0.86); color: #fff; border: 0; font-size: 12px; cursor: pointer; }
.lib-detail-video { display: grid; grid-template-columns: 1fr 320px; gap: 18px; margin-top: 20px; align-items: start; }
.lib-video-frame { position: relative; max-width: 100%; border-radius: var(--r-xl); overflow: hidden; box-shadow: var(--shadow-3); background: #000; }
.lib-video-bg { position: absolute; inset: 0; }
.lib-play { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); width: 64px; height: 64px; border-radius: 999px; background: rgba(255,255,255,0.94); border: 0; font-size: 22px; cursor: pointer; }
.lib-video-bar { position: absolute; left: 16px; right: 16px; bottom: 14px; height: 3px; background: rgba(255,255,255,0.3); border-radius: 999px; overflow: hidden; }
.lib-video-bar-fill { height: 100%; background: #fff; }
.lib-video-time { position: absolute; right: 14px; bottom: 22px; font-size: 10.5px; font-weight: 600; color: #fff; letter-spacing: 0.3px; }
.lib-video-side { background: var(--surface); border: 1px solid var(--hairline-soft); border-radius: var(--r-xl); padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.lib-side-title { font-size: 10.5px; font-weight: 600; letter-spacing: 0.4px; color: var(--muted); text-transform: uppercase; padding: 4px 4px 8px; border-bottom: 1px dashed var(--hairline-soft); margin-bottom: 4px; }
.lib-side-bin { display: flex; align-items: center; gap: 10px; padding: 6px 4px; }
.lib-side-num { font-size: 10.5px; font-weight: 600; color: var(--muted); width: 22px; }
.lib-side-thumb { width: 44px; height: 44px; border-radius: var(--r-md); flex-shrink: 0; }
.lib-side-role { font-size: 13px; font-weight: 500; color: var(--ink); }
.lib-side-role-sub { font-size: 11px; color: var(--muted); margin-top: 1px; }
.lib-meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin-top: 20px; border: 1px solid var(--hairline-soft); border-radius: var(--r-xl); overflow: hidden; background: var(--surface); }
.lib-meta-row { display: grid; grid-template-columns: 140px 1fr; padding: 14px 18px; border-bottom: 1px solid var(--hairline-soft); }
.lib-meta-row:nth-last-child(-n+2) { border-bottom: 0; }
.lib-meta-key { font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: 0.3px; text-transform: uppercase; align-self: center; }
.lib-meta-val { font-size: 13.5px; color: var(--ink); font-weight: 500; }
