/* ---- home overlay (shown before connecting) ---- */
#startOverlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 72px 24px 42px;
  z-index: 30;
  overflow: auto;
  background:
    radial-gradient(900px 560px at 14% 16%, rgba(34, 211, 238, 0.18), transparent 64%),
    radial-gradient(780px 520px at 86% 18%, rgba(236, 72, 153, 0.18), transparent 62%),
    radial-gradient(720px 520px at 72% 92%, rgba(34, 197, 94, 0.14), transparent 64%),
    linear-gradient(135deg, #f5fbff 0%, #f7f3ff 48%, #fff8fb 100%);
}

#startOverlay::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(120deg, transparent 0 43%, rgba(255, 255, 255, 0.62) 43% 44%, transparent 44% 100%),
    radial-gradient(rgba(51, 65, 85, 0.08) 1px, transparent 1.2px);
  background-size: 100% 100%, 28px 28px;
  mask-image: radial-gradient(ellipse 72% 72% at 50% 50%, #000 42%, transparent 100%);
}

#startOverlay.hidden { display: none; }

#landing {
  position: relative;
  z-index: 1;
  width: min(100%, 820px);
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 14px;
  margin: 0 0 16px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.64);
  box-shadow: 0 14px 34px rgba(31, 41, 55, 0.06);
  color: #4f5f76;
  font: 800 12px/1 "Inter", sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#landingTitle {
  margin: 0 auto 28px;
  max-width: 760px;
  color: #101827;
  font: 800 54px/1 "Inter", sans-serif;
  letter-spacing: -0.055em;
}

/* landing flow: learner path chips and the topic box are visible from load
   (the composer is the entry point now, not gated behind a mode choice).
   Only the class dropdown stays hidden until "School/College" is picked
   (home-interactions.js) — it doesn't apply to the Curious path, and once
   revealed it stays on screen so the student can still change their class. */
.landing-step { display: none; }

.learner-paths {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 9px;
  margin: 0 auto 18px;
}

.path-chip,
.prompt-chips button {
  min-height: 38px;
  border: 1px solid rgba(203, 213, 225, 0.88);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: #475569;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
  font: 800 13px/1 "Inter", sans-serif;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.path-chip {
  padding: 0 16px;
}

.path-chip:hover,
.prompt-chips button:hover {
  transform: translateY(-1px);
  border-color: rgba(59, 130, 246, 0.42);
  background: #fff;
  color: #2563eb;
}

.path-chip.selected {
  border-color: transparent;
  background: #111827;
  color: #fff;
}

/* class dropdown, shown inline next to the path chips once "School/College"
   is picked — a dropdown keeps 13 options compact instead of a chip grid,
   and (per .landing-step above) stays visible after a class is chosen. */
select.class-select.landing-step.visible { display: inline-flex; }
.class-select {
  min-height: 38px;
  padding: 0 34px 0 16px;
  border: 1px solid rgba(203, 213, 225, 0.88);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%23475569" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round"><path d="M6 9l6 6 6-6"/></svg>') no-repeat right 12px center;
  background-size: 14px;
  color: #475569;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
  font: 800 13px/1 "Inter", sans-serif;
  appearance: none;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background-color 0.16s ease, color 0.16s ease;
}

.class-select:hover {
  transform: translateY(-1px);
  border-color: rgba(59, 130, 246, 0.42);
  color: #2563eb;
}

#topicBox {
  position: relative;
  overflow: hidden;
  padding: 22px 22px 18px;
  border: 1px solid rgba(255, 255, 255, 0.92);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 34px 90px rgba(15, 23, 42, 0.13);
  text-align: left;
  backdrop-filter: blur(18px);
}

#topicBox::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.48), rgba(59, 130, 246, 0.2), rgba(236, 72, 153, 0.42));
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  pointer-events: none;
}

/* Writing area: its own bordered/tinted box (distinct from #topicBox's outer
   glass card) so it visually reads as THE place to type, separate from the
   tools below it. #dictateBtn/#fileChip/#inferredModeChip are positioned
   relative to this wrap now, not the outer #topicBox. */
.topic-input-wrap {
  position: relative;
  z-index: 1;
  padding: 14px 16px 10px;
  border: 1px solid rgba(59, 130, 246, 0.22);
  border-radius: 18px;
  background: rgba(239, 246, 255, 0.55);
  margin-bottom: 16px;
}

.topic-input-label {
  margin: 0 0 6px;
  color: #3478f6;
  font: 800 11px/1 "Inter", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

#topicInput {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 74px;
  padding-right: 44px; /* keeps typed text clear of #dictateBtn's corner */
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: #172033;
  font: 700 17px/1.6 "Inter", sans-serif;
}

#topicInput::placeholder {
  color: #a3adbd;
}

#dictateBtn {
  position: absolute;
  z-index: 2;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #eef4ff;
  color: #64748b;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}
#dictateBtn[hidden] { display: none; }
#dictateBtn svg { width: 17px; height: 17px; }
#dictateBtn:hover { transform: translateY(-1px); background: #e2ecff; color: #2563eb; }
#dictateBtn.listening {
  background: linear-gradient(135deg, #14b8a6, #3b82f6 56%, #ec4899);
  color: #fff;
  animation: dictate-pulse 1.4s ease-in-out infinite;
}
@keyframes dictate-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.45); }
  50% { box-shadow: 0 0 0 8px rgba(59, 130, 246, 0); }
}

#inferredModeChip {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 2px 0 10px;
}
#inferredModeChip[hidden] { display: none; }

.mode-chip {
  height: 28px;
  padding: 0 14px;
  border: 1px solid rgba(203, 213, 225, 0.88);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
  color: #94a3b8;
  font: 800 11.5px/1 "Inter", sans-serif;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.mode-chip:hover { transform: translateY(-1px); color: #475569; }
.mode-chip.active {
  border-color: transparent;
  background: linear-gradient(135deg, #14b8a6, #3b82f6 56%, #ec4899);
  color: #fff;
}

#chooseTopicSection {
  position: relative;
  z-index: 1;
  margin: 4px 0 14px;
}
#chooseTopicLabel {
  margin: 0 0 8px;
  color: #94a3b8;
  font: 800 11px/1 "Inter", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
#subjectTiles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.subject-tile {
  height: 30px;
  padding: 0 14px;
  border: 1px solid rgba(203, 213, 225, 0.88);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: #475569;
  font: 800 12px/1 "Inter", sans-serif;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.subject-tile:hover { transform: translateY(-1px); border-color: rgba(59, 130, 246, 0.42); color: #2563eb; }
.subject-tile.active {
  border-color: transparent;
  background: #111827;
  color: #fff;
}

#chemistryBranches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
#chemistryBranches[hidden] { display: none; }

#topicSuggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
#topicSuggestions[hidden] { display: none; }
#topicSuggestions button {
  height: 28px;
  padding: 0 13px;
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 999px;
  background: rgba(139, 92, 246, 0.08);
  color: #6d28d9;
  font: 700 11.5px/1 "Inter", sans-serif;
  transition: transform 0.15s ease, background 0.15s ease;
}
#topicSuggestions button:hover { transform: translateY(-1px); background: rgba(139, 92, 246, 0.16); }

/* "Circle the question" overlay — reuses .learning-guide's fixed-scrim-dialog
   shell (see #learningGuide) so it matches that modal's look. */
#circleQuestionOverlay .learning-guide-dialog { width: min(100%, 560px); padding: 24px; }
#circleQuestionHint {
  margin: 0 0 14px;
  color: #475569;
  font: 600 13px/1.5 "Inter", sans-serif;
}
#circleQuestionCanvasWrap {
  position: relative;
  width: 100%;
  max-height: 60vh;
  overflow: auto;
  border-radius: 12px;
  background: #f4f6f9;
}
#circleQuestionImg { display: block; width: 100%; height: auto; user-select: none; }
#circleQuestionCanvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; touch-action: none; }
#circleQuestionActions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}
#circleQuestionActions button {
  height: 40px;
  padding: 0 18px;
  border-radius: 10px;
  font: 800 13px/1 "Inter", sans-serif;
}
#circleQuestionSkip { border: 1px solid rgba(203, 213, 225, 0.88); color: #475569; background: #fff; }
#circleQuestionConfirm { border: none; color: #fff; background: linear-gradient(135deg, #14b8a6, #3b82f6 56%, #ec4899); }
#circleQuestionConfirm:disabled { opacity: 0.45; cursor: default; }

#fileChip {
  position: relative;
  z-index: 1;
  display: none;
  align-items: center;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  margin: 4px 0 10px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #edf7ff;
  color: #2563eb;
  font: 800 12px/1 "Inter", sans-serif;
}

#fileChip.show { display: inline-flex; }
#fileChipName { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 360px; }
#fileChipRemove { cursor: pointer; color: #8b97a8; font-weight: 800; font-size: 15px; }
#fileChipRemove:hover { color: #334155; }

/* Tools area: prompt chips, subject browser, attach/practice/start actions —
   everything the student DOES once a question is typed, kept visually
   distinct from .topic-input-wrap above via a divider + top spacing rather
   than another bordered box (avoids nested-card clutter). */
.topic-tools {
  padding-top: 14px;
  border-top: 1px dashed rgba(203, 213, 225, 0.7);
}

.prompt-chips {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 2px 0 14px;
}

.prompt-chips button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
}

#topicRow {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.attach-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 0 15px;
  border: 1px solid #dbe3ef;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
  color: #475569;
  font: 800 13px/1 "Inter", sans-serif;
}

.attach-btn:hover {
  background: #f8fbff;
  border-color: #c7d3e4;
}

.attach-btn svg {
  width: 15px;
  height: 15px;
}

#practiceBtn, #timedQuizBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  margin-left: auto;
  padding: 0 16px;
  border: 1px solid rgba(139, 92, 246, 0.35);
  border-radius: 999px;
  background: rgba(139, 92, 246, 0.08);
  color: #6d28d9;
  font: 800 13px/1 "Inter", sans-serif;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease;
}

#practiceBtn:hover { background: rgba(139, 92, 246, 0.14); border-color: rgba(139, 92, 246, 0.5); }
#practiceBtn[disabled] { opacity: 0.6; cursor: default; }
#timedQuizBtn { text-decoration: none; margin-left: 0; }
#timedQuizBtn:hover { background: rgba(139, 92, 246, 0.14); border-color: rgba(139, 92, 246, 0.5); }

#startBtn {
  min-height: 48px;
  padding: 0 28px;
  border-radius: 999px;
  background: linear-gradient(135deg, #14b8a6 0%, #3478f6 58%, #ec4899 100%);
  box-shadow: 0 18px 32px rgba(52, 120, 246, 0.28);
  color: #fff;
  font: 800 15px/1 "Inter", sans-serif;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

#startBtn:hover {
  transform: translateY(-1px);
  filter: saturate(1.08);
  box-shadow: 0 22px 38px rgba(52, 120, 246, 0.34);
}

#startBtn[disabled] {
  opacity: 0.5;
  cursor: default;
  transform: none;
  box-shadow: none;
}

/* ---- pre-lesson learning path recommendation --------------------------- */
body.learning-guide-open { overflow: hidden; }
.learning-guide[hidden] { display: none; }
.learning-guide {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 24px;
}

.learning-guide-scrim {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  background: rgba(10, 25, 48, 0.5);
  backdrop-filter: blur(7px);
  cursor: default;
}

.learning-guide-dialog {
  position: relative;
  width: min(100%, 650px);
  max-height: min(760px, calc(100vh - 48px));
  overflow: auto;
  padding: 30px;
  border: 1px solid rgba(255, 255, 255, 0.92);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 32px 90px rgba(10, 25, 48, 0.26);
  color: #172033;
}

.learning-guide-close {
  position: absolute;
  top: 18px;
  right: 18px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid #dbe3ef;
  border-radius: 50%;
  background: #f8fafc;
  color: #64748b;
  font: 500 24px/1 "Inter", sans-serif;
}
.learning-guide-close:hover { background: #eef2f7; color: #172033; }

.learning-guide-eyebrow {
  margin: 0 48px 8px 0;
  color: #2563eb;
  font: 800 11px/1.2 "Inter", sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.learning-guide-dialog h2 {
  margin: 0 48px 8px 0;
  color: #111827;
  font: 800 28px/1.15 "Inter", sans-serif;
  letter-spacing: 0;
}

#learningGuideIntro {
  margin: 0 48px 24px 0;
  color: #64748b;
  font: 500 14px/1.55 "Inter", sans-serif;
}

.learning-guide-loading {
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #64748b;
  font: 700 13px/1.4 "Inter", sans-serif;
}
.learning-guide-loading[hidden] { display: none; }
.learning-guide-loading span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3e9bfd;
  animation: learning-guide-dot 0.9s ease-in-out infinite;
}
.learning-guide-loading span:nth-child(2) { animation-delay: 0.12s; background: #8b5cf6; }
.learning-guide-loading span:nth-child(3) { animation-delay: 0.24s; background: #f924c2; }
.learning-guide-loading strong { margin-left: 8px; }
@keyframes learning-guide-dot {
  0%, 100% { opacity: 0.35; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-4px); }
}

.learning-guide-options {
  display: grid;
  gap: 12px;
}
.learning-guide-options[hidden] { display: none; }

.learning-option {
  width: 100%;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #fff;
  color: #172033;
  text-align: left;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}
.learning-option:hover,
.learning-option:focus-visible {
  transform: translateY(-1px);
  border-color: #3e9bfd;
  box-shadow: 0 14px 30px rgba(62, 155, 253, 0.14);
}
.learning-option.recommended {
  border: 2px solid #3e9bfd;
  background: #f8fbff;
}
.learning-option.foundation { background: #fbfaf7; }

.learning-option-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #eaf3ff;
  color: #2563eb;
  font: 800 22px/1 "Inter", sans-serif;
}
.foundation .learning-option-icon { background: #e7f8f2; color: #0f766e; }

.learning-option-copy { display: grid; gap: 5px; min-width: 0; }
.learning-option-copy strong {
  color: #111827;
  font: 800 17px/1.28 "Inter", sans-serif;
}
.learning-option-copy > span:not(.learning-option-label) {
  color: #596579;
  font: 500 13px/1.45 "Inter", sans-serif;
}
.learning-option-label {
  width: fit-content;
  padding: 5px 8px;
  border-radius: 999px;
  background: #2563eb;
  color: #fff;
  font: 800 10px/1 "Inter", sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.foundation .learning-option-label { background: #0f766e; }
.learning-option-copy small {
  margin-top: 3px;
  color: #0f766e;
  font: 700 12px/1.4 "Inter", sans-serif;
}
.learning-option-arrow { color: #2563eb; font: 800 22px/1 "Inter", sans-serif; }
.foundation .learning-option-arrow { color: #0f766e; }

.learning-guide-alternative {
  margin: 4px 0 0;
  color: #64748b;
  font: 700 12px/1.4 "Inter", sans-serif;
  text-align: center;
}

@media (max-width: 1024px) {
  #startOverlay {
    align-items: flex-start;
    padding: 34px 14px 28px;
  }

  #landing {
    width: 100%;
  }

  #landingTitle {
    font-size: 38px;
  }

  #topicBox {
    padding: 18px 16px 16px;
    border-radius: 24px;
  }

  .topic-input-wrap {
    padding: 12px 12px 8px;
    border-radius: 14px;
  }

  #topicRow {
    flex-wrap: wrap;
  }

  #startBtn, #practiceBtn, #timedQuizBtn {
    width: 100%;
    margin-left: 0;
  }

  .learning-guide { padding: 12px; }
  .learning-guide-dialog {
    max-height: calc(100vh - 24px);
    padding: 24px 18px 20px;
    border-radius: 14px;
  }
  .learning-guide-dialog h2 { font-size: 23px; }
  #learningGuideIntro { margin-bottom: 18px; }
  .learning-option {
    grid-template-columns: 38px minmax(0, 1fr) 18px;
    gap: 11px;
    padding: 14px 12px;
  }
  .learning-option-icon { width: 38px; height: 38px; font-size: 18px; }
  .learning-option-copy strong { font-size: 15px; }
}
