/* Hallmark · shape: app screen · genre: editorial · theme: Ink (deal 3/3, seed school-tool-where-teachers-0750·12fb2afb·2026-11-20·r0) · redesign: full
 * nav: kept sidebar (tutors, recent chats, 知識庫) collapsing to a menu under 60rem · signature: the tutor's instructions set like a printed notice beside its live preview · states: loading, empty, error, full · ink: paper
 * axes: light/grotesk-sans/chromatic-teal · posture: restrained · contrast: pass · v2.0.0 */
/* Hallmark · pre-emit critique: P4 H4 E4 S4 R5 V3 · weakest: V, a chat tool's sidebar-and-thread shell is the category's own; kept it and moved the identity into ruled lists, the notice-style editor and teal that only means shared or ready */
/* Hallmark · waive 22 · ink and greys at zero chroma · a notice board is printed in plain black */
/* Hallmark · answered F4 · the send button is the chat's one submit and a pressed pen tool is a toggle state, not a second primary */
/* Hallmark · answered F7 · inputs, selects and sign-in buttons share one control recipe on purpose: an app screen's controls should read as one family */
/* Hallmark · answered tracking · Chinese glyphs set solid: --tracking-display eased to -0.01em so CJK heads do not crowd; Latin heads keep Epilogue 700 */
@import url("./tokens.css?v=1795231129");
@import url("./base.css?v=1795231129");

:root {
  --font-display: "Epilogue", "Noto Sans HK", ui-sans-serif, system-ui, sans-serif;
  --font-body: var(--font-display);
  --font-outlier: "IBM Plex Mono", "Noto Sans HK", ui-monospace, monospace;
  --tracking-display: -0.01em;
  --radius-control: 10px;
  --control-h: 40px;
  --control-h-s: 32px;
  --sidebar-w: 272px;
  --color-scrim: oklch(16% 0 0 / 0.42);
  --color-error-soft: oklch(95% 0.03 27);
  --color-chart-bg: oklch(99.5% 0.003 100);
  --shadow-page: 0 1px 3px oklch(20% 0 0 / 0.12);
  --note-paper: oklch(99.5% 0.003 100);
  --note-rule: oklch(88% 0.02 230);
  --pen-ink: oklch(18% 0 0);
  --pen-blue: oklch(45% 0.15 255);
  --pen-red: oklch(52% 0.19 27);
  --pen-highlight: oklch(90% 0.17 100);
  --pen-green: oklch(50% 0.13 150);
  --pen-orange: oklch(66% 0.17 55);
  --pen-purple: oklch(46% 0.17 300);
  --note-frame: oklch(62% 0.04 230);
  --note-fill-yellow: oklch(95% 0.07 95);
  --note-fill-blue: oklch(94% 0.04 235);
  --note-fill-green: oklch(94% 0.05 150);
  --note-fill-pink: oklch(94% 0.04 0);
}

body { color: var(--color-ink-2); }
h1, h2, h3 { color: var(--color-ink); }
h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-lg); }
h3 { font-size: var(--text-md); }
a { color: var(--color-ink); font-weight: 600; text-decoration: none; transition: color var(--dur-micro) var(--ease-out); }
a:hover { color: var(--color-accent); }
button { cursor: pointer; }
.muted { color: var(--color-muted); }
.small { font-size: var(--text-sm); }
.block { display: block; }
.grow { flex: 1; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* ---------- controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-xs); min-height: var(--control-h); padding: 0 var(--space-md);
  border: var(--rule-hair) solid var(--color-rule); border-radius: var(--radius-control); background: var(--color-paper-2); color: var(--color-ink);
  font-weight: 600; font-size: var(--text-sm); white-space: nowrap; text-decoration: none; transition: background-color var(--dur-micro) var(--ease-out), border-color var(--dur-micro) var(--ease-out); }
.btn:hover { background: var(--color-paper-3); border-color: var(--color-muted); color: var(--color-ink); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--color-ink); border-color: var(--color-ink); color: var(--color-paper); }
.btn.primary:hover { background: var(--color-ink-2); color: var(--color-paper); }
.btn.quiet { background: transparent; border-color: transparent; color: var(--color-ink-2); }
.btn.quiet:hover { background: var(--color-paper-3); }
.btn.danger-text { color: var(--color-error); }
.btn.small { min-height: var(--control-h-s); padding: 0 var(--space-sm); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; transform: none; }
.icon-btn { display: inline-grid; place-items: center; width: var(--control-h); height: var(--control-h); border: 0; border-radius: var(--radius-control);
  background: transparent; color: var(--color-ink-2); flex: none; transition: background-color var(--dur-micro) var(--ease-out); }
.icon-btn:hover { background: var(--color-paper-3); color: var(--color-ink); }
.icon-btn.tiny { width: var(--control-h-s); height: var(--control-h-s); }
.link { border: 0; background: none; padding: 0; color: var(--color-ink); font-weight: 600; text-decoration: underline; text-underline-offset: 0.16em; text-decoration-thickness: 1px; }
.link:hover { color: var(--color-accent); }
input:not([type=checkbox]):not([type=file]), select, textarea {
  width: 100%; min-height: var(--control-h); border: var(--rule-hair) solid var(--color-rule); border-radius: var(--radius-control);
  background: var(--color-paper); color: var(--color-ink); padding: var(--space-xs) var(--space-sm); font-size: var(--text-md); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--color-focus); outline-offset: -2px; }
input::placeholder, textarea::placeholder { color: var(--color-muted); }
textarea { resize: vertical; line-height: 1.6; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--color-ink); margin: 0; flex: none; }
.tag { display: inline-flex; align-items: center; min-height: 22px; padding: 0 var(--space-xs); border-radius: var(--radius-pill); font-size: var(--text-xs); font-weight: 600;
  background: var(--color-paper-3); color: var(--color-ink-2); white-space: nowrap; }
.tag.in { background: var(--color-accent-soft); color: var(--color-accent-soft-ink); }
.tag.out { background: transparent; box-shadow: inset 0 0 0 var(--rule-hair) var(--color-rule); color: var(--color-muted); }
.tag.on { background: var(--color-ink); color: var(--color-paper); }
.tag.err { background: var(--color-error-soft); color: var(--color-error); }
.spinner { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--color-rule); border-top-color: var(--color-ink); animation: spin 0.8s linear infinite; display: inline-block; flex: none; }
.spinner.small { width: 14px; height: 14px; }
@keyframes spin { to { transform: rotate(360deg); } }
.boot { min-height: 100vh; display: grid; place-items: center; }

/* ---------- marks */
.mark { display: inline-grid; place-items: center; flex: none; border-radius: var(--radius-control); background: var(--color-paper-3); color: var(--color-ink);
  font-weight: 700; box-shadow: inset 0 0 0 var(--rule-hair) var(--color-rule); }
.mark.sm { width: 28px; height: 28px; font-size: var(--text-sm); border-radius: 8px; }
.mark.md { width: 40px; height: 40px; font-size: var(--text-lg); }
.mark.lg { width: 56px; height: 56px; font-size: var(--text-2xl); border-radius: var(--radius-card); }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; flex: none; object-fit: cover; display: inline-grid; place-items: center;
  background: var(--color-paper-3); color: var(--color-ink); font-weight: 700; font-size: var(--text-sm); }

/* ---------- sign in */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); background: var(--color-paper); }
.login-side { padding: var(--space-2xl) var(--gutter); display: flex; flex-direction: column; justify-content: space-between; background: var(--color-paper-2); border-right: var(--rule-hair) solid var(--color-rule); }
.login-side h1 { font-size: clamp(2rem, 1.2rem + 2.4vw, 3.2rem); max-width: 14ch; line-height: 1.1; }
.login-side .lead { margin-top: var(--space-md); color: var(--color-ink-2); max-width: 34ch; font-size: var(--text-lg); }
.notice { border-top: var(--rule-hair) solid var(--color-ink); margin-top: var(--space-xl); max-width: 30rem; }
.notice li { list-style: none; display: grid; grid-template-columns: 2rem minmax(0, 1fr); gap: var(--space-sm); padding: var(--space-sm) 0; border-bottom: var(--rule-hair) solid var(--color-rule); }
.notice ol { margin: 0; padding: 0; }
.notice b { color: var(--color-ink); font-variant-numeric: tabular-nums; }
.login-main { display: grid; place-items: center; padding: var(--space-xl) var(--gutter); }
.login-form { width: min(22rem, 100%); display: grid; gap: var(--space-sm); }
.login-form h2 { font-size: var(--text-xl); margin-bottom: var(--space-xs); }
.wordmark { display: inline-flex; align-items: center; gap: var(--space-xs); font-weight: 700; color: var(--color-ink); font-size: var(--text-lg); }
.wordmark img { flex-shrink: 0; border-radius: 8px; }
.wordmark-name { display: grid; gap: var(--space-3xs); line-height: 1.2; }
.wordmark-name small { font-size: .74rem; font-weight: 600; }

.signin-btn { display: flex; align-items: center; justify-content: center; gap: var(--space-sm); min-height: 48px; border-radius: var(--radius-control);
  border: var(--rule-hair) solid var(--color-rule); background: var(--color-paper); color: var(--color-ink); font-weight: 600; transition: border-color var(--dur-micro) var(--ease-out), background-color var(--dur-micro) var(--ease-out); }
.signin-btn:hover { border-color: var(--color-ink); background: var(--color-paper-2); color: var(--color-ink); }
.signin-apple { background: var(--color-ink); border-color: var(--color-ink); color: var(--color-paper); }
.signin-apple:hover { background: var(--color-ink-2); color: var(--color-paper); }
.signin-logo { display: inline-grid; place-items: center; }
.alert { background: var(--color-error-soft); color: var(--color-error); border-radius: var(--radius-control); padding: var(--space-xs) var(--space-sm); font-size: var(--text-sm); }
.fine { font-size: var(--text-xs); color: var(--color-muted); }
.rule-label { display: flex; align-items: center; gap: var(--space-sm); color: var(--color-muted); font-size: var(--text-xs); margin-top: var(--space-md); }
.rule-label::after { content: ""; flex: 1; height: var(--rule-hair); background: var(--color-rule); }
.dev-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-xs); }
.dev-row .btn { grid-column: 1 / -1; }

/* ---------- shell */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); height: 100vh; height: 100dvh; }
.sidebar { background: var(--color-paper-2); border-right: var(--rule-hair) solid var(--color-rule); display: flex; flex-direction: column; min-height: 0; padding: var(--space-md) var(--space-sm); gap: var(--space-xs); }
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 0 var(--space-xs) var(--space-xs); }
.side-actions { display: grid; gap: var(--space-2xs); }
.side-scroll { flex: 1; overflow-y: auto; min-height: 0; }
.side-group { margin-top: var(--space-md); }
.side-group h3 { color: var(--color-muted); font-weight: 400; font-size: var(--text-xs); letter-spacing: 0; padding: 0 var(--space-xs) var(--space-2xs); }
.side-item { display: flex; align-items: center; gap: var(--space-sm); min-height: 36px; padding: 0 var(--space-xs); border-radius: 8px; color: var(--color-ink-2); font-weight: 400; font-size: var(--text-sm); min-width: 0; }
.side-item:hover { background: var(--color-paper-3); color: var(--color-ink); }
.side-item.active { background: var(--color-paper); color: var(--color-ink); box-shadow: inset 0 0 0 var(--rule-hair) var(--color-rule); }
.side-item svg { flex: none; }
.side-empty { color: var(--color-muted); font-size: var(--text-sm); padding: var(--space-sm) var(--space-xs); }
.side-foot { border-top: var(--rule-hair) solid var(--color-rule); padding-top: var(--space-sm); display: grid; gap: var(--space-xs); }
.usage { padding: 0 var(--space-xs); font-size: var(--text-xs); color: var(--color-muted); }
.usage-row { display: flex; justify-content: space-between; gap: var(--space-xs); }
.usage strong { color: var(--color-ink); font-variant-numeric: tabular-nums; }
.meter { height: 4px; border-radius: 2px; background: var(--color-rule); margin-top: var(--space-2xs); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--color-ink); }
.meter span.warn { background: var(--color-error); }
.me { display: flex; align-items: center; gap: var(--space-sm); padding: 0 0 0 var(--space-xs); }
.me-text { flex: 1; min-width: 0; display: grid; line-height: 1.3; }
.me-text strong { color: var(--color-ink); font-size: var(--text-sm); }
.me-text small { color: var(--color-muted); font-size: var(--text-xs); }
.main { min-width: 0; min-height: 0; overflow-y: auto; position: relative; background: var(--color-paper); }
.main-chat, .main-editor { display: flex; flex-direction: column; overflow: hidden; }
.scrim { display: none; }
.mobile-bar, .only-mobile { display: none; }

/* ---------- pages */
.page { width: 100%; max-width: 64rem; margin: 0 auto; padding: var(--space-xl) var(--space-xl) var(--space-2xl); display: grid; gap: var(--space-xl); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-md); flex-wrap: wrap; }
.page-head .lead { margin-top: var(--space-xs); color: var(--color-ink-2); }
.page-head-left { display: flex; align-items: center; gap: var(--space-sm); min-width: 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); margin-bottom: var(--space-sm); }
.ruled { border-top: var(--rule-hair) solid var(--color-ink); }
.row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--space-md); padding: var(--space-sm) 0; border-bottom: var(--rule-hair) solid var(--color-rule); color: var(--color-ink-2); font-weight: 400; }
a.row:hover { color: var(--color-ink-2); background: var(--color-paper-2); }
a.row:hover .row-name { color: var(--color-accent); }
.row-text { min-width: 0; display: grid; gap: var(--space-3xs); }
.row-name { color: var(--color-ink); font-weight: 600; transition: color var(--dur-micro) var(--ease-out); }
.row-desc { font-size: var(--text-sm); color: var(--color-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-end { display: flex; align-items: center; gap: var(--space-xs); }
.empty { padding: var(--space-lg) 0; border-bottom: var(--rule-hair) solid var(--color-rule); color: var(--color-muted); display: flex; align-items: center; justify-content: space-between; gap: var(--space-md); flex-wrap: wrap; }
.join-form { display: flex; gap: var(--space-xs); width: min(22rem, 100%); }
.join-form input { font-family: var(--font-outlier); }
.empty-page { max-width: 28rem; margin: 18vh auto; display: grid; gap: var(--space-sm); justify-items: start; padding: 0 var(--space-md); }

/* ---------- chat */
.chat-head { display: flex; align-items: center; gap: var(--space-sm); padding: 0 var(--space-md); border-bottom: var(--rule-hair) solid var(--color-rule); min-height: 64px; flex: none; }
.chat-title { display: flex; align-items: center; gap: var(--space-sm); flex: 1; min-width: 0; }
.chat-title > div { display: grid; line-height: 1.3; min-width: 0; }
.chat-title strong { color: var(--color-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-title small { font-size: var(--text-xs); color: var(--color-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.head-actions { display: flex; gap: var(--space-2xs); }
.chat { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.chat-scroll { flex: 1; overflow-y: auto; min-height: 0; }
.chat-inner { max-width: 46rem; margin: 0 auto; padding: var(--space-xl) var(--space-lg) var(--space-md); }
.chat.compact .chat-inner { padding: var(--space-lg) var(--space-md) var(--space-sm); }
.intro-head { display: grid; gap: var(--space-xs); margin-bottom: var(--space-lg); padding-bottom: var(--space-md); border-bottom: var(--rule-hair) solid var(--color-ink); }
.intro-head h2 { font-size: var(--text-2xl); }
.intro-head p { max-width: 52ch; }
.starters { display: flex; flex-wrap: wrap; gap: var(--space-xs); margin: var(--space-xs) 0 0 var(--space-xl); }
.starter { border: var(--rule-hair) solid var(--color-rule); background: var(--color-paper); border-radius: var(--radius-control); padding: var(--space-xs) var(--space-sm);
  color: var(--color-ink-2); font-size: var(--text-sm); text-align: left; min-height: var(--control-h-s); transition: border-color var(--dur-micro) var(--ease-out); }
.starter:hover { border-color: var(--color-ink); color: var(--color-ink); }
.messages { display: grid; gap: var(--space-lg); }
.msg { display: flex; gap: var(--space-sm); align-items: flex-start; }
.chat-intro .msg { margin-bottom: var(--space-sm); }
.msg-body { min-width: 0; max-width: 100%; }
.msg.user { justify-content: flex-end; }
.msg.user .msg-body { background: var(--color-paper-2); border: var(--rule-hair) solid var(--color-rule); padding: var(--space-xs) var(--space-md); border-radius: var(--radius-card); max-width: 80%; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--color-ink); }
.msg.assistant .msg-body { flex: 1; padding-top: var(--space-2xs); color: var(--color-ink); }
.msg-img { display: block; max-width: 240px; max-height: 240px; border-radius: var(--radius-control); margin-bottom: var(--space-xs); object-fit: cover; outline: var(--rule-hair) solid var(--color-rule); outline-offset: -1px; }
.msg-error { color: var(--color-error); background: var(--color-error-soft); padding: var(--space-xs) var(--space-sm); border-radius: var(--radius-control); font-size: var(--text-sm); margin-top: var(--space-xs); }
.sources { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2xs); margin-top: var(--space-sm); font-size: var(--text-xs); color: var(--color-muted); }
.dots { display: inline-flex; gap: var(--space-2xs); padding: var(--space-xs) 0; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--color-muted); animation: blink 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: 0.2s; } .dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 50% { opacity: 0.25; } }
.composer { max-width: 46rem; width: 100%; margin: 0 auto; padding: var(--space-xs) var(--space-lg) 0; flex: none; }
.chat.compact .composer { padding: var(--space-xs) var(--space-md) 0; }
.composer-row { display: flex; align-items: flex-end; gap: var(--space-2xs); background: var(--color-paper); border: var(--rule-hair) solid var(--color-muted); border-radius: var(--radius-card); padding: var(--space-2xs); }
.composer-row:focus-within { outline: 2px solid var(--color-focus); outline-offset: -1px; }
.composer textarea { border: 0 !important; background: transparent; resize: none; padding: var(--space-xs); max-height: 200px; min-height: var(--control-h); outline: none !important; }
.send-btn { width: var(--control-h); height: var(--control-h); border-radius: var(--radius-control); border: 0; background: var(--color-ink); color: var(--color-paper); display: grid; place-items: center; flex: none; }
.send-btn:hover { background: var(--color-ink-2); }
.send-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.thumb { position: relative; display: inline-block; margin: 0 0 var(--space-xs); }
.thumb img { height: 72px; border-radius: var(--radius-control); display: block; }
.thumb-x { position: absolute; top: calc(var(--space-xs) * -1); right: calc(var(--space-xs) * -1); width: 24px; height: 24px; border-radius: 50%; border: 0; background: var(--color-ink); color: var(--color-paper); display: grid; place-items: center; }
.disclaimer { text-align: center; color: var(--color-muted); font-size: var(--text-xs); padding: var(--space-xs) var(--space-md) var(--space-sm); flex: none; }

/* markdown */
.md { overflow-wrap: anywhere; line-height: 1.65; }
.md > * + * { margin-top: 0.7em; }
.md h3, .md h4, .md h5, .md h6 { font-size: var(--text-md); margin-top: 1em; color: var(--color-ink); }
.md ul, .md ol { padding-left: 1.4em; margin-bottom: 0; }
.md li + li { margin-top: 0.25em; }
.md code { font-family: var(--font-outlier); font-size: 0.88em; background: var(--color-paper-2); border: var(--rule-hair) solid var(--color-rule); padding: 0 var(--space-2xs); border-radius: 6px; }
.md pre { background: var(--color-paper-2); border: var(--rule-hair) solid var(--color-rule); border-radius: var(--radius-control); padding: var(--space-sm) var(--space-md); overflow-x: auto; }
.md pre code { background: none; border: 0; padding: 0; font-size: var(--text-sm); line-height: 1.55; }
.md blockquote { margin: 0; padding: var(--space-2xs) var(--space-md); background: var(--color-paper-2); border-radius: var(--radius-control); color: var(--color-ink-2); }
.md hr { border: 0; border-top: var(--rule-hair) solid var(--color-rule); }
.table-wrap { overflow-x: auto; position: relative; }
.md table { border-collapse: collapse; font-size: var(--text-sm); }
.md th, .md td { border-bottom: var(--rule-hair) solid var(--color-rule); padding: var(--space-2xs) var(--space-sm); text-align: left; }
.md th { color: var(--color-ink); border-bottom-color: var(--color-ink); }

/* split: notebook + chat */
.split { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(21rem, 26rem); }
.split-tabs { display: none; }
.split-nb { overflow-y: auto; min-height: 0; background: var(--color-paper-2); }
.split-chat { display: flex; flex-direction: column; min-height: 0; border-left: var(--rule-hair) solid var(--color-rule); }

/* ---------- notebook */
.notebook { max-width: 58rem; margin: 0 auto; padding: 0 var(--space-lg) var(--space-xl); }
.nb-bar { position: sticky; top: 0; z-index: var(--z-sticky); display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2xs); padding: var(--space-sm) 0; background: var(--color-paper-2); border-bottom: var(--rule-hair) solid var(--color-rule); margin-bottom: var(--space-sm); }
.nb-btn { display: inline-flex; align-items: center; gap: var(--space-2xs); min-height: var(--control-h-s); padding: 0 var(--space-sm); border-radius: 8px; border: var(--rule-hair) solid var(--color-rule);
  background: var(--color-paper); font-size: var(--text-sm); font-weight: 600; color: var(--color-ink-2); white-space: nowrap; transition: border-color var(--dur-micro) var(--ease-out); }
.nb-btn:hover { border-color: var(--color-ink); color: var(--color-ink); }
.nb-status { margin-left: auto; }
.nb-readonly { font-size: var(--text-sm); color: var(--color-muted); }
.nb-cells { display: grid; gap: var(--space-xs); }
.nb-cell { display: grid; grid-template-columns: 52px minmax(0, 1fr); background: var(--color-paper); border: var(--rule-hair) solid var(--color-rule); border-radius: var(--radius-control); position: relative; }
.nb-cell:focus-within { border-color: var(--color-ink); }
.nb-cell.is-running { border-color: var(--color-accent); }
.nb-gutter { display: flex; flex-direction: column; align-items: center; gap: var(--space-3xs); padding: var(--space-xs) 0; }
.nb-run { width: 32px; padding: 0; justify-content: center; border-color: transparent; background: var(--color-paper-3); color: var(--color-ink); }
.nb-run:hover { background: var(--color-ink); color: var(--color-paper); }
.nb-count { font-family: var(--font-outlier); font-size: var(--text-xs); color: var(--color-muted); }
.nb-md-mark { font-family: var(--font-body); font-weight: 700; margin-top: var(--space-xs); }
.nb-main { min-width: 0; padding: var(--space-2xs) var(--space-sm) var(--space-2xs) 0; }
.nb-src { border: 0 !important; background: transparent !important; padding: var(--space-xs) var(--space-3xs) !important; resize: none; overflow: hidden; outline: none !important;
  font: var(--text-sm)/1.6 var(--font-outlier) !important; tab-size: 4; white-space: pre; overflow-x: auto; min-height: 38px !important; }
.nb-md-src { font-family: var(--font-body) !important; white-space: pre-wrap; }
.nb-md { padding: var(--space-xs) var(--space-3xs); min-height: 38px; cursor: text; color: var(--color-ink); }
.nb-out { border-top: var(--rule-hair) solid var(--color-rule-2); margin-top: var(--space-2xs); padding-top: var(--space-xs); display: grid; gap: var(--space-2xs); }
.nb-o { margin: 0; font: var(--text-sm)/1.55 var(--font-outlier); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 360px; overflow-y: auto; color: var(--color-ink); }
.nb-stderr { color: var(--color-muted); }
.nb-error { color: var(--color-error); background: var(--color-error-soft); padding: var(--space-xs) var(--space-sm); border-radius: 8px; }
.nb-result { color: var(--color-ink-2); }
.nb-img { max-width: 100%; border-radius: 8px; background: var(--color-chart-bg); }
.nb-tools { position: absolute; top: var(--space-xs); right: var(--space-xs); display: flex; gap: var(--space-3xs); opacity: 0; transition: opacity var(--dur-micro) var(--ease-out); }
.nb-cell:hover .nb-tools, .nb-cell:focus-within .nb-tools { opacity: 1; }
.nb-tools .nb-btn { min-height: 28px; padding: 0 var(--space-xs); font-size: var(--text-xs); }
.nb-ask { background: var(--color-ink) !important; color: var(--color-paper) !important; border-color: var(--color-ink) !important; }
.nb-add { display: flex; justify-content: center; gap: var(--space-xs); padding: var(--space-xs); }

/* ---------- editor: the instructions set like a printed notice, the preview beside it */
.editor-head { display: flex; align-items: center; gap: var(--space-sm); padding: 0 var(--space-md); border-bottom: var(--rule-hair) solid var(--color-rule); flex: none; min-height: 64px; }
.editor-head h1 { font-size: var(--text-lg); }
.editor { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(22rem, 42%); }
.editor-form { overflow-y: auto; padding: var(--space-lg) var(--space-xl) var(--space-2xl); }
.sheet { max-width: 44rem; display: grid; gap: var(--space-xl); }
.sheet-part { display: grid; gap: var(--space-md); border-top: var(--rule-hair) solid var(--color-ink); padding-top: var(--space-md); }
.sheet-part > h2 { font-size: var(--text-lg); }
.field { display: grid; gap: var(--space-2xs); }
.field-label { font-weight: 600; font-size: var(--text-sm); color: var(--color-ink); }
.field-help { font-size: var(--text-sm); color: var(--color-muted); min-height: 1lh; }
.field-top { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); flex-wrap: wrap; }
.row-gap { display: flex; gap: var(--space-xs); align-items: center; flex-wrap: wrap; }
textarea.instructions { min-height: 300px; font-size: var(--text-md); line-height: 1.7; background: var(--color-paper-2); padding: var(--space-md); }
.code-input { font-family: var(--font-outlier) !important; font-size: var(--text-sm) !important; }
.pick-list { border-top: var(--rule-hair) solid var(--color-rule); }
.pick { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center; gap: var(--space-sm); padding: var(--space-xs) 0; border-bottom: var(--rule-hair) solid var(--color-rule-2); cursor: pointer; font-weight: 400; color: var(--color-ink-2); }
.pick:hover .pick-name { color: var(--color-accent); }
.pick-name { color: var(--color-ink); font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: color var(--dur-micro) var(--ease-out); }
.pick-meta { font-size: var(--text-xs); color: var(--color-muted); white-space: nowrap; }
.pick { padding-left: calc(var(--depth, 0) * var(--space-lg)); }
.segmented { display: inline-flex; padding: var(--space-3xs); background: var(--color-paper-3); border-radius: var(--radius-control); gap: var(--space-3xs); justify-self: start; }
.segmented button { display: inline-flex; align-items: center; gap: var(--space-xs); border: 0; background: transparent; min-height: var(--control-h-s); padding: 0 var(--space-sm); border-radius: 8px; color: var(--color-ink-2); font-weight: 600; font-size: var(--text-sm); }
.segmented button.on { background: var(--color-paper); color: var(--color-ink); box-shadow: inset 0 0 0 var(--rule-hair) var(--color-rule); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-md); cursor: pointer; font-weight: 400; }
.switch-row > span:first-child { display: grid; gap: var(--space-3xs); }
.switch-row strong { color: var(--color-ink); font-size: var(--text-sm); }
.switch-row small { font-size: var(--text-sm); line-height: 1.5; color: var(--color-muted); }
.switch { position: relative; flex: none; width: 44px; height: 26px; display: inline-block; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: var(--radius-pill); background: var(--color-rule); transition: background-color var(--dur-short) var(--ease-out); }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--color-paper); box-shadow: 0 1px 2px var(--color-scrim); transition: transform var(--dur-short) var(--ease-out); }
.switch input:checked + i { background: var(--color-ink); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { outline: 2px solid var(--color-focus); outline-offset: 2px; }
details.more summary { cursor: pointer; font-weight: 600; color: var(--color-ink); list-style: none; display: flex; justify-content: space-between; padding: var(--space-xs) 0; }
details.more summary::after { content: "展開"; color: var(--color-muted); font-weight: 400; font-size: var(--text-sm); }
details.more[open] summary::after { content: "收起"; }
details.more > .field { margin-top: var(--space-sm); }
.starter-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-xs); }
.danger-zone { display: flex; gap: var(--space-xs); border-top: var(--rule-hair) solid var(--color-rule); padding-top: var(--space-md); }
.editor-preview { display: flex; flex-direction: column; min-height: 0; border-left: var(--rule-hair) solid var(--color-rule); background: var(--color-paper-2); }
.preview-head { display: flex; align-items: center; gap: var(--space-sm); padding: var(--space-sm) var(--space-md); border-bottom: var(--rule-hair) solid var(--color-rule); }
.preview-head > div { flex: 1; display: grid; }
.preview-head strong { color: var(--color-ink); }
.preview-head small { font-size: var(--text-xs); color: var(--color-muted); }
.editor-preview .chat-inner { padding: var(--space-lg) var(--space-md) var(--space-sm); }
.editor-preview .composer { padding: var(--space-xs) var(--space-md) 0; }
.editor-preview .composer-row { background: var(--color-paper); }
.stale { margin: var(--space-sm) var(--space-md) 0; padding: var(--space-xs) var(--space-sm); border-radius: var(--radius-control); background: var(--color-paper); border: var(--rule-hair) solid var(--color-rule); font-size: var(--text-sm); display: flex; gap: var(--space-xs); justify-content: space-between; flex-wrap: wrap; }

/* ---------- 知識庫 */
.library { display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: var(--space-xl); align-items: start; }
.folders { display: grid; gap: var(--space-3xs); position: sticky; top: var(--space-md); }
.folder { display: flex; align-items: center; gap: var(--space-xs); min-height: 36px; padding: 0 var(--space-xs) 0 calc(var(--space-xs) + var(--depth, 0) * var(--space-md)); border-radius: 8px; border: 0; background: transparent; color: var(--color-ink-2); font-size: var(--text-sm); text-align: left; width: 100%; }
.folder:hover { background: var(--color-paper-3); color: var(--color-ink); }
.folder[aria-current="true"] { background: var(--color-paper-2); color: var(--color-ink); font-weight: 600; box-shadow: inset 0 0 0 var(--rule-hair) var(--color-rule); }
.folder .count { margin-left: auto; font-size: var(--text-xs); color: var(--color-muted); font-variant-numeric: tabular-nums; }
.folder.drop { background: var(--color-accent-soft); color: var(--color-accent-soft-ink); }
.new-folder { margin-top: var(--space-xs); justify-self: start; }
.folders .fine { padding: var(--space-xs) var(--space-xs) 0; }
.folder-row { width: 100%; background: transparent; border: 0; border-bottom: var(--rule-hair) solid var(--color-rule); text-align: left; color: inherit; }
.folder-row:hover { background: var(--color-paper-2); }
.folder-row:hover .row-name { color: var(--color-accent); }
.file-row.drop { background: var(--color-accent-soft); }
.dropzone { display: flex; align-items: center; justify-content: space-between; gap: var(--space-md); flex-wrap: wrap; padding: var(--space-md); border: var(--rule-hair) dashed var(--color-muted); border-radius: var(--radius-card); background: var(--color-paper-2); margin-bottom: var(--space-lg); }
.dropzone.over { border-style: solid; border-color: var(--color-accent); background: var(--color-accent-soft); }
.dropzone p { color: var(--color-ink-2); font-size: var(--text-sm); }
.dropzone .drop-icon { color: var(--color-muted); display: grid; place-items: center; }
.dropzone .drop-text { flex: 1 1 18rem; display: grid; gap: var(--space-3xs); }
.dropzone .drop-hint { display: none; color: var(--color-accent-soft-ink); font-size: var(--text-sm); }
.dropzone .upload-meter { flex-basis: 100%; }
/* computer files hovering anywhere on the library page: light up the drop zone and every folder that takes them */
.library-page.files-over .dropzone { border-style: solid; border-color: var(--color-accent); background: var(--color-accent-soft); }
.library-page.files-over .dropzone .drop-icon { color: var(--color-accent); }
.library-page.files-over .dropzone .drop-hint { display: block; }
.library-page.files-over [data-drop-folder] { outline: var(--rule-hair) dashed var(--color-rule); outline-offset: -2px; }
.library-page.files-over [data-drop-folder].drop { outline: 2px solid var(--color-accent); }
.folder.drop, .folder-row.drop { outline: 2px solid var(--color-accent); outline-offset: -2px; }
.dragging { opacity: .45; }
.upload-meter { display: flex; align-items: center; gap: var(--space-xs); font-size: var(--text-sm); color: var(--color-ink-2); }
.upload-meter[hidden] { display: none; }
.upload-meter span.ellipsis { flex: 1; min-width: 0; }
.upload-meter progress { width: 10rem; accent-color: var(--color-accent); }
.know-drop { transition: background-color .15s, box-shadow .15s; }
.know-drop .upload-meter { padding: var(--space-xs) 0; }
.know-drop.files-over { background: var(--color-accent-soft); box-shadow: 0 0 0 2px var(--color-accent); border-radius: var(--radius-card); }
.file-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: var(--space-md); padding: var(--space-sm) 0; border-bottom: var(--rule-hair) solid var(--color-rule); }
.file-row[draggable="true"] { cursor: grab; }
.file-row .row-text { gap: 0; }
.file-row select { width: auto; min-height: var(--control-h-s); font-size: var(--text-sm); padding: 0 var(--space-xs); }
.file-row.pending { color: var(--color-muted); }
.folder-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); margin-bottom: var(--space-sm); flex-wrap: wrap; }
.reader { white-space: pre-wrap; font-size: var(--text-sm); line-height: 1.7; max-height: 60vh; overflow-y: auto; background: var(--color-paper-2); border: var(--rule-hair) solid var(--color-rule); border-radius: var(--radius-control); padding: var(--space-md); color: var(--color-ink); }

/* ---------- handwritten notes */
.note-title { border-color: transparent !important; font-weight: 700; font-size: var(--text-lg) !important; color: var(--color-ink); max-width: 22rem; }
.note-title:hover { border-color: var(--color-rule) !important; }
.editor-head select { width: auto; }
.note-editor { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--color-paper-3); }
.note-bar { display: flex; flex-wrap: wrap; gap: var(--space-xs); padding: var(--space-xs) var(--space-md); background: var(--color-paper); border-bottom: var(--rule-hair) solid var(--color-rule); align-items: center; }
.note-group { display: flex; gap: var(--space-3xs); align-items: center; padding-right: var(--space-xs); border-right: var(--rule-hair) solid var(--color-rule-2); }
.note-group:last-child { border-right: 0; margin-left: auto; }
.note-group select { width: auto; min-height: var(--control-h-s); font-size: var(--text-sm); padding: 0 var(--space-xs); }
.note-bar .nb-btn[aria-pressed="true"] { background: var(--color-ink); border-color: var(--color-ink); color: var(--color-paper); }
.note-bar .nb-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.note-swatch { width: 32px; padding: 0; justify-content: center; }
.note-swatch::before { content: ""; width: 16px; height: 16px; border-radius: 50%; background: var(--swatch); box-shadow: inset 0 0 0 var(--rule-hair) var(--color-rule); }
.note-bar .note-swatch[aria-pressed="true"] { background: var(--color-paper-3); border-color: var(--color-ink); }
.note-pager { font-size: var(--text-sm); color: var(--color-ink); font-variant-numeric: tabular-nums; min-width: 3.5rem; text-align: center; }
.note-stage { flex: 1; min-height: 0; display: grid; place-items: center; padding: var(--space-xs); overflow: auto; }
.note-canvas { background: var(--note-paper); border-radius: 4px; box-shadow: var(--shadow-page); touch-action: none; cursor: crosshair; }
.note-canvas[data-tool="eraser"] { cursor: cell; }

/* notebook layout: thumbnails, page, AI panel */
.note-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 8rem minmax(0, 1fr) auto; }
.note-thumbs { overflow-y: auto; padding: var(--space-sm) var(--space-xs); display: grid; gap: var(--space-xs); align-content: start; background: var(--color-paper-2); border-right: var(--rule-hair) solid var(--color-rule); }
.note-thumb { border: var(--rule-hair) solid var(--color-rule); background: var(--color-paper); border-radius: 6px; padding: var(--space-3xs); display: grid; gap: var(--space-3xs); justify-items: center; color: var(--color-muted); font-size: var(--text-xs); }
.note-thumb canvas { width: 100%; height: auto; border-radius: 3px; }
.note-thumb[aria-current="true"] { border-color: var(--color-ink); color: var(--color-ink); box-shadow: inset 0 0 0 var(--rule-hair) var(--color-ink); }
.note-sheet { position: relative; }
.note-sheet .note-canvas { width: 100%; height: 100%; display: block; }
.note-textbox { position: absolute; border: var(--rule-hair) dashed var(--color-accent) !important; background: transparent !important; padding: 0 !important; min-height: 0 !important; line-height: 1.45; resize: none; overflow: hidden; outline: none !important; font-family: var(--font-body); }
.note-canvas[data-tool="text"] { cursor: text; }
.note-canvas[data-tool="move"] { cursor: move; }
.note-ai { width: 22rem; border-left: var(--rule-hair) solid var(--color-rule); background: var(--color-paper); display: flex; flex-direction: column; min-height: 0; overflow-y: auto; padding: var(--space-md); gap: var(--space-sm); }
.note-ai-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-xs); }
.note-ai-head h2 { font-size: var(--text-lg); }
.ai-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2xs); }
.ai-ask { display: grid; gap: var(--space-2xs); }
.ai-ask .row-gap { justify-content: flex-end; }
.ai-results { display: grid; gap: var(--space-sm); border-top: var(--rule-hair) solid var(--color-ink); padding-top: var(--space-sm); }
.ai-results:empty { display: none; }
.ai-card { border: var(--rule-hair) solid var(--color-rule); border-radius: var(--radius-control); padding: var(--space-sm); display: grid; gap: var(--space-xs); background: var(--color-paper-2); font-size: var(--text-sm); }
.ai-card header { display: grid; gap: var(--space-3xs); }
.ai-card header strong { color: var(--color-ink); }
.msg-tools { display: flex; gap: var(--space-2xs); margin-top: var(--space-2xs); }
.icon-btn[aria-pressed="true"] { background: var(--color-ink); color: var(--color-paper); }
.mic-btn.busy { opacity: 0.55; cursor: progress; }

/* classes */
.class-code { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 18rem); gap: var(--space-xl); align-items: start; padding: var(--space-md); border: var(--rule-hair) solid var(--color-rule); border-radius: var(--radius-card); background: var(--color-paper-2); }
.class-code > div { display: grid; gap: var(--space-xs); }
.class-code .code-big { justify-self: start; padding: var(--space-sm) var(--space-lg); background: var(--color-paper); }
.class-code-side { display: grid; gap: var(--space-sm); justify-items: start; }
.section-head form select { width: auto; max-width: 16rem; }
.section-head form { flex-wrap: nowrap; }
.add-people { display: grid; gap: var(--space-xs); margin-top: var(--space-md); max-width: 32rem; }
.share-part { display: grid; gap: var(--space-2xs); margin-top: var(--space-md); padding-top: var(--space-sm); border-top: var(--rule-hair) solid var(--color-rule); }

/* ---------- dialog */
dialog.modal { border: 0; border-radius: var(--radius-card); padding: var(--space-lg); width: 100%; max-width: 30rem; background: var(--color-paper); color: var(--color-ink-2); box-shadow: var(--shadow-card); }
dialog.modal.wide { max-width: 46rem; }
dialog.modal.small { max-width: 24rem; }
dialog::backdrop { background: var(--color-scrim); }
dialog.modal h2 { margin-bottom: var(--space-xs); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); margin-bottom: var(--space-md); }
.modal-head h2 { margin: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: var(--space-xs); margin-top: var(--space-lg); }
.share-body { margin-top: var(--space-md); display: grid; gap: var(--space-sm); }
.code-big { font: 600 var(--text-3xl)/1 var(--font-outlier); padding: var(--space-md); background: var(--color-paper-2); border: var(--rule-hair) solid var(--color-rule); border-radius: var(--radius-card); color: var(--color-ink); text-align: center; }
.copy-row { display: flex; gap: var(--space-xs); }
.copy-row input { font-size: var(--text-sm) !important; }

/* ---------- activity & admin */
.conv-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: var(--space-md); align-items: center; padding: var(--space-xs) 0; border-bottom: var(--rule-hair) solid var(--color-rule-2); font-weight: 400; color: var(--color-ink-2); }
.conv-row:hover { color: var(--color-accent); }
.conv-row .num { font-size: var(--text-xs); color: var(--color-muted); }
.student { padding: var(--space-md) 0; border-bottom: var(--rule-hair) solid var(--color-rule); }
.student-head { display: flex; gap: var(--space-sm); align-items: center; margin-bottom: var(--space-xs); }
.student-head strong { color: var(--color-ink); }
.figures { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-xs); }
.figure-well { background: var(--color-paper-2); border: var(--rule-hair) solid var(--color-rule); border-radius: var(--radius-card); padding: var(--space-md); display: grid; gap: var(--space-2xs); }
.figure-well strong { font-size: var(--text-3xl); color: var(--color-ink); line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: var(--tracking-display); }
.figure-well span { font-size: var(--text-sm); color: var(--color-muted); }
.bars { display: flex; align-items: flex-end; gap: var(--space-xs); height: 160px; border-bottom: var(--rule-hair) solid var(--color-ink); }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: var(--space-2xs); }
.bar span { width: 100%; max-width: 32px; background: var(--color-ink); border-radius: 4px 4px 0 0; }
.bar-labels { display: flex; gap: var(--space-xs); margin-top: var(--space-2xs); }
.bar-labels small { flex: 1; text-align: center; font-size: var(--text-xs); color: var(--color-muted); font-variant-numeric: tabular-nums; }
.admin-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-xl); }
.admin-grid > section { display: grid; gap: var(--space-sm); align-content: start; }
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-sm); }
input.num { width: 7rem !important; }
.section-head input[type=search] { max-width: 16rem; }
table.users { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
table.users th { text-align: left; font-weight: 400; color: var(--color-muted); font-size: var(--text-xs); padding: var(--space-xs); border-bottom: var(--rule-hair) solid var(--color-ink); white-space: nowrap; }
table.users td { padding: var(--space-xs); border-bottom: var(--rule-hair) solid var(--color-rule); vertical-align: middle; }
table.users tr.off { opacity: 0.55; }
table.users select { width: auto; min-height: var(--control-h-s); padding: 0 var(--space-xs); font-size: var(--text-sm); }
table.users input.num { min-height: var(--control-h-s); width: 5.5rem !important; font-size: var(--text-sm); }
.user-cell { display: flex; gap: var(--space-sm); align-items: center; min-width: 12rem; }
.user-cell strong { color: var(--color-ink); }

/* ---------- toast */
#toast { position: fixed; left: 50%; bottom: var(--space-lg); transform: translate(-50%, var(--space-md)); background: var(--color-ink); color: var(--color-paper); padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-control); font-size: var(--text-sm); opacity: 0; pointer-events: none; transition: opacity var(--dur-short) var(--ease-out), transform var(--dur-short) var(--ease-out); z-index: var(--z-toast); max-width: calc(100% - var(--space-xl)); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast[data-kind="error"] { background: var(--color-error); }
#toast.act { pointer-events: auto; }
#toast a { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- plans */
.plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: var(--rule-hair) solid var(--color-ink); }
.plan { display: grid; grid-template-rows: auto auto auto auto 1fr auto; gap: var(--space-xs); padding: var(--space-lg) var(--space-md); border-right: var(--rule-hair) solid var(--color-rule); }
.plan:last-child { border-right: 0; }
.plan.current { background: var(--color-paper-2); }
.plan h2 { font-size: var(--text-xl); }
.plan-for { color: var(--color-ink-2); font-size: var(--text-sm); }
.plan-price { margin-top: var(--space-sm); font-variant-numeric: tabular-nums; color: var(--color-ink-2); }
.plan-price strong { font-size: var(--text-3xl); color: var(--color-ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.plan-save { font-size: var(--text-sm); color: var(--color-muted); font-variant-numeric: tabular-nums; }
.plan ul { margin: var(--space-sm) 0 0; padding: 0; list-style: none; }
.plan li { padding: var(--space-xs) 0; border-bottom: var(--rule-hair) solid var(--color-rule); font-size: var(--text-sm); }
.plan-action { padding-top: var(--space-md); }
.plan-note { color: var(--color-ink-2); font-size: var(--text-sm); }
.plan-usage { display: grid; gap: var(--space-sm); max-width: 30rem; }
.plan-usage h2 { font-size: var(--text-lg); }
.plan-meter { display: grid; gap: var(--space-2xs); }
.side-badge { margin-left: auto; font-size: var(--text-xs); color: var(--color-muted); }
@media (max-width: 760px) {
  .plans { grid-template-columns: minmax(0, 1fr); }
  .plan { border-right: 0; border-bottom: var(--rule-hair) solid var(--color-rule); }
}

/* ---------- responsive */
@media (max-width: 75rem) {
  .editor { grid-template-columns: minmax(0, 1fr); overflow-y: auto; }
  .editor-form { overflow: visible; padding: var(--space-lg); }
  .editor-preview { border-left: 0; border-top: var(--rule-hair) solid var(--color-rule); min-height: 34rem; }
  .split { grid-template-columns: minmax(0, 1fr) 22rem; }
  .admin-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 60rem) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; z-index: var(--z-modal); inset: 0 auto 0 0; width: min(18.75rem, 86%); transform: translateX(-100%); transition: transform var(--dur-short) var(--ease-out); box-shadow: var(--shadow-card); }
  .nav-open .sidebar { transform: none; }
  .nav-open .scrim { display: block; position: fixed; inset: 0; z-index: var(--z-sticky-nav); background: var(--color-scrim); }
  .only-mobile { display: inline-grid; }
  .mobile-bar { display: flex; align-items: center; gap: var(--space-xs); padding: var(--space-xs) var(--space-xs) 0; }
  .chat-head .mobile-bar, .editor-head .mobile-bar { padding: 0; }
  .page { padding: var(--space-md) var(--space-md) var(--space-xl); gap: var(--space-lg); }
  .hide-sm { display: none; }
  .head-actions .btn { padding: 0 var(--space-xs); }
  .chat-inner { padding: var(--space-lg) var(--space-md) var(--space-sm); }
  .composer { padding: var(--space-xs) var(--space-sm) 0; }
  .starters { margin-left: 0; }
  .split { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .split-tabs { display: flex; gap: var(--space-2xs); padding: var(--space-xs) var(--space-sm); border-bottom: var(--rule-hair) solid var(--color-rule); }
  .split-tabs .tab { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-xs); min-height: var(--control-h-s); border: var(--rule-hair) solid var(--color-rule); border-radius: 8px; background: var(--color-paper-2); font-weight: 600; font-size: var(--text-sm); color: var(--color-ink); }
  .split-chat { display: none; border-left: 0; }
  .split.show-chat .split-nb { display: none; }
  .split.show-chat .split-chat { display: flex; }
  .notebook { padding: 0 var(--space-sm) var(--space-lg); }
  .nb-cell { grid-template-columns: 40px minmax(0, 1fr); }
  .nb-tools { position: static; opacity: 1; grid-column: 1 / -1; justify-content: flex-end; padding: 0 var(--space-xs) var(--space-xs); }
  .editor-form { padding: var(--space-md); }
  .figures { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .two, .starter-grid { grid-template-columns: minmax(0, 1fr); }
  .login { grid-template-columns: minmax(0, 1fr); }
  .login-side { border-right: 0; border-bottom: var(--rule-hair) solid var(--color-rule); padding: var(--space-xl) var(--gutter); }
  .notice { display: none; }
  .library { grid-template-columns: minmax(0, 1fr); gap: var(--space-md); }
  .class-code { grid-template-columns: minmax(0, 1fr); }
  .note-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .note-thumbs { display: none; }
  .note-ai { width: auto; max-height: 45vh; border-left: 0; border-top: var(--rule-hair) solid var(--color-rule); }
  .folders { position: static; display: flex; overflow-x: auto; gap: var(--space-2xs); padding-bottom: var(--space-2xs); }
  .folder { width: auto; white-space: nowrap; }
  .new-folder { margin-top: 0; }
  .file-row { grid-template-columns: minmax(0, 1fr) auto; }
  .file-row > .mark { display: none; }
  .file-row select { grid-column: 1 / -1; width: 100%; }
  input:not([type=checkbox]):not([type=file]), select, textarea { font-size: var(--text-md); }
}

/* ---- flash cards and the live quiz (play.js) */
.msg-tools { flex-wrap: wrap; align-items: center; }
dialog.modal.study { max-width: 40rem; height: fit-content; }
dialog.modal.study > * + * { margin-top: var(--space-md); }
dialog.modal.study .modal-head { margin-bottom: 0; }
.flash { position: relative; display: grid; place-items: center; width: 100%; min-height: min(22rem, 48vh); padding: var(--space-xl) var(--space-lg); border: var(--rule-hair) solid var(--color-ink); border-radius: var(--radius-card); background: var(--color-paper); color: var(--color-ink); font: inherit; cursor: pointer; text-align: center; }
.flash.flipped { background: var(--color-accent-soft); border-color: var(--color-accent); color: var(--color-accent-soft-ink); }
.flash[hidden] { display: none; }
.card-side { position: absolute; top: var(--space-sm); left: var(--space-md); font-size: var(--text-xs); color: var(--color-muted); }
.card-face { font-size: var(--text-2xl); font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.flash.flipped .card-face { font-size: var(--text-xl); }
.study-foot { display: flex; justify-content: center; gap: var(--space-xs); }
.study-foot .btn { min-width: 8rem; }
.study-done { display: grid; gap: var(--space-xs); justify-items: center; padding: var(--space-xl) 0; }
.page.game { gap: var(--space-lg); }
.host-start { display: grid; gap: var(--space-xs); justify-items: start; border-top: var(--rule-hair) solid var(--color-rule); padding-top: var(--space-lg); }
.game-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-md); border-bottom: var(--rule-hair) solid var(--color-ink); padding-bottom: var(--space-sm); }
.game-head .rule-label { margin: 0 0 var(--space-2xs); }
.game-head .rule-label::after { display: none; }
.lobby { display: grid; gap: var(--space-md); justify-items: center; text-align: center; padding: var(--space-lg) 0; }
.pin { font-family: var(--font-outlier); font-size: clamp(3rem, 14vw, 7rem); line-height: 1; letter-spacing: 0.08em; color: var(--color-ink); }
.pin-form input { font-size: var(--text-xl); letter-spacing: 0.2em; }
.names { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2xs); min-height: 2rem; max-width: 48rem; }
.game-status { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-md); color: var(--color-muted); font-size: var(--text-sm); }
.countdown b { font-family: var(--font-outlier); font-size: var(--text-2xl); color: var(--color-ink); font-variant-numeric: tabular-nums; }
.game-q { max-width: none; width: 100%; text-wrap: balance; font-size: var(--text-2xl); line-height: 1.3; text-align: center; padding: var(--space-md) 0; overflow-wrap: anywhere; }
.answers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-sm); }
.ans-wrap { display: grid; gap: var(--space-2xs); }
.ans { display: flex; align-items: center; gap: var(--space-sm); width: 100%; min-height: 5rem; padding: var(--space-md); border: 0; border-radius: var(--radius-card); color: var(--color-paper); font: inherit; font-size: var(--text-lg); font-weight: 600; text-align: left; }
button.ans { cursor: pointer; }
button.ans:disabled { cursor: default; }
.ans-0 { background: var(--color-ans-0); } .ans-1 { background: var(--color-ans-1); } .ans-2 { background: var(--color-ans-2); } .ans-3 { background: var(--color-ans-3); }
.ans.dim { opacity: 0.35; }
.ans.picked { box-shadow: 0 0 0 3px var(--color-paper), 0 0 0 6px var(--color-ink); }
.ans.right::after { content: "✓"; margin-left: auto; font-size: var(--text-xl); }
.ans-shape { flex: none; font-size: var(--text-xl); }
.ans-text { overflow-wrap: anywhere; }
.ans-count { display: flex; align-items: center; gap: var(--space-xs); font-size: var(--text-sm); }
.ans-count span { display: block; height: 6px; min-width: 2px; border-radius: 3px; background: var(--color-ink); max-width: calc(100% - 2rem); }
.game-next { justify-content: flex-end; }
.verdict { text-align: center; font-size: var(--text-lg); font-weight: 600; color: var(--color-ink); }
.verdict.ok { color: var(--color-success); } .verdict.no { color: var(--color-error); }
.verdict span { color: var(--color-muted); font-weight: 400; }
.score { display: flex; align-items: baseline; gap: var(--space-2xs); color: var(--color-muted); }
.score strong { font-family: var(--font-outlier); font-size: var(--text-xl); color: var(--color-ink); }
.board { list-style: none; margin: 0; padding: 0; width: min(28rem, 100%); display: grid; text-align: left; }
.board li { display: flex; align-items: center; gap: var(--space-sm); padding: var(--space-xs) 0; border-bottom: var(--rule-hair) solid var(--color-rule); }
.board li b { width: 1.5rem; font-family: var(--font-outlier); color: var(--color-muted); }
.board li span { flex: 1; }
.board li strong { font-family: var(--font-outlier); }
@media (max-width: 560px) { .answers { grid-template-columns: 1fr; } .ans { min-height: 4rem; } .game-q { font-size: var(--text-xl); } }
.pin-form input::placeholder { letter-spacing: 0; font-size: var(--text-md); }

/* ---------- notebook folders, shapes and lasso */
.nb-folders { display: flex; flex-wrap: wrap; gap: var(--space-2xs); align-items: center; margin-bottom: var(--space-sm); }
.nb-folder { display: inline-flex; gap: var(--space-2xs); align-items: center; min-height: var(--control-h-s); padding: 0 var(--space-sm); border: var(--rule-hair) solid var(--color-rule); border-radius: 999px; background: var(--color-paper); color: var(--color-ink); font-size: var(--text-sm); cursor: pointer; }
.nb-folder.on { background: var(--color-ink); border-color: var(--color-ink); color: var(--color-paper); }
.nb-folder.on .muted { color: inherit; }
.nb-folder-select { width: auto; max-width: 9rem; min-height: var(--control-h-s); font-size: var(--text-sm); padding: 0 var(--space-xs); }
.note-canvas[data-tool="lasso"] { cursor: crosshair; }
.note-group [hidden] { display: none; }

/* ---- teacher tools: Excel invite, AI 生圖, 排時間表, video attachment */
.sub-head { font-size: var(--text-sm, .9rem); margin: var(--space-md) 0 0; }
.invite-result p { margin: var(--space-sm) 0 var(--space-xs); border: 0; max-width: none; display: block; }
.invite-result p.good { color: var(--color-ink); }
.invite-result p.warn { color: var(--color-error); }
.invite-result ul { margin: 0; padding-left: 1.2rem; max-height: 12rem; overflow: auto; }
.thumb-file { display: inline-flex; align-items: center; gap: var(--space-xs); padding: var(--space-xs) var(--space-sm); border: var(--rule-hair) solid var(--color-rule); border-radius: var(--radius-control); max-width: 18rem; }
.three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-sm); }
.image-out { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: var(--space-md); margin-top: var(--space-md); }
.image-card { margin: 0; border: var(--rule-hair) solid var(--color-rule); border-radius: var(--radius-control); overflow: hidden; }
.image-card img { display: block; width: 100%; height: auto; }
.image-card figcaption { display: grid; gap: var(--space-xs); padding: var(--space-sm); }
.tt-input { width: 100%; border-collapse: collapse; }
.tt-input th { text-align: left; font-size: .85rem; padding: 0 var(--space-xs) var(--space-xs); white-space: nowrap; }
.tt-input td { padding: var(--space-3xs); }
.tt-input input { width: 100%; min-width: 5rem; }
.tt-input input.num { min-width: 4rem; }
.tt-out { margin-top: var(--space-lg); display: grid; gap: var(--space-md); }
.tt-status { padding: var(--space-sm) var(--space-md); border: var(--rule-hair) solid var(--color-ink); border-radius: var(--radius-control); display: grid; gap: var(--space-3xs); }
.tt-status.warn { border-color: var(--color-error); }
.tt-issues ul { margin: var(--space-xs) 0; padding-left: 1.2rem; }
.tt-grid h3 { margin: var(--space-sm) 0 var(--space-xs); }
table.tt { width: 100%; border-collapse: collapse; table-layout: fixed; min-width: 34rem; }
table.tt th, table.tt td { border: var(--rule-hair) solid var(--color-rule); padding: var(--space-xs); text-align: center; vertical-align: middle; font-size: .85rem; font-variant-numeric: tabular-nums; }
table.tt thead th { font-weight: 600; }
table.tt tbody th { width: 2.5rem; }
table.tt td strong, table.tt td span { display: block; }
table.tt td span { color: var(--color-muted); font-size: .78rem; font-variant-numeric: tabular-nums; }
table.tt tr.tt-break td, table.tt tr.tt-break th { border-bottom: 3px solid var(--color-ink); }
/* 排時間表: AI helper, lesson tabs, calendar, move-a-lesson */
.tt-page { display: grid; gap: var(--space-lg); }
.tt-chips { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.chip { border: var(--rule-hair) solid var(--color-rule); background: var(--color-paper); color: var(--color-ink); border-radius: 999px; padding: 0 var(--space-sm); min-height: var(--control-h-s); font-size: var(--text-sm); cursor: pointer; text-align: left; }
.chip:hover { border-color: var(--color-ink); }
.chip.on { background: var(--color-ink); color: var(--color-paper); border-color: var(--color-ink); }
.tt-ai-note:empty { display: none; }
.tt-status.good { border-color: var(--color-ink); }
.tt-status span { font-size: var(--text-sm); }
.check { display: flex; align-items: center; gap: var(--space-xs); align-self: end; min-height: var(--control-h); }
.check input { width: 1.1rem; height: 1.1rem; }
.tt-matrix th[scope=row] { white-space: nowrap; padding-right: var(--space-sm); font-size: .9rem; text-align: left; }
.tt-matrix .tt-cell { display: grid; gap: var(--space-3xs); min-width: 6rem; }
.tt-matrix .tt-cell input { width: 100% !important; min-width: 0; }
.tt-cal-wrap { max-height: 28rem; overflow: auto; border: var(--rule-hair) solid var(--color-rule); border-radius: var(--radius-control); }
table.tt-cal { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
table.tt-cal th, table.tt-cal td { text-align: left; padding: var(--space-xs) var(--space-sm); border-bottom: var(--rule-hair) solid var(--color-rule); vertical-align: top; }
table.tt-cal thead th { position: sticky; top: 0; background: var(--color-paper); border-bottom-color: var(--color-ink); white-space: nowrap; }
table.tt-cal tr.tt-month th { background: var(--color-paper-2); font-weight: 700; }
table.tt-cal tr.tt-off td { color: var(--color-muted); background: var(--color-paper-2); }
.tt-grid h4 { margin: var(--space-sm) 0 var(--space-2xs); font-size: var(--text-sm); color: var(--color-muted); }
table.tt td em { display: block; font-style: normal; font-variant-numeric: tabular-nums; font-size: .7rem; font-weight: 600; letter-spacing: .04em; }
table.tt td:has(> .tt-slot) { padding: 0; }
.tt-slot { display: block; width: 100%; min-height: 3rem; border: 0; background: none; padding: var(--space-xs); font: inherit; color: inherit; cursor: pointer; }
.tt-slot:hover, .tt-slot:focus-visible { background: var(--color-paper-2); }
table.tt td.tt-picked { box-shadow: inset 0 0 0 3px var(--color-ink); }
table.tt td.tt-target .tt-slot { background: var(--color-paper-2); }
.tt-advice { border: var(--rule-hair) solid var(--color-rule); border-radius: var(--radius-control); padding: var(--space-md); display: grid; gap: var(--space-sm); }
@media (max-width: 640px) { .tt-page .two { grid-template-columns: minmax(0, 1fr); } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 640px) { .three { grid-template-columns: minmax(0, 1fr); } }
#print-doc { display: none; }
@media print {
  html.printing-doc body > :not(#print-doc) { display: none !important; }
  html.printing-doc, html.printing-doc body { background: #fff !important; height: auto !important; overflow: visible !important; }
  html.printing-doc #print-doc { display: block; color: #000; font-size: 12pt; line-height: 1.6; }
  html.printing-doc #print-doc .table-wrap { overflow: visible; }
  html.printing-doc #print-doc table { width: 100%; border-collapse: collapse; break-inside: avoid; }
  html.printing-doc #print-doc th, html.printing-doc #print-doc td { border: 1px solid #666; padding: 4pt 6pt; color: #000; }
  html.printing-doc #print-doc h3 { text-align: center; font-size: 16pt; }
  html.printing-doc #print-doc h3, html.printing-doc #print-doc h4, html.printing-doc #print-doc h5 { break-after: avoid; color: #000; }
  html.printing-doc #print-doc hr { border: 0; border-top: 1px dashed #666; margin: 12pt 0; }
  .tt-page .no-print, .sidebar, .mobile-bar, #toast { display: none !important; }
  .tt-grid { break-inside: avoid; }
  table.tt td span { color: var(--color-ink); }
}

/* 筆記本: icon toolbar, colour panel, settings row, player, maths editor */
.nb-btn.icon { width: var(--control-h-s); padding: 0; justify-content: center; }
.nb-btn.icon svg { flex: none; }
.note-bar a.nb-btn { text-decoration: none; }
.note-props { border-bottom: var(--rule-hair) solid var(--color-rule); background: var(--color-paper-2); }
.note-props .note-group:last-child { margin-left: 0; }
.note-props .nb-btn[aria-pressed="true"] { background: var(--color-ink); border-color: var(--color-ink); color: var(--color-paper); }
.note-style-bold { font-weight: 800; }
.note-style-italic { font-style: italic; }
.note-style-underline { text-decoration: underline; }
.note-swatch.none::before { background: linear-gradient(135deg, transparent 45%, var(--color-error) 45% 55%, transparent 55%), var(--color-paper); }
.note-palette-wrap { position: relative; }
.note-current::before { width: 20px; height: 20px; }
.note-palette { position: absolute; top: calc(100% + var(--space-2xs)); left: 0; z-index: var(--z-dropdown); display: grid; grid-template-columns: repeat(6, 32px); gap: var(--space-2xs);
  padding: var(--space-xs); background: var(--color-paper); border: 0; border-radius: var(--radius-control); box-shadow: var(--shadow-card); }
.note-palette .note-swatch { width: 32px; }
.note-palette .note-swatch[aria-pressed="true"] { border-color: var(--color-ink); }
.note-palette-custom { grid-column: span 6; display: flex; align-items: center; gap: var(--space-xs); color: var(--color-ink-2); cursor: pointer; padding-top: var(--space-2xs); border-top: var(--rule-hair) solid var(--color-rule-2); }
.note-color { width: 32px; height: 32px; padding: 0; border: var(--rule-hair) solid var(--color-rule); border-radius: 8px; background: none; cursor: pointer; }
.note-rec.recording { border-color: var(--color-error); color: var(--color-error); width: auto; padding: 0 var(--space-xs); gap: var(--space-2xs); }
.note-rec-time { font-variant-numeric: tabular-nums; font-size: var(--text-xs); }
.note-busy:empty { display: none; }
.note-stage { position: relative; }
.note-stage.over .note-sheet { outline: 2px dashed var(--color-accent); outline-offset: 6px; }
.note-player { position: absolute; right: var(--space-md); bottom: var(--space-md); z-index: var(--z-raised); width: min(22rem, calc(100% - 2 * var(--space-md))); display: grid; gap: var(--space-xs);
  padding: var(--space-xs); background: var(--color-paper); border: 0; border-radius: var(--radius-card); box-shadow: var(--shadow-card); }
.note-player.video { width: min(32rem, calc(100% - 2 * var(--space-md))); }
.note-player audio, .note-player video { width: 100%; border-radius: 8px; }
.note-player-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-xs); font-size: var(--text-sm); font-weight: 600; color: var(--color-ink); }
.note-math { position: fixed; left: 50%; top: 12vh; transform: translateX(-50%); z-index: var(--z-dropdown); width: calc(100% - 2 * var(--space-md)); max-width: 40rem;
  display: grid; gap: var(--space-sm); padding: var(--space-md); background: var(--color-paper); border: 0; border-radius: var(--radius-card); box-shadow: var(--shadow-card); }
.note-math-head { display: flex; align-items: center; justify-content: space-between; color: var(--color-ink); }
.note-math-keys { display: flex; flex-wrap: wrap; gap: var(--space-2xs); }
.note-math-key { min-width: 40px; justify-content: center; padding: 0 var(--space-2xs); font-weight: 400; font-size: var(--text-md); }
.note-math-input { display: block; width: 100%; min-height: 3.5rem; font-size: var(--text-xl); padding: var(--space-xs); border: var(--rule-hair) solid var(--color-rule); border-radius: var(--radius-control); }
.note-math-field { min-height: 3.5rem; display: grid; place-items: center; border: var(--rule-hair) dashed var(--color-rule); border-radius: var(--radius-control); }
.note-math-tex { font-family: var(--font-outlier); font-size: var(--text-sm); }
.note-math-foot { display: flex; justify-content: flex-end; gap: var(--space-xs); }
.tt-page .row-gap select, .tt-page .row-gap input[type=date] { width: auto; }
.note-props { min-height: calc(var(--control-h-s) + 2 * var(--space-xs)); }
.note-hint { padding: 0 var(--space-2xs); line-height: 1.4; }
.note-hw { display: grid; gap: var(--space-xs); }
.note-hw-canvas { width: 100%; height: 180px; touch-action: none; cursor: crosshair; background: var(--note-paper); border: var(--rule-hair) solid var(--color-rule); border-radius: var(--radius-control); }
.note-chart-preview { width: 100%; height: auto; aspect-ratio: 560 / 300; border: var(--rule-hair) solid var(--color-rule-2); border-radius: var(--radius-control); }
.note-math .row-gap select { width: auto; }
.note-math .row-gap input { flex: 1; min-width: 10rem; }
.note-math { max-height: 84vh; overflow-y: auto; }

.tt-cal-ask input { flex: 1 1 18rem; min-width: 0; }
.tt-cal-ask { margin-top: var(--space-xs); }
.note-link-label { width: 9rem; min-height: var(--control-h-s); font-size: var(--text-sm); padding: 0 var(--space-xs); }
.note-props select { width: auto; min-height: var(--control-h-s); font-size: var(--text-sm); padding: 0 var(--space-xs); }
.note-props { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; height: calc(var(--control-h-s) + 2 * var(--space-xs) + var(--rule-hair)); }
.note-props::-webkit-scrollbar { display: none; }
.note-props .note-group { flex: none; }
.note-hint { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
table.tt th.tt-week2 { border-left: 3px solid var(--color-ink); }
.note-picker { position: relative; }
.note-picker::after { content: ""; position: absolute; right: 2px; bottom: 2px; border: 3px solid transparent; border-right-color: currentColor; border-bottom-color: currentColor; opacity: 0.6; }
.note-picker-pop { grid-template-columns: repeat(6, 36px); }
.note-picker-pop .nb-btn.icon { width: 36px; height: 36px; }
.note-picker-pop.labelled { grid-template-columns: repeat(2, minmax(9rem, auto)); }
.note-pick-row { justify-content: flex-start; gap: var(--space-xs); padding: 0 var(--space-xs); min-height: 40px; font-weight: 400; }
.note-picker-pop .nb-btn[aria-pressed="true"] { border-color: var(--color-ink); background: var(--color-paper-3); color: var(--color-ink); }
.note-props .note-palette-wrap .note-picker-pop { position: fixed; top: auto; left: auto; }
.note-group-inline { display: contents; }

/* 排時間表: steps, AI side panel, block grid, subject colours, overview */
.page.tt-page { max-width: 92rem; }
.tt-steps { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--space-2xs); border-bottom: var(--rule-hair) solid var(--color-ink); }
.tt-step { display: flex; align-items: center; gap: var(--space-xs); min-width: 0; padding: var(--space-xs) var(--space-sm); border: 0; border-bottom: 3px solid transparent; background: none; color: var(--color-ink-2); text-align: left; cursor: pointer; font: inherit; }
.tt-step:hover { background: var(--color-paper-2); }
.tt-step.on { border-bottom-color: var(--color-ink); color: var(--color-ink); background: var(--color-paper-2); }
.tt-step-n { flex: none; display: grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 999px; border: var(--rule-hair) solid var(--color-muted); font-size: var(--text-sm); font-weight: 700; font-variant-numeric: tabular-nums; }
.tt-step.on .tt-step-n { background: var(--color-ink); border-color: var(--color-ink); color: var(--color-paper); }
.tt-step.good .tt-step-n { background: var(--color-success); border-color: var(--color-success); color: var(--color-paper); }
.tt-step.warn .tt-step-n { background: var(--color-error); border-color: var(--color-error); color: var(--color-paper); }
.tt-step-text { display: grid; min-width: 0; }
.tt-step-text strong { font-size: var(--text-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tt-step-text small { font-size: var(--text-xs); color: var(--color-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tt-layout { display: grid; grid-template-columns: minmax(0, 1fr) 21rem; gap: var(--space-lg); align-items: start; }
.tt-main { min-width: 0; display: grid; gap: var(--space-lg); }
.tt-main > .sheet-part { border-top: 0; padding-top: 0; }
.tt-main > .sheet-part > h2:not(:first-child) { margin-top: var(--space-md); padding-top: var(--space-md); border-top: var(--rule-hair) solid var(--color-rule); }
.tt-main [hidden] { display: none !important; }
.tt-side { position: sticky; top: var(--space-md); max-height: calc(100vh - 2 * var(--space-md)); overflow-y: auto; }
details.tt-ai { display: grid; gap: var(--space-sm); padding: var(--space-md); border: var(--rule-hair) solid var(--color-rule); border-radius: var(--radius-card); background: var(--color-paper-2); }
details.tt-ai > summary { display: flex; align-items: center; gap: var(--space-xs); font-weight: 700; font-size: var(--text-lg); cursor: pointer; list-style: none; }
details.tt-ai > summary::-webkit-details-marker { display: none; }
details.tt-ai > summary::after { content: "收起"; margin-left: auto; font-size: var(--text-xs); font-weight: 400; color: var(--color-muted); }
details.tt-ai:not([open]) > summary::after { content: "展開"; }
details.tt-ai[open] > summary { margin-bottom: var(--space-sm); }
details.tt-ai > * + * { margin-top: var(--space-sm); }
details.tt-ai textarea { background: var(--color-paper); }
details.tt-ai .chip { white-space: normal; padding: var(--space-2xs) var(--space-sm); border-radius: 12px; font-size: var(--text-xs); min-height: 0; }
.tt-foot { display: flex; justify-content: space-between; gap: var(--space-sm); flex-wrap: wrap; margin-top: var(--space-md); padding-top: var(--space-md); border-top: var(--rule-hair) solid var(--color-rule); }
.tt-help { font-size: var(--text-sm); color: var(--color-ink-2); }
.tt-help summary { cursor: pointer; font-weight: 600; }
.tt-help ul { margin: var(--space-xs) 0 0; padding-left: 1.2rem; display: grid; gap: var(--space-2xs); }
.tt-input input.short { min-width: 4.5rem; }
.tt-input select { width: 100%; min-width: 7rem; }
.tt-mini { width: auto; min-width: min(100%, 32rem); }
.tt-mini td.center { text-align: center; }
.tt-mini input[type=checkbox] { width: 1.1rem; height: 1.1rem; min-width: 0; }
.tt-people-wrap { max-height: 32rem; overflow: auto; border: var(--rule-hair) solid var(--color-rule); border-radius: var(--radius-control); }
table.tt-people th[scope=row] { white-space: nowrap; font-weight: 600; }
table.tt-people td { vertical-align: middle; }
table.tt-people input.num { width: 5rem; }
.tt-page input[type=search] { width: auto; flex: 1 1 14rem; max-width: 22rem; }
table.tt-blockgrid { min-width: 0; width: auto; table-layout: auto; }
table.tt-blockgrid th, table.tt-blockgrid td { padding: 0; }
table.tt-blockgrid tbody th { width: auto; }
.tt-bhead { border: 0; background: none; font: inherit; font-weight: 600; color: inherit; cursor: pointer; padding: var(--space-xs) var(--space-sm); width: 100%; min-height: 2.4rem; white-space: nowrap; }
.tt-bhead:hover { background: var(--color-paper-3); }
.tt-bcell { display: block; width: 100%; min-width: 4.2rem; min-height: 2.4rem; border: 0; background: none; cursor: pointer; font: inherit; font-weight: 700; color: var(--color-paper); }
.tt-bcell:hover { background: var(--color-paper-3); }
td.tt-blocked .tt-bcell { background: var(--color-ink); }
td.tt-blocked .tt-bcell:hover { background: var(--color-ink-2); }
.tt-block-host { display: grid; gap: var(--space-sm); }
.tt-block-list { list-style: none; margin: var(--space-xs) 0 0; padding: 0; display: grid; gap: var(--space-2xs); font-size: var(--text-sm); }
.tt-block-list li { display: flex; align-items: center; gap: var(--space-2xs); flex-wrap: wrap; }
table.tt td.tt-lesson, table.tt td.tt-lesson .tt-slot { background: oklch(95.5% 0.045 var(--tt-h)); }
table.tt td.tt-lesson .tt-slot:hover, table.tt td.tt-lesson .tt-slot:focus-visible { background: oklch(91% 0.07 var(--tt-h)); }
table.tt td.tt-aim-free { box-shadow: inset 0 0 0 2px var(--color-success); }
table.tt td.tt-aim-busy { box-shadow: inset 0 0 0 2px oklch(70% 0.14 75); }
table.tt td.tt-aim-no { opacity: 0.4; }
table.tt td.tt-aim-no .tt-slot { cursor: not-allowed; }
.tt-key { display: inline-block; padding: 0 var(--space-xs); margin: 0 var(--space-2xs); border-radius: 6px; font-size: var(--text-xs); }
.tt-key.free { box-shadow: inset 0 0 0 2px var(--color-success); }
.tt-key.busy { box-shadow: inset 0 0 0 2px oklch(70% 0.14 75); }
.tt-key.no { opacity: 0.5; box-shadow: inset 0 0 0 1px var(--color-muted); }
.tt-picker select { width: auto; min-width: 12rem; }
.tt-picker .tt-next svg { transform: scaleX(-1); }
table.tt-over { table-layout: auto; min-width: 48rem; }
table.tt-over th[scope=row] { white-space: nowrap; width: auto; font-weight: 600; }
table.tt-over td, table.tt-over th { padding: var(--space-2xs) var(--space-xs); font-size: .78rem; }
table.tt-over .tt-brk { border-right: 3px solid var(--color-ink); }
.tt-run .tt-out { margin-top: 0; }
@media (max-width: 75rem) {
  .tt-layout { grid-template-columns: minmax(0, 1fr); }
  .tt-side { position: static; max-height: none; order: -1; }
}
@media (max-width: 60rem) {
  .tt-steps { display: flex; overflow-x: auto; scrollbar-width: none; }
  .tt-steps::-webkit-scrollbar { display: none; }
  .tt-step { flex: none; }
}
@media print {
  .page.tt-page { max-width: none; padding: 0; }
  .tt-layout { display: block; }
  table.tt td.tt-lesson, table.tt td.tt-lesson .tt-slot { background: none; }
  .tt-grid { break-after: page; }
}
.tt-main > .sheet-part, .tt-out { grid-template-columns: minmax(0, 1fr); }
.tt-grid { min-width: 0; }
.tt-main .section-head { flex-wrap: wrap; }
.tt-main .section-head h2 { white-space: nowrap; }
.tt-page .tt-input input { min-width: 4.2rem; padding-inline: var(--space-xs); }
.tt-page .tt-input input.num { min-width: 3.2rem; }
.tt-page .tt-input input::placeholder, table.tt-people input::placeholder { color: var(--color-muted); opacity: 0.7; }
.note-props .note-swatch { flex: none; width: 28px; }
.note-props .note-swatch[aria-pressed="true"] { background: var(--color-paper-3); border-color: var(--color-ink); }
.note-props input.note-color { flex: none; width: 32px; min-height: 0; height: var(--control-h-s); padding: 0; }
.note-props .note-group > .small { white-space: nowrap; }
/* 知識庫: tick boxes, the bar for ticked files, and the line showing where a dragged row will land */
.file-row.lib-row { grid-template-columns: auto auto minmax(0, 1fr) auto auto; }
.file-row.lib-row.picked { background: var(--color-paper-2); }
.row-pick, .pick-all input { width: 18px; height: 18px; min-height: 0; margin: 0; accent-color: var(--color-accent); cursor: pointer; }
.pick-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); flex-wrap: wrap; min-height: calc(var(--control-h-s) + var(--space-xs)); padding-bottom: var(--space-xs); border-bottom: var(--rule-hair) solid var(--color-rule); }
.pick-bar select { width: auto; min-height: var(--control-h-s); font-size: var(--text-sm); padding: 0 var(--space-xs); }
.pick-all { display: inline-flex; align-items: center; gap: var(--space-xs); font-size: var(--text-sm); color: var(--color-ink-2); cursor: pointer; }
.drop-before { box-shadow: inset 0 3px 0 var(--color-accent); }
.drop-after { box-shadow: inset 0 -3px 0 var(--color-accent); }
.folder.drop.drop-before, .folder.drop.drop-after, .folder-row.drop.drop-before, .folder-row.drop.drop-after { outline: 0; background: transparent; }
@media (max-width: 760px) {
  .file-row.lib-row { grid-template-columns: auto minmax(0, 1fr); }
  .file-row.lib-row > .row-end { grid-column: 1 / -1; justify-content: flex-end; }
}

/* ---------------------------------------------------------------- popup tutorial (tour.js) */
button.side-item { width: 100%; background: none; border: 0; text-align: left; cursor: pointer; font: inherit; font-size: var(--text-sm); }
.tour { position: fixed; inset: 0; z-index: var(--z-tooltip); }
.tour-block { position: absolute; inset: 0; }
.tour.centered .tour-block { background: var(--color-scrim); }
.tour-spot { position: fixed; border-radius: 10px; box-shadow: 0 0 0 9999px var(--color-scrim), 0 0 0 2px var(--color-accent); pointer-events: none;
  transition: top var(--dur-short) var(--ease-out), left var(--dur-short) var(--ease-out), width var(--dur-short) var(--ease-out), height var(--dur-short) var(--ease-out); }
.tour.centered .tour-spot { display: none; }
.tour-card { position: fixed; width: min(22rem, calc(100vw - 32px)); background: var(--color-paper); color: var(--color-ink-2); border-radius: var(--radius-card);
  box-shadow: var(--shadow-card); padding: var(--space-lg); display: grid; gap: var(--space-xs); outline: none;
  transition: top var(--dur-short) var(--ease-out), left var(--dur-short) var(--ease-out); }
.tour.centered .tour-card { top: 50%; left: 50%; transform: translate(-50%, -50%); }
.tour-card h2 { margin: 0; padding-right: var(--space-lg); font-size: var(--text-lg); color: var(--color-ink); }
.tour-card p { margin: 0; line-height: 1.6; }
.tour-x { position: absolute; top: var(--space-xs); right: var(--space-xs); }
.tour-extra:empty { display: none; }
.tour-extra { padding-top: var(--space-xs); }
.tour-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); margin-top: var(--space-sm); }
.tour-count { font-size: var(--text-sm); color: var(--color-muted); font-variant-numeric: tabular-nums; }
.tour-nav { display: flex; gap: var(--space-xs); }
.sample-links .row { grid-template-columns: minmax(0, 1fr); cursor: pointer; }

/* ================================================================ warm & friendly theme
   Cream paper, warm brown ink, a coral accent with sunny and leafy helpers, rounder shapes, soft cards, tinted tutor marks.
   Layered over the rules above so each component keeps its structure. Text sizes are all rem, so the text-size setting scales everything. */
:root {
  --font-display: "Nunito", "Noto Sans HK", "Noto Sans SC", ui-rounded, system-ui, sans-serif;
  --font-body: var(--font-display);
  --font-outlier: "IBM Plex Mono", "Noto Sans HK", ui-monospace, monospace;
  --display-weight: 800;
  --tracking-display: -0.005em;
  --color-paper: oklch(98.9% 0.011 85); --color-paper-2: oklch(96.6% 0.02 80); --color-paper-3: oklch(93.6% 0.03 78);
  --color-card: oklch(99.6% 0.005 85);
  --color-ink: oklch(27% 0.035 45); --color-ink-2: oklch(35% 0.03 45); --color-muted: oklch(49% 0.03 50);
  --color-rule: oklch(88.5% 0.028 75); --color-rule-2: oklch(93% 0.02 78);
  --color-accent: oklch(57% 0.16 38); --color-accent-ink: oklch(99.5% 0.008 60);
  --color-accent-soft: oklch(93.5% 0.045 55); --color-accent-soft-ink: oklch(38% 0.11 38);
  --color-sun: oklch(88% 0.12 88); --color-sun-soft: oklch(96% 0.05 92); --color-sun-ink: oklch(40% 0.08 75);
  --color-leaf: oklch(55% 0.12 160); --color-leaf-soft: oklch(94.5% 0.04 160); --color-leaf-ink: oklch(36% 0.08 160);
  --color-sky-soft: oklch(94.5% 0.035 235);
  --color-focus: oklch(57% 0.16 38);
  --color-scrim: oklch(25% 0.03 45 / 0.42);
  --radius-control: 14px; --radius-card: 22px;
  --control-h: 44px; --control-h-s: 34px;
  --shadow-soft: 0 1px 2px oklch(35% 0.05 50 / 0.06), 0 6px 18px oklch(35% 0.05 50 / 0.07);
  --shadow-lift: 0 2px 4px oklch(35% 0.05 50 / 0.08), 0 14px 30px oklch(35% 0.05 50 / 0.12);
  --shadow-card: 0 24px 48px oklch(30% 0.05 45 / 0.18);
  --note-paper: oklch(99.4% 0.006 85);
  --color-chart-bg: oklch(99.4% 0.006 85);
}
:root[lang="zh-Hans"] { --font-display: "Nunito", "Noto Sans SC", "Noto Sans HK", ui-rounded, system-ui, sans-serif; }
body { line-height: 1.65; }
h1, h2, h3 { letter-spacing: var(--tracking-display); }
h1 { line-height: 1.15; }
a:hover { color: var(--color-accent); }

/* controls */
.btn { border-radius: var(--radius-pill); padding: 0 var(--space-lg); background: var(--color-card); border-color: var(--color-rule); box-shadow: 0 1px 0 oklch(35% 0.05 50 / 0.06);
  font-size: var(--text-sm); transition: background-color var(--dur-micro) var(--ease-out), border-color var(--dur-micro) var(--ease-out), box-shadow var(--dur-micro) var(--ease-out), transform var(--dur-micro) var(--ease-out); }
.btn:hover { background: var(--color-paper-2); border-color: var(--color-accent); }
.btn.primary { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-accent-ink); box-shadow: 0 4px 12px oklch(57% 0.16 38 / 0.28); }
.btn.primary:hover { background: oklch(52% 0.16 38); border-color: oklch(52% 0.16 38); color: var(--color-accent-ink); transform: translateY(-1px); }
.btn.quiet { box-shadow: none; }
.btn.small { padding: 0 var(--space-md); }
.icon-btn { border-radius: 50%; }
.icon-btn:hover { background: var(--color-accent-soft); color: var(--color-accent-soft-ink); }
input:not([type=checkbox]):not([type=file]), select, textarea { background: var(--color-card); border-color: var(--color-rule); border-radius: var(--radius-control); }
input:not([type=checkbox]):not([type=file]):hover, select:hover, textarea:hover { border-color: oklch(80% 0.04 70); }
input[type=checkbox] { accent-color: var(--color-accent); }
.link { color: var(--color-accent-soft-ink); }
.tag { min-height: 24px; padding: 0 var(--space-sm); }
.tag.in { background: var(--color-leaf-soft); color: var(--color-leaf-ink); }
.tag.on { background: var(--color-accent); color: var(--color-accent-ink); }
.spinner { border-top-color: var(--color-accent); }

/* tutor marks take the tutor's colour */
.mark { box-shadow: none; border-radius: 14px; font-weight: 800; }
.mark.sm { border-radius: 10px; }
.mark.lg { border-radius: 18px; }
.tint-teal   { background: oklch(92% 0.05 190); color: oklch(36% 0.08 190); }
.tint-blue   { background: oklch(92% 0.045 245); color: oklch(38% 0.11 250); }
.tint-green  { background: oklch(92.5% 0.06 150); color: oklch(37% 0.09 150); }
.tint-amber  { background: oklch(93% 0.08 85); color: oklch(40% 0.08 70); }
.tint-orange { background: oklch(92.5% 0.06 55); color: oklch(42% 0.12 45); }
.tint-rose   { background: oklch(92.5% 0.045 10); color: oklch(42% 0.13 10); }
.tint-violet { background: oklch(92.5% 0.045 300); color: oklch(40% 0.12 300); }
.tint-slate  { background: oklch(92.5% 0.015 250); color: oklch(38% 0.03 250); }
.user-avatar { background: var(--color-sun-soft); color: var(--color-sun-ink); }

/* sign in: a warm welcome panel */
.login { background: var(--color-paper); }
.login-side { position: relative; overflow: hidden; border-right: 0;
  background: radial-gradient(120% 80% at 0% 100%, oklch(93% 0.06 60) 0%, transparent 60%), radial-gradient(90% 70% at 100% 0%, oklch(95% 0.06 95) 0%, transparent 55%), var(--color-paper-2); }
.login-side h1 { color: var(--color-ink); }
.notice { border-top: 0; display: grid; gap: var(--space-xs); }
.notice li { border: 0; background: var(--color-card); border-radius: var(--radius-control); padding: var(--space-sm) var(--space-md); box-shadow: var(--shadow-soft); align-items: center; }
.notice b { display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--color-accent-soft); color: var(--color-accent-soft-ink); }
.login-main { position: relative; }
.login-form { background: var(--color-card); padding: var(--space-xl) var(--space-lg); border-radius: var(--radius-card); box-shadow: var(--shadow-lift); width: min(26rem, 100%); }
.login-form .login-form { background: none; box-shadow: none; padding: 0; border-radius: 0; width: 100%; }
.login-display { position: absolute; top: var(--space-md); right: var(--space-md); }
.text-size-glyph { font-weight: 800; letter-spacing: -0.02em; } .text-size-glyph span { font-size: 1.3em; }
.signin-btn { border-radius: var(--radius-pill); background: var(--color-card); }
.signin-btn:hover { border-color: var(--color-accent); }
.signin-apple { background: var(--color-ink); border-color: var(--color-ink); color: var(--color-paper); }

/* shell; the sidebar scrolls as a whole when text is enlarged, so the tutor list is never squeezed out */
.sidebar { background: var(--color-paper-2); border-right: 0; box-shadow: inset -1px 0 0 var(--color-rule-2); overflow-y: auto; }
.side-scroll { flex: 1 0 auto; overflow: visible; }
.side-item { border-radius: var(--radius-pill); min-height: 40px; padding: 0 var(--space-sm); font-size: var(--text-sm); font-weight: 600; color: var(--color-ink-2); }
.side-item:hover { background: var(--color-paper-3); }
.side-item.active { background: var(--color-accent-soft); color: var(--color-accent-soft-ink); box-shadow: none; }
.side-item.active svg { color: var(--color-accent); }
.side-actions .side-item:first-child { background: var(--color-accent); color: var(--color-accent-ink); justify-content: center; margin-bottom: var(--space-xs); box-shadow: 0 4px 12px oklch(57% 0.16 38 / 0.25); }
.side-actions .side-item:first-child:hover { background: oklch(52% 0.16 38); }
.side-scroll .side-item { font-weight: 500; }
.side-group h3 { font-weight: 700; text-transform: none; }
.side-foot { border-top: 0; background: var(--color-card); border-radius: var(--radius-card); padding: var(--space-sm) var(--space-xs); box-shadow: var(--shadow-soft); gap: var(--space-3xs); }
.side-foot .side-item { min-height: 34px; font-weight: 600; }
.side-foot .usage { margin-top: var(--space-2xs); }
.side-badge { border-radius: var(--radius-pill); background: var(--color-sun-soft); color: var(--color-sun-ink); }
.meter { height: 8px; border-radius: 4px; background: var(--color-paper-3); }
.meter span { background: linear-gradient(90deg, var(--color-leaf), oklch(70% 0.14 120)); border-radius: 4px; }
.meter span.warn { background: var(--color-error); }
.main { background: var(--color-paper); }

/* pages: sections become soft cards */
.page { gap: var(--space-lg); }
.page-head h1 { font-size: var(--text-3xl); }
.page-head .lead { color: var(--color-muted); }
.ruled { border-top: 0; background: var(--color-card); border-radius: var(--radius-card); box-shadow: var(--shadow-soft); padding: var(--space-2xs) var(--space-lg); }
.ruled > .row:last-child, .ruled > .empty:last-child, .ruled > .file-row:last-child { border-bottom: 0; }
.row { border-bottom-color: var(--color-rule-2); padding: var(--space-sm) 0; }
a.row { border-radius: var(--radius-control); margin: 0 calc(-1 * var(--space-sm)); padding-inline: var(--space-sm); }
a.row:hover { background: var(--color-paper-2); }
.section-head h2 { font-size: var(--text-xl); }
.empty { border-bottom: 0; }
.intro-head { border-bottom: 0; padding-bottom: 0; }
.host-start { border-top: 0; background: var(--color-sun-soft); border-radius: var(--radius-card); padding: var(--space-lg); }
/* plans (billing) as soft cards too */
.plans { border-top: 0; gap: var(--space-md); }
.plan { background: var(--color-card); border-right: 0; border-radius: var(--radius-card); box-shadow: var(--shadow-soft); }
.plan.current { background: var(--color-sun-soft); box-shadow: 0 0 0 2px var(--color-sun), var(--shadow-soft); }
.plan li { border-bottom-color: var(--color-rule-2); }

/* chat */
.chat-head { border-bottom: 0; box-shadow: 0 1px 0 var(--color-rule-2); background: var(--color-paper); }
.msg.user .msg-body { background: var(--color-accent-soft); border: 0; color: var(--color-accent-soft-ink); border-radius: 20px 20px 6px 20px; padding: var(--space-sm) var(--space-md); }
.starter { border-radius: var(--radius-pill); background: var(--color-card); padding: var(--space-xs) var(--space-md); box-shadow: 0 1px 0 oklch(35% 0.05 50 / 0.06); }
.starter:hover { border-color: var(--color-accent); color: var(--color-accent-soft-ink); background: var(--color-accent-soft); }

/* dialogs, tour */
dialog.modal { border-radius: var(--radius-card); background: var(--color-card); }
.tour-card { background: var(--color-card); border-radius: var(--radius-card); }
.tour-spot { border-radius: 16px; box-shadow: 0 0 0 9999px var(--color-scrim), 0 0 0 3px var(--color-accent); }
.tour-count { color: var(--color-accent-soft-ink); font-weight: 700; }

/* language + text size dialog */
.display-settings { display: grid; gap: var(--space-md); }
.display-settings:not([open]) { display: none; }
.seg { display: flex; flex-wrap: wrap; gap: var(--space-2xs); background: var(--color-paper-2); padding: var(--space-2xs); border-radius: var(--radius-pill); }
.seg-btn { flex: 1 1 auto; min-height: 40px; padding: 0 var(--space-md); border: 0; border-radius: var(--radius-pill); background: transparent; color: var(--color-ink-2); font-weight: 700; cursor: pointer; }
.seg-btn:hover { background: var(--color-paper-3); }
.seg-btn[aria-checked="true"] { background: var(--color-card); color: var(--color-accent-soft-ink); box-shadow: var(--shadow-soft); }
.display-settings .field { display: grid; gap: var(--space-xs); }

@page { size: A4; margin: 2cm; }

/* ================================================================ public landing page (welcome.js) */
/* Plain on purpose: hierarchy comes from type, hairlines, spacing and the real screenshots,
   not from tinted panels, pill labels, shadowed cards or gradients. */
.welcome { min-height: 100vh; background: var(--color-paper); color: var(--color-ink-2); }
.wl-nav { position: sticky; top: 0; z-index: var(--z-sticky); display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm);
  padding: var(--space-sm) clamp(16px, 4vw, 48px); background: var(--color-paper); border-bottom: 1px solid var(--color-rule-2); }
.wl-nav-actions { display: flex; align-items: center; gap: var(--space-xs); }
.welcome main { max-width: 74rem; margin: 0 auto; padding: 0 clamp(16px, 4vw, 48px); display: grid; gap: clamp(64px, 9vw, 120px); padding-bottom: var(--space-2xl); }
.btn.big { min-height: 52px; padding: 0 var(--space-xl); font-size: var(--text-md); }
.wl-eyebrow { font-size: var(--text-sm); font-weight: 800; letter-spacing: 0.06em; color: var(--color-accent); }
.welcome h1 { line-height: 1.12; max-width: none; margin-top: var(--space-sm); }
.welcome .wl-hero h1 { font-size: clamp(2rem, 0.9rem + 2.5vw, 3.3rem); }
.welcome h1 em { font-style: normal; color: var(--color-accent); }
.welcome h2 { font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.4rem); line-height: 1.2; max-width: 22ch; }
.wl-line { display: inline-block; }   /* each phrase stays on one line; the break falls between them */
.wl-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: clamp(32px, 5vw, 64px); align-items: center; padding-top: clamp(32px, 6vw, 80px); }
.wl-lead { font-size: var(--text-lg); line-height: 1.7; margin-top: var(--space-md); max-width: 34rem; color: var(--color-ink-2); }
.wl-cta { display: flex; flex-wrap: wrap; gap: var(--space-sm); margin-top: var(--space-lg); }
.wl-facts { list-style: none; padding: var(--space-sm) 0 0; margin: var(--space-lg) 0 0; display: flex; flex-wrap: wrap; gap: var(--space-xs) var(--space-md); font-size: var(--text-sm); color: var(--color-muted); font-weight: 600; border-top: 1px solid var(--color-rule); }
.wl-facts li { display: inline-flex; align-items: center; gap: var(--space-2xs); }
.wl-facts svg { color: var(--color-muted); }
.wl-hero-visual { position: relative; padding-bottom: 8%; }
.wl-shot { margin: 0; border-radius: 8px; overflow: hidden; background: var(--color-paper); border: 1px solid var(--color-rule); }
.wl-shot img { width: 100%; height: auto; }
.wl-phone { margin: 0; width: 34%; max-width: 220px; border-radius: 24px; overflow: hidden; border: 5px solid var(--color-ink); background: var(--color-ink); }
.wl-phone img { width: 100%; height: auto; border-radius: 19px; }
.wl-hero-phone { position: absolute; right: -4%; bottom: 0; width: 30%; }
/* three steps: big numerals on one ruled line, no boxes */
.wl-how { display: grid; gap: var(--space-lg); }
.wl-steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-xl); border-top: 1px solid var(--color-rule); }
.wl-steps li { padding-top: var(--space-md); display: grid; gap: var(--space-xs); align-content: start; }
.wl-steps b { font-size: clamp(2.4rem, 1.8rem + 2vw, 3.4rem); font-weight: 800; line-height: 1; color: var(--color-accent); font-variant-numeric: tabular-nums; }
.wl-steps h3 { font-size: var(--text-lg); }
.wl-steps p { line-height: 1.7; }
.wl-feature { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: clamp(32px, 5vw, 64px); align-items: center; }
.wl-feature.flip .wl-feature-text { order: 2; }
.wl-feature-text { display: grid; gap: var(--space-sm); justify-items: start; }
.wl-body { font-size: var(--text-md); line-height: 1.75; max-width: 32rem; }
.wl-points { list-style: none; padding: 0; margin: var(--space-xs) 0 0; display: grid; width: 100%; max-width: 32rem; border-bottom: 1px solid var(--color-rule); }
.wl-points li { padding: var(--space-xs) 0; border-top: 1px solid var(--color-rule); font-weight: 600; color: var(--color-ink); }
.wl-duo { position: relative; padding-bottom: 6%; }
.wl-duo .wl-phone { position: absolute; right: -3%; bottom: 0; width: 26%; }
/* the other tools: a plain two-column index, name then what it does */
.wl-more { display: grid; gap: var(--space-lg); }
.wl-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--space-xl); border-top: 1px solid var(--color-rule); }
.wl-tool { display: grid; grid-template-columns: minmax(0, 11rem) minmax(0, 1fr); gap: var(--space-md); align-items: baseline; padding: var(--space-md) 0; border-bottom: 1px solid var(--color-rule); }
.wl-tool h3 { font-size: var(--text-md); }
.wl-tool p { line-height: 1.7; }
.wl-trust { display: grid; gap: var(--space-lg); }
.wl-trust-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-lg); border-top: 1px solid var(--color-rule); padding-top: var(--space-md); }
.wl-trust-grid h3 { font-size: var(--text-lg); margin-bottom: var(--space-2xs); }
.wl-trust-grid p { line-height: 1.7; }
.wl-final { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: var(--space-lg); padding: clamp(28px, 5vw, 56px); border-radius: 24px; background: var(--color-sun); color: var(--color-ink); }
.wl-final h2 { font-size: clamp(1.9rem, 1.2rem + 2.4vw, 3.2rem); max-width: none; }
.wl-final p { max-width: 36rem; font-size: var(--text-lg); margin-top: var(--space-sm); }
.wl-foot { max-width: 74rem; margin: 0 auto; padding: var(--space-lg) clamp(16px, 4vw, 48px) var(--space-2xl); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-sm); border-top: 1px solid var(--color-rule-2); }
.wordmark.small { font-size: var(--text-md); } .wordmark.small img { width: 28px; height: 28px; }
@media (max-width: 60rem) {
  .wl-hero, .wl-feature, .wl-final { grid-template-columns: minmax(0, 1fr); }
  .wl-final { justify-items: start; }
  .wl-feature.flip .wl-feature-text { order: 0; }
  .wl-steps, .wl-tools { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .wl-steps li { padding-bottom: var(--space-md); border-bottom: 1px solid var(--color-rule); }
  .wl-trust-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wl-hero-phone, .wl-duo .wl-phone { right: 0; }
}
@media (max-width: 40rem) {
  .wl-hide-s { display: none; }
  .wl-trust-grid { grid-template-columns: minmax(0, 1fr); }
  .wl-tool { grid-template-columns: minmax(0, 1fr); gap: var(--space-2xs); }
  .wl-nav .btn { padding: 0 var(--space-sm); }
}

/* inside the iOS / Android app (app-bridge.js): Google sign-in is blocked in app web views, and store rules forbid selling
   digital subscriptions outside their own billing, so those parts are hidden there. */
.in-app .signin-google, .in-app a[href="#/plans"], .in-app .plans, .in-app .plan-action, .in-app .plan-note { display: none !important; }
.in-app body { padding-top: env(safe-area-inset-top); }
.in-app .shell { height: calc(100dvh - env(safe-area-inset-top)); }

/* 帳戶 dialog and account deletion */
.btn.primary.danger-fill { background: var(--color-error); border-color: var(--color-error); }
.btn.primary.danger-fill:disabled { opacity: .45; }
.account-dialog .me { padding: var(--space-xs) 0 var(--space-sm); }
.account-dialog .danger-zone { margin-top: var(--space-sm); }

/* chat: pictures, YouTube previews, HTML5 activities */
.md-img { display: block; max-width: min(100%, 26rem); height: auto; border-radius: var(--radius-control); margin: var(--space-xs) 0; outline: var(--rule-hair) solid var(--color-rule); outline-offset: -1px; }
.yt { position: relative; width: min(100%, 30rem); aspect-ratio: 16 / 9; margin: var(--space-xs) 0; border-radius: var(--radius-control); overflow: hidden; background: var(--color-ink); }
.yt iframe, .yt-play, .yt-play img { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; padding: 0; }
.yt-play { cursor: pointer; background: none; }
.yt-play img { object-fit: cover; }
.yt-mark { position: absolute; left: 50%; top: 50%; translate: -50% -50%; width: 4rem; height: 2.75rem; display: grid; place-items: center; border-radius: var(--radius-control); background: oklch(55% 0.22 27); color: oklch(99% 0 0); font-size: 1.25rem; }
.h5 { border: var(--rule-hair) solid var(--color-rule); border-radius: var(--radius-card); margin: var(--space-xs) 0; overflow: hidden; background: var(--color-paper-2); }
.h5-head { display: flex; align-items: center; gap: var(--space-xs); padding: var(--space-xs) var(--space-sm); }
.h5-head strong { flex: 1; font-size: var(--text-sm); color: var(--color-ink); }
.h5-stage iframe { display: block; width: 100%; height: min(70vh, 34rem); border: 0; border-top: var(--rule-hair) solid var(--color-rule); background: oklch(100% 0 0); }
.h5-code { padding: 0 var(--space-sm) var(--space-xs); font-size: var(--text-sm); }
.h5-code summary { cursor: pointer; color: var(--color-muted); padding: var(--space-2xs) 0; }
.h5-code pre { max-height: 16rem; overflow: auto; }
/* class analytics */
.hbars { display: grid; gap: var(--space-xs); }
.hbar { display: grid; grid-template-columns: minmax(8rem, 16rem) minmax(4rem, 1fr) auto; align-items: center; gap: var(--space-sm); font-size: var(--text-sm); }
.hbar-name { color: var(--color-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: .75rem; background: var(--color-paper-2); border-radius: var(--radius-control); overflow: hidden; }
.hbar-track span { display: block; height: 100%; background: var(--color-accent); border-radius: inherit; }
.hbar-n { color: var(--color-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
td.heat { text-align: center; font-variant-numeric: tabular-nums; background: color-mix(in oklch, var(--color-accent-soft) calc(var(--heat, 0) * 100%), transparent); }
table.users th.num { text-align: center; white-space: normal; min-width: 5rem; }
.analysis-report:empty { display: none; }
.analysis-report { border: var(--rule-hair) solid var(--color-rule); border-radius: var(--radius-card); padding: var(--space-md); background: var(--color-paper-2); }
@media (max-width: 640px) { .hbar { grid-template-columns: 1fr; gap: var(--space-2xs); } }

/* ================================================================ the shared look of every list page
   A flat colour greeting on the home page; everywhere, plain lists (a bold colour tile, a quiet detail line, a chevron)
   grouped by spacing instead of sitting inside one big shadowed card. Status is quiet text, not a pill. */
.home-hello { background: var(--color-sun); color: var(--color-ink); border-radius: 24px; padding: clamp(24px, 4vw, 40px); align-items: center; }
.home-hello h1 { font-size: clamp(1.9rem, 1.4rem + 1.6vw, 2.7rem); max-width: none; }
.page-head.home-hello .lead { color: var(--color-ink-2); font-size: var(--text-lg); }
/* bold flat tiles for tutors, tools and classes */
.tint-teal, .tint-blue, .tint-green, .tint-orange, .tint-rose, .tint-violet, .tint-slate { color: oklch(99% 0.01 90); }
.tint-teal   { background: oklch(60% 0.105 195); }
.tint-blue   { background: oklch(56% 0.15 250); }
.tint-green  { background: oklch(60% 0.15 150); }
.tint-amber  { background: oklch(82% 0.15 85); color: oklch(30% 0.06 70); }
.tint-orange { background: oklch(66% 0.17 50); }
.tint-rose   { background: oklch(62% 0.17 15); }
.tint-violet { background: oklch(55% 0.15 300); }
.tint-slate  { background: oklch(46% 0.04 250); }
.ruled { background: none; box-shadow: none; border-radius: 0; padding: 0; }
.ruled > .row, .ruled > .row-wrap { margin-top: var(--space-2xs); }
.row { grid-template-columns: auto minmax(0, 1fr) auto auto; border-bottom: 0; }
a.row { padding: var(--space-xs); margin-inline: calc(-1 * var(--space-xs)); border-radius: 18px; }
.row-wrap > a.row { margin-right: 0; }
a.row::after { content: ""; width: 9px; height: 9px; margin-right: var(--space-xs); border-right: 2px solid var(--color-rule); border-top: 2px solid var(--color-rule); rotate: 45deg; }
a.row:hover::after { border-color: var(--color-accent); }
.row > .mark.md { width: 56px; height: 56px; border-radius: 16px; font-size: var(--text-xl); }
.row > .mark.md svg { width: 24px; height: 24px; }
.row > .row-text > .row-name { font-size: var(--text-lg); font-weight: 700; }
.row .tag { min-height: 0; padding: 0; background: none; box-shadow: none; border-radius: 0; font-size: var(--text-sm); color: var(--color-muted); }
.row .tag.in { color: var(--color-leaf-ink); }
.row .tag.err { color: var(--color-error); }
.row .tag + .tag::before { content: "•"; margin-right: var(--space-xs); color: var(--color-rule); }
.ruled > .empty { background: var(--color-paper-2); border-radius: 18px; padding: var(--space-md) var(--space-lg); margin-top: var(--space-xs); }
.ruled > .file-row { border-bottom: var(--rule-hair) solid var(--color-rule-2); }
@media (max-width: 40rem) {
  .row { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "m t c" "m e c"; column-gap: var(--space-sm); row-gap: 0; }
  .row > .mark { grid-area: m; } .row > .row-text { grid-area: t; } .row > .row-end { grid-area: e; justify-content: flex-start; }
  a.row::after { grid-area: c; }
  .row > .mark.md { width: 48px; height: 48px; }
  .row > .row-text > .row-desc { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .section-head { flex-wrap: wrap; row-gap: var(--space-2xs); }
  .section-head h2 { white-space: nowrap; }
}
@media (max-width: 60rem) {
  .folders { align-items: center; }
  .folders .fine { display: none; }   /* the drag hints don't apply on a phone, and stretched the folder strip */
}

/* tutor icon (uploaded or AI-drawn) */
.mark.has-icon { padding: 0; overflow: hidden; background: var(--color-paper-3); }
.mark.has-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
.icon-row { display: flex; align-items: center; gap: var(--space-md); }
.icon-show .mark.lg { width: 72px; height: 72px; }
.icon-tools { flex: 1; min-width: 0; display: grid; gap: var(--space-sm); }
.icon-tools .row-gap { flex-wrap: wrap; }
@media (max-width: 520px) { .icon-row { align-items: flex-start; } }

/* marks and comments for teaching tutors */
.score { font-variant-numeric: tabular-nums; white-space: nowrap; }
.score.lo { color: var(--color-danger, #b3261e); }
.score-chip { display: block; font-size: var(--text-xs, .75rem); color: var(--color-muted); }
table.evals td { vertical-align: top; }
.eval-cell { min-width: 16rem; max-width: 44rem; white-space: normal; }
.eval-comment > summary { cursor: pointer; color: var(--color-muted); }
.eval-comment[open] > summary { margin-bottom: var(--space-xs); }
.eval-criteria p { margin: var(--space-xs) 0; }
table.evals td:nth-child(2) strong, table.users td a.link strong { white-space: nowrap; }
table.evals td:nth-child(5), table.evals td:nth-child(6) { white-space: nowrap; }

/* 導師 dashboard: search, filters and groups */
.tutor-tools { display: grid; gap: var(--space-sm); margin-bottom: var(--space-sm); }
.tutor-tools input[type=search] { width: 100%; }
.tutor-picks { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.tutor-picks select { width: auto; max-width: 12rem; min-height: var(--control-h-s); font-size: var(--text-sm); }
.tutor-results { display: grid; gap: var(--space-xl); margin-bottom: var(--space-xl); }
.tutor-line { display: flex; align-items: center; }
.tutor-line .row-end { flex-wrap: wrap; row-gap: 0; }
@media (min-width: 761px) { .tutor-line .row-end { justify-content: flex-end; max-width: 22rem; } }
.side-more { color: var(--color-muted); font-size: var(--text-sm); }
@media (max-width: 640px) {
  .tutor-picks select { flex: 1 1 6.5rem; max-width: none; padding-inline: var(--space-xs); }
}
.more-link { display: inline-block; margin: var(--space-xs) 0 var(--space-sm); font-size: var(--text-sm); }

/* ================================================================ flat finish
   No glow under buttons, no gradients, no floating cards: surfaces are flat colour, a hairline, or nothing.
   (Dialogs, menus and the slide-in sidebar keep their shadow, because they really do sit above the page.) */
.btn { box-shadow: none; }
.btn.primary { box-shadow: none; }
.btn.primary:hover { transform: none; }
.login-side { background: var(--color-sun); }
.login-form { box-shadow: none; }
.notice li { box-shadow: none; background: var(--color-paper-2); }
.meter span { background: var(--color-leaf); }
.side-foot { box-shadow: none; background: none; border-radius: 0; border-top: var(--rule-hair) solid var(--color-rule); padding: var(--space-sm) 0 0; }
.plan { box-shadow: none; border: var(--rule-hair) solid var(--color-rule); }
.plan.current { background: var(--color-sun); border-color: var(--color-sun); box-shadow: none; }
.plan.current li { border-bottom-color: oklch(40% 0.08 75 / 0.25); }
.seg-btn[aria-checked="true"] { box-shadow: none; outline: var(--rule-hair) solid var(--color-rule); }

/* ---------- phones: cards and a bottom tab bar */
.tabbar, .note-ai-fold { display: none; }
.page { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 40rem) {
  .shell { grid-template-rows: minmax(0, 1fr) auto; }
  .tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); background: var(--color-card); box-shadow: 0 -1px 0 var(--color-rule-2), 0 -6px 18px oklch(35% 0.05 50 / 0.06);
    padding: var(--space-2xs) var(--space-2xs) calc(var(--space-2xs) + env(safe-area-inset-bottom)); }
  .tab-item { display: grid; justify-items: center; gap: 2px; padding: var(--space-2xs) 0; border: 0; background: none; border-radius: 14px; color: var(--color-muted); font: inherit; font-size: var(--text-xs); font-weight: 600; text-decoration: none; }
  .tab-item.active { color: var(--color-accent); background: var(--color-accent-soft); }
  .shell:has(.main-chat, .main-editor) .tabbar { display: none; }
  .shell:has(.main-chat, .main-editor) { grid-template-rows: minmax(0, 1fr); }
  .main > .mobile-bar:has(> :only-child) { display: none; }   /* the tab bar's 更多 opens the menu */
  .main { background: var(--color-paper-2); }
  .page { padding-top: var(--space-lg); gap: var(--space-md); }
  .page-head h1 { font-size: var(--text-2xl); }
  .page-head .lead { font-size: var(--text-sm); }
  .page-head-left { align-items: flex-start; }
  .page-head.home-hello { border-radius: var(--radius-card); }

  /* tutors: two cards a row, icon on top */
  .ruled:has(> a.row > .mark, > .tutor-line) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-xs); }
  .ruled:has(> a.row > .mark, > .tutor-line) > :not(a.row, .tutor-line) { grid-column: 1 / -1; }
  .ruled > a.row, .ruled > .row-wrap, .tutor-line > a.row { margin: 0; }
  .ruled > a.row:has(> .mark), .tutor-line { position: relative; background: var(--color-card); border-radius: 20px; box-shadow: var(--shadow-soft); }
  .ruled > a.row:has(> .mark), .tutor-line > a.row { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-2xs); padding: var(--space-sm); height: 100%; }
  .tutor-line { display: block; }
  .ruled > a.row:has(> .mark)::after, .tutor-line > a.row::after { display: none; }
  .ruled > a.row > .mark.md, .tutor-line .mark.md { width: 52px; height: 52px; margin-bottom: var(--space-2xs); }
  .ruled > a.row:has(> .mark) > .row-text > .row-name, .tutor-line > a.row > .row-text > .row-name { font-size: var(--text-md); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: normal; }
  .ruled > a.row:has(> .mark) .row-desc, .tutor-line .row-desc { font-size: var(--text-xs); line-height: 1.45; }
  .ruled > a.row:has(> .mark) .row-end, .tutor-line .row-end { margin-top: auto; flex-wrap: wrap; row-gap: 0; font-size: var(--text-xs); }
  .ruled > a.row:has(> .mark) .tag, .tutor-line .tag { font-size: var(--text-xs); }
  .tutor-line > .icon-btn { position: absolute; top: var(--space-2xs); right: var(--space-2xs); }
  .tutor-line > span.icon-btn { display: none; }

  /* other lists: one card a row */
  .ruled > a.row:not(:has(> .mark)), .ruled > .file-row, .ruled > .row-wrap:not(.tutor-line) { background: var(--color-card); border-radius: 18px; box-shadow: var(--shadow-soft); padding: var(--space-sm); border-bottom: 0; margin: 0 0 var(--space-xs); }
  .ruled > .empty { margin-top: 0; background: var(--color-card); box-shadow: var(--shadow-soft); }
  .join-form { width: 100%; }

  /* figures and the marks tables */
  .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .figure-well { background: var(--color-card); border: 0; box-shadow: var(--shadow-soft); padding: var(--space-sm) var(--space-md); }
  .figure-well strong { font-size: var(--text-2xl); }
  .section-head { flex-wrap: wrap; }
  .section-head > .row-gap { width: 100%; }
  table.evals, table.evals tbody { display: block; }
  table.evals thead { display: none; }
  table.evals tr { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--space-2xs) var(--space-sm); align-items: center; background: var(--color-card); border-radius: 18px; box-shadow: var(--shadow-soft); padding: var(--space-sm); margin-bottom: var(--space-xs); }
  table.evals td { display: block; border: 0; padding: 0; min-width: 0; }
  table.evals td.eval-cell, table.evals td[colspan] { grid-column: 1 / -1; }
  table.evals td:empty { display: none; }
  table.evals td:nth-child(5), table.evals td:nth-child(6) { white-space: normal; }

  /* notebook: tighter tools, AI helper folds away */
  .note-bar { gap: 3px; padding: var(--space-2xs) var(--space-xs); }
  .note-bar:not(.note-props) .note-group { display: contents; }
  .note-bar .nb-btn.icon { width: 34px; height: 34px; min-height: 34px; padding: 0; justify-content: center; }
  .note-bar select { max-width: 7.5rem; }
  .note-ai-fold { display: inline-grid; }
  .note-ai-head h2 { font-size: var(--text-md); }
  .note-ai { padding: var(--space-xs) var(--space-md); gap: var(--space-xs); }
  .note-ai.folded > :not(.note-ai-head) { display: none; }
  .note-ai.folded .segmented { display: none; }
  .note-ai.folded .note-ai-fold { margin-left: auto; }
  .note-ai:not(.folded) .note-ai-fold svg { rotate: 180deg; }
}

.tool-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); gap: .8rem; }
.tool-card { display: grid; align-content: start; gap: .55rem; padding: 1rem; border: 1px solid var(--color-rule); background: var(--color-card); border-radius: .9rem; text-decoration: none; color: inherit; }
.tool-card .tool-art { width: 6rem; max-width: 100%; height: auto; aspect-ratio: 1; object-fit: contain; border-radius: .7rem; }
.tool-card small { line-height: 1.5; }
@media (max-width: 600px) {
  .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tool-card { overflow-wrap: anywhere; }
  .editor .segmented { flex-wrap: wrap; }
}
@media (max-width: 600px) {
  .chat-title small { padding-block: .15rem; }
  .bar-labels small { min-width: 0; white-space: nowrap; }
  .bar-labels small:nth-child(even):not(:last-child), .bar-labels small:nth-last-child(2) { visibility: hidden; }
}
