/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a0a0f;
  --bg-card: #14141f;
  --bg-elevated: #1c1c2e;
  --text: #e8e8f0;
  --text-muted: #8888a0;
  --accent: #6366f1;
  --accent-glow: rgba(99, 102, 241, 0.3);
  --accent-hover: #818cf8;
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;
  --radius: 12px;
  --radius-sm: 8px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

body.in-presentation {
  overflow: hidden;
}

/* ── Screens ── */
.screen {
  display: none;
  min-height: 100vh;
}
.screen.active { display: flex; }

/* ══════════════════════════════════════
   LANDING PAGE
   ══════════════════════════════════════ */
#consent-screen {
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(99,102,241,0.1) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(52,211,153,0.05) 0%, transparent 40%);
  overflow-y: auto;
}

.landing {
  max-width: 640px;
  width: 92%;
  padding: 3rem 0;
}

.landing-hero {
  text-align: center;
  margin-bottom: 3rem;
}

.logo {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--accent) 0%, #a78bfa 50%, var(--success) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}

.tagline {
  color: var(--text);
  font-size: 1.3rem;
  font-weight: 500;
  margin-bottom: 1rem;
}

.hero-sub {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.6;
  max-width: 480px;
  margin: 0 auto;
}

/* Features */
.landing-features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}

.feature {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  padding: 1.5rem 1.25rem;
  text-align: center;
}

.feature-icon {
  font-size: 1.75rem;
  margin-bottom: 0.75rem;
}

.feature h3 {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.feature p {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Action area */
.landing-action {
  text-align: center;
}

.slide-source {
  margin-bottom: 1.25rem;
}

.source-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
}

.source-tab {
  flex: 1;
  padding: 0.6rem 1rem;
  background: var(--bg-card);
  color: var(--text-muted);
  border: none;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.source-tab.active {
  background: var(--accent);
  color: white;
}
.source-tab:hover:not(.active):not(:disabled) {
  color: var(--text);
}
.source-tab:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.upload-area[hidden] { display: none; }

.drop-zone {
  border: 2px dashed rgba(255,255,255,0.1);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--accent);
  background: rgba(99,102,241,0.05);
}
.drop-zone p { color: var(--text-muted); font-size: 0.9rem; }
.drop-zone .drop-hint { font-size: 0.8rem; margin-top: 0.25rem; opacity: 0.6; }

#upload-info {
  display: flex;
  justify-content: space-between;
  margin-top: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}
#upload-info[hidden] { display: none; }
#upload-filename { color: var(--text); }
#upload-slide-count { color: var(--accent); }

.narration-status {
  margin-bottom: 1rem;
}
.narration-status[hidden] { display: none; }

.narration-progress {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

.progress-bar-track {
  width: 100%;
  max-width: 300px;
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 3px;
  overflow: hidden;
  margin: 0 auto;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--success));
  border-radius: 3px;
  transition: width 0.5s ease;
  width: 0%;
}

/* Name step */
.name-step {
  margin-bottom: 1.25rem;
}

.name-label {
  display: block;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.name-input {
  display: block;
  width: 100%;
  max-width: 300px;
  margin: 0 auto 1rem;
  padding: 0.7rem 1rem;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
  font-family: var(--font);
  text-align: center;
  transition: border-color 0.2s;
}
.name-input:focus {
  outline: none;
  border-color: var(--accent);
}
.name-input::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

/* CTA button */
.btn-cta {
  display: inline-block;
  background: linear-gradient(135deg, var(--accent) 0%, #34d399 100%);
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 1rem 3rem;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s;
  box-shadow: 0 4px 24px rgba(99,102,241,0.25);
}
.btn-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 32px rgba(99,102,241,0.35);
}
.btn-cta:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  background: var(--bg-elevated);
}

.landing-secondary {
  margin-top: 0.75rem;
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.btn-link {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.btn-link:hover { color: var(--text); }
.btn-link[hidden] { display: none; }

/* Privacy */
.landing-privacy {
  margin-top: 2.5rem;
  text-align: center;
}

.landing-privacy details {
  display: inline-block;
  text-align: left;
}

.landing-privacy summary {
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  text-align: center;
}
.landing-privacy summary:hover { color: var(--text); }

.landing-privacy ul {
  list-style: none;
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.landing-privacy li {
  color: var(--text-muted);
  font-size: 0.8rem;
  padding-left: 1rem;
  position: relative;
}
.landing-privacy li::before {
  content: '';
  position: absolute;
  left: 0; top: 0.5em;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.5;
}

.learn-more {
  display: block;
  margin-top: 0.5rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-decoration: none;
}
.learn-more:hover { color: var(--text); }

/* ══════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════ */
.btn-primary {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.85rem 2.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 24px var(--accent-glow);
}

.btn-nav {
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-nav:hover:not(:disabled) {
  color: var(--text);
  border-color: rgba(255,255,255,0.15);
}
.btn-nav:disabled { opacity: 0.3; cursor: not-allowed; }

.btn-secondary {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  padding: 0.7rem 2rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-secondary:hover {
  color: var(--text);
  border-color: rgba(255,255,255,0.2);
}

/* ══════════════════════════════════════
   PRESENTATION SCREEN
   ══════════════════════════════════════ */
#presentation-screen {
  flex-direction: column;
  height: 100vh;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.header-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: -0.01em;
}

.slide-counter {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 2rem;
  overflow: hidden;
  min-height: 0;
}

/* ── Dual Viewer ── */
#dual-viewer {
  max-width: 900px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 0;
}

#dual-viewer.dual-active {
  max-width: 900px;
  position: relative;
}

.viewer-pane {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.viewer-pane[hidden] { display: none; }

#dual-viewer.dual-active #ai-pane { flex: 1; }

/* User pane as floating popout */
#dual-viewer.dual-active #user-pane {
  position: fixed;
  bottom: 5.5rem;
  right: 1.5rem;
  width: 260px;
  min-width: 160px;
  max-width: 50vw;
  max-height: 60vh;
  z-index: 50;
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  border: 1px solid rgba(52,211,153,0.2);
  padding: 0.5rem;
  overflow: auto;
}

/* Top-left resize handle */
#dual-viewer.dual-active #user-pane .resize-handle {
  position: absolute;
  top: 0;
  left: 0;
  width: 18px;
  height: 18px;
  cursor: nwse-resize;
  z-index: 10;
}
#dual-viewer.dual-active #user-pane .resize-handle::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  width: 8px;
  height: 8px;
  border-top: 2px solid rgba(52,211,153,0.4);
  border-left: 2px solid rgba(52,211,153,0.4);
  border-radius: 2px 0 0 0;
}
#dual-viewer.dual-active #user-pane .resize-handle:hover::before {
  border-color: var(--success);
}

#dual-viewer.dual-active #user-pane .slide-frame {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}
#dual-viewer.dual-active #user-pane .slide-frame::-webkit-scrollbar {
  width: 4px;
}
#dual-viewer.dual-active #user-pane .slide-frame::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
}

#dual-viewer.dual-active #user-pane .slide-card {
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  aspect-ratio: auto;
  max-height: none;
  text-align: left;
  align-items: flex-start;
}

#dual-viewer.dual-active #user-pane #slide-title {
  font-size: 0.8rem;
  margin-bottom: 0.35rem;
  background: none;
  -webkit-text-fill-color: var(--text);
  color: var(--text);
}

#dual-viewer.dual-active #user-pane #slide-content {
  font-size: 0.7rem;
  line-height: 1.35;
}
#dual-viewer.dual-active #user-pane #slide-content li {
  font-size: 0.7rem !important;
  padding-left: 1rem;
}
#dual-viewer.dual-active #user-pane #slide-content li::before {
  width: 5px;
  height: 5px;
  top: 0.5em;
}
#dual-viewer.dual-active #user-pane #slide-content p {
  font-size: 0.7rem !important;
  margin-bottom: 0.25rem !important;
}
#dual-viewer.dual-active #user-pane #slide-content ul,
#dual-viewer.dual-active #user-pane #slide-content ol {
  gap: 0.15rem;
}

#dual-viewer.dual-active #user-pane .slide-image {
  max-height: 50px;
}

#dual-viewer.dual-active #user-pane .slide-nav {
  margin-top: 0.35rem;
  gap: 0.35rem;
  flex-shrink: 0;
}

#dual-viewer.dual-active #user-pane .btn-nav {
  padding: 0.2rem 0.5rem;
  font-size: 0.7rem;
}

#dual-viewer.dual-active #user-pane #slide-progress {
  font-size: 0.65rem;
}

/* Minimized popout — just a small tab */
#dual-viewer.dual-active #user-pane.minimized {
  width: auto;
  padding: 0;
  border: none;
  box-shadow: none;
  background: none;
}

#dual-viewer.dual-active #user-pane.minimized .slide-frame,
#dual-viewer.dual-active #user-pane.minimized .slide-nav,
#dual-viewer.dual-active #user-pane.minimized .pane-counter {
  display: none;
}

#dual-viewer.dual-active #user-pane.minimized .pane-header {
  background: var(--bg-card);
  border: 1px solid rgba(52,211,153,0.2);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  cursor: pointer;
}

.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  padding: 0 0.25rem;
}

.pane-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.ai-label { color: var(--accent-hover); }
.user-label { color: var(--success); cursor: default; }
#dual-viewer.dual-active #user-pane .pane-header {
  cursor: grab;
}
#dual-viewer.dual-active #user-pane .pane-header:active {
  cursor: grabbing;
}
#dual-viewer.dual-active .user-label { cursor: pointer; }

.minimize-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 0.25rem;
  line-height: 1;
}
.minimize-btn:hover { color: var(--text); }
#dual-viewer.dual-active .minimize-btn { display: block; }

.pane-counter {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* ── Slide Frame (16:9 aspect ratio) ── */
.slide-frame {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.slide-card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  padding: 2.5rem 4rem;
  width: 100%;
  max-width: 960px;
  min-height: 50vh;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  text-align: center;
  transition: all 0.3s ease;
  overflow-y: auto;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.slide-card::-webkit-scrollbar { width: 4px; }
.slide-card::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.12);
  border-radius: 2px;
}

/* 16:9 aspect ratio only when in dual-viewer (AI presenting) */
#dual-viewer.dual-active .slide-card {
  aspect-ratio: 16 / 9;
  min-height: auto;
  max-height: 75vh;
}

/* AI pane glow */
#ai-pane .slide-card {
  border-color: rgba(99,102,241,0.2);
  box-shadow: 0 0 40px rgba(99,102,241,0.08);
  background: linear-gradient(160deg, var(--bg-card) 0%, rgba(99,102,241,0.04) 100%);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(99,102,241,0.2) transparent;
}
#ai-pane .slide-card::-webkit-scrollbar { width: 4px; }
#ai-pane .slide-card::-webkit-scrollbar-thumb {
  background: rgba(99,102,241,0.25);
  border-radius: 2px;
}

/* User pane subtle border */
#user-pane .slide-card {
  border-color: rgba(52,211,153,0.12);
}

#slide-title, #ai-slide-title {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, var(--text) 0%, var(--text-muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  width: 100%;
}

/* Only shrink title in the user popout pane, not the AI pane */

.slide-image {
  width: 100%;
  max-height: min(260px, 30vh);
  object-fit: contain;
  margin-bottom: 0.75rem;
  border-radius: var(--radius-sm);
  flex-shrink: 1;
}

#slide-content, #ai-slide-content {
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.65;
  overflow: hidden;
  width: 100%;
  text-align: left;
}

/* User popout content size handled in the #user-pane section above */

#slide-content ul, #ai-slide-content ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  text-align: left;
}

#slide-content li, #ai-slide-content li {
  padding-left: 1.75rem;
  position: relative;
  font-size: 1rem;
}
#slide-content li::before, #ai-slide-content li::before {
  content: '';
  position: absolute;
  left: 0; top: 0.55em;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.7;
}

#slide-content ol, #ai-slide-content ol {
  list-style: none;
  counter-reset: step;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  text-align: left;
}

#slide-content ol li, #ai-slide-content ol li {
  counter-increment: step;
  padding-left: 2.25rem;
  font-size: 1.1rem;
}
#slide-content ol li::before, #ai-slide-content ol li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  width: 1.6rem; height: 1.6rem;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.7;
  color: white;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  top: 0.1em;
}

#slide-content p, #ai-slide-content p { margin-bottom: 0.5rem; font-size: 1.05rem; }

.slide-subhead {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent-hover);
  margin: 0.75rem 0 0.25rem;
  text-align: left;
  letter-spacing: 0.01em;
}
.slide-subhead:first-child { margin-top: 0; }

#slide-content strong, #ai-slide-content strong {
  color: var(--text);
  font-weight: 600;
}

#slide-content code, #ai-slide-content code {
  background: rgba(99,102,241,0.15);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  font-size: 0.9em;
}
#slide-content p:last-child, #ai-slide-content p:last-child { margin-bottom: 0; }

.slide-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.75rem;
  gap: 1rem;
}

#slide-progress {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ══════════════════════════════════════
   CONTROL BAR
   ══════════════════════════════════════ */
#control-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0.6rem 1rem;
  border-top: 1px solid rgba(255,255,255,0.06);
  background: var(--bg-card);
  flex-shrink: 0;
  gap: 0.5rem;
}

#status-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-self: start;
}

.control-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-self: end;
}

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}
.status-dot.presenting { background: var(--accent); animation: pulse 1.5s infinite; }
.status-dot.listening { background: var(--success); animation: pulse 0.8s infinite; }
.status-dot.thinking { background: var(--warning); animation: pulse 1s infinite; }
.status-dot.error { background: var(--danger); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

#status-text {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Cost ticker — hidden by default, toggle to show */
.cost-ticker {
  font-size: 0.7rem;
  color: var(--text-muted);
  background: rgba(255,255,255,0.05);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  opacity: 0.6;
}
.cost-ticker:hover { opacity: 1; }
.cost-ticker[hidden] { display: none; }

/* Ask button */
.btn-ask {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.btn-ask:hover { background: var(--accent-hover); }
.btn-ask[hidden] { display: none; }

.btn-ask.active {
  background: var(--danger);
  box-shadow: 0 0 24px rgba(248, 113, 113, 0.3);
  transform: scale(1.05);
  animation: activePulse 1.5s ease-in-out infinite;
}

@keyframes activePulse {
  0%, 100% { box-shadow: 0 0 16px rgba(248, 113, 113, 0.3); }
  50% { box-shadow: 0 0 32px rgba(248, 113, 113, 0.5), 0 0 48px rgba(248, 113, 113, 0.15); }
}

/* Mic listening waveform */
.mic-waves {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 1.1rem;
}
.mic-waves span {
  display: block;
  width: 3px;
  height: 60%;
  background: white;
  border-radius: 2px;
  animation: micWave 0.8s ease-in-out infinite;
}
.mic-waves span:nth-child(1) { animation-delay: 0s; height: 40%; }
.mic-waves span:nth-child(2) { animation-delay: 0.15s; height: 80%; }
.mic-waves span:nth-child(3) { animation-delay: 0.3s; height: 50%; }

@keyframes micWave {
  0%, 100% { transform: scaleY(0.5); }
  50% { transform: scaleY(1.3); }
}

/* No ::after — label text handles all states */

.btn-ask.raise-mode {
  background: var(--bg-elevated);
  border: 1px solid rgba(255,255,255,0.15);
  animation: none;
  box-shadow: none;
}
.btn-ask.raise-mode:hover {
  background: var(--bg-elevated);
  border-color: var(--accent);
}

.btn-ask.raised-mode {
  background: var(--warning);
  color: #1a1a2e;
  animation: raisedPulse 1s ease-in-out infinite;
}

@keyframes raisedPulse {
  0%, 100% { box-shadow: 0 0 12px rgba(251,191,36,0.3); }
  50% { box-shadow: 0 0 24px rgba(251,191,36,0.5); }
}

.btn-ask.ready {
  animation: askPulse 1.5s ease-in-out infinite;
  box-shadow: 0 0 20px var(--accent-glow);
}

@keyframes askPulse {
  0%, 100% { box-shadow: 0 0 12px var(--accent-glow); }
  50% { box-shadow: 0 0 28px var(--accent-glow), 0 0 48px rgba(99,102,241,0.15); }
}

.ask-icon { font-size: 1.1rem; }

.nav-buttons {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  justify-self: center;
}

.action-buttons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-skip {
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  padding: 0.6rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-skip:hover { color: var(--text); border-color: rgba(255,255,255,0.2); }
.btn-skip[hidden] { display: none; }

/* Speed control */
.speed-control {
  display: flex;
  gap: 0.2rem;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  padding: 0.15rem;
  border: 1px solid rgba(255,255,255,0.08);
}
.speed-control[hidden] { display: none; }
.speed-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
  font-variant-numeric: tabular-nums;
}
.speed-btn:hover { color: var(--text); }
.speed-btn.active {
  background: var(--accent);
  color: white;
}

.btn-end-session {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid rgba(248,113,113,0.2);
  border-radius: var(--radius-sm);
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-end-session:hover {
  color: var(--danger);
  border-color: var(--danger);
  background: rgba(248,113,113,0.08);
}
.btn-end-session[hidden] { display: none; }

/* Q&A banner */
#qa-banner {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: linear-gradient(90deg, rgba(99,102,241,0.15), rgba(139,92,246,0.1));
  border-top: 1px solid rgba(99,102,241,0.2);
  font-size: 0.85rem;
  color: var(--accent-hover);
  font-weight: 500;
}
#qa-banner.visible { display: flex; }

#qa-banner .qa-arrow {
  animation: bounceDown 1s ease-in-out infinite;
  font-size: 0.7rem;
}

@keyframes bounceDown {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(3px); }
}

/* ══════════════════════════════════════
   END SCREEN
   ══════════════════════════════════════ */
#end-screen {
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 0%, rgba(52,211,153,0.06) 0%, transparent 60%);
}

.end-card {
  max-width: 520px;
  width: 90%;
  text-align: center;
}

.end-card h2 { font-size: 1.75rem; margin-bottom: 0.5rem; }
.end-subtitle { color: var(--text-muted); margin-bottom: 2rem; }

#bookmarked-section {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: left;
  margin-bottom: 2rem;
}
#bookmarked-section h3 { font-size: 1rem; margin-bottom: 0.5rem; }

.bookmarked-note { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.75rem; }

#bookmarked-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

#bookmarked-list li {
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
}

#bookmarked-list .slide-ref {
  color: var(--accent);
  font-size: 0.75rem;
  margin-top: 0.25rem;
  display: block;
}

/* Cost summary */
.cost-summary {
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.06);
}
.cost-summary h3 { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.5rem; }

.cost-total {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.cost-breakdown { font-size: 0.8rem; }

.cost-row {
  display: flex;
  justify-content: space-between;
  padding: 0.25rem 0;
  color: var(--text-muted);
  border-top: 1px solid rgba(255,255,255,0.04);
}
.cost-row small { opacity: 0.6; }

#feedback-section { margin-bottom: 2rem; }
#feedback-section p { color: var(--text-muted); margin-bottom: 0.75rem; }

.feedback-buttons {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.btn-feedback {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  padding: 0.5rem 2rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-feedback:hover { border-color: var(--accent); color: var(--accent); }
.btn-feedback.selected { background: var(--accent); color: white; border-color: var(--accent); }

/* ── Error Overlay ── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}
.overlay[hidden] { display: none; }

.error-card {
  background: var(--bg-card);
  border: 1px solid rgba(248,113,113,0.2);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  max-width: 400px;
  width: 90%;
}
.error-card h3 { color: var(--danger); margin-bottom: 0.5rem; }
.error-card p { color: var(--text-muted); margin-bottom: 1rem; }

/* ── Cover slide (few content lines → center vertically + center text) ── */
.slide-card.slide-cover {
  justify-content: center !important;
  text-align: center !important;
}
.slide-card.slide-cover #slide-content,
.slide-card.slide-cover #ai-slide-content {
  text-align: center !important;
}
.slide-card.slide-cover p {
  text-align: center !important;
}

/* ── Dense slide auto-fit ── */
.slide-card.slide-dense {
  padding: 1.5rem 2.5rem;
}
.slide-card.slide-dense h2 {
  font-size: 1.35rem !important;
  margin-bottom: 0.5rem !important;
}
.slide-card.slide-dense #slide-content,
.slide-card.slide-dense #ai-slide-content {
  font-size: 0.88rem !important;
  line-height: 1.4 !important;
}
.slide-card.slide-dense li {
  font-size: 0.85rem !important;
}
.slide-card.slide-dense p {
  font-size: 0.88rem !important;
  margin-bottom: 0.3rem !important;
}
.slide-card.slide-dense ul,
.slide-card.slide-dense ol {
  gap: 0.2rem !important;
}
.slide-card.slide-dense .slide-subhead {
  font-size: 0.85rem !important;
  margin: 0.5rem 0 0.2rem !important;
}

.slide-card.slide-very-dense {
  padding: 1.25rem 2rem;
}
.slide-card.slide-very-dense h2 {
  font-size: 1.1rem !important;
  margin-bottom: 0.35rem !important;
}
.slide-card.slide-very-dense #slide-content,
.slide-card.slide-very-dense #ai-slide-content {
  font-size: 0.75rem !important;
  line-height: 1.35 !important;
}
.slide-card.slide-very-dense li {
  font-size: 0.75rem !important;
  padding-left: 1.1rem !important;
}
.slide-card.slide-very-dense li::before {
  width: 5px !important;
  height: 5px !important;
}
.slide-card.slide-very-dense p {
  font-size: 0.75rem !important;
  margin-bottom: 0.2rem !important;
}
.slide-card.slide-very-dense ul,
.slide-card.slide-very-dense ol {
  gap: 0.1rem !important;
}
.slide-card.slide-very-dense .slide-subhead {
  font-size: 0.78rem !important;
  margin: 0.35rem 0 0.15rem !important;
}

/* ── Email Gate ── */
.email-card {
  background: var(--bg-card);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  text-align: center;
  max-width: 380px;
  width: 90%;
}
.email-logo {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--accent) 0%, #a78bfa 50%, var(--success) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}
.email-sub {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}
.email-input {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-elevated);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
  font-family: var(--font);
  text-align: center;
  transition: border-color 0.2s;
}
.email-input:focus {
  outline: none;
  border-color: var(--accent);
}
.email-input::placeholder {
  color: var(--text-muted);
  opacity: 0.5;
}
.email-error {
  color: var(--danger);
  font-size: 0.8rem;
  margin-top: 0.5rem;
}
.email-error[hidden] { display: none; }

/* ── Slide Transitions ── */
.slide-card.slide-enter {
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ══════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════ */
@media (max-width: 900px) {
  #dual-viewer.dual-active #user-pane {
    width: 220px;
    bottom: 5rem;
    right: 0.75rem;
  }
  #dual-viewer.dual-active #user-pane .slide-frame {
    max-height: 150px;
    overflow-y: auto;
  }
}

@media (max-width: 640px) {
  .landing-features {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  .feature { padding: 1rem; }
  .logo { font-size: 2rem; }
  .tagline { font-size: 1.1rem; }
  .btn-cta { padding: 0.85rem 2rem; font-size: 1rem; }

  .slide-card {
    padding: 2rem 1.5rem;
    aspect-ratio: auto;
    min-height: 35vh;
    max-height: none;
  }
  #slide-title, #ai-slide-title { font-size: 1.25rem; }
  #slide-content, #ai-slide-content { font-size: 0.9rem; }
  main { padding: 0.75rem; }

  .btn-ask { padding: 0.75rem 1.25rem; font-size: 0.85rem; }
}
