/* ── Tokens ─────────────────────────────────────────────────────── */
:root {
  --green:     #39D353; /* Electric Green for success/wins */
 --green-dk:  #2ea836; 
  --green-txt: #2ea836;
  --red:       #B91C1C; /* Crimson Red */
  --red-dk:    #991717; /* Darker Red for hovers */
  --red-light: #E8EDF2; /* Silver Light (Officially replacing the Pink!) */
  --black:     #111111; /* Brand Black */
  --ink:       #111111; 
  --silver:    #B8C8D8; /* Silver Mid-Light */
  --white:     #FFFFFF;
  --muted:     #52667C; /* Cool Charcoal */
  --border:    #B8C8D8;
  --bg-soft:   #F7F8FA;
  --shadow-sm: 0 1px 4px rgba(0,0,0,.07), 0 4px 16px rgba(0,0,0,.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,.10), 0 12px 40px rgba(0,0,0,.08);
  --r:         10px;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --serif: 'Fraunces', Georgia, serif;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: var(--sans);
  background: var(--bg-soft);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }

/* ── Topbar ──────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 100;
  min-height: 80px;
  background: var(--black);
  display: flex; align-items: center;
  padding: 0 28px;
  gap: 20px;
  box-shadow: 0 1px 0 rgba(255,255,255,.06);
}
.logo { 
  height: 55px; /* Bumped up to balance with the new 80px header */
  width: auto; 
}
.topbar-center { flex: 1; text-align: center; }
.product-name {
  font-size: 20px;
  font-weight: 600;
  color: var(--white);
  letter-spacing: .04em;
}
.ghost-btn {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,.38);
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,.12);
  transition: color .15s, border-color .15s;
  white-space: nowrap;
}
.ghost-btn:hover { color: rgba(255,255,255,.7); border-color: rgba(255,255,255,.28); }

/* ── App Layout ──────────────────────────────────────────────────── */
.app-layout {
  display: grid;
  grid-template-columns: 200px 1fr 320px;
  grid-template-rows: 1fr;
  min-height: calc(100vh - 80px);
}

/* ── Step Rail ───────────────────────────────────────────────────── */
.step-rail {
  background: var(--white);
  border-right: 1px solid var(--border);
  padding: 40px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.rail-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  cursor: default;
  transition: background .15s;
  border-left: 3px solid transparent;
}
.rail-step.active {
  background: var(--red-light);
  border-left-color: var(--red);
}
.rail-step.done {
  opacity: .55;
  border-left-color: transparent;
}
.rail-num {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--silver);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background .15s, color .15s;
}
.rail-step.active .rail-num {
  background: var(--red);
  color: var(--white);
}
/* done steps keep green check — intentional secondary accent */
.rail-step.done .rail-num {
  background: var(--green);
  color: var(--black);
}
.rail-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.3;
}
.rail-step.active .rail-label { color: var(--red-dk); }

/* ── Main Content ────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  width: 100%;
  max-width: 800px;
  min-width: 0;
  padding: 0 20px;
  margin: 0 auto; /* This forces the entire column to the center */
}

/* ── Dexter Sidebar ──────────────────────────────────────────────── */
.dexter-rail {
  background: var(--black);
  border-left: 1px solid rgba(255,255,255,.06);
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow-y: auto;
}
.dexter-card { display: flex; flex-direction: column; gap: 12px; }
.dexter-img-wrap {
  width: 100%;
  background: #1A1A1A;
  border-radius: 10px;
  min-height: 180px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
}

.dexter-img {
  width: 100%;
  max-width: 100%; /* Was previously capped at 250px — this sets him free! */
  height: auto;
  object-fit: contain;
  object-position: bottom center;
  display: block;
}
.dexter-name {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255,255,255,.3);
}
.dexter-tip {
  font-size: 14.5px; /* Bumped up from 13px to balance the larger image */
  color: rgba(255,255,255,.85); /* Made it slightly brighter white so it's easier to read! */
  line-height: 1.65;
}
.live-preview-box {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: var(--r);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.preview-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255,255,255,.28);
}
.preview-pre {
  font-family: var(--sans);
  font-size: 11.5px;
  color: rgba(255,255,255,.72);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.6;
  max-height: 320px;
  overflow-y: auto;
}
.copy-mini-btn {
  align-self: flex-end;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,.45);
  padding: 5px 10px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 5px;
  transition: color .15s, border-color .15s;
}
.copy-mini-btn:hover { color: var(--white); border-color: rgba(255,255,255,.35); }

/* ── Typography ──────────────────────────────────────────────────── */
.step-eyebrow {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
  margin-top: 24px; /* <-- This drops it safely away from the top edge! */
}

.step-headline {
  font-family: var(--serif);
  font-size: clamp(26px, 3vw, 38px);
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: -.5px;
  color: var(--black);
  margin-bottom: 12px;
}
.step-sub {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.6;
  max-width: 540px;
  margin-bottom: 36px;
}

/* ── Form ─────────────────────────────────────────────────────────── */
.form-stack {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-row { 
  display: grid; 
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); 
  gap: 16px; 
}

.field {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.field label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
}

.field input,
.field textarea {
  width: 100%;
  max-width: none;
  box-sizing: border-box; /* The magic bullet is safe! */
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  transition: all 0.2s;
}

.field input:focus, .field textarea:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(185,28,28,.10);
}

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

.field-hint {
  font-size: 14px; /* Much larger and more legible! */
  color: #2ea836; /* Your signature green */
  line-height: 1.55;
  font-style: italic;
  margin-top: 6px; 
  display: block; 
}

/* ── Button row ──────────────────────────────────────────────────── */
.btn-row { display: flex; align-items: center; gap: 12px; margin-top: 36px; }
.primary-btn {
  background: var(--red);
  color: var(--white);
  font-size: 15px;
  font-weight: 800;
  padding: 14px 28px;
  border-radius: 8px;
  transition: background .15s, box-shadow .15s;
  box-shadow: 0 2px 8px rgba(185,28,28,.28);
}
.primary-btn:hover { background: var(--red-dk); box-shadow: 0 4px 16px rgba(185,28,28,.35); }
.secondary-btn {
  background: var(--white);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  padding: 13px 22px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  transition: border-color .15s;
}
.secondary-btn:hover { border-color: var(--ink); }
.secondary-btn:disabled { opacity: .35; pointer-events: none; }

/* ── Template Browser ────────────────────────────────────────────── */
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 4px;
}
.template-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  padding: 20px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .18s, transform .18s;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  box-shadow: var(--shadow-sm);
}
.template-card:hover {
  border-color: var(--red);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.template-card.selected {
  border-color: var(--red);
  background: var(--red-light);
  box-shadow: 0 0 0 3px rgba(185,28,28,.12);
}
.template-num {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--red);
}
.template-title {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--black);
}
.template-what {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.55;
}
.template-ex {
  font-size: 12px;
  font-style: italic;
  color: var(--ink);
  border-left: 2px solid var(--border);
  padding-left: 10px;
  margin-top: 4px;
  line-height: 1.5;
}
.selected-check {
  position: absolute;
  top: 12px; right: 12px;
  width: 22px; height: 22px;
  background: var(--red);
  border-radius: 50%;
  display: none;
  align-items: center; justify-content: center;
}
.template-card.selected .selected-check { display: flex; }
.selected-check svg { width: 11px; height: 11px; }

/* ── Fill-in Step ────────────────────────────────────────────────── */
.selected-template-banner {
  background: var(--black);
  border-radius: var(--r);
  padding: 20px 24px;
  margin-bottom: 28px;
}
.stb-num { font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: rgba(255,255,255,.35); margin-bottom: 4px; }
.stb-title { font-family: var(--serif); font-size: 22px; font-weight: 900; color: var(--white); margin-bottom: 6px; }
.stb-template {
  font-size: 13.5px;
  color: rgba(255,255,255,.58);
  line-height: 1.65;
  font-style: italic;
  border-left: 2px solid var(--red);
  padding-left: 12px;
  margin-top: 8px;
}
.tip-box {
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  color: #92400E;
  line-height: 1.6;
  margin-bottom: 24px;
}
.tip-box strong { color: #78350F; }

/* ── Output ──────────────────────────────────────────────────────── */
.output-card {
  background: var(--white);
  border-radius: var(--r);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.output-header {
  background: var(--black);
  padding: 20px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.output-header-copy { display: flex; flex-direction: column; gap: 4px; }
.output-kicker {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(255,255,255,.35);
}
.output-title {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 900;
  color: var(--white);
}
.output-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.action-btn {
  font-size: 13px;
  font-weight: 700;
  padding: 9px 18px;
  border-radius: 6px;
  border: 1.5px solid rgba(255,255,255,.15);
  color: rgba(255,255,255,.8);
  transition: background .15s, border-color .15s;
}
.action-btn:hover { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.35); }
.action-btn.fill { background: var(--red); border-color: var(--red); color: var(--white); }
.action-btn.fill:hover { background: var(--red-dk); }
.output-body { padding: 32px 28px; }
.output-script {
  font-size: 16px;
  line-height: 1.8;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--sans);
}

/* ── Multi-variation output ─────────────────────────────────────── */
.variations-section {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.variations-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 16px;
}
.variation-block {
  background: var(--bg-soft);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  padding: 20px 22px;
  margin-bottom: 12px;
}
.variation-block + .variation-block { border-top: none; }
.variation-angle {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .10em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 10px;
}
.variation-text {
  font-size: 15px;
  line-height: 1.75;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Scene Guidance block ───────────────────────────────────────── */
.scene-guidance {
  margin-top: 28px;
  background: var(--red-light);
  border: 1.5px solid var(--green-dk);
  border-radius: var(--r);
  padding: 20px 22px;
}
.scene-guidance-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--green-txt);
  margin-bottom: 8px;
}
.scene-guidance p {
  font-size: 14px;
  color: var(--ink);
  line-height: 1.65;
}

/* ── How to use note ────────────────────────────────────────────── */
.how-to-use {
  margin-top: 20px;
  background: var(--bg-soft);
  border-radius: 8px;
  padding: 14px 18px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}
.how-to-use strong { color: var(--ink); }

/* ── Open workspace ─────────────────────────────────────────────── */
.workspace-section {
  margin-top: 28px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}
.workspace-label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.workspace-textarea {
  width: 100%;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  padding: 18px 20px;
  min-height: 200px;
  resize: vertical;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.workspace-textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(57,211,83,.1);
}
.workspace-copy-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}
.workspace-copy-btn {
  font-size: 13px;
  font-weight: 800;
  color: var(--black);
  background: var(--green); /* Your electric green! */
  border: 1.5px solid var(--green);
  border-radius: 6px;
  padding: 8px 16px;
  transition: opacity .15s;
}
.workspace-copy-btn:hover { opacity: 0.85; }

/* ── Output meta ─────────────────────────────────────────────────── */
.output-meta {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.output-meta-row { display: flex; gap: 8px; align-items: flex-start; }
.meta-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  min-width: 80px;
  padding-top: 2px;
}
.meta-value { font-size: 13px; color: var(--ink); line-height: 1.55; }
.disclaimer-box {
  background: var(--bg-soft);
  border-radius: 8px;
  padding: 14px 18px;
  margin-top: 20px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

/* ── Try-another strip ───────────────────────────────────────────── */
.try-another {
  margin-top: 24px;
  padding: 20px 24px;
  background: var(--white);
  border-radius: var(--r);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.try-another p { font-size: 14px; color: var(--muted); }
.try-another strong { color: var(--ink); }
.try-link {
  font-size: 14px;
  font-weight: 700;
  color: var(--red);
  border-bottom: 1.5px solid rgba(185,28,28,.25);
  transition: border-color .15s;
  white-space: nowrap;
  cursor: pointer;
}
.try-link:hover { border-color: var(--red); }

/* ── Welcome screen ──────────────────────────────────────────────── */
.welcome-split {
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
}

.welcome-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--red-light);
  border: 1px solid rgba(185,28,28,.25);
  color: var(--red-dk);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 100px;
  margin-bottom: 18px;
  margin-top: 40px; /* Drops it down so it can breathe */
}

.welcome-headline {
  font-family: var(--serif);
  font-size: clamp(30px, 3.5vw, 42px); /* Dropped the max size from 46px to 42px */
  font-weight: 900;
  line-height: 1.06;
  letter-spacing: -.8px;
  color: var(--black);
  margin-bottom: 16px;
}
.welcome-headline em { font-style: italic; color: var(--red); }
.welcome-sub {
  font-size: 16px;
  color: var(--muted);
  line-height: 1.65;
  margin-bottom: 28px;
  max-width: 460px;
}
.feature-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 32px;
}
.pill {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 13px;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 100px;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.welcome-dexter {
  background: var(--black);
  border-radius: 14px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.welcome-dexter-img-wrap {
  width: 100%;
  background: #1A1A1A;
  border-radius: 10px;
  min-height: 200px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
} /* <-- This little bracket was missing! */

.welcome-dexter-text {
  font-size: 14.5px; 
  color: rgba(255,255,255,.85); 
  line-height: 1.65;
}

.dexter-tip {
  font-size: 14.5px; 
  color: rgba(255,255,255,.85);
  line-height: 1.65;
}
/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .app-layout { grid-template-columns: 1fr; }
  .step-rail { flex-direction: row; border-right: none; border-bottom: 1px solid var(--border); padding: 12px 16px; overflow-x: auto; }
  .dexter-rail { border-left: none; border-top: 1px solid var(--border); min-height: 250px; padding: 20px; }
  .main-content {
  padding: 48px 52px;
  overflow-y: auto;
  max-width: 100%;
}
  .welcome-dexter { display: flex; justify-content: center; }
  .template-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}

/* ── Print ───────────────────────────────────────────────────────── */
@media print {
  ::placeholder { color: transparent !important; opacity: 0 !important; }
  input::placeholder, textarea::placeholder { color: transparent !important; opacity: 0 !important; }
  .topbar, .step-rail, .dexter-rail, .btn-row, .try-another, .workspace-section,
  .ghost-btn, .action-btn, .output-actions { display: none !important; }
  .output-card { box-shadow: none; border: 1px solid #ddd; }
  body { background: white; }
}
/* ── Final Visual Overrides ── */

/* 1. True Red Start Over Button */
#restartBtn {
  background-color: #cc0000 !important; 
  color: white !important;
  border: none;
  font-weight: bold;
  padding: 10px 20px;
  border-radius: 4px;
}

/* 2. Brighten Header Title */
header, .header-title, nav {
  color: #ffffff !important;
}
/* ── Mobile Layout Overrides ─────────────────────────────────────── */
@media (max-width: 900px) { 
  .app-layout { 
    display: flex;
    flex-direction: column;
  }

  .step-rail { 
    order: 1; 
  }
  
  .dexter-rail { 
    order: 2; 
    border-top: none; 
    border-bottom: 1px solid var(--border);
    min-height: auto; 
  }

  /* Stops Dexter from taking over your entire phone screen */
  .dexter-rail img {
    max-width: 220px; 
    margin: 0 auto;
    display: block;
  }

  .main-content { 
    order: 3; 
  }
}