/* ═══════════════════════════════════════════════════════════════
   Biography Agent — Global Styles
   Palette: Deep slate + warm gold/amber + soft ivory
   ═══════════════════════════════════════════════════════════════ */

/* ── Reset & Tokens ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }

:root {
  /* Palette */
  --bg-0: #0b0c10;         /* deepest background */
  --bg-1: #12141a;         /* main surface */
  --bg-2: #1a1d26;         /* elevated surface */
  --bg-3: #242838;         /* card/bubble */
  --bg-4: #2e3349;         /* hover state */

  --gold: #c9962a;          /* primary accent */
  --gold-light: #e8b84b;    /* brighter gold */
  --gold-dim: #8a6420;      /* muted gold */
  --amber: #d4853a;         /* warm amber */
  --amber-light: #f0a050;

  --ivory: #f0ead6;         /* agent message text */
  --white: #ffffff;
  --text-primary: #e8e4da;
  --text-secondary: #9a9080;
  --text-muted: #5a5650;

  --border: rgba(255,255,255,0.06);
  --border-gold: rgba(201,150,42,0.25);

  /* Typography */
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-sans: 'Inter', system-ui, sans-serif;

  /* Spacing */
  --sidebar-width: 280px;

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

body {
  background: var(--bg-0);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  overflow: hidden;
}

/* ── View System ────────────────────────────────────────────────────────────── */
.view {
  position: fixed;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s var(--ease);
}
.view.active {
  opacity: 1;
  pointer-events: all;
}
.hidden { display: none !important; }

/* ═══════════════════════════════════════════════════════════════
   WELCOME VIEW — SPLIT PANEL
   ═══════════════════════════════════════════════════════════════ */

#view-welcome {
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  overflow: hidden;
}

.welcome-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.welcome-hero-texture {
  position: absolute;
  inset: 0;
  background-image: url('/hero-bg.png');
  background-size: cover;
  background-position: center;
  opacity: 0.06;
  pointer-events: none;
}

.welcome-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.15;
  animation: orb-float 12s ease-in-out infinite;
}

.orb-1 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, #c9962a, transparent);
  top: -100px; left: -100px;
  animation-delay: 0s;
}
.orb-2 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, #d4853a, transparent);
  bottom: -100px; right: -100px;
  animation-delay: -4s;
}
.orb-3 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, #5a3e8a, transparent);
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  animation-delay: -8s;
  opacity: 0.08;
}

@keyframes orb-float {
  0%, 100% { transform: scale(1) translate(0,0); }
  33% { transform: scale(1.1) translate(20px, -20px); }
  66% { transform: scale(0.95) translate(-15px, 15px); }
}

/* ── Split layout ────────────────────────────────────────────── */

.welcome-split {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: row;
  width: 100%;
  height: 100%;
}

/* ── Left panel ──────────────────────────────────────────────── */

.welcome-left {
  width: 42%;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 32px;
  background: linear-gradient(160deg, rgba(12,14,22,0.95) 0%, rgba(18,20,30,0.8) 100%);
  border-right: 1px solid rgba(201,150,42,0.12);
  position: relative;
  overflow: hidden;
  animation: panel-slide-in 0.7s var(--ease-spring) both;
}

@keyframes panel-slide-in {
  from { opacity: 0; transform: translateX(-30px); }
  to   { opacity: 1; transform: translateX(0); }
}

.welcome-left::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url('/hero-bg.png');
  background-size: cover;
  background-position: center;
  opacity: 0.08;
  pointer-events: none;
}

/* Portrait */
.portrait-container {
  position: relative;
  width: 200px;
  height: 200px;
  margin-bottom: 24px;
  flex-shrink: 0;
}

.portrait-ring {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    var(--gold) 0%,
    var(--amber-light) 25%,
    var(--gold-dim) 50%,
    var(--amber) 75%,
    var(--gold) 100%
  );
  animation: ring-spin 8s linear infinite;
  opacity: 0.8;
}

@keyframes ring-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.portrait-ring::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: var(--bg-0);
}

.portrait-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  object-position: top center;
  z-index: 1;
  transition: transform 0.4s var(--ease);
}

.portrait-container:hover .portrait-img {
  transform: scale(1.04);
}

/* Shimmer sweep over portrait */
.portrait-container::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(
    135deg,
    transparent 30%,
    rgba(255,255,255,0.08) 50%,
    transparent 70%
  );
  background-size: 200% 200%;
  animation: shimmer 4s ease-in-out infinite;
  z-index: 2;
  pointer-events: none;
}

@keyframes shimmer {
  0%   { background-position: 200% 200%; }
  50%  { background-position: -50% -50%; }
  100% { background-position: 200% 200%; }
}

/* Floating crest badge */
.portrait-crest {
  position: absolute;
  bottom: -8px;
  right: -8px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--bg-1);
  border: 2px solid rgba(201,150,42,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  animation: float-badge 3s ease-in-out infinite;
  overflow: hidden;
}

.portrait-crest img {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: 50%;
}

@keyframes float-badge {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-4px); }
}

/* Nameplate */
.subject-nameplate {
  text-align: center;
  margin-bottom: 28px;
  animation: fade-up 0.6s 0.3s var(--ease) both;
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.nameplate-name {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  color: var(--ivory);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}

.nameplate-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gold-light);
  opacity: 0.8;
}

/* Milestone timeline */
.milestone-strip {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 0;
  width: 100%;
  max-width: 360px;
  animation: fade-up 0.6s 0.5s var(--ease) both;
}

.milestone {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  animation: milestone-pop 0.5s var(--d, 0s) var(--ease-spring) both;
}

@keyframes milestone-pop {
  from { opacity: 0; transform: translateY(10px) scale(0.9); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.milestone::before {
  content: '';
  position: absolute;
  top: 26px;
  left: calc(50% + 8px);
  right: calc(-50% + 8px);
  height: 1px;
  background: linear-gradient(90deg, rgba(201,150,42,0.5), rgba(201,150,42,0.1));
}
.milestone:last-child::before { display: none; }

.milestone-year {
  font-family: var(--font-serif);
  font-size: 12px;
  font-weight: 700;
  color: var(--gold-light);
  margin-bottom: 8px;
}

.milestone-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid var(--gold-light);
  box-shadow: 0 0 10px rgba(201,150,42,0.6);
  margin-bottom: 8px;
  flex-shrink: 0;
}

.milestone-label {
  font-size: 10px;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.3;
}

/* ── Right panel ─────────────────────────────────────────────── */

.welcome-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
  overflow-y: auto;
}

.welcome-content {
  position: relative;
  z-index: 1;
  max-width: 520px;
  width: 100%;
  animation: panel-slide-right 0.7s 0.1s var(--ease-spring) both;
}

@keyframes panel-slide-right {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold-light);
  margin-bottom: 28px;
}

.logo-icon {
  font-size: 20px;
  animation: spin-slow 20s linear infinite;
}

@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.welcome-title {
  font-family: var(--font-serif);
  font-size: clamp(32px, 5vw, 58px);
  font-weight: 700;
  line-height: 1.05;
  color: var(--ivory);
  margin-bottom: 16px;
}
.welcome-title em {
  font-style: italic;
  color: var(--gold-light);
  background: linear-gradient(135deg, var(--gold-light), var(--amber-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.welcome-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  max-width: 440px;
  margin: 0 0 28px;
  line-height: 1.7;
}

.welcome-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 28px;
}

/* Bio fact cards */
.bio-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 24px;
}

.bio-fact-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(201,150,42,0.12);
  border-radius: 12px;
  transition: all 0.2s var(--ease);
  cursor: default;
}

.bio-fact-card:hover {
  background: rgba(201,150,42,0.07);
  border-color: rgba(201,150,42,0.25);
  transform: translateY(-1px);
}

.bio-fact-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.bio-fact-body {
  min-width: 0;
}

.bio-fact-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.bio-fact-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Pull quote */
.welcome-quote {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  background: rgba(201,150,42,0.05);
  border-left: 3px solid var(--gold-dim);
  border-radius: 0 10px 10px 0;
}

.quote-mark {
  font-family: var(--font-serif);
  font-size: 40px;
  line-height: 0.8;
  color: var(--gold-dim);
  flex-shrink: 0;
}

.quote-text {
  font-family: var(--font-serif);
  font-size: 13px;
  font-style: italic;
  color: var(--text-secondary);
  line-height: 1.6;
}



/* ═══════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 12px;
  border: none;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.btn-primary {
  background: linear-gradient(135deg, var(--gold), var(--amber));
  color: #0b0c10;
  font-weight: 600;
  box-shadow: 0 0 0 0 rgba(201,150,42,0);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--gold-light), var(--amber-light));
  transform: translateY(-1px);
  box-shadow: 0 8px 32px rgba(201,150,42,0.3);
}
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text-primary);
  border-color: rgba(255,255,255,0.12);
}

.btn-amber {
  background: rgba(201,150,42,0.15);
  color: var(--gold-light);
  border: 1px solid rgba(201,150,42,0.25);
}
.btn-amber:hover {
  background: rgba(201,150,42,0.25);
  border-color: rgba(201,150,42,0.4);
}

.btn-danger-ghost {
  color: #ff8080;
  border-color: rgba(220,60,60,0.2);
}
.btn-danger-ghost:hover {
  background: rgba(220,60,60,0.12);
  color: #ff6060;
  border-color: rgba(220,60,60,0.35);
}

.btn-lg { padding: 16px 32px; font-size: 16px; border-radius: 14px; min-width: 260px; justify-content: center; }
.btn-sm { padding: 7px 14px; font-size: 13px; border-radius: 8px; }
.btn-full { width: 100%; justify-content: center; }

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s var(--ease);
  flex-shrink: 0;
}
.btn-icon:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text-primary);
}

/* ═══════════════════════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════════════════════ */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fade-in 0.2s var(--ease);
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-up { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.modal {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px;
  max-width: 480px;
  width: 100%;
  position: relative;
  animation: slide-up 0.3s var(--ease-spring);
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
}
.modal-wide { max-width: 600px; }

.modal-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 32px; height: 32px;
  border-radius: 8px;
  border: none;
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s var(--ease);
  line-height: 1;
}
.modal-close:hover { background: rgba(255,255,255,0.12); color: var(--text-primary); }

.modal-header { text-align: center; margin-bottom: 32px; }
.modal-icon { font-size: 32px; margin-bottom: 16px; animation: spin-slow 20s linear infinite; }
.modal-header h2 { font-family: var(--font-serif); font-size: 24px; color: var(--ivory); margin-bottom: 8px; }
.modal-header p { color: var(--text-secondary); font-size: 14px; line-height: 1.6; }

.modal-body { display: flex; flex-direction: column; gap: 20px; }

.input-group { display: flex; flex-direction: column; gap: 8px; }
.input-group label { font-size: 13px; font-weight: 500; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.06em; }
.input-group input {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s var(--ease);
  width: 100%;
}
.input-group input:focus { border-color: var(--gold-dim); }
.input-group input::placeholder { color: var(--text-muted); }

/* Subject list in modal */
.subject-list-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-radius: 12px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s var(--ease);
  margin-bottom: 8px;
}
.subject-list-item:hover {
  background: var(--bg-4);
  border-color: rgba(201,150,42,0.2);
}
.subject-list-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--amber));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 700;
  color: #0b0c10;
  flex-shrink: 0;
}
.subject-list-info { flex: 1; min-width: 0; }
.subject-list-name { font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.subject-list-meta { font-size: 12px; color: var(--text-secondary); }
.subject-list-arrow { color: var(--text-muted); }

.subject-list-delete {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s var(--ease);
  flex-shrink: 0;
  opacity: 0;
}
.subject-list-item:hover .subject-list-delete {
  opacity: 1;
}
.subject-list-delete:hover {
  background: rgba(220,60,60,0.12);
  color: #ff8080;
}

/* ═══════════════════════════════════════════════════════════════
   INTERVIEW VIEW — LAYOUT
   ═══════════════════════════════════════════════════════════════ */

#view-interview {
  display: flex;
  flex-direction: row;
}

/* ── Sidebar ────────────────────────────────────────────────────────────────── */

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
}
.sidebar-logo {
  flex: 1;
  text-align: center;
  font-size: 18px;
  color: var(--gold);
  animation: spin-slow 20s linear infinite;
}

.sidebar-subject {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-2);
  border-radius: 12px;
  margin-bottom: 24px;
  border: 1px solid var(--border);
}
.subject-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--amber));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  color: #0b0c10;
  flex-shrink: 0;
}
.subject-info { min-width: 0; }
.subject-name { font-weight: 600; font-size: 14px; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.subject-session { font-size: 12px; color: var(--text-muted); }

/* ── Coverage ring ──────────────────────────────────────────────────────────── */

.coverage-section { text-align: center; margin-bottom: 20px; }

.coverage-ring-container {
  position: relative;
  display: inline-block;
  margin-bottom: 12px;
}

.coverage-ring { display: block; }

.ring-bg {
  fill: none;
  stroke: var(--bg-3);
  stroke-width: 6;
}
.ring-fill {
  fill: none;
  stroke: url(#ring-gradient);
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.8s var(--ease);
}

.coverage-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.coverage-percent {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  color: var(--gold-light);
  line-height: 1;
}
.coverage-text { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }

.coverage-stats {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-secondary);
}
.stat { display: flex; align-items: center; gap: 6px; justify-content: center; }
.stat-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
}
.stat-dot.covered { background: var(--gold); }
.stat-dot.partial { background: var(--amber); opacity: 0.7; }
.stat-dot.untouched { background: var(--bg-4); border: 1px solid var(--border); }

/* ── Section bars ───────────────────────────────────────────────────────────── */

.sections-progress { margin-top: 8px; flex: 1; }
.sections-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 10px; }

.section-bars { display: flex; flex-direction: column; gap: 8px; }
.section-bar-item { display: flex; flex-direction: column; gap: 4px; }
.section-bar-label { font-size: 11px; color: var(--text-secondary); }
.section-bar-track {
  height: 4px;
  background: var(--bg-3);
  border-radius: 999px;
  overflow: hidden;
}
.section-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--amber));
  border-radius: 999px;
  transition: width 0.6s var(--ease);
}

/* ── Move indicator ─────────────────────────────────────────────────────────── */

.sidebar-footer { margin-top: auto; padding-top: 12px; }
.move-indicator { display: flex; justify-content: center; }
.move-badge {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(201,150,42,0.1);
  color: var(--gold-light);
  border: 1px solid rgba(201,150,42,0.2);
  transition: all 0.3s var(--ease);
}

/* ── Chat Main ──────────────────────────────────────────────────────────────── */

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-1);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 32px 40px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 2px; }

/* ── Message Bubbles ────────────────────────────────────────────────────────── */

.message {
  display: flex;
  gap: 14px;
  animation: msg-appear 0.4s var(--ease-spring);
  max-width: 800px;
}
@keyframes msg-appear {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.message.agent { align-self: flex-start; }
.message.user { align-self: flex-end; flex-direction: row-reverse; }

.msg-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  margin-top: 4px;
}
.message.agent .msg-avatar {
  background: linear-gradient(135deg, #2a3050, #1a2040);
  border: 1px solid var(--border-gold);
  color: var(--gold-light);
  font-family: var(--font-serif);
}
.message.user .msg-avatar {
  background: linear-gradient(135deg, var(--gold), var(--amber));
  color: #0b0c10;
  font-family: var(--font-serif);
}

.msg-body { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }

.msg-bubble {
  padding: 16px 20px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.7;
  word-break: break-word;
  position: relative;
}

.message.agent .msg-bubble {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--ivory);
  border-top-left-radius: 4px;
}

.message.user .msg-bubble {
  background: linear-gradient(135deg, rgba(201,150,42,0.15), rgba(212,133,58,0.12));
  border: 1px solid rgba(201,150,42,0.2);
  color: var(--text-primary);
  border-top-right-radius: 4px;
  text-align: right;
}

/* Agent message — reflection is styled differently from question */
.msg-reflection {
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: 10px;
  font-size: 14px;
  line-height: 1.6;
}
.msg-question {
  color: var(--ivory);
  font-size: 15.5px;
}

.msg-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.message.user .msg-meta { text-align: right; }

/* ── Typing indicator ───────────────────────────────────────────────────────── */

.typing-indicator .msg-bubble {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 14px 20px;
}
.typing-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typing-bounce 1.4s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-8px); opacity: 1; }
}

/* ── Chat Input ─────────────────────────────────────────────────────────────── */

.chat-input-area {
  padding: 16px 40px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-1);
}

.chat-input-container { max-width: 800px; margin: 0 auto; }

.input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 10px 10px 10px 16px;
  transition: border-color 0.2s var(--ease);
}
.input-wrapper:focus-within { border-color: var(--gold-dim); }

#chat-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  resize: none;
  min-height: 24px;
  max-height: 160px;
  overflow-y: auto;
  padding: 4px 0;
}
#chat-input::placeholder { color: var(--text-muted); }

.input-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }

.btn-voice-toggle {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: transparent;
  color: var(--text-secondary);
  transition: all 0.2s var(--ease);
}
.btn-voice-toggle:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }
.btn-voice-toggle.recording {
  background: rgba(220,50,50,0.15);
  color: #ff6060;
  border: 1px solid rgba(220,50,50,0.25);
  animation: pulse-ring 1.5s ease-in-out infinite;
}

@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(220,50,50,0.3); }
  70% { box-shadow: 0 0 0 8px rgba(220,50,50,0); }
  100% { box-shadow: 0 0 0 0 rgba(220,50,50,0); }
}

.pulse { animation: pulse-icon 1s ease-in-out infinite; }
@keyframes pulse-icon { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

.btn-send {
  width: 40px; height: 40px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, var(--gold), var(--amber));
  color: #0b0c10;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s var(--ease);
  flex-shrink: 0;
}
.btn-send:hover {
  background: linear-gradient(135deg, var(--gold-light), var(--amber-light));
  transform: scale(1.05);
}
.btn-send:active { transform: scale(0.97); }
.btn-send:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.input-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
  text-align: center;
}
.input-hint kbd {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: var(--font-sans);
  font-size: 10px;
}

/* ═══════════════════════════════════════════════════════════════
   BIOGRAPHY VIEW
   ═══════════════════════════════════════════════════════════════ */

#view-biography {
  display: flex;
  flex-direction: column;
  background: var(--bg-0);
  overflow: hidden;
}

.bio-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-1);
  flex-shrink: 0;
}

.bio-topbar-title {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-serif);
  font-size: 16px;
  color: var(--ivory);
}
.logo-icon-sm { color: var(--gold); font-size: 14px; animation: spin-slow 20s linear infinite; }

.bio-topbar-actions { display: flex; align-items: center; gap: 8px; }

.bio-content-wrapper {
  flex: 1;
  overflow-y: auto;
  padding: 60px 40px;
}

.bio-content-wrapper::-webkit-scrollbar { width: 4px; }
.bio-content-wrapper::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 2px; }

.bio-content {
  max-width: 720px;
  margin: 0 auto;
  font-family: var(--font-serif);
  font-size: 18px;
  line-height: 1.8;
  color: var(--ivory);
}

/* Markdown rendering */
.bio-content h1 {
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 700;
  color: var(--ivory);
  margin-bottom: 8px;
  line-height: 1.2;
}
.bio-content h2 {
  font-size: clamp(20px, 2.5vw, 28px);
  font-weight: 600;
  color: var(--gold-light);
  margin: 48px 0 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-gold);
}
.bio-content h3 {
  font-size: 20px;
  color: var(--ivory);
  margin: 32px 0 16px;
}
.bio-content p { margin-bottom: 24px; }
.bio-content blockquote {
  border-left: 3px solid var(--gold);
  padding: 12px 24px;
  margin: 32px 0;
  color: var(--gold-light);
  font-style: italic;
  background: rgba(201,150,42,0.05);
  border-radius: 0 8px 8px 0;
}
.bio-content em { font-style: italic; }
.bio-content strong { font-weight: 700; color: var(--ivory); }
.bio-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 40px 0;
}

/* ═══════════════════════════════════════════════════════════════
   GENERATING OVERLAY
   ═══════════════════════════════════════════════════════════════ */

.fullscreen-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(11,12,16,0.92);
  backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.generating-content { text-align: center; max-width: 400px; padding: 40px; }

.generating-animation {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 32px;
}
.gen-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--gold);
  animation: gen-bounce 1.4s ease-in-out infinite;
}
.gen-dot:nth-child(2) { animation-delay: 0.2s; background: var(--amber); }
.gen-dot:nth-child(3) { animation-delay: 0.4s; background: var(--gold-dim); }
@keyframes gen-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

.generating-content h2 {
  font-family: var(--font-serif);
  font-size: 28px;
  color: var(--ivory);
  margin-bottom: 12px;
}
.generating-content p { color: var(--text-secondary); font-size: 15px; margin-bottom: 32px; }

.generating-steps { display: flex; flex-direction: column; gap: 10px; }
.gen-step {
  font-size: 14px;
  color: var(--text-muted);
  transition: color 0.3s var(--ease);
}
.gen-step.active { color: var(--gold-light); }
.gen-step.done { color: var(--text-secondary); }

/* ═══════════════════════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════════════════════ */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 14px;
  animation: slide-up 0.3s var(--ease-spring);
  max-width: 480px;
  text-align: center;
}
.toast-error {
  background: rgba(220,60,60,0.15);
  border: 1px solid rgba(220,60,60,0.3);
  color: #ff8080;
}

/* ═══════════════════════════════════════════════════════════════
   LOADING & UTILITY
   ═══════════════════════════════════════════════════════════════ */

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px;
  color: var(--text-secondary);
  font-size: 14px;
}

.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--bg-3);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* SVG gradient for ring */
svg defs { position: absolute; }

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  :root { --sidebar-width: 0px; }
  .sidebar { display: none; }
  .chat-messages { padding: 20px 16px; }
  .chat-input-area { padding: 12px 16px 20px; }
  .bio-content-wrapper { padding: 32px 20px; }
  .bio-content { font-size: 16px; }
}

/* ── Welcome screen narrow ── */
@media (max-width: 600px) {
  .welcome-actions { flex-direction: column; }
  .btn-lg { min-width: unset; width: 100%; }
}

/* ═══════════════════════════════════════════════════════════════
   UPLOAD FEATURE
   ═══════════════════════════════════════════════════════════════ */

/* Sidebar upload button */
.btn-upload-sidebar {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  margin-top: 10px;
  border-radius: 10px;
  border: 1px dashed rgba(201,150,42,0.25);
  background: rgba(201,150,42,0.06);
  color: var(--gold-dim);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.btn-upload-sidebar:hover {
  background: rgba(201,150,42,0.12);
  border-color: rgba(201,150,42,0.45);
  color: var(--gold-light);
}
.btn-upload-sidebar svg { flex-shrink: 0; }

/* Upload modal sizing */
.modal-upload-inner { max-width: 560px; padding: 36px; }

/* Tab row */
.upload-tabs {
  display: flex;
  gap: 6px;
  background: var(--bg-3);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 20px;
}
.upload-tab {
  flex: 1;
  padding: 8px 10px;
  border-radius: 9px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  white-space: nowrap;
}
.upload-tab.active {
  background: var(--bg-4);
  color: var(--gold-light);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.upload-tab:hover:not(.active) { color: var(--text-primary); }

/* Panels */
.upload-panel { display: none; flex-direction: column; gap: 14px; }
.upload-panel.active { display: flex; }

/* Upload textarea */
.upload-textarea {
  width: 100%;
  min-height: 160px;
  max-height: 280px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s var(--ease);
}
.upload-textarea:focus { border-color: var(--gold-dim); }
.upload-textarea::placeholder { color: var(--text-muted); }

/* Dropzone */
.upload-dropzone {
  border: 2px dashed rgba(201,150,42,0.2);
  border-radius: 14px;
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  background: rgba(255,255,255,0.02);
  position: relative;
  overflow: hidden;
}
.upload-dropzone:hover,
.upload-dropzone.dragover {
  border-color: rgba(201,150,42,0.5);
  background: rgba(201,150,42,0.05);
}
.upload-file-hidden {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  pointer-events: none;
}
.dropzone-icon { color: var(--gold-dim); margin-bottom: 12px; }
.dropzone-text { font-size: 15px; color: var(--text-secondary); margin-bottom: 6px; }
.dropzone-link { color: var(--gold-light); text-decoration: underline; cursor: pointer; }
.dropzone-hint { font-size: 12px; color: var(--text-muted); }

.file-selected-name {
  font-size: 13px;
  color: var(--gold-light);
  background: rgba(201,150,42,0.08);
  border: 1px solid rgba(201,150,42,0.2);
  border-radius: 8px;
  padding: 8px 12px;
}

.upload-privacy-notice {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
  margin-top: 4px;
}

/* ── Record UI ─────────────────────────────────────────────────── */
.record-ui { display: flex; flex-direction: column; align-items: center; gap: 14px; }

.record-visualizer {
  width: 120px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.record-wave { display: none; align-items: flex-end; gap: 4px; height: 50px; }
.record-wave.active { display: flex; }
.record-wave span {
  display: block;
  width: 5px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--gold-light), var(--amber));
  animation: wave-bar 1.2s ease-in-out infinite;
}
.record-wave span:nth-child(1)  { height: 20px; animation-delay: 0.00s; }
.record-wave span:nth-child(2)  { height: 35px; animation-delay: 0.10s; }
.record-wave span:nth-child(3)  { height: 50px; animation-delay: 0.20s; }
.record-wave span:nth-child(4)  { height: 28px; animation-delay: 0.15s; }
.record-wave span:nth-child(5)  { height: 42px; animation-delay: 0.05s; }
.record-wave span:nth-child(6)  { height: 18px; animation-delay: 0.25s; }
.record-wave span:nth-child(7)  { height: 38px; animation-delay: 0.10s; }
.record-wave span:nth-child(8)  { height: 48px; animation-delay: 0.30s; }
.record-wave span:nth-child(9)  { height: 24px; animation-delay: 0.08s; }
.record-wave span:nth-child(10) { height: 32px; animation-delay: 0.18s; }

@keyframes wave-bar {
  0%, 100% { transform: scaleY(0.4); opacity: 0.7; }
  50%       { transform: scaleY(1);   opacity: 1; }
}

.record-idle-icon { color: var(--text-muted); display: flex; align-items: center; justify-content: center; }
.record-timer { font-family: var(--font-serif); font-size: 28px; font-weight: 700; color: var(--gold-light); letter-spacing: 0.05em; min-width: 60px; text-align: center; }
.record-status { font-size: 13px; color: var(--text-secondary); text-align: center; }
.record-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: center; }

.btn-record {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 12px;
  border: 1px solid rgba(220,50,50,0.3);
  background: rgba(220,50,50,0.1);
  color: #ff8080;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s var(--ease);
}
.btn-record:hover { background: rgba(220,50,50,0.2); border-color: rgba(220,50,50,0.5); }
.btn-record.recording {
  background: rgba(220,50,50,0.2);
  border-color: rgba(220,50,50,0.5);
  color: #ff5050;
  animation: pulse-ring 1.5s ease-in-out infinite;
}

/* ── Loading state ─────────────────────────────────────────────── */
.upload-loading { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 32px 0; }
.upload-spinner {
  width: 36px; height: 36px;
  border: 3px solid rgba(201,150,42,0.15);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.upload-loading-text { font-size: 14px; color: var(--text-secondary); }

/* ── Results panel ─────────────────────────────────────────────── */
.upload-results {
  background: rgba(50,140,90,0.07);
  border: 1px solid rgba(50,140,90,0.2);
  border-radius: 14px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: slide-up 0.3s var(--ease);
}
.upload-results-header { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: #80d0a0; }
.upload-results-header svg { color: #60c080; flex-shrink: 0; }
.upload-results-summary { font-size: 14px; color: var(--text-secondary); line-height: 1.6; }
.upload-results-stats { display: flex; flex-wrap: wrap; gap: 6px; }

.upload-stat-chip {
  font-size: 12px; font-weight: 500;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
}
.upload-stat-chip.upload-stat-green { background: rgba(50,140,90,0.12); border-color: rgba(50,140,90,0.25); color: #80d0a0; }
.upload-stat-chip.upload-stat-amber { background: rgba(201,150,42,0.1); border-color: rgba(201,150,42,0.25); color: var(--gold-light); }
.upload-stat-chip.upload-stat-blue  { background: rgba(80,120,220,0.1); border-color: rgba(80,120,220,0.25); color: #90b0f0; }

.upload-transcript-details { border-top: 1px solid rgba(255,255,255,0.06); padding-top: 10px; }
.upload-transcript-details summary { font-size: 12px; color: var(--text-muted); cursor: pointer; user-select: none; text-transform: uppercase; letter-spacing: 0.06em; }
.upload-transcript-details summary:hover { color: var(--text-secondary); }
.upload-transcript-pre {
  margin-top: 10px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-3);
  border-radius: 8px;
  padding: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
  line-height: 1.6;
}

/* ── Session dividers & history ────────────────────────────────── */

.session-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.session-divider::before,
.session-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.session-divider span {
  white-space: nowrap;
  flex-shrink: 0;
}
.session-divider-new span {
  color: var(--gold-dim);
}

.upload-history-card {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  align-self: center;
  font-size: 12px;
  color: var(--text-muted);
  background: rgba(201,150,42,0.06);
  border: 1px dashed rgba(201,150,42,0.18);
  border-radius: 8px;
  padding: 6px 14px;
  margin: 2px auto;
}

/* ── Unlock / access overlay ─────────────────────────────────────────────── */
.unlock-card {
  width: 100%;
  max-width: 380px;
  margin: 0 24px;
  padding: 40px 36px;
  background: var(--bg-1);
  border: 1px solid rgba(201,150,42,0.25);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(0,0,0,0.55);
  text-align: center;
}
.unlock-icon { font-size: 34px; margin-bottom: 14px; }
.unlock-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  color: #f3ead4;
  margin: 0 0 6px;
}
.unlock-subtitle {
  color: #9aa0ad;
  font-size: 0.92rem;
  margin: 0 0 22px;
}
.unlock-input {
  width: 100%;
  padding: 13px 15px;
  background: var(--bg-0);
  border: 1px solid var(--bg-4);
  border-radius: 10px;
  color: #f3ead4;
  font-size: 1rem;
  margin-bottom: 16px;
  outline: none;
  transition: border-color 0.18s ease;
}
.unlock-input:focus { border-color: var(--gold); }
.unlock-error {
  margin-top: 14px;
  color: #e7857a;
  font-size: 0.85rem;
}
