/* wizard.css — planb storyboard wizard
   Design rules (redesign-skill applied):
   - Single accent (pink); gold only for ★lead; cyan only for ✓included
   - Off-black bg, not pure #000; subtle warm tint
   - Tinted shadows (pink-warm), not pure black
   - tabular-nums on numeric data
   - text-wrap: balance on headlines
   - min-height: 100dvh (iOS safari fix)
   - 250ms transitions on all interactive
*/

:root {
  color-scheme: dark;
  --pink: #ff2d75;
  --pink-soft: rgba(255, 45, 117, .22);
  --gold: #ffd166;
  --cyan: #6ee7f0;
  --ink: #f4f4f5;
  --mute: #9ca3af;
  --bg-0: #0a0710;
  --bg-1: #110a18;
  --bg-2: #1a0f24;
  --line: rgba(255, 255, 255, .1);
  --line-strong: rgba(255, 255, 255, .15);
}

* { box-sizing: border-box; }
html, body { min-height: 100dvh; overflow-x: hidden; }
body {
  margin: 0;
  font-family: 'Geist', Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background:
    radial-gradient(circle at 20% 0%, var(--pink-soft), transparent 38%),
    linear-gradient(180deg, var(--bg-0) 0%, var(--bg-1) 60%, var(--bg-0) 100%);
  color: var(--ink);
  font-feature-settings: 'ss01', 'cv11';
}

h1, h2, h3 { text-wrap: balance; letter-spacing: -0.018em; }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-variant-numeric: tabular-nums; }
.nums { font-variant-numeric: tabular-nums; }

.scanlines::before {
  content: ""; pointer-events: none; position: fixed; inset: 0; z-index: 50; opacity: .055;
  background: repeating-linear-gradient(180deg, transparent 0 3px, rgba(255, 255, 255, .26) 3px 4px);
}

.quest {
  background: linear-gradient(135deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .02));
  border: 1px solid var(--line);
  box-shadow: 0 28px 80px rgba(20, 0, 14, .55), inset 0 1px 0 rgba(255, 255, 255, .07);
  backdrop-filter: blur(18px);
}

.screen { display: none; animation: stageIn .42s cubic-bezier(.2, .8, .2, 1); }
.screen.active { display: block; }

@keyframes stageIn { from { opacity: 0; transform: translateX(28px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes flyRight { to { opacity: 0; transform: translateX(120vw) rotate(18deg); } }
@keyframes flyLeft { to { opacity: 0; transform: translateX(-120vw) rotate(-18deg); } }

.press { transition: transform .18s ease, background .25s ease, border-color .25s ease, filter .25s ease; }
.press:active { transform: scale(.97); }

.cta {
  background: linear-gradient(180deg, #ff4f8d 0%, var(--pink) 100%);
  box-shadow: 0 14px 34px rgba(255, 45, 117, .35), inset 0 1px 0 rgba(255, 255, 255, .25);
  transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}
.cta:not(:disabled):hover { transform: translateY(-2px); box-shadow: 0 18px 42px rgba(255, 45, 117, .45), inset 0 1px 0 rgba(255, 255, 255, .3); }
.cta:disabled {
  opacity: 1;
  filter: grayscale(.85);
  background: rgba(255, 255, 255, .08);
  color: rgba(255, 255, 255, .42);
  box-shadow: none;
  border: 1px solid rgba(255, 255, 255, .10);
  cursor: not-allowed;
}
.footer-help { min-height: 14px; }
footer.fixed {
  position: sticky;
  bottom: 0;
  margin-top: auto;
  padding-left: 0;
  padding-right: 0;
  padding-bottom: max(1rem, env(safe-area-inset-bottom, 0px));
}

.bar { background: linear-gradient(90deg, var(--pink), var(--gold)); transition: width .28s ease; }

/* obsidian-inject style dropdown — quick-switcher vibe */
.dd {
  max-height: 52vh; overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(8, 6, 14, .92);
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 44px rgba(0, 0, 0, .55);
  padding: 4px;
}
.obs-row {
  display: block; width: 100%; text-align: left;
  padding: 9px 12px; border-radius: 10px;
  border-left: 2px solid transparent;
  transition: background .15s ease, border-color .15s ease;
  cursor: pointer;
}
.obs-row:hover { background: rgba(255, 255, 255, .05); }
.obs-row.sel { background: rgba(255, 45, 117, .14); border-left-color: var(--pink); }
.obs-row .title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; color: var(--ink); }
.obs-row .select-dot { width: 18px; flex: 0 0 18px; color: rgba(255, 255, 255, .42); font-size: 15px; line-height: 1; text-align: center; }
.obs-row.sel .select-dot { color: var(--pink); text-shadow: 0 0 16px rgba(255, 45, 117, .55); }
.obs-row .keep { font-family: ui-monospace, monospace; font-size: 10px; color: var(--pink); letter-spacing: .04em; padding: 2px 6px; border-radius: 4px; background: rgba(255, 45, 117, .15); }
.obs-row .meta { font-family: ui-monospace, monospace; font-size: 11px; color: var(--mute); margin-top: 3px; padding-left: 4px; }
.obs-row .hl { color: var(--pink); font-weight: 800; }
.dd::-webkit-scrollbar { width: 6px; }
.dd::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .12); border-radius: 999px; }
.dd::-webkit-scrollbar-track { background: transparent; }

/* ───── Step 2 — avatar card ───── */
.avatar-card {
  min-height: 460px;
  touch-action: pan-y;
  user-select: none;
  background: var(--bg-0);
  box-shadow: 0 26px 70px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .12);
  transition: transform .2s ease, opacity .2s ease;
}
.avatar-portrait {
  position: absolute; inset: 0; background-size: cover; background-position: center top;
  filter: saturate(1.05) contrast(1.04);
}
.avatar-shade {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, .05) 0%, transparent 32%, rgba(4, 3, 8, .82) 78%, rgba(4, 3, 8, .96) 100%);
}

.gallery-thumb {
  width: 64px; height: 64px; border-radius: 16px; flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, .08);
  background-size: cover; background-position: center top;
  position: relative; cursor: pointer;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.gallery-thumb.active { border-color: var(--pink); transform: scale(1.06); box-shadow: 0 8px 22px rgba(255, 45, 117, .45); }
.gallery-thumb.included::after {
  content: "✓"; position: absolute; top: -6px; right: -6px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--cyan); color: #021018;
  font-size: 11px; font-weight: 900;
  display: grid; place-items: center;
}
.gallery-thumb.lead::after {
  content: "★"; position: absolute; top: -6px; right: -6px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--gold); color: #021018;
  font-size: 11px; font-weight: 900;
  display: grid; place-items: center;
}
.gallery-thumb.skipped { opacity: .35; filter: grayscale(.85); }

.bio-row { display: grid; grid-template-columns: 78px 1fr; gap: 6px; font-size: 11px; line-height: 1.35; }
.bio-row .lbl { color: var(--mute); text-transform: uppercase; letter-spacing: .08em; font-family: ui-monospace, monospace; font-size: 9px; padding-top: 2px; }
.bio-row .val { color: var(--ink); }

.avatar-title-pill {
  display: inline-flex; flex-direction: column;
  align-self: flex-start;
  padding: 8px 12px 9px;
  background: rgba(4, 3, 8, .72);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 14px;
  max-width: 90%;
}
.avatar-title-pill .role { font-size: 11px; color: var(--cyan); font-weight: 600; margin-top: 1px; }
.avatar-title-pill .status { font-size: 9px; font-family: ui-monospace, monospace; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 2px; }

/* hide bottom nav footer on step 4 — produce button is the primary CTA */
body.on-step-4 footer.fixed { display: none; }
body.on-step-4 #step-4 { padding-bottom: 1rem; }

/* ───── Step 3 — scene tuner ───── */
.scene-avatar-img {
  background-size: cover; background-position: center top;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .5), inset 0 0 0 2px rgba(255, 255, 255, .18);
}

.chip { border: 1px solid var(--line-strong); background: rgba(255, 255, 255, .06); }

.stat-track {
  height: 12px; border-radius: 999px;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .14) 0 1px, transparent 1px 10%),
    linear-gradient(90deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .02));
  overflow: hidden;
}
.stat-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--gold), var(--pink)); }

input[type=range] { width: 100%; accent-color: var(--pink); }
.rpg-slider {
  height: 16px; border-radius: 999px;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .14) 0 2px, transparent 2px calc(10% - 1px)),
    linear-gradient(90deg, rgba(255, 209, 102, .2), rgba(255, 45, 117, .35));
}

.scene-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .02));
  border: 1px solid var(--line);
}
.visual {
  background-color: #0a0710;
  background-size: cover;
  background-position: center;
  transition: background-image .35s ease;
}
.visual::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255, 45, 117, .14), transparent 38%),
              linear-gradient(315deg, rgba(255, 209, 102, .10), transparent 50%);
  pointer-events: none;
}

.bubble {
  position: relative; border: 2px solid rgba(255, 255, 255, .22); background: rgba(4, 7, 16, .92);
  box-shadow: 0 0 0 4px rgba(0, 0, 0, .3), 0 16px 36px rgba(0, 0, 0, .4);
}
.bubble::before {
  content: ""; position: absolute; left: -12px; top: 26px; width: 20px; height: 20px;
  background: rgba(4, 7, 16, .92);
  border-left: 2px solid rgba(255, 255, 255, .22);
  border-bottom: 2px solid rgba(255, 255, 255, .22);
  transform: rotate(45deg);
}

.toast {
  position: fixed;
  right: 0; top: 50%;
  transform: translate(110%, -50%);
  min-width: 48px;
  min-height: 60vh;
  display: flex; align-items: center; justify-content: center;
  padding: 18px 14px;
  border-radius: 16px 0 0 16px;
  border: 1px solid rgba(0, 0, 0, .35);
  border-right: none;
  background: linear-gradient(180deg, #4ade80 0%, #16a34a 100%);
  color: #04140a;
  font-weight: 800; font-size: 14px;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  letter-spacing: .06em;
  transition: transform .3s cubic-bezier(.2, .8, .2, 1);
  z-index: 70;
  box-shadow: -10px 0 32px rgba(22, 163, 74, .45);
  white-space: nowrap;
}
.toast.show { transform: translate(0, -50%); }

/* compact pink action buttons for step-2 */
.pink-act {
  font-size: 12px; font-weight: 700; padding: 8px 10px; border-radius: 14px;
  border: 1px solid rgba(255, 45, 117, .35);
  background: rgba(255, 45, 117, .12); color: #ffd1e0;
  transition: background .2s ease, border-color .2s ease, transform .15s ease;
}
.pink-act:hover { background: rgba(255, 45, 117, .22); border-color: var(--pink); }
.pink-act.lead { background: linear-gradient(180deg, rgba(255,209,102,.22), rgba(255,45,117,.22)); border-color: rgba(255,209,102,.5); color: #fff1c2; }
.pink-act.include { background: rgba(255,45,117,.28); border-color: var(--pink); color: #fff; }

/* ───── Step 4 — preview & produce ───── */
.preview-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.preview-tile {
  position: relative; aspect-ratio: 3 / 4; border-radius: 18px; overflow: hidden;
  background: var(--bg-0); border: 1px solid var(--line);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .45);
}
.preview-tile .ph {
  position: absolute; inset: 0; background-size: cover; background-position: center;
  transition: opacity .35s ease, transform .6s ease;
  opacity: 0; transform: scale(1.04);
}
.preview-tile.loaded .ph { opacity: 1; transform: scale(1); }
.preview-tile .spinner {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--mute); font-family: ui-monospace, monospace; font-size: 11px;
}
.preview-tile.loaded .spinner { display: none; }
.preview-tile .meta {
  position: absolute; inset: auto 0 0 0; padding: 10px 12px;
  background: linear-gradient(0deg, rgba(0, 0, 0, .92), rgba(0, 0, 0, 0));
}
.preview-tile .scene-num { font-family: ui-monospace, monospace; font-size: 9px; color: var(--gold); letter-spacing: .18em; }
.preview-tile .scene-name { font-size: 12px; font-weight: 800; line-height: 1.18; color: var(--ink); margin-top: 2px; }
.preview-tile .avi-chip {
  position: absolute; top: 8px; left: 8px; padding: 3px 8px; border-radius: 999px;
  background: rgba(0, 0, 0, .72); font-family: ui-monospace, monospace; font-size: 9px; color: var(--cyan);
  border: 1px solid var(--line-strong);
}
.preview-tile .reload {
  position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: 50%;
  background: rgba(0, 0, 0, .72); border: 1px solid var(--line-strong);
  color: var(--gold); display: grid; place-items: center; font-size: 13px; cursor: pointer;
  transition: transform .2s ease, border-color .2s ease;
}
.preview-tile .reload:hover { transform: rotate(60deg); border-color: var(--gold); }

.cost-row { display: flex; justify-content: space-between; padding: 7px 0; font-size: 13px; }
.cost-row .lbl { color: var(--mute); font-family: ui-monospace, monospace; font-size: 11px; font-variant-numeric: tabular-nums; }
.cost-row .val { color: var(--gold); font-weight: 700; font-variant-numeric: tabular-nums; }
.cost-total { border-top: 1px solid var(--line-strong); margin-top: 6px; padding-top: 10px; font-size: 15px; }
.cost-total .val { color: var(--pink); font-size: 19px; }
