/* The study workspace shares the dashboard's quiet, celestial visual language. */
.studio-page { --studio-gutter:clamp(16px, 3vw, 36px); }
.studio-page .workspace-main, .exam-page .workspace-main { min-width:0; }
.studio-page .workspace-main, .exam-page .workspace-main { background:radial-gradient(ellipse at 75% 0, #30224b48, transparent 580px); }
.studio-breadcrumb { display:flex; align-items:center; gap:12px; font-size:13px; color:var(--text-muted); }
.studio-breadcrumb a { color:var(--text-muted); text-decoration:none; }
.studio-breadcrumb strong { font-weight:500; color:var(--text-main); }
.studio-breadcrumb > svg, .studio-breadcrumb > [data-icon] { width:14px; }
.mobile-menu { display:none; }
.studio-intro { padding:22px var(--studio-gutter) 14px; }
.studio-intro h1 { margin:0; font-size:clamp(30px, 4vw, 42px); letter-spacing:-.045em; font-weight:700; line-height:1.1; }
.studio-page .studio-source-row {
  display:grid;
  grid-template-columns:minmax(168px, 220px) minmax(0, 1fr) auto;
  align-items:center;
  gap:12px;
  margin:0 var(--studio-gutter) 16px;
  padding:12px;
  border:1px solid var(--space-border);
  border-radius:var(--radius-md);
  background:var(--space-card);
}
.studio-source-label { display:flex; align-items:center; gap:10px; min-width:0; }
.studio-source-icon { display:grid; flex:none; place-items:center; width:38px; height:38px; border-radius:10px; background:var(--accent-star-glow); color:var(--accent); }
.studio-source-icon .icon { width:19px; height:19px; }
.studio-source-row label { display:block; color:var(--text-main); font-size:13px; font-weight:650; }
.studio-source-row .source-badge { display:block; margin-top:2px; color:var(--text-muted); font-size:11px; }
.studio-source-row select { width:100%; min-width:0; max-width:none; min-height:44px; padding:9px 32px 9px 12px; font-size:14px; text-overflow:ellipsis; }
.studio-source-row .studio-add-source { gap:6px; min-height:44px; padding:8px 12px; }
.studio-add-source .icon { width:16px; height:16px; }
.studio-shortcuts { display:none; }
.studio-alert { margin:0 var(--studio-gutter) 16px; border:1px solid #635077; border-radius:12px; padding:13px 16px; background:#1d1830; color:#d9c9f2; font-size:13px; }
.studio-alert a { color:#e6dcff; }
.studio-body {
  display:grid;
  grid-template-columns:minmax(320px, .9fr) minmax(0,1.4fr);
  gap:14px;
  height:max(540px, calc(100vh - 248px));
  height:max(540px, calc(100dvh - 248px));
  margin:0 var(--studio-gutter) 24px;
}
.chat-pane, .tool-pane { display:flex; flex-direction:column; min-width:0; min-height:0; }
.studio-body > :is(.chat-pane, .tool-pane) {
  overflow:hidden;
  border:1px solid var(--space-border);
  border-radius:var(--radius-lg);
  box-shadow:0 12px 36px #07081128;
  scroll-margin-top:80px;
}
.chat-pane { background:linear-gradient(165deg,#151725 0%,#10121d 60%); }
.pane-heading { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:12px 16px; border-bottom:1px solid var(--space-border); }
.pane-title { display:flex; min-width:0; gap:10px; align-items:center; }
.mini-star { display:grid; place-items:center; width:36px; height:36px; border-radius:12px; background:#26213d; border:1px solid #44335e; color:#d7c3ff; font-size:23px; }
.pane-title .mini-star { flex:none; }
.pane-title h2 { font-size:15px; margin:0; font-weight:650; line-height:1.25; }
.pane-actions { display:flex; align-items:center; gap:4px; flex:none; }
.pane-heading .icon-button { width:40px; height:40px; }
.pane-heading .text-link { min-height:40px; padding-inline:6px; white-space:nowrap; }
.pane-heading .icon-button[aria-pressed="true"] { color:var(--accent); background:#2a2241; border-color:#675184; }
.chat-log { flex:1; overflow:auto; padding:22px 17px; display:flex; flex-direction:column; gap:18px; min-height:0; scroll-behavior:smooth; }
.chat-welcome { margin:auto; text-align:center; padding:20px 10px; max-width:320px; }
.tutor-stellina { display:block; margin:0 auto; width:76px; height:76px; object-fit:contain; }
.chat-welcome:has(.tutor-stellina) h3 { margin:8px 0; font-weight:720; }
.chat-orbit { position:relative; height:94px; width:94px; margin:0 auto 28px; border:1px solid #2e2945; border-radius:50%; display:grid; place-items:center; transform:rotate(-25deg); }
.chat-orbit::before { content:""; position:absolute; width:122px; height:46px; border:1px solid #4b3d6e; border-radius:50%; }
.chat-orbit::after { content:""; position:absolute; width:6px; height:6px; border-radius:50%; background:#d7c2ff; right:0; top:22px; box-shadow:0 0 16px #c6a4ff; }
.chat-orbit span { font-size:49px; color:#c3a6ff; text-shadow:0 0 32px #8b66c888; transform:rotate(25deg); }
.chat-welcome .eyebrow { font-size:8px; letter-spacing:1.3px; color:#9784bd; }
.chat-welcome h3 { font-size:24px; line-height:1.4; letter-spacing:-.7px; font-weight:500; margin:14px 0; }
.chat-welcome p { font-size:12px; line-height:1.9; color:var(--text-muted); margin:0; }
.msg-wrapper { display:flex; align-items:flex-start; gap:9px; max-width:100%; }
.msg-wrapper.user { align-self:flex-end; max-width:92%; }
.avatar { display:grid; place-items:center; flex-shrink:0; width:26px; height:26px; border-radius:9px; font-size:17px; }
.ai-avatar { color:#c9b0ff; background:#2a223d; }
.message-content { min-width:0; }
.msg { font-size:14px; line-height:1.7; overflow-wrap:anywhere; }
.msg.user { white-space:pre-wrap; background:#29213c; border:1px solid #3e3257; border-radius:14px 14px 4px 14px; padding:11px 14px; color:#e7dcfc; }
.msg.ai { color:#cdd0e1; }
.chat-log .msg.ai:not(.typing) { font-size:14px; line-height:1.7; }
.chat-log .msg.ai h3 { margin-block:12px 5px; line-height:1.35; }
.chat-log .msg.ai li + li { margin-top:4px; }
.msg p:first-child, .rich-output p:first-child { margin-top:0; }
.msg p:last-child { margin-bottom:0; }
.msg ul, .rich-output ul { padding-left:20px; }
.msg-actions { display:flex; gap:12px; margin-top:10px; }
.msg-btn { border:0; background:none; color:var(--text-dim); font-size:10px; cursor:pointer; padding:4px 0; }
.msg-btn:hover { color:var(--accent); }
.typing { color:var(--text-muted); animation:soft-pulse 1.6s infinite; }
.chips { display:flex; flex-wrap:wrap; gap:6px; padding:8px 16px 12px; }
.chip { color:var(--text-muted); border:1px solid var(--space-border); background:transparent; border-radius:var(--radius-pill); padding:7px 10px; font-size:12px; cursor:pointer; transition:border-color .2s,color .2s; }
.chip:hover { color:#e3d6ff; border-color:#685385; }
.composer { margin:0 14px; padding:12px; background:#191b29; border:1px solid #343348; border-radius:14px; }
.composer:focus-within { border-color:#8d70bc; }
.composer textarea { border:0; background:transparent; border-radius:0; outline:none; padding:0; width:100%; min-height:44px; max-height:140px; resize:none; font-size:14px; color:var(--text-main); box-shadow:none; }
.composer textarea:focus-visible { outline:none; box-shadow:none; }
.composer textarea::placeholder { color:#797c99; }
.composer-bottom { display:flex; justify-content:space-between; gap:8px; align-items:center; margin-top:7px; }
.composer-bottom > span { font-size:10px; color:var(--text-dim); max-width:160px; }
.composer-bottom > div { display:flex; align-items:center; gap:5px; }
.composer .icon-button, .composer .send-button { width:40px; min-height:40px; height:40px; padding:0; border-radius:9px; display:grid; place-items:center; }
.composer svg { width:16px; height:16px; }
.mic-btn.active { color:#f49db6; background:#492d3c; }
.ai-footnote { text-align:center; font-size:10px; color:var(--text-dim); margin:8px 12px 10px; }
.chat-error { padding:12px; border:1px solid #6b3f52; border-radius:12px; background:#281b28; font-size:12px; color:#f3b4c4; }
.chat-error p { margin:0 0 10px; }
.chat-error button { font-size:11px; padding:6px 10px; }
.tool-pane { background:#10131e; }
.tool-nav-tabs { display:flex; flex-wrap:wrap; gap:4px; flex-shrink:0; align-items:center; padding:9px 12px; border-bottom:1px solid var(--space-border); background:#181a28; }
.tab-btn { display:inline-flex; align-items:center; justify-content:center; gap:6px; min-height:44px; white-space:nowrap; background:transparent; border:1px solid transparent; border-radius:10px; padding:9px 11px; font-size:12px; color:var(--text-muted); cursor:pointer; }
.tab-btn svg { width:13px; height:13px; }
.tab-btn:hover { color:var(--text-main); background:#1b1c2c; }
.tab-btn.active { color:#d4bfff; background:#272039; border-color:#49365d; }
.tool-viewport { flex:1; overflow:auto; min-height:0; padding:24px; }
.tool-viewport > section { min-width:0; }
.tool-title { display:grid; grid-template-columns:auto minmax(0, 1fr); align-items:center; gap:8px 12px; margin:0 0 18px; }
.tool-title h2 { font-size:26px; font-weight:650; letter-spacing:-.6px; line-height:1.2; margin:0; }
.tool-title p { grid-column:1/-1; color:var(--text-muted); font-size:13px; line-height:1.6; margin:0; max-width:52ch; }
.tool-symbol { display:inline-grid; place-items:center; width:42px; height:42px; border-radius:13px; border:1px solid; }
.tool-symbol svg { width:20px; height:20px; }
.tool-symbol.lilac { color:#c1a3fa; background:#251e36; border-color:#463456; }
.tool-symbol.peach { color:#e1aa8c; background:#30231f; border-color:#4d352b; }
.tool-symbol.mint { color:#8bc8b2; background:#1b2c29; border-color:#2f4a42; }
.tool-symbol.blue { color:#8eb8e2; background:#1c2936; border-color:#31475c; }
.tool-controls { display:flex; flex-wrap:wrap; align-items:flex-end; gap:12px; padding:16px; margin-bottom:20px; background:#171a27; border:1px solid var(--space-border); border-radius:12px; }
.tool-controls label { display:flex; flex-direction:column; gap:7px; min-width:0; font-size:12px; color:var(--text-muted); }
.tool-controls input { width:88px; min-height:44px; padding:8px 10px; font-size:13px; }
.tool-controls select { max-width:100%; min-height:44px; padding:8px 30px 8px 10px; font-size:13px; }
.tool-controls button { font-size:12px; padding:9px 12px; min-height:44px; }
.tool-controls:not(:has(> :not([hidden]))) { display:none; }
.podcast-status { color:var(--text-muted); font-size:12px; line-height:1.7; margin:0; }
.podcast-status:not(:empty) { margin-bottom:14px; }
.podcast-player { display:flex; flex-wrap:wrap; align-items:center; gap:12px; margin-bottom:20px; }
.podcast-player audio { flex:1 1 240px; min-width:0; max-width:100%; }
.note-editor { display:grid; gap:12px; }
.note-editor label { display:grid; gap:6px; }
.note-editor textarea { width:100%; resize:vertical; }
.note-editor button { justify-self:start; }
.tool-empty { text-align:center; padding:36px 20px; color:var(--text-muted); width:100%; }
.tool-empty > svg, .tool-empty > [data-icon] { width:32px; height:32px; color:#77688c; margin:0 auto 15px; }
.empty-star { color:#847399; font-size:28px; margin-bottom:15px; }
.tool-empty h3 { font-size:16px; color:#d8d4e6; font-weight:500; margin:0 0 10px; letter-spacing:-.2px; }
.tool-empty p { font-size:12px; line-height:1.8; max-width:340px; margin:0 auto; }
.viewer-heading { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-bottom:16px; }
.viewer-heading strong { font-size:12px; font-weight:500; overflow-wrap:anywhere; }
.viewer-heading a { font-size:10px; white-space:nowrap; padding:7px 10px; }
.viewer { width:100%; height:calc(100vh - 410px); min-height:470px; background:#fff; border:0; border-radius:10px; }
.source-document-list { display:grid; gap:9px; }
.source-document-button { display:flex; align-items:center; gap:12px; width:100%; padding:13px; background:#191b28; border:1px solid #2c2e42; border-radius:12px; text-align:left; color:var(--text-main); cursor:pointer; }
.source-document-button:hover { border-color:#6a5484; }
.source-document-button > span:nth-child(2) { flex:1; min-width:0; font-size:12px; overflow-wrap:anywhere; }
.source-document-icon { display:grid; place-items:center; width:35px; height:40px; border-radius:7px; color:#b7a2de; background:#2c243d; font-size:8px; flex-shrink:0; }
.source-document-button small { font-size:10px; color:var(--text-dim); white-space:nowrap; }
.source-links { display:flex; flex-wrap:wrap; gap:6px; margin-top:12px; }
.cite { display:inline-block; max-width:100%; padding:4px 7px; color:#c1a6ee; background:#282037; border:1px solid #493559; border-radius:6px; font-size:10px; cursor:pointer; overflow-wrap:anywhere; }
.msg .cite, .rich-output .cite { font:inherit; font-size:.85em; min-height:28px; padding:2px 7px; vertical-align:baseline; }
.cite:hover { color:#f1e7ff; border-color:#bca2ec; background:#392b50; }
.cite:focus-visible { outline:2px solid #c6b0ff; outline-offset:3px; }
.inline-citation { color:#bda4dc; font-size:11px; }
.quiz-mode-picker { min-width:0; margin:0 0 20px; padding:0; border:0; }
.quiz-mode-picker legend { padding:0; margin-bottom:11px; color:#d8cce9; font-size:11px; font-weight:500; }
.quiz-mode-options { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
.quiz-mode-card { position:relative; display:grid; grid-template-columns:16px minmax(0,1fr); align-items:start; gap:10px; min-width:0; padding:16px 14px; border:1px solid #373249; border-radius:12px; background:#171a27; cursor:pointer; transition:background .15s,border-color .15s; }
.quiz-mode-card:hover { background:#211e30; border-color:#74618e; }
.quiz-mode-card:has(input:checked) { border-color:#b49adf; background:linear-gradient(135deg,#2d2341,#1c1b2c); box-shadow:inset 0 0 0 1px #b49adf1f; }
.quiz-mode-card:focus-within { outline:2px solid #d3baf5; outline-offset:3px; }
.quiz-mode-card input { width:16px; height:16px; min-height:0; margin:2px 0 0; padding:0; accent-color:#bea4ea; cursor:pointer; }
.quiz-mode-copy { display:flex; flex-direction:column; gap:6px; min-width:0; }
.quiz-mode-copy strong { font-size:12px; line-height:1.5; color:#eee4fc; font-weight:500; }
.quiz-mode-copy > span { color:#a9a6bc; font-size:10px; line-height:1.75; overflow-wrap:anywhere; }
.quiz-mode-help { margin:11px 2px 0; color:#9995ad; font-size:10px; line-height:1.8; }
.quiz-session-bar { display:flex; justify-content:space-between; align-items:center; gap:12px; margin:0 0 18px; padding:13px 15px; border:1px solid #38443f; background:#18231f; border-radius:11px; }
.quiz-session-bar[hidden] { display:none; }
.quiz-session-details { display:flex; flex-direction:column; gap:5px; min-width:0; }
#quiz-session-status { color:#b5d8c5; font-size:11px; line-height:1.6; }
#quiz-session-source { color:#a7b4b0; font-size:10px; line-height:1.7; overflow-wrap:anywhere; }
#quiz-session-source:empty { display:none; }
.quiz-session-bar.is-unsaved { border-color:#675138; background:#292117; }
.quiz-session-bar.is-unsaved #quiz-session-status { color:#e4c69d; }
.quiz-delete { flex-shrink:0; padding:8px 10px; color:#c4aebc; font-size:10px; }
.quiz-delete:hover { color:#ffd2df; border-color:#885466; background:#35212c; }
.quiz-session-heading { color:#ded4ed; font-size:14px; font-weight:500; line-height:1.7; margin:0 0 12px; overflow-wrap:anywhere; }
.quiz-lesson { padding:23px; margin-bottom:18px; border:1px solid #5b4772; border-radius:14px; background:radial-gradient(ellipse at top right,#6d4b8c1c,transparent 70%),#1d1b2d; }
.quiz-lesson h2, .quiz-lesson h3 { color:#e4d7f4; font-size:17px; font-weight:500; line-height:1.6; margin:0 0 13px; }
.quiz-lesson h3:not(:first-child) { font-size:14px; margin-top:21px; }
.quiz-lesson p { margin:0 0 12px; }
.quiz-lesson p:last-child { margin-bottom:0; }
.quiz-lesson ul, .quiz-lesson ol { padding-left:21px; }
.quiz-lesson-actions { display:flex; align-items:center; flex-wrap:wrap; gap:12px; margin-top:21px; padding-top:17px; border-top:1px solid #44354f; }
.quiz-lesson-actions button { font-size:12px; }
.quiz-progress { margin:0 0 18px; padding:13px 15px; border:1px solid #393047; border-radius:10px; background:#201c2c; color:#c8bbdd; font-size:12px; line-height:1.7; }
.quiz-progress progress { display:block; width:100%; height:6px; margin-top:10px; accent-color:#b79bde; }
.quiz-complete { padding:18px 20px; margin:0 0 18px; border:1px solid #476755; background:linear-gradient(120deg,#20352a,#192823); border-radius:12px; color:#badbc8; font-size:12px; line-height:1.8; }
.quiz-complete h3 { margin:0 0 7px; font-size:16px; color:#d4f0de; font-weight:500; }
.quiz-complete p { margin:0; }
.quiz-score { margin-bottom:16px; padding:10px 12px; border-left:2px solid #b69ada; font-size:12px; color:var(--text-muted); }
.quiz-q { padding:20px; background:#171a27; border:1px solid #2c2e42; border-radius:14px; margin-bottom:16px; }
.q-header { font-size:9px; letter-spacing:1px; color:#9691ab; }
.q-text { font-size:14px; line-height:1.7; font-weight:500; margin:10px 0 14px; }
.quiz-opt { width:100%; text-align:left; display:block; padding:11px 12px; margin-top:7px; border:1px solid #34364c; border-radius:9px; color:#c8c8dc; background:#1d2030; font-size:12px; line-height:1.6; cursor:pointer; }
.quiz-opt:hover:not(:disabled) { border-color:#997bc4; background:#252239; }
.quiz-opt.correct { color:#a5e2be; border-color:#557c65; background:#1b3029; opacity:1; }
.quiz-opt.wrong { color:#edafbe; border-color:#885466; background:#35212c; opacity:1; }
.explain { color:#b8bfcd; font-size:12px; line-height:1.8; border-top:1px solid var(--space-border); padding-top:13px; margin-top:15px; }
.explain.correct { color:#bedccb; border-color:#476755; }
.explain.wrong { color:#e0c3cd; border-color:#764d5f; }
.open-answer { width:100%; resize:vertical; font-size:12px; margin-bottom:12px; }
.question-actions { display:flex; flex-wrap:wrap; gap:8px; }
.question-actions button { font-size:10px; padding:8px 10px; }
.model-answer { margin-top:14px; color:#c3bbd8; font-size:12px; line-height:1.8; padding:12px; background:#251f33; border-radius:8px; }
.deck-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(210px,1fr)); gap:14px; }
.deck-grid > .tool-empty { grid-column:1/-1; }
.flashcard { padding:0; border:1px solid #42324e; background:linear-gradient(145deg,#262035,#171a27); border-radius:15px; overflow:hidden; }
.flip { width:100%; min-height:210px; display:flex; flex-direction:column; justify-content:space-between; align-items:center; gap:20px; padding:24px 20px; text-align:center; border:0; color:var(--text-main); background:transparent; cursor:pointer; }
.flip[aria-pressed="true"] { background:#1f2a31; }
.face-tag { font-size:8px; letter-spacing:1.2px; color:#ab94c6; }
.face-body { font-size:16px; line-height:1.6; overflow-wrap:anywhere; white-space:pre-wrap; }
.face-hint { font-size:9px; color:#9292ab; }
.review-actions { display:flex; justify-content:center; flex-wrap:wrap; gap:6px; padding:12px 8px; border-top:1px solid #36434a; }
.review-button { border:1px solid #48535a; background:#26363a; padding:6px; border-radius:6px; font-size:9px; color:#c2ded7; cursor:pointer; }
.review-status { margin:0; padding:0 12px 12px; text-align:center; font-size:10px; color:#aad4c6; }
.review-status:empty { display:none; }
.rich-output { color:#c7cadb; font-size:13px; line-height:1.9; overflow-wrap:anywhere; }
.rich-output strong { color:#ebe5fa; font-weight:550; }
.research-form label { display:block; margin-bottom:9px; color:#c5bdd6; font-size:11px; }
.research-form textarea { width:100%; resize:vertical; min-height:100px; font-size:12px; }
.research-actions { display:flex; align-items:center; justify-content:space-between; gap:14px; margin:12px 0 20px; }
.research-actions > span { font-size:9px; color:var(--text-dim); max-width:220px; line-height:1.6; }
.research-actions button { font-size:11px; white-space:nowrap; }
.research-status { padding:12px 14px; border:1px solid #44335d; background:#221c31; border-radius:10px; font-size:11px; color:#c3a7ee; margin:14px 0; }
.research-plan { color:var(--text-muted); font-size:11px; line-height:1.9; padding:0 0 0 20px; }
.verification-note { padding:14px; margin:16px 0; border:1px solid #435a51; background:#1d2b28; color:#b2d5c7; border-radius:10px; font-size:11px; line-height:1.8; }
#download-research { margin-top:16px; font-size:11px; }
.mindmap-cluster { display:flex; align-items:flex-start; gap:18px; margin:15px 0; }
.mindmap-pill { text-align:left; padding:9px 12px; border:1px solid #3d3b55; border-radius:10px; font-size:11px; color:#c3bfd5; background:#1c1e2d; line-height:1.5; cursor:pointer; }
.mindmap-pill:hover { color:#e9d9ff; border-color:#9b7cc3; }
.mindmap-pill.root { max-width:45%; color:#d3b9f9; background:#2c2340; border-color:#625073; }
.mindmap-branches { border-left:1px solid #4d3c63; padding-left:18px; display:flex; flex-direction:column; gap:9px; flex:1; }
/* Oral practice */
.exam-page-content { max-width:900px; margin:0 auto; padding:28px 32px 32px; }
.exam-intro {
  position:relative;
  isolation:isolate;
  overflow:hidden;
  margin-bottom:16px;
  padding:clamp(18px, 3vw, 30px);
  border:1px solid #4a3e62;
  border-radius:var(--radius-lg);
  background:radial-gradient(ellipse at 96% 5%,#513b7477,transparent 58%),linear-gradient(145deg,#211b36,#131622 72%);
}
.exam-intro::after {
  position:absolute;
  z-index:-1;
  content:"";
  inset:0;
  opacity:.55;
  background:radial-gradient(circle at 89% 26%,#d3beff 0 2px,transparent 3px),radial-gradient(circle at 94% 69%,#c7affe 0 1px,transparent 2px),radial-gradient(circle at 78% 17%,#b0c9f1 0 1px,transparent 2px),radial-gradient(circle at 83% 86%,#c7affe 0 1px,transparent 2px);
}
.exam-intro h1 { font-size:clamp(28px, 4vw, 42px); line-height:1.12; letter-spacing:-.045em; font-weight:700; margin:0 0 8px; }
.exam-intro h1 span { color:var(--accent); }
.exam-intro > p:last-child { margin:0; max-width:54ch; font-size:14px; line-height:1.6; color:var(--text-muted); }
.exam-setup-card, .exam-session-card { border:1px solid var(--space-border); background:var(--space-card); border-radius:var(--radius-lg); padding:24px; }
.exam-card-top { display:flex; align-items:center; gap:12px; margin-bottom:18px; }
.exam-card-top h2 { font-size:20px; font-weight:650; margin:0; letter-spacing:-.4px; }
.exam-form-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; }
.exam-source-field { grid-column:1/-1; }
.exam-form-grid label { display:flex; flex-direction:column; gap:7px; min-width:0; font-size:13px; color:var(--text-muted); font-weight:600; }
.exam-form-grid select { width:100%; min-height:44px; font-size:13px; padding:10px 30px 10px 12px; text-overflow:ellipsis; }
.read-aloud-option { display:flex; align-items:center; gap:12px; padding:12px; margin:16px 0 14px; border:1px solid var(--space-border); border-radius:var(--radius-sm); background:var(--space-card-hover); cursor:pointer; }
.read-aloud-option input { flex:none; width:19px; height:19px; min-height:0; accent-color:var(--accent); }
.read-aloud-option strong, .read-aloud-option small { display:block; }
.read-aloud-option strong { color:var(--text-main); font-size:13px; font-weight:650; }
.read-aloud-option small { font-size:12px; color:var(--text-muted); margin-top:3px; }
.exam-start-row { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:12px; }
.exam-start-row button { grid-column:2; min-height:44px; font-size:13px; }
.setup-note { margin:0; font-size:12px; color:var(--danger); line-height:1.6; }
.setup-note:empty { display:none; }
.exam-guidance { display:flex; align-items:flex-start; gap:8px; margin:12px 4px 0; color:var(--text-muted); font-size:12px; line-height:1.6; }
.exam-guidance .icon { width:16px; height:16px; color:var(--accent); }
.exam-footnote { color:var(--text-dim); font-size:11px; line-height:1.6; margin:18px 4px 0; }
.exam-session-heading { display:flex; justify-content:space-between; align-items:center; gap:20px; }
.exam-session-heading .eyebrow { font-size:9px; color:#ae95ca; letter-spacing:1.7px; margin:0 0 9px; }
.exam-session-heading strong { font-size:15px; font-weight:500; }
.exam-session-heading button { min-height:44px; font-size:12px; }
.exam-progress-track { height:5px; border-radius:10px; background:#2d2b3f; margin:22px 0 16px; overflow:hidden; }
.exam-progress-track span { display:block; height:100%; width:0; background:linear-gradient(90deg,#8064b6,#d0b1f5); transition:width .4s; }
.exam-status { color:var(--text-muted); font-size:13px; line-height:1.65; margin-bottom:16px; }
.exam-turns > article { margin:0 0 20px; }
.exam-question { padding:22px; background:#292138; border:1px solid #4c395c; border-radius:14px; }
.exam-question .eyebrow, .exam-answer .eyebrow, .exam-closing .eyebrow { color:#b49bcb; font-size:9px; letter-spacing:1.2px; margin:0 0 12px; }
.exam-speech-bubble { margin:0; font-size:16px; color:#e2d6f2; line-height:1.8; white-space:pre-wrap; }
.exam-answer { margin-left:32px!important; padding:20px; border:1px solid #33394a; border-radius:14px; background:#1b202d; }
.exam-answer > p:last-child { font-size:13px; line-height:1.8; margin:0; white-space:pre-wrap; }
.exam-feedback { padding:20px; border:1px solid #374343; background:#172524; border-radius:14px; }
.feedback-heading { display:flex; align-items:center; justify-content:space-between; gap:20px; font-size:12px; }
.feedback-heading strong { font-weight:500; }
.score-badge { border-radius:8px; padding:5px 9px; color:#bfe6ca; background:#293c31; border:1px solid #435f4f; }
.score-badge.improve { color:#edc69f; background:#423627; border-color:#6a5137; }
.exam-feedback p, .exam-feedback li { color:#b4c5c0; font-size:12px; line-height:1.8; }
.exam-feedback ul { padding-left:18px; margin-bottom:0; }
.feedback-label { font-size:11px; font-weight:500; }
.exam-closing { padding:20px; color:#c7bed8; font-size:13px; line-height:1.9; }
#answer-box > label { display:block; font-size:12px; color:#c8bfd8; margin-bottom:12px; }
#answer { width:100%; resize:vertical; min-height:140px; font-size:13px; }
.answer-actions { display:flex; justify-content:space-between; align-items:center; gap:15px; margin-top:14px; }
.answer-actions button { font-size:12px; }
.exam-final { border-top:1px solid var(--space-border); text-align:center; padding-top:30px; }
.final-star { font-size:35px; color:#c6a5f4; }
.exam-final h2 { font-size:24px; font-weight:500; letter-spacing:-.5px; }
.final-score { color:#d3b8ff; font-size:40px; letter-spacing:-1px; margin:18px 0; }
.exam-final > p { color:var(--text-muted); font-size:12px; }
.exam-report { display:grid; grid-template-columns:repeat(auto-fit,minmax(170px,1fr)); gap:15px; margin:24px 0; text-align:left; }
.exam-report section { background:#1e1e30; border:1px solid #3a334a; border-radius:12px; padding:15px; }
.exam-report h3 { color:#d1b8eb; font-size:12px; font-weight:500; margin:0 0 12px; }
.exam-report ul { padding-left:15px; font-size:11px; line-height:1.9; color:#b6aec5; }
.final-actions { display:flex; gap:12px; justify-content:center; flex-wrap:wrap; }
.final-actions > * { font-size:12px; }
#restart-exam { margin-top:20px; }
@keyframes soft-pulse { 50% { opacity:.45; } }
@media (min-width:1650px) {
  .studio-body { grid-template-columns:minmax(365px, .75fr) minmax(0,1.55fr); }
}
@media (max-width:1250px) {
  .tool-viewport { padding:20px; }
  .tab-btn { padding:9px; }
}
@media (max-width:1100px) {
  .studio-body { grid-template-columns:minmax(0,1fr); height:auto; }
  .chat-pane {
    height:clamp(440px, 70vh, 600px);
    height:clamp(440px, 70dvh, 600px);
  }
  .tool-viewport { min-height:360px; overflow:visible; }
  .viewer { height:550px; }
  .studio-page:not(.mobile-app) .studio-shortcuts {
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:8px;
    margin:0 var(--studio-gutter) 12px;
  }
  .studio-shortcuts a { min-height:44px; justify-content:center; }
  .studio-shortcuts a .icon { width:16px; height:16px; }
}
@media (max-width:760px), (pointer:coarse) {
  .pane-heading .icon-button, .composer .icon-button, .composer .send-button { width:44px; height:44px; min-height:44px; }
  .pane-heading .text-link, .chip, .msg-btn, .tool-controls button, .quiz-opt, .quiz-delete,
  .quiz-lesson-actions button, .review-button, .research-actions button, .viewer-heading a,
  .podcast-player a, .answer-actions button, .final-actions > * { min-height:44px; }
  .tool-controls input, .tool-controls select, .exam-form-grid select, .studio-source-row select { font-size:16px; }
  .composer textarea, .research-form textarea, #answer { font-size:16px; }
}
@media (max-width:760px) {
  .mobile-menu { display:inline-flex; }
  .studio-intro { padding-top:18px; }
  .studio-breadcrumb { font-size:11px; gap:8px; }
  .exam-page .workspace-header > .btn-subtle { min-height:44px; padding:8px 10px; }
  .studio-page .studio-source-row { grid-template-columns:minmax(0,1fr) auto; gap:9px; }
  .studio-source-label { grid-column:1/-1; }
  .studio-body { gap:12px; }
  .tool-nav-tabs { padding:7px; }
  .tool-title h2 { font-size:22px; }
  .tool-controls { padding:12px; gap:10px; }
  .tool-controls label { flex:1 1 105px; }
  .tool-controls :is(input, select) { width:100%; }
  .tool-controls button { flex-grow:1; }
  .tool-viewport { min-height:320px; padding:16px 14px; }
  .research-actions { flex-wrap:wrap; }
  .research-actions > span { max-width:none; }
  .research-actions button { width:100%; }
  .exam-page-content { padding:18px 16px 24px; }
  .exam-intro > p:last-child { font-size:13px; }
  .exam-setup-card, .exam-session-card { padding:16px; }
  .exam-page .exam-form-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:11px; }
  .exam-voice-field { grid-column:1/-1; }
  .exam-start-row { grid-template-columns:minmax(0,1fr); gap:8px; }
  .exam-start-row button { grid-column:1; }
  .exam-question { padding:16px; }
  .exam-speech-bubble { font-size:15px; }
  .exam-answer { margin-left:12px!important; padding:16px; }
  .answer-actions { flex-wrap:wrap; gap:8px; }
  .answer-actions button { flex:1; }
}
@media (max-width:600px) {
  .quiz-mode-options { grid-template-columns:1fr; }
  .quiz-mode-card { padding:15px 14px; }
  .quiz-mode-copy strong { font-size:13px; }
  .quiz-mode-copy > span, .quiz-mode-help { font-size:11px; }
  .quiz-session-bar { align-items:flex-start; flex-direction:column; padding:13px; }
  .quiz-lesson { padding:18px 16px; }
  .quiz-lesson-actions button { width:100%; }
  .quiz-q { padding:18px 15px; }
}
@media (max-width:400px) {
  .studio-breadcrumb > a, .studio-breadcrumb > [data-icon="chevron-right"] { display:none; }
  .pane-heading { padding-inline:11px; }
  .pane-title { gap:7px; }
  .pane-title h2 { font-size:14px; }
  .exam-session-heading { gap:8px; }
  .exam-session-heading button { white-space:normal; padding-inline:9px; }
}
@media (max-width:360px) {
  .exam-page .exam-form-grid { grid-template-columns:minmax(0,1fr); }
}
.studio-page.mobile-app { --studio-gutter:var(--mobile-gutter); }
.studio-page.mobile-app .studio-intro { padding-block:18px 12px; }
.studio-page.mobile-app .studio-source-row { margin-bottom:12px; }
@media (prefers-reduced-motion:reduce) { .typing { animation:none; } .chat-log { scroll-behavior:auto; } .exam-progress-track span { transition:none; } }

/* Light study surfaces and answer states. */
html[data-theme="light"] :is(.studio-page, .exam-page) {
  --study-ink: #322647;
  --study-violet: #5732be;
  --study-violet-bg: #f0eaff;
  --study-violet-border: #d9c9fb;
  --study-surface: #faf8ff;
  --study-border: #e5def0;
  --study-green: #225a43;
  --study-green-bg: #ebf8f0;
  --study-green-border: #a5d4b9;
  --study-rose: #933955;
  --study-rose-bg: #fff0f4;
  --study-rose-border: #edbdcb;
  --study-amber: #79501d;
  --study-amber-bg: #fff5e6;
  --study-amber-border: #e8c995;
}
html[data-theme="light"] :is(.studio-page, .exam-page) .workspace-main {
  background: radial-gradient(ellipse at 75% 0, #e8dcff9e, transparent 520px), var(--bg);
}
html[data-theme="light"] :is(.studio-intro, .exam-intro) h1 {
  color: var(--text-main);
  font-size: clamp(29px, 4.6vw, 44px);
  font-weight: 750;
  letter-spacing: -.045em;
}
html[data-theme="light"] .studio-alert {
  border-color: var(--study-violet-border);
  background: var(--study-violet-bg);
  color: var(--study-violet);
}
html[data-theme="light"] .studio-alert a { color: inherit; font-weight: 700; text-decoration: underline; }
html[data-theme="light"] :is(.studio-source-row, .studio-body > .chat-pane, .studio-body > .tool-pane) {
  border-color: var(--study-border);
  box-shadow: 0 10px 28px #2f18500f;
}
html[data-theme="light"] .studio-source-icon { background: var(--study-violet-bg); color: var(--study-violet); }
html[data-theme="light"] .chat-pane { background: linear-gradient(155deg, #faf7ff, #fff 60%); }
html[data-theme="light"] :is(.pane-heading, .tool-pane) { background: #fff; }
html[data-theme="light"] :is(.mini-star, .ai-avatar, .source-document-icon) {
  border-color: var(--study-violet-border);
  background: var(--study-violet-bg);
  color: var(--study-violet);
}
html[data-theme="light"] .mini-star { background: linear-gradient(145deg, #f8f1ff, #e9dcff); }
html[data-theme="light"] .pane-heading .icon-button[aria-pressed="true"] {
  border-color: var(--study-violet-border);
  background: var(--study-violet-bg);
  color: var(--study-violet);
}
html[data-theme="light"] .chat-orbit { border-color: #e0d2fa; background: #f4edff; }
html[data-theme="light"] .chat-orbit::before { border-color: #c7afee; }
html[data-theme="light"] .chat-orbit::after { background: #8656e4; box-shadow: 0 0 12px #a57bee; }
html[data-theme="light"] .chat-orbit span { color: #794bdb; text-shadow: 0 4px 14px #8958d53d; }
html[data-theme="light"] .chat-welcome .eyebrow { color: var(--study-violet); }
html[data-theme="light"] .chat-welcome h3 { font-weight: 700; line-height: 1.25; }
html[data-theme="light"] :is(.msg, .rich-output) { font-size: 14px; }
html[data-theme="light"] .msg.user {
  background: var(--study-violet-bg);
  border-color: var(--study-violet-border);
  color: var(--study-ink);
}
html[data-theme="light"] :is(.msg.ai, .rich-output) { color: var(--study-ink); }
html[data-theme="light"] .rich-output strong { color: var(--text-main); font-weight: 650; }
html[data-theme="light"] :is(.msg, .rich-output, .explain) code {
  border-radius: 4px;
  padding: .08em .27em;
  background: var(--study-violet-bg);
  color: var(--study-violet);
}
html[data-theme="light"] :is(.chip, .composer) { background: #fff; border-color: var(--study-violet-border); }
html[data-theme="light"] .chip { color: var(--study-violet); border-radius: var(--radius-pill); font-size: 12px; }
html[data-theme="light"] .chip:hover { background: var(--study-violet-bg); border-color: var(--accent); }
html[data-theme="light"] .composer { box-shadow: 0 4px 16px #3b20560d; }
html[data-theme="light"] .composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px #6843e820; }
html[data-theme="light"] .composer textarea::placeholder,
html[data-theme="light"] :is(.composer-bottom > span, .ai-footnote) {
  color: var(--text-dim);
}
html[data-theme="light"] .composer textarea { background: transparent; }
html[data-theme="light"] :is(.chat-error, .mic-btn.active) {
  border-color: var(--study-rose-border);
  background: var(--study-rose-bg);
  color: var(--study-rose);
}
html[data-theme="light"] :is(.tool-nav-tabs, .mobile-studio-switch) {
  background: var(--study-surface);
  border-color: var(--study-border);
}
html[data-theme="light"] .mobile-studio-switch button { color: var(--text-muted); }
html[data-theme="light"] .tab-btn:hover { background: var(--study-violet-bg); color: var(--study-violet); }
html[data-theme="light"] :is(.tab-btn.active, .mobile-studio-switch button.active) {
  border-color: var(--study-violet-border);
  background: var(--study-violet-bg);
  color: var(--study-violet);
  box-shadow: none;
  font-weight: 700;
}
html[data-theme="light"] .tool-symbol.lilac {
  color: var(--study-violet);
  background: var(--study-violet-bg);
  border-color: var(--study-violet-border);
}
html[data-theme="light"] .tool-symbol.peach {
  color: var(--study-amber);
  background: var(--study-amber-bg);
  border-color: var(--study-amber-border);
}
html[data-theme="light"] .tool-symbol.mint {
  color: var(--study-green);
  background: var(--study-green-bg);
  border-color: var(--study-green-border);
}
html[data-theme="light"] .tool-symbol.blue { color: #2b587d; background: #ebf5ff; border-color: #c3dcf1; }
html[data-theme="light"] .tool-controls { background: var(--study-surface); border-color: var(--study-border); border-radius: 16px; }
html[data-theme="light"] :is(.tool-controls label, .research-form label, .exam-form-grid label, #answer-box > label) {
  color: var(--study-ink);
  font-size: 13px;
  font-weight: 600;
}
html[data-theme="light"] .tool-empty {
  border: 1px dashed var(--study-violet-border);
  border-radius: 18px;
  background: var(--study-surface);
}
html[data-theme="light"] :is(.tool-empty > svg, .tool-empty > [data-icon], .empty-star) { color: var(--study-violet); }
html[data-theme="light"] .tool-empty h3 { color: var(--text-main); font-weight: 650; }
html[data-theme="light"] :is(.source-document-button, .quiz-mode-card, .quiz-q, .quiz-opt, .mindmap-pill) {
  border-color: var(--study-border);
  background: var(--study-surface);
  color: var(--study-ink);
}
html[data-theme="light"] :is(.source-document-button, .quiz-mode-card, .quiz-opt:not(:disabled), .mindmap-pill):hover {
  background: var(--study-violet-bg);
  border-color: var(--study-violet-border);
}
html[data-theme="light"] :is(.cite, .model-answer, .research-status, .mindmap-pill.root) {
  border-color: var(--study-violet-border);
  background: var(--study-violet-bg);
  color: var(--study-violet);
}
html[data-theme="light"] .cite:hover { border-color: var(--accent); background: #e8dcff; color: var(--study-violet); }
html[data-theme="light"] .cite:focus-visible { outline-color: var(--accent); }
html[data-theme="light"] :is(.inline-citation, .exam-status, .exam-session-heading .eyebrow) { color: var(--study-violet); }
html[data-theme="light"] :is(.quiz-mode-picker legend, .quiz-mode-copy strong, .quiz-session-heading, .quiz-lesson h2, .quiz-lesson h3) {
  color: var(--text-main);
  font-weight: 650;
}
html[data-theme="light"] :is(.quiz-mode-copy > span, .quiz-mode-help, #quiz-session-source, .q-header, .explain) {
  color: var(--text-muted);
}
html[data-theme="light"] .quiz-mode-card:has(input:checked) {
  background: var(--study-violet-bg);
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px #6843e822;
}
html[data-theme="light"] .quiz-mode-card:focus-within { outline-color: var(--accent); }
html[data-theme="light"] :is(.quiz-mode-card input, .read-aloud-option input, .quiz-progress progress) { accent-color: var(--accent); }
html[data-theme="light"] :is(.quiz-session-bar, .quiz-complete, .quiz-opt.correct, .verification-note, .exam-feedback, .score-badge) {
  border-color: var(--study-green-border);
  background: var(--study-green-bg);
  color: var(--study-green);
}
html[data-theme="light"] :is(#quiz-session-status, .quiz-complete h3, .review-status, .exam-feedback p, .exam-feedback li) {
  color: var(--study-green);
}
html[data-theme="light"] :is(.quiz-session-bar.is-unsaved, .score-badge.improve) {
  border-color: var(--study-amber-border);
  background: var(--study-amber-bg);
  color: var(--study-amber);
}
html[data-theme="light"] .quiz-session-bar.is-unsaved #quiz-session-status { color: var(--study-amber); }
html[data-theme="light"] :is(.quiz-delete, .setup-note) { color: var(--study-rose); }
html[data-theme="light"] :is(.quiz-opt.wrong, .quiz-delete:hover) {
  border-color: var(--study-rose-border);
  background: var(--study-rose-bg);
  color: var(--study-rose);
}
html[data-theme="light"] :is(.quiz-lesson, .quiz-progress) {
  border-color: var(--study-violet-border);
  background: var(--study-violet-bg);
  color: var(--study-ink);
}
html[data-theme="light"] .quiz-lesson-actions { border-color: var(--study-violet-border); }
html[data-theme="light"] .quiz-opt { background: #fff; min-height: 44px; }
html[data-theme="light"] .explain.correct { color: var(--study-green); border-color: var(--study-green-border); }
html[data-theme="light"] .explain.wrong { color: var(--study-rose); border-color: var(--study-rose-border); }
html[data-theme="light"] .flashcard {
  background: linear-gradient(150deg, #fff6eb 0%, #fff 74%);
  border-color: var(--study-amber-border);
}
html[data-theme="light"] .flip[aria-pressed="true"] { background: var(--study-green-bg); }
html[data-theme="light"] .flip:focus-visible { outline-offset: -4px; }
html[data-theme="light"] .flashcard:has(.flip[aria-pressed="true"]) { border-color: var(--study-green-border); }
html[data-theme="light"] .face-tag { color: var(--study-amber); font-weight: 700; }
html[data-theme="light"] .flip[aria-pressed="true"] .face-tag { color: var(--study-green); }
html[data-theme="light"] .face-hint { color: var(--text-muted); }
html[data-theme="light"] .review-actions { border-color: var(--study-green-border); }
html[data-theme="light"] .review-button {
  background: #fff;
  border-color: var(--study-green-border);
  color: var(--study-green);
}
html[data-theme="light"] .review-button:hover { background: var(--study-green-bg); }
html[data-theme="light"] .mindmap-pill { min-width: 0; overflow-wrap: anywhere; }
html[data-theme="light"] .mindmap-branches { min-width: 0; border-color: var(--study-violet-border); }
html[data-theme="light"] .exam-intro {
  background:
    radial-gradient(circle at 90% 26%, #ffe2bfc9, transparent 22%),
    linear-gradient(123deg, #f3ecff, #eaddff);
  border-color: var(--study-violet-border);
}
html[data-theme="light"] .exam-intro::after {
  background:
    radial-gradient(circle at 89% 26%, #8860cf 0 2px, transparent 3px),
    radial-gradient(circle at 94% 69%, #a583dc 0 1px, transparent 2px),
    radial-gradient(circle at 78% 17%, #8860cf 0 1px, transparent 2px),
    radial-gradient(circle at 83% 86%, #a583dc 0 1px, transparent 2px);
}
html[data-theme="light"] :is(.exam-setup-card, .exam-session-card) {
  background: #fff;
  border-color: var(--study-border);
  box-shadow: 0 12px 34px #38205b0d;
}
html[data-theme="light"] :is(.read-aloud-option strong, .exam-speech-bubble, .exam-closing) { color: var(--study-ink); }
html[data-theme="light"] .read-aloud-option small { color: var(--text-muted); font-size: 12px; }
html[data-theme="light"] :is(.exam-guidance .icon, .final-star, .final-score, .exam-report h3) { color: var(--study-violet); }
html[data-theme="light"] .exam-progress-track { background: var(--study-violet-bg); }
html[data-theme="light"] .exam-progress-track span { background: linear-gradient(90deg, var(--accent), #9a6de4); }
html[data-theme="light"] .exam-question { background: var(--study-violet-bg); border-color: var(--study-violet-border); }
html[data-theme="light"] :is(.exam-question, .exam-answer, .exam-closing) .eyebrow { color: var(--study-violet); }
html[data-theme="light"] :is(.exam-answer, .exam-report section) { background: var(--study-surface); border-color: var(--study-border); }
html[data-theme="light"] .exam-report ul { color: var(--text-muted); }

@media (max-width:760px) {
  html[data-theme="light"] .tool-nav-tabs { padding-inline: 10px; }
  html[data-theme="light"] .tool-empty { padding: 24px 12px; }
  html[data-theme="light"] .open-answer { font-size: 16px; }
}
