/* ============================================
   BACKSTAGE v8 — Desktop sidebar + tutorial
   ============================================ */

:root {
  /* Default theme: Sky (blue) */
  --accent:         #7c9ec9;
  --accent-hover:   #96b8db;
  --accent-dim:     rgba(124,158,201,0.12);
  --bg:             #0f0f0f;
  --bg-card:        #1a1a1a;
  --bg-card-edited: #1a1f1a;
  --border:         #2a2a2a;
  --border-edited:  #3a5a3a;
  --text:           #e8e4df;
  --text-muted:     #8a8580;
  --text-dim:       #5a5550;
  --edit-bg:        #141414;
  --success:        #5a8a5a;
  --locked:         #3a3a3a;
  --locked-text:    #555;
  --complete-overlay: rgba(10,10,10,0.72);
  --tray-bg:        #111114;
  --sidebar-bg:     #111114;
  --font-body:      'Georgia', 'Times New Roman', serif;
  --font-ui:        -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:      'SF Mono', 'Menlo', monospace;
  --space-xs:       0.5rem;
  --space-sm:       1rem;
  --space-md:       1.5rem;
  --space-lg:       2.5rem;
  --space-xl:       4rem;
  --radius:         12px;
  --radius-sm:      8px;
  --topbar-h:       56px;
  --bottombar-h:    72px;
  --sidebar-w:      0px;
  --transition:     0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body { font-family: var(--font-body); background: var(--bg); color: var(--text); line-height: 1.65; min-height: 100dvh; -webkit-font-smoothing: antialiased; overflow: hidden; touch-action: pan-y; }

/* ===== TOP BAR ===== */
.topbar { position: fixed; top: 0; left: var(--sidebar-w); right: 0; height: var(--topbar-h); background: var(--bg); border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 var(--space-sm); z-index: 100; gap: var(--space-xs); }
.progress-wrap { flex: 1; display: flex; flex-direction: column; gap: 4px; cursor: pointer; }
.progress-label { font-family: var(--font-ui); font-size: 0.75rem; color: var(--text-dim); letter-spacing: 0.02em; }
.progress-bar { height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width var(--transition), background-color var(--transition); }
.topbar-settings, .topbar-reset { background: none; border: none; color: var(--text-dim); cursor: pointer; padding: 8px; font-size: 1.38rem; line-height: 1; flex-shrink: 0; transition: color var(--transition); }
.topbar-settings:hover, .topbar-reset:hover { color: var(--text); }

/* ===== TOP DROPDOWN MENU ===== */
.top-menu {
  position: fixed; top: var(--topbar-h); left: calc(var(--sidebar-w) + var(--space-sm)); right: var(--space-sm);
  z-index: 210; background: var(--tray-bg);
  border: 1px solid rgba(124,158,201,0.12); border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: 0 12px 40px -10px rgba(0,0,0,0.5);
  padding: 0.5rem; max-width: 480px; margin: 0 auto;
  opacity: 0; transform: translateY(-8px) scale(0.97);
  pointer-events: none; transition: opacity 0.2s, transform 0.2s;
  transform-origin: top center;
  display: flex; flex-direction: column; gap: 2px;
}
.top-menu.is-open { opacity: 1; transform: none; pointer-events: auto; }

.top-menu a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 6px;
  font-family: var(--font-ui); font-size: 0.82rem; font-weight: 500;
  color: var(--text-dim); text-decoration: none;
  transition: color 0.15s, background 0.15s;
}
.top-menu a:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.top-menu a.is-active { color: var(--text); background: var(--accent-dim); }
.top-menu a.is-locked { opacity: 0.3; pointer-events: none; }

.top-menu-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--border); flex-shrink: 0; transition: background 0.2s; }
.top-menu a.is-complete .top-menu-dot { background: var(--success); }
.top-menu a.is-active .top-menu-dot { background: var(--accent); box-shadow: 0 0 0 2px var(--accent-dim); }

/* ===== SIDEBAR (desktop only, hidden on mobile) ===== */
.sidebar {
  display: none;
  position: fixed; left: 0; top: 0; bottom: 0;
  width: 260px; background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  z-index: 101;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo {
  font-family: var(--font-ui); font-size: 0.6rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.15em;
  color: var(--accent); display: block; margin-bottom: 2px;
}
.sidebar-project {
  font-family: var(--font-ui); font-size: 1.1rem; font-weight: 700;
  letter-spacing: -0.02em; color: var(--text);
}

.sidebar-steps {
  flex: 1; overflow-y: auto; padding: 8px 0;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}

.sidebar-step {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px; margin: 0 8px; border-radius: 8px;
  font-family: var(--font-ui); font-size: 0.82rem; font-weight: 500;
  color: var(--text-dim); cursor: pointer;
  border: none; background: none; width: calc(100% - 16px); text-align: left;
  transition: all 0.15s; position: relative;
  opacity: 0; transform: translateX(-12px);
  animation: sidebarSlideIn 0.3s ease forwards;
}
.sidebar-step:nth-child(1) { animation-delay: 0.05s; }
.sidebar-step:nth-child(2) { animation-delay: 0.1s; }
.sidebar-step:nth-child(3) { animation-delay: 0.15s; }
.sidebar-step:nth-child(4) { animation-delay: 0.2s; }
.sidebar-step:nth-child(5) { animation-delay: 0.25s; }
.sidebar-step:nth-child(6) { animation-delay: 0.3s; }
.sidebar-step:nth-child(7) { animation-delay: 0.35s; }
.sidebar-step:nth-child(8) { animation-delay: 0.4s; }
.sidebar-step:nth-child(9) { animation-delay: 0.45s; }
.sidebar-step:nth-child(10) { animation-delay: 0.5s; }

@keyframes sidebarSlideIn {
  to { opacity: 1; transform: translateX(0); }
}

.sidebar-step:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.sidebar-step.is-active { color: var(--text); background: var(--accent-dim); border-left: 3px solid var(--accent); padding-left: 17px; }
.sidebar-step.is-locked { opacity: 0.25; pointer-events: none; }

.sidebar-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--border); flex-shrink: 0;
  transition: all 0.2s;
}
.sidebar-step.is-active .sidebar-dot { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.sidebar-step.is-complete .sidebar-dot { background: var(--success); }

.sidebar-step-label { flex: 1; }

.sidebar-check {
  font-size: 0.7rem; color: var(--success);
  opacity: 0; transition: opacity 0.2s;
}
.sidebar-step.is-complete .sidebar-check { opacity: 1; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.sidebar-progress {
  height: 3px; background: var(--border); border-radius: 2px;
  overflow: hidden; margin-bottom: 8px;
}
.sidebar-progress-fill {
  height: 100%; background: var(--accent); border-radius: 2px;
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.sidebar-progress-text {
  font-family: var(--font-ui); font-size: 0.7rem;
  color: var(--text-dim); letter-spacing: 0.02em;
}

/* ===== BOTTOM TRAY (mobile — mirrors desktop sidebar) ===== */
.tray {
  position: fixed; bottom: var(--bottombar-h); left: 0; right: 0;
  z-index: 200; background: var(--tray-bg);
  border-top: 1px solid rgba(124,158,201,0.12);
  box-shadow: 0 -8px 32px -8px rgba(0,0,0,0.45);
  transform: translateY(calc(100% + var(--bottombar-h)));
  transition: transform var(--transition);
  max-height: calc(100dvh - var(--topbar-h) - var(--bottombar-h) - 20px);
  display: flex; flex-direction: column;
}
.tray.is-open { transform: translateY(0); }

.tray-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px 8px; flex-shrink: 0; }
.tray-label { font-family: var(--font-mono); font-size: 0.6rem; font-weight: 600; text-transform: uppercase; letter-spacing: 1.5px; color: var(--accent); }
.tray-close { background: none; border: none; color: var(--text-dim); font-size: 1.3rem; cursor: pointer; padding: 2px 6px; line-height: 1; transition: color 0.2s; }
.tray-close:hover { color: var(--text); }

.tray-steps {
  flex: 1; overflow-y: auto; padding: 4px 8px 8px;
  -webkit-overflow-scrolling: touch;
}

.tray-step {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; margin-bottom: 2px; border-radius: 8px;
  font-family: var(--font-ui); font-size: 0.85rem; font-weight: 500;
  color: var(--text-dim); cursor: pointer;
  border: none; background: none; width: 100%; text-align: left;
  transition: all 0.15s;
}
.tray-step:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.tray-step.is-active { color: var(--text); background: var(--accent-dim); border-left: 3px solid var(--accent); padding-left: 9px; }
.tray-step.is-locked { opacity: 0.25; pointer-events: none; }

.tray-step-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--border); flex-shrink: 0;
  transition: all 0.2s;
}
.tray-step.is-active .tray-step-dot { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.tray-step.is-complete .tray-step-dot { background: var(--success); }

.tray-step-label { flex: 1; }

.tray-step-check {
  font-size: 0.7rem; color: var(--success);
  opacity: 0; transition: opacity 0.2s;
}
.tray-step.is-complete .tray-step-check { opacity: 1; }

.tray-footer {
  padding: 10px 16px 14px; border-top: 1px solid var(--border); flex-shrink: 0;
}
.tray-progress { height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; margin-bottom: 6px; }
.tray-progress-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1); }
.tray-progress-text { font-family: var(--font-ui); font-size: 0.7rem; color: var(--text-dim); }

/* ===== FAB (mobile only) ===== */
.fab {
  position: fixed; bottom: calc(var(--bottombar-h) + 10px); right: 1rem;
  z-index: 210; width: 48px; height: 48px; border-radius: 50%;
  background: var(--accent); color: var(--bg);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px -4px rgba(0,0,0,0.4), 0 0 0 1px rgba(124,158,201,0.2);
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}
.fab:hover { transform: scale(1.08); }
.fab.is-open { background: var(--text-dim); }
.fab svg { pointer-events: none; }

/* ===== NAV ARROWS ===== */
.nav-arrows {
  position: fixed; bottom: calc(var(--bottombar-h) + 10px);
  left: var(--sidebar-w); right: 0;
  display: flex; justify-content: space-between;
  padding: 0 var(--space-sm); pointer-events: none;
  z-index: 90; max-width: 520px; margin: 0 auto;
}
.nav-arrow {
  pointer-events: auto; width: 48px; height: 48px;
  border-radius: 50%; background: var(--bg-card);
  border: 1px solid var(--border); color: var(--text-muted);
  font-size: 1.3rem; display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all var(--transition);
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}
.nav-arrow:hover { border-color: var(--accent); color: var(--accent); }
.nav-arrow:disabled { opacity: 0.2; pointer-events: none; }
.nav-arrow.next { visibility: hidden; }

/* ===== STEP VIEWPORT ===== */
.step-viewport { position: fixed; top: var(--topbar-h); bottom: var(--bottombar-h); left: var(--sidebar-w); right: 0; overflow: hidden; }
.step { position: absolute; top: 0; left: 0; right: 0; bottom: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: var(--space-md) var(--space-sm); padding-bottom: calc(var(--space-xl) + 60px); max-width: 480px; margin: 0 auto; opacity: 0; transform: translateX(0); pointer-events: none; will-change: opacity, transform; transition: opacity 0.3s ease, transform 0.3s ease; }
.step.active { opacity: 1; transform: translateX(0); pointer-events: auto; }
.step.entering-right { opacity: 0; transform: translateX(60px); pointer-events: none; transition: none; }
.step.entering-left { opacity: 0; transform: translateX(-60px); pointer-events: none; transition: none; }
.step.exiting-left { opacity: 0; transform: translateX(-60px); pointer-events: none; }
.step.exiting-right { opacity: 0; transform: translateX(60px); pointer-events: none; }

/* ===== STEP HEADER & BODY ===== */
.step-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: var(--space-sm); position: relative; z-index: 15; }
.step-header-text { flex: 1; }
.step-header-text .dim { margin-bottom: 4px; }
.step-header-text h1 { margin-bottom: 4px; }
.step-header-text .muted { margin-bottom: 0; }
.step-body { position: relative; }

/* ===== COMPLETION OVERLAY ===== */
.step-complete-overlay { display: none; position: absolute; inset: -8px; background: var(--complete-overlay); z-index: 10; align-items: center; justify-content: center; flex-direction: column; gap: var(--space-sm); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); border-radius: var(--radius); min-height: 200px; }
.step-body.completed .step-complete-overlay { display: flex; }
.complete-stamp { font-family: var(--font-ui); font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.15em; color: var(--success); border: 2px solid var(--success); border-radius: var(--radius-sm); padding: 8px 24px; transform: rotate(-3deg); animation: stampIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; }
@keyframes stampIn { 0% { opacity: 0; transform: rotate(-3deg) scale(1.5); } 100% { opacity: 1; transform: rotate(-3deg) scale(1); } }
.complete-tap-hint { font-family: var(--font-ui); font-size: 0.75rem; color: var(--text-dim); }

/* ===== BOTTOM BAR ===== */
.bottombar { position: fixed; bottom: 0; left: var(--sidebar-w); right: 0; height: var(--bottombar-h); background: var(--bg); border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: center; padding: 0 var(--space-sm); z-index: 100; }
.continue-btn { width: 100%; max-width: 480px; font-family: var(--font-ui); font-size: 1rem; font-weight: 600; background: var(--accent); color: var(--bg); border: none; border-radius: var(--radius); padding: 14px 0; cursor: pointer; transition: all var(--transition); letter-spacing: -0.01em; }
.continue-btn:hover { background: var(--accent-hover); }
.continue-btn:active { transform: scale(0.98); }
.continue-btn:disabled { background: var(--locked); color: var(--locked-text); cursor: not-allowed; }
.continue-btn.sent { background: var(--success); color: #fff; }

/* ===== THEME PICKER ===== */
.theme-picker { position: fixed; top: var(--topbar-h); right: 0; background: var(--bg-card); border: 1px solid var(--border); border-top: none; border-radius: 0 0 0 var(--radius); padding: var(--space-sm); z-index: 110; display: none; flex-direction: column; gap: var(--space-xs); }
.theme-picker.open { display: flex; }
.theme-picker-label { font-family: var(--font-ui); font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); margin-bottom: 2px; }
.theme-swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; transition: all 0.2s; }
.swatch:hover { transform: scale(1.15); }
.swatch.active { border-color: var(--text); box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--text); }

/* ===== TYPOGRAPHY ===== */
h1 { font-family: var(--font-ui); font-size: 1.5rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.3; margin-bottom: var(--space-xs); }
h2 { font-family: var(--font-ui); font-size: 1.05rem; font-weight: 600; letter-spacing: -0.01em; color: var(--accent); margin-bottom: var(--space-xs); transition: color var(--transition); }
p { margin-bottom: var(--space-sm); }
.muted { color: var(--text-muted); font-size: 0.9rem; }
.dim { color: var(--text-dim); font-size: 0.85rem; font-family: var(--font-ui); }
blockquote { border-left: 2px solid var(--accent); padding-left: var(--space-sm); margin: var(--space-sm) 0; color: var(--text-muted); font-style: italic; transition: border-color var(--transition); }

/* ===== WELCOME ===== */
.welcome-bg {
  position: absolute; inset: 0; z-index: 0;
  background: radial-gradient(ellipse at 30% 20%, rgba(124,158,201,0.08) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 80%, rgba(124,158,201,0.05) 0%, transparent 50%);
  animation: welcomeBgShift 12s ease-in-out infinite alternate;
}
@keyframes welcomeBgShift {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}

.welcome-content { position: relative; z-index: 1; }

.welcome-anim { text-align: center; padding-top: var(--space-xl); }
.welcome-eyebrow { font-family: var(--font-mono); font-size: 0.6rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.25em; color: var(--accent); opacity: 0; animation: fadeDown 0.6s 0.3s ease forwards; }
.welcome-title { font-family: var(--font-ui); font-size: 2.4rem; font-weight: 700; letter-spacing: -0.03em; margin: var(--space-sm) 0; opacity: 0; animation: fadeDown 0.7s 0.6s ease forwards; }
.welcome-line { width: 48px; height: 2px; background: var(--accent); margin: 0 auto; opacity: 0; animation: growLine 0.6s 1s ease forwards; }
.welcome-subtitle { font-family: var(--font-ui); font-size: 1rem; color: var(--text-muted); font-weight: 400; margin-top: var(--space-sm); opacity: 0; animation: fadeUp 0.5s 1.3s ease forwards; }

.welcome-body { text-align: left; opacity: 0; animation: fadeUp 0.5s 1.6s ease forwards; margin-top: var(--space-lg); }

.welcome-instructions {
  display: flex; flex-direction: column; gap: 10px;
  margin: var(--space-md) 0;
  padding: var(--space-sm) 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.welcome-inst-item {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--font-ui); font-size: 0.88rem;
  color: var(--text-muted);
}

.welcome-inst-num {
  font-family: var(--font-mono); font-size: 0.65rem;
  font-weight: 700; color: var(--accent);
  width: 24px; text-align: right; flex-shrink: 0;
}

/* Play button pulse */
.play-btn.pulse {
  animation: playPulse 2s ease-in-out infinite;
  animation-delay: 2s;
}

@keyframes playPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(124,158,201,0.3); }
  50% { box-shadow: 0 0 0 10px rgba(124,158,201,0); }
}

@keyframes fadeDown { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes growLine { from { opacity: 0; width: 0; } to { opacity: 1; width: 48px; } }

/* ===== VOICE MEMO ===== */
.voice-memo { display: flex; align-items: center; gap: var(--space-sm); background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-sm) var(--space-md); margin: var(--space-md) 0; }
.play-btn { width: 48px; height: 48px; border-radius: 50%; background: var(--accent); border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background 0.2s; }
.play-btn:hover { background: var(--accent-hover); }
.play-btn svg { width: 20px; height: 20px; fill: var(--bg); margin-left: 2px; }
.play-btn.playing svg { margin-left: 0; }
.voice-meta .label { font-family: var(--font-ui); font-size: 0.85rem; font-weight: 500; }
.voice-meta .duration { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-dim); }

/* ===== CARDS ===== */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-md); margin-bottom: var(--space-sm); position: relative; transition: border-color var(--transition), background var(--transition), transform 0.2s, box-shadow 0.2s; }
.card.edited { background: var(--bg-card-edited); border-color: var(--border-edited); }
.card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: var(--space-xs); }
.card-header h2 { margin-bottom: 0; }
.edit-toggle { font-family: var(--font-ui); font-size: 0.75rem; font-weight: 500; color: var(--accent); background: none; border: 1px solid var(--accent); border-radius: var(--radius-sm); padding: 4px 12px; cursor: pointer; transition: all 0.2s; white-space: nowrap; flex-shrink: 0; margin-left: var(--space-sm); }
.edit-toggle:hover { background: var(--accent); color: var(--bg); }
.card-content { transition: all 0.2s; }
.card-content.editing { background: var(--edit-bg); border-radius: var(--radius-sm); padding: var(--space-sm); margin: 0 calc(-1 * var(--space-sm)); outline: 1px solid var(--border); min-height: 80px; }
.card-content.editing:focus { outline-color: var(--accent); }
.card-content p:last-child { margin-bottom: 0; }
.card-actions { display: none; margin-top: var(--space-xs); gap: var(--space-xs); justify-content: flex-end; }
.card-actions.visible { display: flex; }
.btn-save, .btn-cancel { font-family: var(--font-ui); font-size: 0.8rem; font-weight: 500; padding: 6px 16px; border-radius: var(--radius-sm); cursor: pointer; border: none; transition: all 0.2s; }
.btn-save { background: var(--accent); color: var(--bg); }
.btn-save:hover { background: var(--accent-hover); }
.btn-cancel { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-cancel:hover { border-color: var(--text-muted); }
.edited-badge { display: none; font-family: var(--font-mono); font-size: 0.7rem; color: var(--success); margin-top: var(--space-xs); }
.card.edited .edited-badge { display: block; }

/* ===== ADD NOTE ===== */
.add-note { margin-top: var(--space-sm); }
.add-note-toggle { font-family: var(--font-ui); font-size: 0.8rem; color: var(--text-dim); background: none; border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: 8px 14px; cursor: pointer; width: 100%; text-align: left; transition: all 0.2s; }
.add-note-toggle:hover { border-color: var(--accent); color: var(--accent); }
.add-note-area { display: none; margin-top: var(--space-xs); }
.add-note-area.open { display: block; }
.add-note-area textarea { width: 100%; min-height: 80px; background: var(--edit-bg); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--space-sm); font-family: var(--font-body); font-size: 0.95rem; line-height: 1.6; resize: vertical; outline: none; }
.add-note-area textarea:focus { border-color: var(--accent); }

/* ===== NEEDS ===== */
.needs-grid { display: flex; flex-direction: column; gap: var(--space-xs); }
.need-box { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-sm) var(--space-md); cursor: pointer; transition: all var(--transition); display: flex; align-items: flex-start; gap: var(--space-sm); user-select: none; -webkit-user-select: none; }
.need-box:hover { border-color: var(--accent); }
.need-box.active { border-color: var(--accent); background: var(--accent-dim); }
.need-check { width: 24px; height: 24px; border-radius: 6px; border: 2px solid var(--border); flex-shrink: 0; display: flex; align-items: center; justify-content: center; transition: all var(--transition); margin-top: 2px; }
.need-box.active .need-check { background: var(--accent); border-color: var(--accent); }
.need-check svg { width: 14px; height: 14px; stroke: var(--bg); stroke-width: 3; fill: none; opacity: 0; transition: opacity 0.2s; }
.need-box.active .need-check svg { opacity: 1; }
.need-label strong { font-family: var(--font-ui); font-size: 0.95rem; font-weight: 600; display: block; margin-bottom: 2px; }
.need-label span { font-size: 0.85rem; color: var(--text-muted); line-height: 1.4; }
.need-box.custom-need { border-style: dashed; }
.need-box.custom-need .need-label { flex: 1; }
.custom-need-input { width: 100%; background: transparent; border: none; color: var(--text); font-family: var(--font-ui); font-size: 0.95rem; font-weight: 600; outline: none; padding: 0; }
.custom-need-input::placeholder { color: var(--text-dim); font-weight: 400; }
.add-need-btn { font-family: var(--font-ui); font-size: 0.8rem; color: var(--text-dim); background: none; border: 1px dashed var(--border); border-radius: var(--radius); padding: 12px; cursor: pointer; width: 100%; text-align: center; transition: all 0.2s; margin-top: var(--space-xs); }
.add-need-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ===== PATHS ===== */
.paths { display: flex; flex-direction: column; gap: var(--space-sm); }
.path-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-md); cursor: pointer; transition: all var(--transition); overflow: hidden; }
.path-card:hover { border-color: var(--accent); }
.path-card.selected { border-color: var(--accent); background: linear-gradient(135deg, var(--bg-card) 0%, var(--accent-dim) 100%); }
.path-card h2, .path-card > p { pointer-events: none; }
.path-expand { display: none; margin-top: var(--space-sm); padding-top: var(--space-sm); border-top: 1px solid var(--border); }
.path-card.selected .path-expand { display: block; }
.path-expand textarea { width: 100%; min-height: 80px; background: var(--edit-bg); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--space-sm); font-family: var(--font-body); font-size: 0.95rem; line-height: 1.6; resize: vertical; outline: none; margin-top: var(--space-xs); pointer-events: auto; }
.path-expand textarea:focus { border-color: var(--accent); }
.calendly-btn { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-ui); font-size: 0.85rem; font-weight: 600; background: var(--accent); color: var(--bg); border: none; border-radius: var(--radius-sm); padding: 10px 16px; cursor: pointer; transition: all 0.2s; margin-bottom: var(--space-xs); pointer-events: auto; }
.calendly-btn:hover { background: var(--accent-hover); }
.calendly-btn svg { width: 16px; height: 16px; fill: none; stroke: var(--bg); }

/* ===== MATERIALS / UPLOAD ===== */
.materials-section { margin-top: var(--space-sm); }

.materials-paste {
  width: 100%; min-height: 100px;
  background: var(--edit-bg); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: var(--space-sm); font-family: var(--font-body);
  font-size: 0.95rem; line-height: 1.6; resize: vertical; outline: none;
  margin-bottom: var(--space-sm);
}
.materials-paste:focus { border-color: var(--accent); }
.materials-paste::placeholder { color: var(--text-dim); }

.upload-zone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: var(--space-lg) var(--space-md);
  text-align: center; cursor: pointer;
  transition: all 0.2s; position: relative;
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.upload-zone-icon {
  font-size: 2rem; margin-bottom: var(--space-xs);
  color: var(--text-dim); transition: color 0.2s;
}
.upload-zone:hover .upload-zone-icon { color: var(--accent); }

.upload-zone-text {
  font-family: var(--font-ui); font-size: 0.85rem;
  color: var(--text-muted); margin-bottom: 4px;
}

.upload-zone-hint {
  font-family: var(--font-ui); font-size: 0.72rem;
  color: var(--text-dim);
}

.upload-zone input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
}

.upload-list {
  margin-top: var(--space-sm);
  display: flex; flex-direction: column; gap: 6px;
}

.upload-item {
  display: flex; align-items: center; gap: var(--space-xs);
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 12px;
  font-family: var(--font-ui); font-size: 0.82rem;
}

.upload-item-name { flex: 1; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-item-size { color: var(--text-dim); font-size: 0.72rem; font-family: var(--font-mono); flex-shrink: 0; }

.upload-item-remove {
  background: none; border: none; color: var(--text-dim);
  cursor: pointer; font-size: 1.1rem; padding: 0 4px; line-height: 1;
  transition: color 0.2s;
}
.upload-item-remove:hover { color: #e07d7d; }

/* ===== SITE PREVIEWS (current + new direction) ===== */
.site-preview {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: var(--space-sm);
  max-width: 600px;
}

.preview-chrome {
  display: flex; align-items: center; gap: 8px;
  background: #1a1a1e; padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

.preview-dots {
  display: flex; gap: 5px;
}

.preview-dots span {
  width: 8px; height: 8px; border-radius: 50%;
  background: #333;
}

.preview-url {
  flex: 1; text-align: center;
  font-family: var(--font-mono); font-size: 0.65rem;
  color: var(--text-dim); letter-spacing: 0.02em;
}

.preview-body {
  position: relative; overflow: hidden;
}

.preview-annotation {
  margin-top: var(--space-sm);
  font-family: var(--font-ui); font-size: 0.85rem;
  color: var(--text-muted); line-height: 1.5;
  font-style: italic;
}

/* --- Current site (mackstage.com recreation) --- */
.cs-homepage {
  background: #f5f5f0;
  min-height: 200px;
  position: relative;
  overflow: hidden;
}

.cs-dormant-badge {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  font-family: var(--font-mono); font-size: 0.55rem;
  text-transform: uppercase; letter-spacing: 1px;
  color: #999; background: rgba(0,0,0,0.6); color: rgba(255,255,255,0.6);
  padding: 3px 8px; border-radius: 3px;
}

.cs-hero-split {
  display: flex; min-height: 200px;
}

.cs-hero-left {
  flex: 1; padding: 28px 20px;
  display: flex; flex-direction: column; justify-content: center;
}

.cs-hero-title {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 1.6rem; font-weight: 800; color: #222;
  line-height: 1.1; margin-bottom: 8px;
}

.cs-hero-subtitle {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 0.5rem; font-weight: 400;
  letter-spacing: 0.15em; text-transform: uppercase;
  color: #666; margin-bottom: 4px;
}

.cs-hero-desc {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 0.65rem; color: #888;
  letter-spacing: 0.03em; margin-bottom: 12px;
}

.cs-hero-nav {
  display: flex; gap: 8px;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 0.5rem; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: #444;
}

.cs-hero-right {
  flex: 1; overflow: hidden; position: relative;
}

.cs-hero-right img {
  position: absolute; top: 0; right: 0;
  width: 200%; height: 100%; object-fit: cover;
  object-position: right center;
}

/* Page thumbnail grid */
.cs-pages-label {
  font-family: var(--font-ui); font-size: 0.8rem;
  font-weight: 600; color: var(--text-dim);
  margin: var(--space-sm) 0 var(--space-xs);
  text-transform: uppercase; letter-spacing: 0.05em;
}

.cs-page-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  margin-bottom: var(--space-sm);
}

.cs-page-thumb {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  overflow: hidden; position: relative;
  aspect-ratio: 3/4;
}

.cs-page-thumb img {
  width: 100%; height: 100%; object-fit: cover;
  object-position: top center;
  filter: brightness(0.85);
  transition: filter 0.2s;
}

.cs-page-thumb:hover img { filter: brightness(1); }

.cs-page-name {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  padding: 16px 8px 6px;
  font-family: var(--font-ui); font-size: 0.68rem;
  font-weight: 600; color: #fff;
  letter-spacing: 0.03em;
}

/* --- New direction preview --- */
.new-direction .preview-body {
  background: linear-gradient(160deg, #111115 0%, #16131a 100%);
  min-height: 360px;
  display: flex; flex-direction: column;
  padding: 40px 24px 32px;
}

.nd-prompt {
  font-family: var(--font-ui); font-size: 1.1rem;
  font-weight: 500; color: var(--text);
  line-height: 1.5; margin-bottom: 24px;
  max-width: 340px;
}

.nd-options {
  display: flex; flex-direction: column; gap: 10px;
  margin-bottom: 28px;
}

.nd-option {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px; padding: 14px 16px;
  font-family: var(--font-ui); font-size: 0.88rem;
  color: var(--text-muted);
  transition: border-color 0.2s;
  cursor: default;
}

.nd-option:hover { border-color: rgba(255,255,255,0.15); }

.nd-option-dot {
  width: 8px; height: 8px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.2);
  flex-shrink: 0;
}

.nd-depth-hint {
  display: flex; align-items: center; gap: 10px;
  margin-top: auto;
}

.nd-depth-text {
  font-family: var(--font-ui); font-size: 0.72rem;
  color: var(--text-dim); letter-spacing: 0.02em;
}

.nd-depth-bar {
  flex: 1; height: 2px; background: var(--border);
  border-radius: 1px; position: relative;
  max-width: 120px;
}

.nd-depth-fill {
  position: absolute; left: 0; top: 0;
  width: 20%; height: 100%;
  background: var(--accent); border-radius: 1px;
}

.nd-draft-badge {
  position: absolute; top: 12px; right: 12px;
  font-family: var(--font-mono); font-size: 0.55rem;
  text-transform: uppercase; letter-spacing: 1px;
  color: var(--accent); opacity: 0.6;
  border: 1px solid currentColor;
  padding: 3px 8px; border-radius: 3px;
}

/* --- Comparison grid (new vs old) --- */
.nd-comparison {
  margin-top: var(--space-md);
}

.nd-compare-label {
  font-family: var(--font-ui); font-size: 0.75rem;
  font-weight: 600; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.05em;
  margin-bottom: var(--space-xs);
}

.nd-compare-grid {
  display: flex; flex-direction: column; gap: 6px;
}

.nd-compare-item {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-ui); font-size: 0.78rem; line-height: 1.4;
}

.nd-compare-old {
  flex: 1; color: var(--text-dim);
  text-decoration: line-through;
  text-decoration-color: rgba(255,255,255,0.15);
}

.nd-compare-arrow {
  color: var(--accent); flex-shrink: 0; font-size: 0.9rem;
}

.nd-compare-new {
  flex: 1.2; color: var(--text); font-weight: 500;
}

@media (min-width: 768px) {
  .site-preview { max-width: 640px; margin-left: auto; margin-right: auto; }
  .cs-hero-title { font-size: 2.2rem; }
  .cs-hero-split { min-height: 280px; }
  .cs-hero-subtitle { font-size: 0.6rem; }
  .cs-hero-desc { font-size: 0.75rem; }
  .cs-hero-nav { font-size: 0.55rem; }
  .cs-page-grid { grid-template-columns: 1fr 1fr 1fr; }
  .new-direction .preview-body { min-height: 400px; padding: 48px 32px 36px; }
  .nd-prompt { font-size: 1.2rem; }
  .nd-compare-item { font-size: 0.82rem; }
}

/* ===== CLOSING BOOKEND ===== */
.closing-bg {
  position: absolute; inset: 0; z-index: 0;
  background: radial-gradient(ellipse at 70% 80%, rgba(124,158,201,0.08) 0%, transparent 60%),
              radial-gradient(ellipse at 20% 30%, rgba(90,138,90,0.06) 0%, transparent 50%);
  animation: closingBgShift 14s ease-in-out infinite alternate;
}
@keyframes closingBgShift {
  0% { opacity: 0.5; }
  50% { opacity: 1; }
  100% { opacity: 0.5; }
}

.closing-content { position: relative; z-index: 1; }

.closing-anim { text-align: center; padding-top: var(--space-lg); margin-bottom: var(--space-lg); }

.closing-eyebrow {
  font-family: var(--font-mono); font-size: 0.6rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.25em;
  color: var(--accent); margin-bottom: var(--space-xs);
}

.closing-title {
  font-family: var(--font-ui); font-size: 2rem; font-weight: 700;
  letter-spacing: -0.03em; margin-bottom: var(--space-sm);
}

.closing-line {
  width: 48px; height: 2px; background: var(--accent);
  margin: 0 auto var(--space-sm);
}

.closing-subtitle {
  font-family: var(--font-ui); font-size: 0.92rem;
  color: var(--text-muted); max-width: 360px;
  margin: 0 auto; line-height: 1.5;
}

/* Action cards — side by side, clickable */
.closing-actions {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  margin-bottom: var(--space-md);
}

.closing-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--space-md);
  text-align: center; cursor: pointer;
  transition: all 0.25s;
}

.closing-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px -8px rgba(0,0,0,0.3);
}

.closing-card-icon {
  color: var(--accent); margin-bottom: 10px;
  transition: transform 0.2s;
}

.closing-card:hover .closing-card-icon { transform: scale(1.1); }

.closing-card-icon svg { stroke: currentColor; fill: none; }

.closing-card-label {
  font-family: var(--font-ui); font-size: 0.92rem;
  font-weight: 700; color: var(--text); margin-bottom: 4px;
}

.closing-card-desc {
  font-family: var(--font-ui); font-size: 0.75rem;
  color: var(--text-dim); line-height: 1.4;
}

/* Notes */
.closing-notes { margin-bottom: var(--space-lg); }

.closing-notes textarea {
  width: 100%; min-height: 80px;
  background: var(--edit-bg); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: var(--space-sm); font-family: var(--font-body);
  font-size: 0.95rem; line-height: 1.6; resize: vertical; outline: none;
}

.closing-notes textarea:focus { border-color: var(--accent); }

/* Send */
.closing-send { text-align: center; margin-bottom: var(--space-md); }

.closing-send-btn {
  font-family: var(--font-ui); font-size: 1.2rem; font-weight: 700;
  background: var(--accent); color: var(--bg);
  border: none; border-radius: 999px;
  padding: 18px 56px; cursor: pointer;
  transition: all 0.3s; letter-spacing: -0.01em;
  box-shadow: 0 6px 28px -6px rgba(124,158,201,0.35);
  position: relative;
  overflow: hidden;
}

.closing-send-btn::before {
  content: '';
  position: absolute; inset: -2px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), transparent, var(--accent));
  opacity: 0; transition: opacity 0.3s;
  z-index: -1;
}

.closing-send-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 10px 36px -6px rgba(124,158,201,0.5);
}

.closing-send-btn:hover::before { opacity: 0.3; }
.closing-send-btn:active { transform: translateY(0); }

.closing-send-btn.is-sent {
  background: var(--success); color: #fff;
  pointer-events: none; box-shadow: none;
}

.closing-send-status {
  margin-top: var(--space-sm); font-family: var(--font-ui);
  font-size: 0.82rem; color: var(--text-dim); min-height: 1.5em;
}

/* Byline */
.closing-byline {
  text-align: center;
  font-family: var(--font-mono); font-size: 0.55rem;
  text-transform: uppercase; letter-spacing: 0.2em;
  color: var(--text-dim); opacity: 0.4;
  padding: var(--space-lg) 0 var(--space-sm);
}

@media (min-width: 768px) {
  .closing-title { font-size: 2.6rem; }
  .closing-actions { gap: 16px; }
  .closing-card { padding: var(--space-lg); }
  .closing-card-label { font-size: 1rem; }
  .closing-send-btn { font-size: 1.3rem; padding: 20px 64px; }
}

/* ===== TUTORIAL OVERLAY ===== */
.tutorial-overlay { position: fixed; inset: 0; z-index: 300; display: none; }
.tutorial-overlay.is-active { display: block; }
.tutorial-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.4); }

.tutorial-spotlight {
  position: absolute; border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.5),
              0 0 0 4px var(--accent),
              0 0 30px 8px rgba(124,158,201,0.2);
  transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
  background: rgba(255,255,255,0.03);
}

.tutorial-tooltip {
  position: absolute; width: 280px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--accent); border-radius: var(--radius);
  padding: 20px 22px; z-index: 301;
  box-shadow: 0 20px 50px -10px rgba(0,0,0,0.6),
              0 0 0 1px rgba(124,158,201,0.15);
  animation: tooltipPop 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes tooltipPop {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.tutorial-step-num {
  font-family: var(--font-mono); font-size: 0.65rem;
  text-transform: uppercase; letter-spacing: 1px;
  color: var(--accent); margin-bottom: 8px;
}

.tutorial-text {
  font-family: var(--font-ui); font-size: 0.9rem;
  line-height: 1.5; margin-bottom: 14px; color: var(--text);
}

.tutorial-actions {
  display: flex; justify-content: space-between; align-items: center;
}

.tutorial-skip {
  font-family: var(--font-ui); font-size: 0.8rem;
  color: var(--text-dim); background: none; border: none;
  cursor: pointer; padding: 6px 0; transition: color 0.2s;
}
.tutorial-skip:hover { color: var(--text); }

.tutorial-next {
  font-family: var(--font-ui); font-size: 0.8rem; font-weight: 600;
  background: var(--accent); color: var(--bg);
  border: none; border-radius: var(--radius-sm);
  padding: 8px 18px; cursor: pointer; transition: background 0.2s;
}
.tutorial-next:hover { background: var(--accent-hover); }

/* ========================================
   DESKTOP (768px+)
   ======================================== */
@media (min-width: 768px) {
  :root { --sidebar-w: 260px; }

  /* Show sidebar */
  .sidebar { display: flex; }

  /* Hide mobile-only elements */
  .fab { display: none; }
  .tray { display: none; }

  /* Show both nav arrows, center vertically */
  .nav-arrow.next { visibility: visible; }
  .nav-arrows {
    bottom: auto; top: 50%; transform: translateY(-50%);
    max-width: none; padding: 0;
    left: calc(var(--sidebar-w) + 12px); right: 12px;
  }
  .nav-arrow { width: 44px; height: 44px; font-size: 1.2rem; }

  /* Wider content */
  .step { max-width: 800px; padding: var(--space-lg) var(--space-xl); }
  .step.entering-right { transform: translateX(40px) scale(0.98); }
  .step.entering-left { transform: translateX(-40px) scale(0.98); }
  .step { transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.22, 1, 0.36, 1); }
  .continue-btn { max-width: 800px; }
  .top-menu { max-width: 800px; left: calc(var(--sidebar-w) + var(--space-sm)); }

  /* Typography */
  h1 { font-size: 1.85rem; }
  h2 { font-size: 1.15rem; }
  .welcome-anim { padding-top: calc(var(--space-xl) * 1.5); }
  .welcome-title { font-size: 2.8rem; }
  .welcome-line { animation-name: growLineWide; }
  @keyframes growLineWide { from { opacity: 0; width: 0; } to { opacity: 1; width: 60px; } }

  /* Cards get hover + more padding */
  .card { padding: var(--space-lg); border-radius: 16px; }
  .card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px -8px rgba(0,0,0,0.3); }

  /* Grids */
  .needs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-sm); }
  .paths { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--space-sm); }
  .path-card { min-height: 140px; }
}

/* ===== WIDE DESKTOP (1200px+) ===== */
@media (min-width: 1200px) {
  .step { max-width: 900px; }
  .continue-btn { max-width: 900px; }
  .nav-arrows { left: calc(var(--sidebar-w) + 24px); right: 24px; }
  .nav-arrow { width: 48px; height: 48px; font-size: 1.3rem; }
  .welcome-title { font-size: 3.2rem; }
}
