:root {
  --paper: #faf9f6;
  --ink: #242723;
  --muted: #62655f;
  --rule: #cecec5;
  --serif: "Songti SC", "Noto Serif CJK SC", SimSun, serif;
  color: var(--ink);
  background: var(--paper);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body,h1,h2 { margin: 0; }
button,select,input,summary { font: inherit; color: inherit; }
button,summary,select { cursor: pointer; }
button,input,select { border: 0; border-radius: 0; background: transparent; }
:focus-visible { outline: 2px solid #43534c; outline-offset: 3px; }
button:hover,summary:hover,a:hover { text-decoration: underline; text-underline-offset: 4px; }
button:disabled { opacity: .5; }
svg { display: block; }
button svg { width: 19px; height: 19px; }
.shell { width: min(1250px, 90%); margin-inline: auto; }
.masthead,.nav-tools,.teacher-picker,.lecture-caption,.nameplate,.stage-tools,.chathead,.state,.mic,form { display: flex; align-items: center; }
.masthead { justify-content: space-between; min-height: 76px; border-bottom: 1px solid var(--ink); }
.wordmark { display: flex; gap: 10px; align-items: center; font-family: var(--serif); font-weight: 700; font-size: 19px; letter-spacing: .08em; }
.wordmark svg { width: 26px; height: 26px; }
.nav-tools { gap: 28px; font-size: 14px; }
.teacher-picker { gap: 6px; position: relative; }
.teacher-picker span { color: var(--muted); }
.teacher-picker select { appearance: none; padding: 10px 17px 10px 2px; min-height: 42px; }
.teacher-picker::after,summary::after { content: ""; width: 6px; height: 6px; border: solid currentColor; border-width: 0 1px 1px 0; transform: translateY(-2px) rotate(45deg); }
.teacher-picker::after { position: absolute; right: 2px; pointer-events: none; }
details { position: relative; }
summary { min-height: 42px; list-style: none; display: flex; align-items: center; gap: 8px; font-size: 14px; }
summary::-webkit-details-marker { display: none; }
details[open]>summary::after { transform: translateY(2px) rotate(225deg); }
.material-links,.stage-options { position: absolute; z-index: 4; right: 0; min-width: 128px; padding: 4px 0; background: var(--paper); border-block: 1px solid var(--ink); }
.material-links { top: 100%; }
.stage-options { bottom: 100%; }
.material-links a,.stage-options button { display: block; width: 100%; padding: 10px 12px; font-size: 14px; text-decoration: none; color: var(--ink); text-align: left; white-space: nowrap; }
.material-links a:hover,.stage-options button:hover,.stage-options button[aria-pressed=true] { text-decoration: underline; text-underline-offset: 4px; }
.layout { display: grid; grid-template-columns: minmax(0,1.4fr) minmax(290px,1fr); gap: clamp(32px,6vw,95px); padding-block: clamp(24px,4vh,48px) 22px; }
.lecture,.chat { min-width: 0; display: flex; flex-direction: column; height: clamp(440px, calc(100svh - 146px), 770px); }
h1,h2,.nameplate strong { font-family: var(--serif); }
h1 { font-size: clamp(32px,3.8vw,58px); letter-spacing: .025em; font-weight: 600; line-height: 1.22; }
.stage { position: relative; flex: 1; min-height: 0; isolation: isolate; }
.stage canvas,#poster { position: absolute; inset: 0; width: 100%; height: 100%; }
#poster { object-fit: contain; }
#teacher,#bones { visibility: hidden; }
.stage.loaded #teacher,.stage.loaded.show-bones #bones { visibility: visible; }
.stage.loaded #poster { visibility: hidden; }
#teacher { cursor: grab; touch-action: pan-y; }
#teacher:active { cursor: grabbing; }
#bones { pointer-events: none; }
.lecture-caption { min-height: 54px; justify-content: space-between; gap: 8px; border-top: 1px solid var(--rule); }
.nameplate { gap: 16px; }
.nameplate strong { font-size: 21px; }
.state { font-size: 13px; gap: 6px; color: var(--muted); }
.state i { width: 5px; height: 5px; border: 1px solid currentColor; border-radius: 50%; }
.lecture:has(.stage[data-mode="speaking"]) .state i,.lecture:has(.stage[data-mode="listening"]) .state i { background: currentColor; }
.stage-tools { gap: 12px; }
.lecture:has(.stage:not(.loaded)) .view-controls { display: none; }
.round,#reset,#send { width: 42px; height: 42px; display: grid; place-items: center; }
.round:hover svg,#reset:hover svg,#send:hover svg { stroke-width: 2.2; }
.chat { padding-top: 8px; }
.chathead { justify-content: space-between; border-bottom: 1px solid var(--rule); padding-bottom: 10px; }
h2 { font-size: clamp(24px,2.1vw,33px); font-weight: 550; letter-spacing: .06em; }
.history { flex: 1; min-height: 70px; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: 16px 2px 4px; }
.msg { margin-bottom: 22px; }
.who { font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.bubble { font-size: 17px; line-height: 1.85; overflow-wrap: anywhere; }
.you { margin-left: 12%; text-align: right; }
.you .bubble { font-weight: 550; }
.starter { padding-bottom: 12px; }
#prompts { display: flex; flex-wrap: wrap; gap: 0 17px; }
#prompts button { min-height: 38px; font-size: 14px; color: var(--muted); padding: 4px 0; text-decoration: underline; text-decoration-color: #aaa99e; text-underline-offset: 5px; }
.composer { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 0 12px; padding: 3px 0; border-block: 1px solid var(--ink); }
#notice { grid-column: 1/-1; font-size: 14px; line-height: 1.5; }
#notice:not(:empty) { padding-top: 7px; }
form { min-width: 0; }
input { min-width: 0; flex: 1; width: 100%; padding: 12px 0; font-size: 16px; }
input::placeholder { color: #72736b; }
.mic { min-height: 42px; padding: 0 0 0 12px; gap: 6px; position: relative; white-space: nowrap; font-size: 14px; }
.mic::before { content: ""; width: 1px; height: 16px; position: absolute; left: 0; background: var(--rule); }
.mic.active { font-weight: 650; text-decoration: underline; }
@media (max-width: 720px) {
  .shell { width: calc(100% - 36px); }
  .masthead { min-height: 53px; }
  .wordmark { font-size: 17px; gap: 6px; }
  .wordmark svg { width: 22px; }
  .nav-tools { gap: 16px; }
  .teacher-picker span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .layout { grid-template-columns: minmax(0,1fr); gap: 18px; padding-block: 17px 22px; }
  h1 { font-size: clamp(28px,6.4vw,35px); }
  .lecture { height: auto; }
  .stage { flex: none; height: clamp(205px,31svh,340px); }
  .lecture-caption { min-height: 43px; }
  .nameplate { gap: 11px; }
  .nameplate strong { font-size: 18px; }
  .stage-tools { gap: 5px; }
  .chat { height: clamp(245px,35svh,380px); padding: 0; }
  .chathead { padding: 0; }
  h2 { font-size: 23px; }
  .history { padding-top: 9px; }
  .bubble { font-size: 16px; line-height: 1.65; }
  .starter { padding-bottom: 3px; }
}
