/* Shared workspace contract. Loaded last; feature styles own diagrams and animation. */
:root {
  --space-1:4px; --space-2:8px; --space-3:12px; --space-4:16px;
  --space-6:24px; --space-8:32px;
  --radius-control:8px; --radius:12px; --radius-dialog:16px;
  --border:var(--color-border); --control-border:var(--color-border); --muted:var(--color-muted);
  --soft:var(--color-soft); --accent-soft:var(--color-soft); --accent-border:var(--color-border);
  --topbar-height:56px; --mobile-nav-height:calc(66px + env(safe-area-inset-bottom));
  --page-gutter:32px;
}
html {scroll-padding-block:24px calc(var(--mobile-nav-height) + 24px)}
.workspace main {max-width:1240px;padding:24px var(--page-gutter) 32px}
.topbar {height:var(--topbar-height);padding-inline:var(--page-gutter);border-bottom:1px solid var(--border)}
h1 {font-size:28px;letter-spacing:-.5px;overflow-wrap:anywhere}
.page-head {gap:16px;margin-bottom:24px}
.page-head>div,.page-head h1 {min-width:0}
.btn-row {gap:8px}
.btn,.btn.small,.icon-btn,.tiny-link,input,select,.tab {min-height:44px}
.btn,.btn.small {gap:8px;padding:8px 12px;border-radius:var(--radius-control);font-size:13px;border-color:var(--control-border)}
.btn.text {border-color:transparent}
.btn.primary {border-color:var(--primary)}
.btn,.icon-btn,a,input,select,textarea {transition:background-color .15s,border-color .15s,box-shadow .15s}
.icon-btn,.search-box,input,select,textarea,.source-option,.nav-tooltip {border-radius:var(--radius-control)}
input,select,textarea,.search-box {border-color:var(--control-border)}
input,select,textarea {font-size:14px}
select {appearance:none;height:44px;padding-right:32px;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23686b63' stroke-width='1.8'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 10px center}
input[type=checkbox],input[type=range] {min-height:0}
input[type=checkbox] {border-radius:4px}
.card,.course-card,.resume-panel,.agent-banner,.agent-hero,.material-document,.diagram-card,.task-document,.classroom-player {border-radius:var(--radius)}
.card,.course-card,.material-document,.diagram-card,.task-document,.classroom-player {border-color:var(--border)}
.pad,.course-card,.agent-banner,.agent-hero,.material-document {padding:24px}
.field {gap:8px;margin-bottom:16px}
.field-pair,.account-grid,.settings-grid,.form-grid,.detail-layout {gap:24px}
.field-pair {gap:16px}
.form-grid {grid-template-columns:minmax(0,1fr) 300px}
.form-grid>section {padding-right:0}
.source-options {grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin-bottom:16px}
.source-option:last-child:nth-child(odd) {grid-column:auto}
.source-option {margin-top:8px;padding:16px;gap:8px}
.recording-modes {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-bottom:16px}
.recording-modes .source-option {min-width:0;align-items:flex-start;text-align:left;padding:12px 16px;margin:0}
.recording-modes .source-option:last-child {grid-column:auto}
.recording-modes .source-option span {line-height:1.5}
.recording-explanation {flex:1;padding:24px;min-height:0;overflow:auto}
.recording-explanation h2 {margin-bottom:12px}
.recording-result {padding:24px;overflow:auto}
.recording-result h3,.recording-result p {margin-block:12px}
.recording-notes {margin-top:24px}
.source-hint {margin:0 0 16px}
.separator {margin-block:24px}
.notice {border:1px solid var(--border);border-radius:var(--radius-control);margin-bottom:16px;padding:12px 16px;overflow-wrap:anywhere}
.notice.error {border-color:var(--color-border)}
.home-minimal {padding-top:0}
.page-icon {margin-bottom:16px}
.page-icon .icon {width:32px;height:32px}
.home-section {margin-top:24px}
.agent-banner,.resume-panel {margin-bottom:24px}
.agent-hero h2 {font-size:26px;margin:8px 0 16px}
.agent-hero .btn-row {margin-top:16px}
.agent-steps {gap:24px;margin:24px 0}
.agent-steps p {margin-top:8px}
.account-identity {margin-bottom:24px}
.account-grid h2,.settings-grid h2 {margin-bottom:16px}
.section-title {gap:16px;margin-bottom:16px}
.toolbar {gap:8px;margin-bottom:24px}
.panel-head,.diagram-toolbar {padding:12px 16px;gap:12px}
.material-document>.section-title {margin-bottom:24px;padding-bottom:16px}
.analysis-section,.evidence,.markdown-body pre {border-radius:var(--radius-control)}
.tag,.keyterm,.timestamp {border-radius:4px}
.task-document {padding-inline:24px}
.classroom-player {margin-bottom:24px}
.lyrics-pane .segment .btn,.lyrics-pane .segment .timestamp,.playback-options select {min-height:44px}
.lyrics-pane .segment .btn-row {opacity:1}
.tabs {margin-bottom:24px}
dialog {border:1px solid var(--border);border-radius:var(--radius-dialog);max-height:calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom));overflow:hidden}
dialog[open] {display:flex;flex-direction:column}
.modal-head {flex:none;padding:12px 24px;gap:16px}
.modal-head h2 {min-width:0;overflow-wrap:anywhere}
.modal-body {min-height:0;overflow:auto;overscroll-behavior:contain;padding:24px;scroll-padding:16px}
.modal-actions {gap:8px;margin-top:24px}
#live-note-editor {margin-top:12px;min-height:160px;height:32dvh;max-height:42dvh}
#toast {border-radius:var(--radius-control)}
meter {appearance:none;accent-color:var(--color-muted);background:var(--color-soft);border-radius:4px}
meter::-webkit-meter-bar {background:var(--color-soft);border:1px solid var(--color-border);border-radius:4px}
meter::-webkit-meter-optimum-value,meter::-webkit-meter-suboptimum-value,meter::-webkit-meter-even-less-good-value {background:var(--color-muted);border-radius:4px}
meter::-moz-meter-bar {background:var(--color-muted)}
/* The live workspace reserves space for controls; only its transcript scrolls. */
.workspace .page-live {height:calc(100dvh - var(--topbar-height));display:flex;flex-direction:column;padding-block:16px;gap:16px}
.page-live>.page-head {margin:0;flex:none}
.page-live:has(>.notice) .live-orbit {display:none}
.page-live>.notice {flex:none;max-height:100px;overflow:auto;margin:0}
.page-live .live-layout {flex:1;min-height:0;grid-template-columns:minmax(0,1fr) 260px;gap:16px;align-items:stretch}
.live-layout>section.card {min-width:0;min-height:0;display:flex;flex-direction:column;overflow:hidden}
.live-layout .panel-head {flex:none;flex-wrap:nowrap}
.live-layout .panel-head h2 {min-width:0;font-size:15px}
.live-layout .panel-head h2 span {display:block;font-size:12px}
.live-layout .panel-head #latency-status:empty {display:none}
.live-orbit {flex:none;gap:16px;padding:12px 16px}
.nebula {width:80px;height:80px}
.nebula>span {inset:32px}
.live-orbit .sound-level {margin:4px 0;gap:2px}

.live-reading-controls {flex:none;gap:8px;padding:0 16px 8px}
.live-reading-controls .muted {font-size:12px}
.page-live .live-layout #live-transcript {flex:1;min-height:60px;height:auto;padding-inline:16px;overscroll-behavior:contain;scrollbar-width:thin}
.live-layout .segment {padding-block:16px}
.live-layout .segment .zh {font-size:18px;line-height:1.8}
.live-controls {position:static;flex:none;padding:12px 16px;gap:8px;background:var(--surface);flex-wrap:nowrap}
.live-controls>[data-action=end] {margin-left:auto}
.live-notes-button {display:none}
.live-layout>aside.card {display:flex;flex-direction:column;min-height:0;padding:16px;gap:16px}
.live-layout>aside h2 {font-size:16px}
.live-layout>aside .edit-area {flex:1;min-height:80px;resize:none}
.live-layout>aside .btn {flex:none}
@media(max-width:1100px) {
  :root {--page-gutter:24px}
  .form-grid {grid-template-columns:minmax(0,1fr) 280px}
}
@media(max-width:1000px) {
  .page-live .live-layout {grid-template-columns:minmax(0,1fr)}
  .live-layout>aside.card {display:none}
  .live-notes-button {display:inline-flex}
}
@media(max-width:700px) {
  :root {--page-gutter:16px;--topbar-height:52px}
  .workspace main {padding:16px var(--page-gutter) calc(var(--mobile-nav-height) + 24px)}
  h1 {font-size:24px;letter-spacing:-.3px}
  .page-head {gap:12px;margin-bottom:16px;align-items:flex-start}
  .page-head .btn-row {width:auto;justify-content:flex-end}
  .page-head .btn {padding-inline:10px}
  .pad,.course-card,.agent-banner,.agent-hero,.material-document {padding:16px}
  .form-grid,.account-grid,.settings-grid {grid-template-columns:minmax(0,1fr);gap:16px}
  .form-grid .field-pair {gap:12px}
  .form-grid>section>.field {margin-bottom:12px}
  .source-options {grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin-bottom:12px}
  .source-option:last-child:nth-child(odd) {grid-column:auto}
  .source-option {padding:12px 8px;gap:4px;margin-top:8px}
  .source-option b {font-size:12px;white-space:normal}
  .source-option.selected:after {top:8px;right:8px}
  .source-hint {font-size:12px;margin-bottom:12px}
  .agent-hero h2 {font-size:22px;margin-bottom:12px}
  .agent-steps {gap:12px;margin-block:16px}
  .agent-steps p {margin-top:4px}
  .agent-page>p {font-size:12px}
  .agent-banner {gap:16px;margin-bottom:24px}
  .agent-banner h2 {font-size:18px}
  .home-minimal>.page-icon {display:none}
  .material-document>.section-title {margin-bottom:16px}
  .task-document {padding-inline:16px}
  .modal-head {padding:12px 16px}
  .modal-body {padding:16px}
  input,select,textarea,.lyrics-pane .reading-toolbar select {font-size:16px}
  .search-box input {font-size:16px}
  .mobile-nav {min-height:var(--mobile-nav-height);padding:6px 12px calc(6px + env(safe-area-inset-bottom))}
  .mobile-nav a {min-height:54px;border-radius:var(--radius-control)}
  #toast {bottom:calc(var(--mobile-nav-height) + 16px)}
  .is-live .mobile-nav {display:none}
  .is-live~#toast,body:has(.is-live) #toast {bottom:calc(88px + env(safe-area-inset-bottom))}
  .workspace .page-live {padding:12px var(--page-gutter) calc(12px + env(safe-area-inset-bottom));gap:12px}
  .page-live h1 {font-size:20px}
  .page-live .page-head {align-items:center}
  .page-live .live-status {font-size:11px;justify-content:flex-end}
  .live-layout .panel-head {padding:8px 12px;gap:8px}
  .live-layout #latency-status {font-size:11px}
  .live-orbit {padding:8px 12px;gap:12px}
  .nebula {width:64px;height:64px}
  .nebula>span {inset:26px}
  .nebula-spin {inset:4px}
  .live-orbit h3 {font-size:14px}
  .live-orbit #live-update-status {font-size:11px}
  .live-orbit .sound-level span {min-height:18px;font-size:12px}
  
  .live-reading-controls {padding:0 12px 8px;gap:4px}
  .live-reading-controls>span {display:none}
  .page-live .live-layout #live-transcript {padding-inline:12px}
  .live-controls {display:grid;grid-template-columns:repeat(3,minmax(0,1fr)) minmax(92px,1.4fr);padding:8px 12px;gap:6px}
  .live-controls .btn {padding:8px 6px;gap:4px;min-width:0;font-size:12px}
  .live-controls .icon {width:16px;height:16px}
  .live-controls>[data-action=end] {margin:0}
}
/* A short landscape screen or on-screen keyboard must allow natural scrolling. */
@media(max-height:620px) {
  .workspace .page-live {height:auto;min-height:calc(100dvh - var(--topbar-height))}
  .page-live .live-layout {flex:none;min-height:0}
  .page-live .live-layout #live-transcript {height:180px;flex:none}
  .live-controls {position:sticky;bottom:0;z-index:6}
  .live-layout>section.card {overflow:visible}
  .live-orbit {padding-block:8px}
  
}
@media(prefers-reduced-motion:reduce) {
  .btn,.icon-btn,a,input,select,textarea {transition:none}
}
