/* ================================================================
   ALTUX ACADEMY — Platform v3
   Design system: cool obsidian + indigo brand
================================================================ */

/* --- RESET & BASE --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Backgrounds — cool zinc/obsidian */
  --bg:     #09090B;
  --bg-2:   #111113;
  --bg-3:   #18181B;

  /* Text — crisp white scale */
  --fg:     #FAFAFA;
  --fg-2:   #A1A1AA;
  --fg-3:   #52525B;

  /* Aliases for backwards compat within this file */
  --cream:   #FAFAFA;
  --cream-2: #A1A1AA;
  --cream-3: #52525B;

  /* Borders — zinc */
  --border:   #27272A;
  --border-2: #3F3F46;

  /* Brand indigo */
  --blue:       #5B47EB;
  --blue-2:     #818CF8;
  --blue-dark:  #4435C8;
  --blue-bg:    rgba(91, 71, 235, 0.08);
  --blue-glow:  rgba(91, 71, 235, 0.20);

  /* Semantic aliases */
  --blue-light: #818CF8;

  /* Success */
  --green:        #22C55E;
  --green-bg:     rgba(34, 197, 94, 0.08);
  --green-border: rgba(34, 197, 94, 0.30);

  --gradient: linear-gradient(135deg, #5B47EB 0%, #818CF8 100%);

  --radius:    8px;
  --radius-sm: 6px;
  --ease:      cubic-bezier(0.16, 1, 0.3, 1);

  /* Focus ring */
  --ring-shadow: 0 0 0 2px #09090B, 0 0 0 4px #5B47EB;
}

html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'DM Sans', sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: 'Fraunces', serif;
  line-height: 1.2;
  font-weight: 600;
}

em { font-style: italic; color: var(--blue-2); }

/* ================================================================
   SCREEN MANAGEMENT
================================================================ */
.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; flex-direction: column; }

/* Module screen is viewport-locked so chat scrolls internally */
#screen-module { height: 100vh; overflow: hidden; min-height: unset; }

/* ================================================================
   SHARED — LOGO
================================================================ */
.logo {
  font-family: 'Fraunces', serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.01em;
}

.logo span {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-left: 3px;
}

/* ================================================================
   SHARED — BUTTONS
================================================================ */
.btn-primary {
  display: block;
  width: 100%;
  padding: 13px 24px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s var(--ease), box-shadow 0.2s var(--ease), transform 0.1s;
  text-align: center;
  margin-top: 4px;
}

.btn-primary:hover {
  background: var(--blue-dark);
  box-shadow: 0 0 24px var(--blue-glow);
}

.btn-primary:active { transform: scale(0.99); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }
.btn-primary:focus-visible { outline: none; box-shadow: var(--ring-shadow); }

.btn-ghost {
  padding: 8px 16px;
  background: transparent;
  color: var(--fg-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.btn-ghost:hover { border-color: var(--fg-3); color: var(--fg); }

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 0;
  background: transparent;
  color: var(--fg-2);
  border: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  cursor: pointer;
  transition: color 0.2s;
}

.btn-back:hover { color: var(--fg); }

/* ================================================================
   SHARED — INPUTS
================================================================ */
.input {
  width: 100%;
  padding: 13px 14px;
  background: var(--bg-3);
  color: var(--fg);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9375rem;
  outline: none;
  transition: border-color 0.2s;
  margin-bottom: 20px;
}

.input:focus { border-color: var(--blue); }
.input:focus-visible { box-shadow: var(--ring-shadow); }
.input::placeholder { color: var(--fg-3); }
textarea.input { resize: vertical; min-height: 110px; }

/* ================================================================
   SHARED — PAGE NAV + SPLIT LAYOUT
================================================================ */
.page-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

/* 2-column split: left flexible, right fixed 360px */
.split-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 0;
  flex: 1;
  min-height: 0;
}

.split-left {
  padding: 32px;
  border-right: 1px solid var(--border);
  overflow-y: auto;
}

.split-right {
  background: var(--bg-2);
  position: sticky;
  top: 62px;
  height: calc(100vh - 62px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Panel header */
.panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
}

.panel-icon { color: var(--blue-2); font-size: 1rem; }

.panel-title {
  font-family: 'Fraunces', serif;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--fg);
  flex: 1;
}

.btn-refresh {
  background: transparent;
  border: none;
  color: var(--fg-3);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.2s;
}

.btn-refresh:hover { color: var(--blue-2); }

/* ================================================================
   SCREEN W — WELCOME
================================================================ */
#screen-welcome {
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: radial-gradient(ellipse 60% 50% at 50% 0%, rgba(91, 71, 235, 0.10) 0%, transparent 70%);
}

.welcome-wrap {
  max-width: 440px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.welcome-wrap .logo { font-size: 1.5rem; }

.welcome-title {
  font-size: 2.75rem;
  font-weight: 600;
  color: var(--fg);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.welcome-sub {
  font-size: 1rem;
  color: var(--fg-2);
  line-height: 1.65;
}

.welcome-cta { max-width: 280px; }

/* ================================================================
   SCREEN D — DASHBOARD
================================================================ */
#screen-dashboard { background: var(--bg); }

.dash-top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  border-bottom: 1px solid var(--border);
}

.btn-gear {
  background: transparent;
  border: 1px solid var(--border-2);
  color: var(--fg-2);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.btn-gear:hover { border-color: var(--fg-3); color: var(--fg); }

.ai-insight-strip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 32px;
  background: var(--blue-bg);
  border-bottom: 1px solid rgba(91, 71, 235, 0.12);
}

.insight-icon { color: var(--blue-2); font-size: 0.875rem; margin-top: 3px; flex-shrink: 0; }

.insight-text {
  font-size: 0.875rem;
  color: var(--fg-2);
  line-height: 1.55;
}

.cards-section {
  padding: 32px;
  flex: 1;
}

.section-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--fg-3);
  text-transform: uppercase;
  letter-spacing: 0.10em;
  margin-bottom: 16px;
  font-family: 'DM Sans', sans-serif;
}

/* Roadmap cards grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

/* Roadmap card */
.roadmap-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), transform 0.15s var(--ease), box-shadow 0.2s var(--ease);
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 140px;
}

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

.rcard-status {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 100px;
  display: inline-block;
  align-self: flex-start;
  letter-spacing: 0.04em;
}

.status-active {
  background: var(--blue-bg);
  color: var(--blue-2);
  border: 1px solid rgba(91, 71, 235, 0.2);
}

.status-done {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-border);
}

.rcard-title {
  font-family: 'Fraunces', serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--fg);
  line-height: 1.3;
  flex: 1;
}

.rcard-modules { font-size: 0.8rem; color: var(--fg-3); }

.rcard-progress-bar {
  height: 2px;
  background: var(--border-2);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 4px;
}

.rcard-progress-fill {
  height: 100%;
  background: var(--gradient);
  border-radius: 2px;
  transition: width 0.4s var(--ease);
}

/* "+" new roadmap card */
.new-card {
  background: transparent;
  border: 1px dashed var(--border-2);
  justify-content: center;
  align-items: center;
  gap: 10px;
  min-height: 140px;
}

.new-card:hover { border-color: var(--blue); background: var(--blue-bg); }

.new-card-plus {
  font-size: 1.75rem;
  color: var(--fg-3);
  line-height: 1;
  transition: color 0.2s;
}

.new-card:hover .new-card-plus { color: var(--blue-2); }

.new-card-label {
  font-size: 0.8125rem;
  color: var(--fg-3);
  transition: color 0.2s;
}

.new-card:hover .new-card-label { color: var(--fg-2); }

/* Settings modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-box {
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: 12px;
  padding: 28px;
  max-width: 400px;
  width: 100%;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-header h3 { font-size: 1.0625rem; color: var(--fg); }

.btn-modal-close {
  background: transparent;
  border: none;
  color: var(--fg-3);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px;
  transition: color 0.2s;
}

.btn-modal-close:hover { color: var(--fg); }
.modal-body { font-size: 0.875rem; color: var(--fg-2); line-height: 1.6; }

/* ================================================================
   SCREEN 1 — ONBOARDING
================================================================ */
#screen-onboarding {
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: radial-gradient(ellipse 50% 40% at 50% -10%, rgba(91, 71, 235, 0.08) 0%, transparent 70%);
}

.card {
  position: relative;
  width: 100%;
  max-width: 560px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px;
}

.card .logo { margin-bottom: 32px; }

.step-progress {
  height: 2px;
  background: var(--border-2);
  border-radius: 2px;
  margin-bottom: 8px;
  overflow: hidden;
}

.step-progress-fill {
  height: 100%;
  background: var(--gradient);
  border-radius: 2px;
  width: 20%;
  transition: width 0.4s var(--ease);
}

.step-label { font-size: 0.8125rem; color: var(--fg-3); margin-bottom: 32px; }

.step { display: none; flex-direction: column; }
.step.active { display: flex; }

.question {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 10px;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.hint { font-size: 0.875rem; color: var(--fg-2); margin-bottom: 20px; line-height: 1.5; }

.option-grid { display: grid; gap: 8px; margin-bottom: 20px; }
.option-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.option-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }

.option-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 14px;
  background: var(--bg-3);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-align: left;
}

.option-btn:hover { border-color: var(--blue-2); background: var(--blue-bg); }
.option-btn.selected { border-color: var(--blue); background: var(--blue-bg); box-shadow: 0 0 0 1px var(--blue); }

.opt-icon { font-size: 1.125rem; line-height: 1; margin-bottom: 2px; }
.opt-label { font-family: 'DM Sans', sans-serif; font-size: 0.9rem; font-weight: 600; color: var(--fg); }
.opt-desc { font-size: 0.775rem; color: var(--fg-3); line-height: 1.3; }

/* ================================================================
   SCREEN 2 — LOADING
================================================================ */
#screen-loading { align-items: center; justify-content: center; }

.loading-wrap {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 2px solid var(--border-2);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-title { font-size: 1.375rem; color: var(--fg); }
.loading-msg { font-size: 0.875rem; color: var(--fg-2); min-height: 1.5em; }

/* ================================================================
   SCREEN 3 — ROADMAP DETAIL
================================================================ */

/* Goal hero */
.goal-hero { margin-bottom: 24px; }

.goal-title {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 10px;
  line-height: 1.2;
  letter-spacing: -0.015em;
}

.deliverable-tag {
  display: inline-block;
  padding: 4px 12px;
  background: var(--blue-bg);
  border: 1px solid rgba(91, 71, 235, 0.25);
  border-radius: 100px;
  font-size: 0.8125rem;
  color: var(--blue-2);
  font-weight: 500;
  line-height: 1.4;
}

.roadmap-progress { margin-bottom: 32px; }

.roadmap-progress-bar {
  height: 3px;
  background: var(--border-2);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 8px;
}

.roadmap-progress-fill {
  height: 100%;
  background: var(--gradient);
  border-radius: 2px;
  width: 0%;
  transition: width 0.5s var(--ease);
}

.roadmap-progress-text { font-size: 0.8rem; color: var(--fg-3); }

/* Timeline */
.timeline { display: flex; flex-direction: column; position: relative; }

.timeline::before {
  content: '';
  position: absolute;
  left: 19px;
  top: 28px;
  bottom: 28px;
  width: 1px;
  background: var(--border-2);
  z-index: 0;
}

.module-card {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  padding: 10px 0;
  position: relative;
}

.module-dot {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 50%;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--fg-3);
  z-index: 1;
  transition: border-color 0.3s, background 0.3s, color 0.3s;
  font-family: 'DM Sans', sans-serif;
}

.module-card.current .module-dot { border-color: var(--blue); background: var(--blue-bg); color: var(--blue-2); }
.module-card.current .module-body { border-color: rgba(91, 71, 235, 0.35); }
.module-card.completed .module-dot { border-color: var(--green-border); background: var(--green-bg); color: var(--green); }
.module-card.completed .module-body { opacity: 0.55; }
.module-card.locked .module-dot { border-color: var(--border); opacity: 0.4; }
.module-card.locked .module-body { opacity: 0.35; }

.module-body {
  flex: 1;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  transition: border-color 0.2s;
}

.module-week {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--blue-2);
  text-transform: uppercase;
  letter-spacing: 0.10em;
  margin-bottom: 5px;
  font-family: 'DM Sans', sans-serif;
}

.module-card.completed .module-week { color: var(--green); }
.module-title-card { font-family: 'Fraunces', serif; font-size: 1.0625rem; font-weight: 600; color: var(--fg); margin-bottom: 5px; }
.module-objective-card { font-size: 0.875rem; color: var(--fg-2); margin-bottom: 8px; line-height: 1.5; }
.module-mission-preview { font-size: 0.8rem; color: var(--fg-3); margin-bottom: 14px; line-height: 1.4; }
.module-mission-preview strong { color: var(--fg-2); font-weight: 500; }
.module-card-footer { display: flex; align-items: center; gap: 10px; }

.btn-start {
  padding: 7px 18px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
}

.btn-start:hover { background: var(--blue-dark); box-shadow: 0 0 14px var(--blue-glow); }
.module-locked-msg { font-size: 0.775rem; color: var(--fg-3); }
.completed-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 0.8125rem; color: var(--green); font-weight: 500; }
.btn-review {
  padding: 6px 12px;
  background: transparent;
  color: var(--fg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.btn-review:hover { border-color: var(--fg-2); color: var(--fg); }

/* AI Summary panel */
.summary-content {
  padding: 20px;
  flex: 1;
  overflow-y: auto;
}

.summary-text {
  font-size: 0.9rem;
  color: var(--fg);
  line-height: 1.75;
  font-family: 'DM Sans', sans-serif;
}

.summary-loading { font-size: 0.875rem; color: var(--fg-3); font-style: italic; }
.summary-error { font-size: 0.875rem; color: var(--fg-3); }

.btn-retry {
  background: transparent;
  border: none;
  color: var(--blue-2);
  cursor: pointer;
  font-size: 0.875rem;
  text-decoration: underline;
  padding: 0;
}

/* ================================================================
   SCREEN 4 — MODULE DETAIL
================================================================ */
.module-header { margin-bottom: 24px; }

.week-tag {
  display: inline-block;
  padding: 3px 10px;
  background: var(--blue-bg);
  border: 1px solid rgba(91, 71, 235, 0.25);
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--blue-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
  font-family: 'DM Sans', sans-serif;
}

.module-header h2 { font-size: 1.875rem; color: var(--fg); margin-bottom: 10px; letter-spacing: -0.02em; }
.module-detail-objective { font-size: 0.9375rem; color: var(--fg-2); line-height: 1.6; }

/* Mission box */
.mission-box {
  background: var(--bg-3);
  border: 1px solid var(--border-2);
  border-left: 2px solid var(--blue);
  border-radius: var(--radius);
  padding: 18px 20px 18px 20px;
  margin-bottom: 28px;
}

.mission-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--blue-2);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 8px;
  font-family: 'DM Sans', sans-serif;
}

.mission-box p { font-size: 0.9375rem; color: var(--fg); line-height: 1.65; }

/* Steps */
.steps-box { margin-bottom: 28px; }

.steps-box h3 {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--fg-3);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 12px;
  font-family: 'DM Sans', sans-serif;
}

.step-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: opacity 0.2s;
}

.step-item:last-child { border-bottom: none; }
.step-item:hover { opacity: 0.8; }

.step-num {
  width: 22px;
  height: 22px;
  min-width: 22px;
  border-radius: 4px;
  background: var(--bg-3);
  border: 1px solid var(--border-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--fg-3);
  font-family: 'DM Mono', 'Fira Code', monospace;
  margin-top: 2px;
  flex-shrink: 0;
}

.step-content {
  flex: 1;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.step-checkbox {
  width: 18px;
  height: 18px;
  min-width: 18px;
  border: 1px solid var(--border-2);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, background 0.2s;
  margin-top: 2px;
  font-size: 10px;
  font-weight: 700;
  color: transparent;
  flex-shrink: 0;
}

.step-item.done .step-num { background: var(--green-bg); border-color: var(--green-border); color: var(--green); }
.step-item.done .step-checkbox { border-color: var(--green-border); background: var(--green-bg); color: var(--green); }
.step-item.done .step-text { color: var(--fg-3); text-decoration: line-through; text-decoration-color: var(--fg-3); }

.step-text { font-size: 0.875rem; color: var(--fg-2); line-height: 1.5; }

/* Complete section */
.complete-box {
  text-align: center;
  padding: 24px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.btn-complete {
  padding: 13px 36px;
  background: transparent;
  border: 1px solid var(--green-border);
  color: var(--green);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
  margin-bottom: 10px;
}

.btn-complete:hover { background: var(--green-bg); box-shadow: 0 0 20px rgba(34, 197, 94, 0.10); }
.complete-hint { font-size: 0.8rem; color: var(--fg-3); }

/* ================================================================
   AI CHAT PANEL (Screen 4 right side)
================================================================ */
.chat-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

/* "A" avatar circle */
.chat-avatar {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fraunces', serif;
  font-size: 0.875rem;
  font-weight: 600;
  flex-shrink: 0;
}

.chat-title { font-family: 'Fraunces', serif; font-size: 0.9rem; font-weight: 600; color: var(--fg); }
.chat-subtitle { font-size: 0.7rem; color: var(--fg-3); }

/* Scrollable messages area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  scrollbar-width: none;
}
.chat-messages::-webkit-scrollbar { display: none; }

/* Individual message bubbles */
.chat-bubble {
  display: flex;
  gap: 8px;
  max-width: 92%;
}

.ai-bubble { align-self: flex-start; }
.user-bubble { align-self: flex-end; flex-direction: row-reverse; }

/* Small "A" avatar inside AI bubbles */
.bubble-avatar {
  width: 24px;
  height: 24px;
  min-width: 24px;
  border-radius: 6px;
  background: var(--blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fraunces', serif;
  font-size: 0.6875rem;
  font-weight: 600;
  margin-top: 2px;
  flex-shrink: 0;
}

.bubble-text {
  padding: 9px 13px;
  border-radius: 10px;
  font-size: 0.875rem;
  line-height: 1.6;
  word-break: break-word;
}

.ai-bubble .bubble-text {
  background: var(--bg-3);
  color: var(--fg);
  border: 1px solid var(--border);
  border-bottom-left-radius: 3px;
}

.user-bubble .bubble-text {
  background: var(--blue-bg);
  border: 1px solid rgba(91, 71, 235, 0.20);
  color: var(--fg);
  border-bottom-right-radius: 3px;
}

/* Typing indicator */
.typing-indicator .bubble-text {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 11px 14px;
}

.typing-indicator .bubble-text span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--fg-3);
  display: inline-block;
  animation: typing-bounce 1.2s infinite;
}

.typing-indicator .bubble-text span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator .bubble-text span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* Chat input area */
.chat-input-area {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  padding: 9px 12px;
  background: var(--bg-3);
  color: var(--fg);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  outline: none;
  resize: none;
  transition: border-color 0.2s;
  line-height: 1.5;
}

.chat-input:focus { border-color: var(--blue); }
.chat-input::placeholder { color: var(--fg-3); }

.btn-send {
  padding: 9px 14px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
  flex-shrink: 0;
}

.btn-send:hover { background: var(--blue-dark); }
.btn-send:disabled { opacity: 0.4; cursor: not-allowed; }

/* ================================================================
   SCREEN 5 — COMPLETION
================================================================ */
#screen-done {
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.done-wrap {
  max-width: 560px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.done-icon { font-size: 3rem; }
.done-title { font-size: 2rem; color: var(--fg); letter-spacing: -0.02em; }
.done-sub { font-size: 0.9375rem; color: var(--fg-2); }

.portfolio-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.portfolio-item {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  text-align: left;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.portfolio-check { color: var(--green); font-size: 0.9375rem; margin-top: 2px; flex-shrink: 0; }
.portfolio-mission { font-size: 0.875rem; color: var(--fg); line-height: 1.5; }
.portfolio-module { font-size: 0.75rem; color: var(--fg-3); margin-top: 3px; }

/* ================================================================
   UTILITY
================================================================ */
.hidden { display: none !important; }

/* ================================================================
   MOBILE — 900px
================================================================ */
@media (max-width: 900px) {
  .split-layout {
    grid-template-columns: 1fr;
  }

  .split-right {
    position: static;
    height: auto;
    border-top: 1px solid var(--border);
    border-right: none;
  }

  .chat-panel {
    height: 500px;
  }

  .split-left {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}

/* ================================================================
   MOBILE — 640px
================================================================ */
@media (max-width: 640px) {
  .card { padding: 28px 20px; border-radius: 10px; }
  .question { font-size: 1.25rem; }
  .option-grid.cols-3 { grid-template-columns: 1fr; }
  .option-grid.cols-2 { grid-template-columns: 1fr; }
  .welcome-title { font-size: 2rem; }
  .goal-title { font-size: 1.375rem; }
  .timeline::before { left: 15px; }
  .module-dot { width: 32px; height: 32px; min-width: 32px; font-size: 0.6875rem; }
  .module-card-footer { flex-wrap: wrap; }
  .done-title { font-size: 1.625rem; }
  .dash-top-header, .cards-section { padding: 16px; }
  .ai-insight-strip { padding: 12px 16px; }
  .page-nav { padding: 14px 16px; }
  .split-left { padding: 20px 16px; }
  .module-header h2 { font-size: 1.375rem; }
}

/* ================================================================
   AUTH — Google Login button & user avatar
================================================================ */

.btn-google-login {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding: 11px 22px;
  background: #fff;
  color: #3c4043;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid #dadce0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: box-shadow 0.2s ease, background 0.2s ease;
}
.btn-google-login:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  background: #f8f8f8;
}

.btn-google-login-small {
  padding: 5px 12px;
  background: transparent;
  color: var(--fg-2);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.btn-google-login-small:hover {
  border-color: var(--blue-2);
  color: var(--fg);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--blue);
  cursor: pointer;
  flex-shrink: 0;
}
.user-avatar .user-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.user-avatar .user-initial {
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

.btn-signout {
  padding: 5px 10px;
  background: transparent;
  color: var(--fg-3);
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.btn-signout:hover { color: var(--fg); border-color: var(--border-2); }
