:root {
  --bg: #f4f2ec;
  --bg-glow: transparent;
  --ink: #141816;
  --muted: #6a726c;
  --line: #e2ddd3;
  --line-strong: #cfc8ba;
  --panel: #ffffff;
  --panel-soft: #faf8f4;
  --accent: #0b5c45;
  --accent-soft: #e8f3ee;
  --demo: #2563eb;
  --amber: #b8860b;
  --red: #a33b3b;
  --radius: 12px;
  --radius-sm: 8px;
  --font: "DM Sans", system-ui, sans-serif;
  --display: "Fraunces", Georgia, serif;
  --shadow: 0 1px 0 rgba(20, 24, 22, 0.04);
  --shell-mark-bg: linear-gradient(145deg, #1c221f 0%, #0d1210 100%);
  --shell-mark-fg: #f3efe6;
  --shell-bar: transparent;
}

/* Teacher · warm paper + forest — desk / console feel */
body[data-shell="teacher"] {
  --bg: #efe8dc;
  --bg-glow: color-mix(in srgb, #0b5c45 14%, transparent);
  --ink: #1a1f1c;
  --muted: #5f6a62;
  --line: #d9d0c0;
  --line-strong: #c4b9a4;
  --panel: #fffcf6;
  --panel-soft: #f6f0e6;
  --accent: #0a5340;
  --accent-soft: #dceee6;
  --shell-mark-bg: linear-gradient(145deg, #1a3d32 0%, #0a5340 100%);
  --shell-mark-fg: #eef7f2;
  --shell-bar: #0a5340;
}

/* Student · cool slate-blue — phone / join feel */
body[data-shell="student"] {
  --bg: #e4ebf4;
  --bg-glow: color-mix(in srgb, #1d4f91 16%, transparent);
  --ink: #121820;
  --muted: #5a6574;
  --line: #c8d2e0;
  --line-strong: #aeb9cb;
  --panel: #fbfcfe;
  --panel-soft: #eef3f9;
  --accent: #1d4f91;
  --accent-soft: #dce7f5;
  --shell-mark-bg: linear-gradient(145deg, #243b66 0%, #1d4f91 100%);
  --shell-mark-fg: #eef3fb;
  --shell-bar: #1d4f91;
}

/* Gate · neutral entry */
body[data-shell="gate"] {
  --bg: #f0eee8;
  --bg-glow: color-mix(in srgb, #4a5560 8%, transparent);
  --shell-bar: #8a857a;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(900px 480px at 12% -8%, var(--bg-glow), transparent 58%),
    radial-gradient(700px 420px at 92% 0%, color-mix(in srgb, var(--bg-glow) 55%, transparent), transparent 52%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.2s ease;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }

/* ——— Shell ——— */
.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 28px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  box-shadow: inset 0 -3px 0 var(--shell-bar);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand {
  display: flex;
  gap: 11px;
  align-items: center;
  cursor: pointer;
  margin-right: auto;
  min-width: 0;
}
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--shell-mark-bg);
  color: var(--shell-mark-fg);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.brand strong {
  display: block;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.02em;
}
.brand small {
  display: block;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  margin-top: 2px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
body[data-shell="gate"] .brand small {
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.01em;
  text-transform: none;
  font-size: 11px;
}

.shell-role-pill {
  display: none;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  background: var(--accent-soft);
  color: var(--accent);
  white-space: nowrap;
}
body[data-shell="teacher"] .shell-role-pill,
body[data-shell="student"] .shell-role-pill {
  display: inline-flex;
}
.shell-role-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}
.context-chip {
  font-size: 12px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Right nav: label (not clickable) + segmented tabs (clickable) */
.top-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.nav-cluster {
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0.55;
  transition: opacity 0.15s ease;
}
.nav-cluster.active-side {
  opacity: 1;
}
.nav-group {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
  user-select: none;
  pointer-events: none;
  cursor: default;
  white-space: nowrap;
}
.nav-tabs {
  display: inline-flex;
  align-items: stretch;
  padding: 3px;
  gap: 2px;
  border-radius: 999px;
  background: #efebe3;
  border: 1px solid color-mix(in srgb, var(--line-strong) 65%, transparent);
}
.top-nav button {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}
.top-nav button:hover {
  color: var(--ink);
  background: color-mix(in srgb, #fff 70%, transparent);
}
.top-nav button.on {
  background: #fff;
  color: var(--accent);
  box-shadow: 0 1px 2px rgba(20, 24, 22, 0.06), 0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent);
}

#root {
  padding: 32px 28px 64px;
  max-width: 1080px;
  margin: 0 auto;
}

/* ——— Type ——— */
.eyebrow {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}
h1 {
  font-family: var(--display);
  font-weight: 650;
  font-size: clamp(1.75rem, 2.5vw, 2.15rem);
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0 0 8px;
}
h2 {
  font-family: var(--display);
  font-weight: 650;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
}
.lede, .muted, .hint, .field-hint { color: var(--muted); line-height: 1.5; }
.hint { font-size: 13px; margin-top: 10px; }
.context-line {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 14px;
}
.screen-head { margin-bottom: 24px; max-width: 40rem; }
.screen-head .muted { margin: 0; font-size: 14px; }

/* ——— Buttons ——— */
.btn {
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--ink);
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.btn:hover { background: var(--panel-soft); }
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #f3faf6;
}
.btn.primary:hover { filter: brightness(1.06); }
.btn.small {
  padding: 6px 12px;
  font-size: 12px;
}
.btn.small.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #f3faf6;
}
.btn.ghost {
  border-color: transparent;
  background: transparent;
  color: var(--accent);
  padding-inline: 10px;
}
.btn.ghost:hover { background: var(--accent-soft); }
.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}
.cta-row.center { justify-content: center; }

.demo,
.btn.demo,
.top-nav button.demo,
.dock {
  display: none !important;
}

/* ——— Panels ——— */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
}
.panel.soft {
  background: var(--panel-soft);
  box-shadow: none;
}
.panel.narrow { max-width: 280px; }
.mt { margin-top: 20px; }

/* ——— Navigator ——— */
.nav-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  min-height: 560px;
}
.course-list {
  padding: 16px;
  position: sticky;
  top: 72px;
}
.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.list-head h2 {
  font-family: var(--font);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}
.course-list .list-head .btn,
.section-block-head .btn.small,
.session-head .btn.small {
  border: 0;
  background: var(--accent-soft);
  color: var(--accent);
}
.course-list .list-head .btn:hover,
.section-block-head .btn.small:hover,
.session-head .btn.small:hover {
  background: #d9ebe3;
}

.course-item {
  display: grid;
  gap: 3px;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 10px;
  padding: 11px 12px;
  margin-bottom: 2px;
  transition: background 0.12s ease;
}
.course-item:hover { background: var(--panel-soft); }
.course-item strong {
  font-size: 13px;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.course-item span { font-size: 12px; color: var(--muted); }
.course-item.on {
  background: var(--accent-soft);
}
.course-item.on strong { color: var(--accent); }
.course-items {
  display: grid;
  gap: 2px;
}
.ai-check-dock {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  max-width: min(300px, calc(100vw - 24px));
}
.ai-check-dock.is-hidden { display: none !important; }
.ai-check-fab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 10px 14px 10px 10px;
  font-size: 13px;
  font-weight: 650;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 10px 28px rgba(26, 24, 20, 0.16);
  cursor: pointer;
}
.ai-check-fab:hover {
  border-color: var(--accent);
}
.ai-check-fab .bubble-avatar {
  width: 24px;
  height: 24px;
  margin: 0;
}
.ai-check-panel {
  width: min(300px, calc(100vw - 24px));
  aspect-ratio: 1 / 2;
  height: auto;
  max-height: calc(100vh - 100px);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: 0 16px 40px rgba(26, 24, 20, 0.18);
}
.ai-check-panel.is-hidden { display: none !important; }
.ai-check-bot-head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.ai-check-bot-head .bubble-avatar { margin-top: 2px; flex: 0 0 auto; }
.ai-check-bot-titles { flex: 1; min-width: 0; }
.ai-check-bot-head strong {
  display: block;
  font-size: 14px;
  letter-spacing: -0.01em;
}
.ai-check-bot-head p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}
.ai-check-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ai-chip {
  border: 1px solid var(--line);
  background: var(--panel-soft);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 11px;
  color: var(--ink);
  cursor: pointer;
}
.ai-chip:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
.ai-check-log {
  min-height: 0;
  max-height: none;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.ai-check-msg {
  font-size: 12px;
  line-height: 1.45;
  padding: 8px 10px;
  border-radius: 10px;
  max-width: 92%;
}
.ai-check-msg.bot {
  background: var(--accent-soft);
  align-self: flex-start;
}
.ai-check-msg.user {
  background: #efe8da;
  align-self: flex-end;
}
.ai-check-msg .who {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 2px;
}
.ai-check-composer {
  display: flex;
  gap: 6px;
  align-items: center;
}
.ai-check-composer input[type="text"] {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
  background: var(--panel-soft);
}
.ai-attach {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  color: var(--muted);
}
.ai-attach:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.ai-attach.has-file {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
body.ai-dock-on .exit-fab {
  left: 16px;
  right: auto;
}

.nav-main-head {
  margin-bottom: 18px;
}
.nav-main-head .eyebrow { margin-bottom: 2px; }
.nav-main-head h2 {
  font-size: 1.6rem;
  margin: 0;
}

.section-block-head {
  margin-bottom: 10px;
}
.section-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.sec-tab {
  text-align: left;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  border-radius: 10px;
  padding: 10px 14px;
  min-width: 0;
  display: grid;
  gap: 2px;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.sec-tab strong {
  font-size: 13px;
  font-weight: 700;
}
.sec-tab span {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}
.sec-tab:hover { border-color: var(--line-strong); }
.sec-tab.on {
  background: var(--panel);
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.sec-tab.on strong { color: var(--accent); }

.session-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 12px;
}
.list-title {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.session-list { display: grid; gap: 6px; }
.session-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 12px;
  padding: 14px 16px;
  background: var(--panel-soft);
  transition: background 0.12s ease, transform 0.12s ease;
}
.session-row:hover { background: #f0ece4; }
.session-row.current {
  background: var(--accent-soft);
}
.session-row.future { opacity: 0.55; }
.session-main p {
  margin: 3px 0;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.session-main small {
  color: var(--muted);
  font-size: 12px;
}
.session-top {
  display: flex;
  align-items: center;
  gap: 8px;
}
.session-top strong {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent);
  color: #f3faf6;
}
.session-go {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  opacity: 0.7;
  white-space: nowrap;
}
.session-row:hover .session-go { opacity: 1; }

/* ——— Forms ——— */
.narrow-form { max-width: 460px; margin: 0 auto; }
.prep-screen { max-width: 640px; }
.prep-actions {
  flex-wrap: nowrap;
  gap: 8px;
}
.prep-actions .btn {
  flex: 1 1 0;
  text-align: center;
  padding-left: 10px;
  padding-right: 10px;
  white-space: nowrap;
  font-size: 13px;
}
.prep-link-box {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.link-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 8px 0 6px;
}
.link-row input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--panel-soft);
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--ink);
}
.form-stack { display: grid; gap: 2px; }
.form-stack .cta-row { margin-top: 12px; }
.stack-gap { display: grid; gap: 10px; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field-label {
  font-size: 13px;
  font-weight: 700;
}
.field-hint {
  margin: 0 0 8px;
  font-size: 13px;
}
.field.tight { margin-bottom: 8px; }
.field.tight span {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.field textarea,
.field input[type="text"],
.field input:not([type="file"]),
.field select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  resize: vertical;
}
.field textarea:focus,
.field input:focus,
.field select:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-color: var(--accent);
}
.readonly-block {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
}
.readonly-value {
  margin: 4px 0 6px;
  font-weight: 650;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.file-pick {
  display: block;
  cursor: pointer;
  position: relative;
}
.file-pick input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.file-pick-ui {
  display: grid;
  gap: 4px;
  padding: 16px;
  border: 1px dashed color-mix(in srgb, var(--accent) 45%, var(--line));
  border-radius: 12px;
  background: var(--accent-soft);
}
.file-pick-ui strong { color: var(--accent); font-size: 14px; }
.file-pick-ui small { color: var(--muted); font-size: 12px; }
.q-editor {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
}
.act-editor {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
}
.act-editor.dragging {
  opacity: 0.55;
  border-style: dashed;
  border-color: var(--accent);
}
.act-editor.drag-over {
  box-shadow: inset 0 3px 0 0 var(--accent);
}
.act-editor-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 13px;
}
.act-editor.is-collapsed .act-editor-head {
  margin-bottom: 0;
}
.act-editor.is-collapsed .act-body {
  display: none;
}
.act-summary {
  display: none;
  flex: 1;
  min-width: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.act-editor.is-collapsed .act-summary {
  display: block;
}
.act-editor.is-collapsed .act-title {
  flex: 0 0 auto;
}
.item-fold {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font-size: 18px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
}
.item-fold:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.q-editor:not(.is-collapsed) .item-fold,
.act-editor:not(.is-collapsed) .item-fold {
  margin-left: auto;
}
.act-drag {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  cursor: grab;
  font-size: 14px;
  line-height: 1;
  user-select: none;
}
.act-drag:active { cursor: grabbing; }
.act-editor-head .act-title {
  flex: 1;
  min-width: 0;
  font-weight: 700;
}
.act-editor.is-collapsed .act-title {
  flex: 0 0 auto;
}
.act-type {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 6px;
}
.q-editor-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 13px;
}
.q-editor-head strong {
  flex: 0 0 auto;
}
.q-editor.is-collapsed .q-editor-head {
  margin-bottom: 0;
}
.q-editor.is-collapsed .q-body {
  display: none;
}
.q-summary {
  display: none;
  flex: 1;
  min-width: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.q-editor.is-collapsed .q-summary {
  display: block;
}
.q-editor-remove {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  margin: -4px -4px -4px 0;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.q-editor-remove:hover {
  background: color-mix(in srgb, var(--red) 12%, transparent);
  color: var(--red);
}
.q-editor-remove:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.q-editor-remove:disabled:hover {
  background: transparent;
  color: var(--muted);
}
.prep-form .cta-row { margin-top: 6px; }

.q-pills { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.q-pill {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 650;
}
.q-pill.on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* ——— Split / chat / misc ——— */
.split {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 18px;
  align-items: start;
}
.card-grid {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}
.card-grid.three { grid-template-columns: repeat(3, 1fr); }
.info-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.info-card h3 {
  margin: 0 0 6px;
  font-family: var(--display);
  font-size: 1.05rem;
}
.info-card p { margin: 0; color: var(--muted); font-size: 13px; }

.phone {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
  max-width: 260px;
  background: #fff;
  box-shadow: var(--shadow);
}
.phone-bar {
  padding: 10px 14px;
  background: var(--ink);
  color: #efeae1;
  font-size: 12px;
  font-weight: 600;
}
.phone-body { padding: 16px; }
.narrow { max-width: 400px; margin: 0 auto; text-align: center; }
.qr {
  width: 160px;
  height: 160px;
  margin: 18px auto;
  border-radius: 16px;
  border: 1px solid var(--line);
  background:
    linear-gradient(var(--ink) 0 0) 14px 14px / 32px 32px no-repeat,
    linear-gradient(var(--ink) 0 0) 114px 14px / 32px 32px no-repeat,
    linear-gradient(var(--ink) 0 0) 14px 114px / 32px 32px no-repeat,
    repeating-linear-gradient(90deg, var(--ink) 0 7px, transparent 7px 14px) 56px 42px / 56px 10px no-repeat,
    repeating-linear-gradient(var(--ink) 0 7px, transparent 7px 12px) 48px 64px / 72px 48px no-repeat,
    #fff;
}
.qr.sm { width: 110px; height: 110px; margin: 8px auto; }
.qr.qr-lg {
  width: 220px;
  height: 220px;
  margin: 8px auto 16px;
}
.scan-screen { max-width: 420px; text-align: center; }
.scan-board { padding: 28px 20px; }
.scan-code {
  margin: 0 0 6px;
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--accent);
}
.scan-screen .cta-row { justify-content: center; }
.live-grid .cta-row.center { justify-content: center; margin-top: 8px; }
.center { text-align: center; }

.chat-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 16px;
  min-height: 68vh;
}

/* ——— Pre-class with inline slides ——— */
.preclass-screen { max-width: 1100px; }
.preclass-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 8px;
}
.preclass-top h1 { margin: 0 0 4px; }
.preclass-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
  min-height: 560px;
}
.slide-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.slide-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}
.slide-toolbar strong { font-size: 13px; }
.slide-page {
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.slide-stage {
  flex: 1;
  min-height: 280px;
  display: grid;
  place-items: center;
  padding: 8px;
  border-radius: 14px;
  background:
    radial-gradient(ellipse at 30% 20%, #2a3340 0%, transparent 55%),
    linear-gradient(160deg, #1a1f27 0%, #12151a 100%);
}
.slide-card {
  width: 100%;
  max-width: 440px;
  aspect-ratio: 16 / 10;
  display: flex;
  flex-direction: column;
  padding: 22px 24px 16px;
  border-radius: 6px;
  background: #f7f4ee;
  color: #1c1a16;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 18px 40px rgba(0, 0, 0, 0.35);
}
.slide-kicker {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6b6560;
}
.slide-card h2 {
  margin: 0 0 14px;
  font-size: clamp(1.15rem, 2.4vw, 1.45rem);
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.slide-body {
  margin: 0;
  flex: 1;
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  color: #2e2a24;
}
.slide-card footer {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #e0d9ce;
  font-size: 11px;
  color: #8a8378;
}
.slide-nav {
  display: flex;
  gap: 8px;
}
.slide-nav .btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.slide-hint { margin: 0; }
.preclass-chat {
  min-height: 520px;
}
.preclass-chat .slide-ref {
  margin-top: 0;
  margin-bottom: 12px;
}
.preclass-chat .slide-ref p {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.35;
}

.chat-panel {
  display: flex;
  flex-direction: column;
  min-height: 520px;
}
.chat-log {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 14px;
}
.bubble {
  max-width: 84%;
  padding: 10px 12px;
  border-radius: 14px;
  line-height: 1.45;
  font-size: 14px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.bubble.bot { background: var(--accent-soft); align-self: flex-start; }
.bubble.user { background: #efe8da; align-self: flex-end; }
.bubble.peer { background: #f1eee8; align-self: flex-start; }
.bubble.teacher {
  max-width: 100%;
  background: color-mix(in srgb, var(--amber) 18%, var(--panel));
  align-self: stretch;
  border: 1px solid color-mix(in srgb, var(--amber) 35%, var(--line));
}
.bubble-avatar.teacher {
  background: color-mix(in srgb, var(--amber) 55%, #8a5a12);
  border-radius: 6px;
}
.bubble .who {
  display: block;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 3px;
  color: var(--muted);
}
.bubble-body { min-width: 0; }
.bubble-avatar {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  margin-top: 2px;
}
.bubble-avatar.ai {
  background:
    radial-gradient(circle at 50% 38%, #f0e6d8 0 38%, transparent 39%),
    linear-gradient(180deg, #c5b8a4 0%, #5c7168 100%);
  box-shadow: inset 0 0 0 1px rgba(11, 92, 69, 0.25);
}
.bubble-avatar.peer {
  background: #d9d3c8;
}
.composer {
  display: flex;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.composer input {
  flex: 1;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 10px 14px;
}
.slide-ref, .ai-card, .buddy {
  padding: 12px;
  margin: 10px 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
}
.ai-facilitator {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 0;
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 25%, var(--line));
}
.ai-facilitator strong {
  display: block;
  font-size: 14px;
  color: var(--accent);
}
.ai-facilitator p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.ai-avatar {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 38%, #f0e6d8 0 38%, transparent 39%),
    radial-gradient(circle at 50% 100%, #2a3d34 0 46%, transparent 47%),
    linear-gradient(180deg, #c5b8a4 0%, #8a7d6c 100%);
  box-shadow: inset 0 0 0 2px rgba(11, 92, 69, 0.2);
  position: relative;
}
.ai-avatar::after {
  content: "";
  position: absolute;
  inset: 10px 12px auto;
  height: 10px;
  border-radius: 8px 8px 4px 4px;
  background: #3d342c;
  opacity: 0.85;
}

.summary-banner {
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff6e5;
  border: 1px solid color-mix(in srgb, var(--amber) 35%, var(--line));
  font-size: 13px;
  font-weight: 600;
  color: #8a6508;
}
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin: 12px 0 16px;
}
.summary-card {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
}
.summary-card strong {
  display: block;
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 13px;
}
.summary-card p {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
}

.code {
  font-family: ui-monospace, monospace;
  background: var(--accent-soft);
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 12px;
}
.choice-stack {
  display: grid;
  gap: 12px;
  margin: 18px 0 20px;
}
.choice-card {
  display: grid;
  gap: 6px;
  text-align: left;
  width: 100%;
  padding: 18px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.choice-card:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.choice-card strong {
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}
.choice-card span {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}

.mode-tabs {
  display: flex;
  gap: 6px;
  margin: 14px 0 12px;
  padding: 4px;
  border-radius: 12px;
  background: var(--panel-soft);
}
.mode-tab {
  flex: 1;
  border: 0;
  background: transparent;
  border-radius: 9px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.mode-tab.on {
  background: var(--panel);
  color: var(--accent);
  box-shadow: var(--shadow);
}
.is-hidden {
  display: none !important;
}

.invite-code {
  margin: 4px 0 8px;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}
.buddy-list {
  margin: 0 0 14px;
  padding-left: 18px;
  color: var(--ink);
  font-size: 14px;
}
.group-choice-screen .btn { margin-top: 4px; }

.members { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.members span {
  background: var(--panel-soft);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
}

.screen-head.row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  max-width: none;
}

.insight {
  overflow: hidden;
  padding: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.insight header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}
.insight h2 {
  margin: 0;
  font-size: 1.2rem;
  max-width: 36ch;
}
.pill {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 650;
  align-self: flex-start;
}
.insight-grid { display: grid; grid-template-columns: 1fr 1fr; }
.insight-grid > div {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
}
.insight-grid > div:nth-child(2n) { border-right: 0; }
.insight-grid h3 {
  margin: 0 0 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.insight-grid p, .insight-grid ul { margin: 0; font-size: 14px; }
.insight-grid ul { padding-left: 18px; }

.live-grid {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 14px;
}
#live-idle,
#live-after-groups,
#live-poll-running {
  display: grid;
  gap: 12px;
}
#live-idle > .disc-pick-list,
#live-idle > .cta-row,
#live-after-groups > .broadcast-box,
#live-after-groups > .cta-row,
#live-poll-running > .poll-results,
#live-poll-running > .cta-row {
  margin-top: 0;
  margin-bottom: 0;
}
.health {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.h {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  text-align: left;
  background: var(--panel-soft);
  display: grid;
  gap: 3px;
}
.h span { color: var(--muted); font-size: 12px; }
.h.ok { box-shadow: inset 3px 0 0 var(--accent); }
.h.warn { box-shadow: inset 3px 0 0 var(--amber); }
.h.bad { box-shadow: inset 3px 0 0 var(--red); }
.disc-pick-list {
  display: grid;
  gap: 12px;
  margin: 4px 0;
}
.disc-pick {
  display: grid;
  gap: 6px;
  text-align: left;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.disc-pick:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.disc-pick.on {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.disc-pick strong {
  font-size: 14px;
  letter-spacing: -0.01em;
}
.disc-pick span {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}
.broadcast-box {
  margin: 14px 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  display: grid;
  gap: 6px;
}
.broadcast-composer {
  border-top: none;
  padding-top: 4px;
  margin-top: 2px;
}
.broadcast-log {
  display: grid;
  gap: 6px;
  margin-top: 4px;
}
.broadcast-log .broadcast-item {
  font-size: 13px;
  line-height: 1.4;
  padding: 8px 10px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--amber) 12%, var(--panel-soft));
  border: 1px solid color-mix(in srgb, var(--amber) 28%, var(--line));
}
.broadcast-log .broadcast-item strong {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 2px;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: color-mix(in srgb, #1a1814 45%, transparent);
}
.modal-backdrop.is-hidden { display: none; }
.modal-card {
  width: min(440px, 100%);
  max-height: min(88vh, 720px);
  overflow: auto;
  padding: 18px 18px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 18px 48px rgba(26, 24, 20, 0.22);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.modal-head h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.02em;
}
.activity-type-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 10px 0 12px;
}
.activity-type {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}
.activity-type.on {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
.act-type-list {
  display: grid;
  gap: 8px;
  margin: 12px 0 4px;
}
.act-type-option {
  display: grid;
  gap: 2px;
  text-align: left;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.act-type-option:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.act-type-option strong {
  font-size: 14px;
  letter-spacing: -0.01em;
}
.act-type-option span {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}
.disc-pick .act-kind {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2px;
}
.poll-results {
  display: grid;
  gap: 10px;
  margin: 12px 0 14px;
}
.poll-bar.mine {
  outline: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line));
  border-radius: 10px;
  padding: 6px;
  background: var(--accent-soft);
}
.student-poll-options {
  display: grid;
  gap: 10px;
  margin: 12px 0 8px;
}
.student-poll-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.student-poll-option:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.student-poll-option.on {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.student-poll-option .opt-letter {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
}
.student-poll-option.on .opt-letter {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.student-poll-option .opt-text {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  line-height: 1.4;
  padding-top: 4px;
}
.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-direction: row !important;
}
.check-row input[type="checkbox"] {
  width: auto;
  margin: 0;
}
.qa-list {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}
.qa-card {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
}
.qa-card.mine {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  background: var(--accent-soft);
}
.qa-card p {
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.4;
}
.qa-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}
.qa-meta em {
  font-style: normal;
  color: var(--accent);
  font-weight: 650;
}
.sticky-wall {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin: 12px 0;
  min-height: 120px;
}
.sticky {
  padding: 12px;
  border-radius: 4px 12px 12px 12px;
  border: 1px solid var(--line);
  background: #fff8dc;
  box-shadow: 0 1px 0 color-mix(in srgb, var(--ink) 6%, transparent);
  display: grid;
  gap: 8px;
  min-height: 96px;
}
.sticky.c1 { background: #e8f4ff; }
.sticky.c2 { background: #eefae8; }
.sticky.c3 { background: #fceeee; }
.sticky.mine {
  outline: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
}
.sticky p {
  margin: 0;
  font-size: 13px;
  line-height: 1.35;
}
.sticky span {
  font-size: 11px;
  color: var(--muted);
  align-self: end;
}
.word-cloud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 14px;
  padding: 18px 12px;
  margin: 12px 0;
  min-height: 140px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: var(--panel-soft);
}
.wc-word {
  color: var(--ink);
  font-weight: 650;
  letter-spacing: -0.02em;
  opacity: 0.85;
}
.wc-word.mine {
  color: var(--accent);
  opacity: 1;
}
.quiz-timer-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.quiz-timer {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 15px;
  color: var(--accent);
}
.poll-bar.correct {
  outline: 1px solid color-mix(in srgb, #2f7d4a 50%, var(--line));
  border-radius: 10px;
  padding: 6px;
  background: color-mix(in srgb, #2f7d4a 10%, transparent);
}
.ok-text {
  color: #2f7d4a;
}
.poll-bar {
  display: grid;
  gap: 4px;
}
.poll-bar-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
}
.poll-bar-top span { color: var(--muted); }
.poll-bar-track {
  height: 10px;
  border-radius: 999px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  overflow: hidden;
}
.poll-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  width: 0;
  transition: width 0.35s ease;
}

@media (max-width: 860px) {
  .nav-layout,
  .split,
  .chat-layout,
  .preclass-grid,
  .live-grid,
  .card-grid.three,
  .insight-grid,
  .health {
    grid-template-columns: 1fr;
  }
  .course-list { position: static; }
  .panel.narrow { max-width: none; }
  .insight-grid > div { border-right: 0; }
  #root { padding: 20px 16px 48px; }
  .topbar { padding: 10px 16px; }
  .preclass-top { flex-wrap: wrap; }
  .slide-stage { min-height: 220px; }
  .slide-card { aspect-ratio: 16 / 11; max-width: none; }
  .preclass-chat { min-height: 420px; }
}

.role-pick { max-width: 520px; margin: 0 auto; }
.role-choices { margin-top: 8px; }
.tour-entry {
  margin-top: 22px;
  display: grid;
  gap: 8px;
  justify-items: start;
}
.tour-entry .hint { margin: 0; }

/* ——— Guided tour ——— */
.tour-help-fab {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 90;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(20, 24, 22, 0.12);
  cursor: pointer;
}
.tour-help-fab:hover {
  border-color: var(--accent);
  color: var(--accent);
}
body.ai-dock-on .tour-help-fab {
  bottom: 72px;
}
body.tour-on .tour-help-fab {
  display: none;
}
body.mobile-ui .tour-help-fab {
  right: max(16px, calc(50% - 195px + 16px));
  bottom: 72px;
}

.tour-root {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}
.tour-root.is-hidden { display: none; }
.tour-spotlight {
  pointer-events: none;
  position: fixed;
  border-radius: 14px;
  box-shadow:
    0 0 0 9999px color-mix(in srgb, #0c1210 48%, transparent),
    0 0 0 2px var(--accent);
  transition: top 0.2s ease, left 0.2s ease, width 0.2s ease, height 0.2s ease;
  z-index: 99;
}
.tour-spotlight.is-hidden { display: none; }
.tour-card {
  pointer-events: auto;
  width: min(440px, calc(100vw - 32px));
  padding: 16px 18px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 18px 50px rgba(12, 18, 16, 0.22);
  display: grid;
  gap: 8px;
  z-index: 101;
}
.tour-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.tour-kicker {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.tour-step-label {
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.tour-card h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  line-height: 1.25;
}
.tour-card #tour-body {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}
.tour-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.tour-actions-right {
  display: flex;
  gap: 8px;
  margin-left: auto;
}
body.mobile-ui .tour-root {
  /* keep card inside phone chrome */
  position: absolute;
  inset: auto 0 0 0;
  padding: 12px;
}
body.mobile-ui #app {
  position: relative;
}
body.mobile-ui .tour-spotlight {
  /* spotlight still uses viewport coords; hide under phone frame to avoid confusion */
  display: none !important;
}
.exit-fab {
  position: fixed;
  left: 16px;
  right: auto;
  bottom: 16px;
  z-index: 80;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 650;
  background: var(--panel);
  color: var(--muted);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}
.exit-fab:hover {
  color: var(--ink);
  border-color: var(--accent);
}
body.mobile-ui .exit-fab {
  display: none !important;
}
body.mobile-ui .mobile-fab {
  left: 50%;
  transform: translateX(-50%);
  bottom: 20px;
}

/* ——— Phone preview (student only toggle) ——— */
.mobile-fab {
  position: fixed;
  left: 16px;
  bottom: 56px;
  z-index: 80;
  border: 0;
  border-radius: 999px;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 650;
  background: var(--ink);
  color: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}
.mobile-fab:hover { filter: brightness(1.08); }
.mobile-fab.on {
  background: var(--accent);
}

body.mobile-ui {
  background: #12151a;
  min-height: 100vh;
}
body.mobile-ui #app {
  width: min(390px, calc(100vw - 24px));
  height: min(844px, calc(100vh - 32px));
  margin: 16px auto;
  border-radius: 36px;
  overflow: hidden;
  background: var(--bg);
  border: 3px solid #2a2f36;
  box-shadow:
    0 0 0 1px #0a0c0f,
    0 24px 60px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  position: relative;
}
body.mobile-ui #app::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 96px;
  height: 22px;
  border-radius: 999px;
  background: #0a0c0f;
  z-index: 5;
  pointer-events: none;
}
body.mobile-ui .topbar {
  flex-wrap: wrap;
  gap: 8px;
  padding: 28px 12px 10px;
  flex: 0 0 auto;
}
body.mobile-ui .brand small { display: none; }
body.mobile-ui .context-chip {
  max-width: 100%;
  order: 3;
  width: 100%;
  font-size: 11px;
}
body.mobile-ui .top-nav {
  width: 100%;
  order: 2;
  overflow-x: auto;
  flex-wrap: nowrap;
  padding-bottom: 2px;
}
body.mobile-ui .top-nav button {
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 12px;
  padding: 7px 10px;
}
body.mobile-ui #root {
  flex: 1;
  overflow: auto;
  padding: 14px 12px 40px;
  max-width: none;
  margin: 0;
  -webkit-overflow-scrolling: touch;
}
body.mobile-ui .preclass-grid,
body.mobile-ui .chat-layout,
body.mobile-ui .split,
body.mobile-ui .nav-layout {
  grid-template-columns: 1fr;
}
body.mobile-ui .preclass-screen,
body.mobile-ui .narrow-form,
body.mobile-ui .screen {
  max-width: none;
}
body.mobile-ui .preclass-top {
  flex-direction: column;
  align-items: stretch;
}
body.mobile-ui .slide-stage { min-height: 180px; }
body.mobile-ui .slide-card {
  aspect-ratio: 16 / 11;
  max-width: none;
  padding: 16px;
}
body.mobile-ui .slide-card h2 { font-size: 1.05rem; }
body.mobile-ui .preclass-chat,
body.mobile-ui .chat-panel {
  min-height: 360px;
}
body.mobile-ui .panel { padding: 14px; }
