/* v1.34: a compact workspace; home and setup retain their layout. */
[hidden]{display:none!important}
body.in-workspace{background:#f2f4ec}
.in-workspace>.top,.in-workspace>footer,.in-workspace>#save-status,.in-workspace>#sync-status{display:none}
.in-workspace main{max-width:none;margin:0;padding:0;min-height:0}
.workspace-shell{max-width:none;height:100dvh;height:var(--workspace-height,100dvh);margin:0;padding:8px max(12px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left));display:flex;flex-direction:column;gap:8px;position:relative;top:var(--workspace-offset,0px);font-size:18px;line-height:1.75;min-width:0}
.workspace-shell.large{font-size:20px}
.workspace-shell button,.workspace-shell summary{min-height:44px;font-size:14px;line-height:1.5}
.workspace-shell button{padding:8px 12px}
.workspace-shell button.primary{min-height:48px}
.workspace-shell :focus-visible{outline:3px solid #688b45;outline-offset:2px}
.workspace-toolbar{display:flex;align-items:center;gap:12px;min-height:48px;flex:none}
.workspace-navigation{display:flex;align-items:center;gap:12px;flex:1;min-width:0}
.workspace-context{font-size:16px;font-weight:600;white-space:nowrap}
.workspace-meta{display:flex;align-items:center;gap:4px;color:var(--muted);font-size:13px;min-width:0}
#workspace-word-count{white-space:nowrap;flex:none;font-variant-numeric:tabular-nums}
#workspace-word-count::after{content:" ·";padding-left:4px}
.workspace-navigation-actions{flex:none}
.workspace-shell .visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}
.workspace-toolbar .row{gap:6px;flex-wrap:nowrap}
#workspace-save{font-size:13px;font-weight:400;background:transparent;border-color:transparent}
#workspace-save.save-warning{background:#fff0d8;border-color:#ead3a5;color:#805023;font-weight:600}
.workspace-alerts{flex:none}
.workspace-alerts:empty{display:none}
.workspace-alerts p{margin:0;padding:6px 12px;display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.workspace-alerts:has(>[hidden]:only-child){display:none}
.workspace-shell .composition-layout{flex:1;min-height:0;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:12px;align-items:stretch}
.workspace-shell .conversation-column{min-width:0;min-height:0;display:flex;grid-row:auto}
.workspace-shell .conversation-panel{width:100%;display:flex;flex-direction:column;min-width:0;min-height:0;padding:0;overflow:hidden}
.workspace-shell .composition-paper{display:flex;flex-direction:column;min-width:0;min-height:0;padding:0;overflow:hidden;background:var(--paper);grid-row:auto;container-type:inline-size;container-name:composition}
.workspace-shell .panel{border-radius:16px}
.workspace-shell .conversation-heading,.workspace-shell .article-heading{margin:0;padding:10px 16px;min-height:64px;border-bottom:1px solid var(--line);flex:none;gap:8px}
.workspace-shell h2{font-size:21px;margin:0}
.workspace-shell .conversation-heading>.row{gap:6px}
.workspace-shell .chat{height:auto;flex:1;min-height:0;max-height:none;overflow:auto;overscroll-behavior:contain;overflow-anchor:none;padding:10px 16px;scrollbar-gutter:stable}
.workspace-shell .message{font-size:inherit;line-height:1.75;margin:14px 0;padding:12px 16px;max-width:96%;white-space:normal}
.workspace-shell .message.child{margin-left:auto;background:#eaf0df}
.workspace-shell .message p{white-space:pre-wrap}
.workspace-shell .message button{min-width:44px;min-height:44px;font-size:13px;padding:4px 10px}
.workspace-shell .chat-history{margin:8px 0;border:0;padding:0}
.workspace-shell .chat-history>summary{padding:10px 6px;color:var(--green);font-size:14px}
.workspace-shell .chat-history[data-current]{margin:0}
.workspace-shell .new-reply-line{flex:none;text-align:center;height:0;position:relative;z-index:2}
.workspace-shell .new-reply-line button{position:absolute;bottom:8px;left:50%;transform:translateX(-50%);white-space:nowrap;box-shadow:0 3px 12px #203e3022;background:#eaf3dc}
.workspace-shell .composer{flex:none;border-top:1px solid var(--line);padding:8px 16px;margin:0;max-height:65%;overflow:auto;overscroll-behavior:contain}
.workspace-shell .composer label{margin:0 0 5px;font-size:14px;line-height:1.5}
.workspace-shell .composer textarea{min-height:0;font-size:18px;line-height:1.75;padding:10px 12px;height:86px;max-height:180px;resize:none;display:block}
.workspace-shell.large .composer textarea{font-size:20px}
.workspace-shell .composer-actions{margin-top:8px;gap:8px}
.workspace-shell .composer-actions>button[type="submit"]{margin-left:auto}
.workspace-shell .composer small{font-size:12px;margin:0;line-height:1.6}
.workspace-shell .composer-context .help,.workspace-shell .composer-context .banner{margin:0 0 8px;padding:6px 10px}
.workspace-shell .composer-operation{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:6px}
.workspace-shell .composer-operation button{flex:none}
.workspace-shell .chat-focus{margin:0 0 8px;padding:0 8px;align-items:start;gap:8px;border-radius:8px}
.workspace-shell .chat-focus details{margin:0;flex:1;min-width:0}
.workspace-shell .chat-focus summary{padding:10px 0;font-size:13px}
.workspace-shell .chat-focus p{max-height:100px;overflow:auto;white-space:pre-wrap;margin:0 0 8px;font-size:15px}
.workspace-shell .chat-focus button{font-size:13px;min-height:44px}
#paper-save-warning{flex:none;margin:0;padding:6px 12px;font-size:14px}
.workspace-shell .paper-content{position:relative;display:flex;flex-direction:column;flex:1;min-height:0;min-width:0}
.workspace-shell .paper-update{position:absolute;bottom:8px;right:12px;z-index:3;display:flex;align-items:center;gap:6px;max-width:calc(100% - 24px);padding:4px 8px;background:#edf4e2;border:1px solid #c7d8b5;border-radius:10px;box-shadow:0 3px 12px #203e3015;font-size:13px;flex-wrap:wrap}
.workspace-shell .paper-update button{padding:4px 8px;font-size:13px;min-height:44px;background:transparent;border-color:transparent}
.workspace-shell .article-body{flex:1;min-height:0;max-height:none;overflow:auto;overscroll-behavior:contain;overflow-anchor:none;scrollbar-gutter:stable;padding:16px 28px 28px;mask-image:none}
.workspace-shell .article-body h1{font-size:25px;line-height:1.6;margin:4px 0 22px}
.workspace-shell .composition-paragraph{margin:12px -8px;padding:8px;line-height:1.8;scroll-margin-top:16px}
.workspace-shell .composition-paragraph>p{font-size:inherit;line-height:1.8}
.workspace-shell .composition-paragraph.is-active{box-shadow:inset 0 0 0 1px #98b67e}
.workspace-shell .composition-paragraph.selected{outline:1px dashed #6e8e5e}
.workspace-shell .composition-paragraph.is-reading{box-shadow:inset 4px 0 #6b8c39;background:#edf4df}
.workspace-shell .paragraph-tools{display:flex;gap:6px;flex-wrap:wrap;margin-top:10px;padding-top:8px;border-top:1px solid var(--line)}
.workspace-shell .paragraph-tools button{font-size:13px;min-height:44px;padding:6px 10px}
.workspace-shell .edit-hint{font-size:14px;color:var(--muted);background:var(--light);border-radius:8px;padding:10px 12px}
.workspace-shell .composition-editor{padding:14px}
.workspace-shell .composition-editor textarea{font-size:inherit;line-height:1.8;min-height:180px;max-height:55dvh;resize:vertical}
.workspace-shell .composition-editor button{font-size:14px;min-height:44px}
.workspace-shell .article-footer{flex:none;display:block;border-top:1px solid var(--line);padding:8px 12px;margin:0}
.workspace-shell .article-footer>.paper-actions{display:flex;flex-wrap:nowrap;gap:6px}
.workspace-shell .article-footer button{font-size:14px;min-height:48px;padding:8px 6px;min-width:0;flex:1}
.workspace-shell .paper-secondary-actions{display:contents}
.workspace-shell .paper-secondary-actions button{background:transparent;border-color:transparent;font-weight:500}
.workspace-shell .article-footer .paper-tools-toggle{display:none;background:transparent;border-color:transparent;font-weight:500}
.workspace-shell .finish-reason{font-size:12px;line-height:1.5;color:var(--muted);margin:4px 0 0}
.workspace-shell .finish-reason:empty{display:none}
.workspace-shell .paper-mobile-toolbar,.workspace-shell .mobile-paper-open{display:none}
@container composition (max-width:559px){
 .workspace-shell .paper-secondary-actions{display:none}
 .workspace-shell .article-footer .paper-tools-toggle{display:inline-flex}
 .workspace-shell .article-footer button{padding:8px 4px}
}
.workspace-speech{flex:none;display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:4px 12px;border:1px solid #c7d8b5;background:#edf4e2;border-radius:10px;font-size:14px}
.workspace-speech>span{flex:1;min-width:100px}
.workspace-speech button{font-size:13px}
.workspace-shell #workspace-tools{padding:0;max-width:760px;max-height:calc(var(--workspace-height,100dvh) - 32px);width:calc(100% - 32px);overflow:auto}
.workspace-shell .tools-heading{position:sticky;top:0;z-index:2;background:var(--paper);padding:12px 20px;border-bottom:1px solid var(--line)}
.workspace-shell .more-content{position:static;width:auto;max-height:none;overflow:visible;border:0;border-radius:0;box-shadow:none;padding:8px 20px 20px;font-size:16px}
#workspace-save-panel{padding:20px;font-size:16px}
.workspace-tool-content{padding:16px 20px 20px;font-size:16px;overflow-wrap:anywhere}
.workspace-tool-content>.row{margin:12px 0}
.workspace-tool-content>h3{margin-top:12px}
.workspace-shell .recent-change .row{gap:6px}
.workspace-shell #workspace-tools .conflict-panel{padding:12px}
.workspace-shell #workspace-tools .compare{grid-template-columns:1fr}
/* Speech shares the main composer; only status and optional tools sit below it. */
.workspace-shell .voice-inline-status{display:flex;align-items:center;gap:8px;flex-wrap:wrap;font-size:13px;color:var(--muted)}
.workspace-shell .voice-inline-status:empty{display:none}
.workspace-shell .voice-inline-status button,.workspace-shell .voice-tools button,.workspace-shell .voice-error button{min-height:44px;padding:4px 8px;font-size:13px}
.workspace-shell .voice-tools,.workspace-shell .voice-retained{margin:0;font-size:13px}
.workspace-shell .voice-tools>summary,.workspace-shell .voice-retained>summary{padding:6px 0;min-height:44px;font-weight:500}
.workspace-shell .voice-tools label{margin:4px 0;font-weight:400}
.workspace-shell .voice-tools audio{display:block;height:44px;margin:4px 0}
.workspace-shell .voice-retained p{white-space:pre-wrap;overflow-wrap:anywhere;max-height:120px;overflow:auto;margin:4px 0}
.workspace-shell .voice-error{color:#963e29;font-size:14px;margin:4px 0;overflow-wrap:anywhere}
.in-workspace .notice{bottom:max(12px,env(safe-area-inset-bottom));z-index:80;padding:12px 16px;max-height:60dvh;overflow:auto;display:flex;align-items:center;gap:12px;font-size:15px}
.in-workspace .notice button{flex:none;min-height:44px;font-size:14px}
@media(max-width:959px){
 .workspace-shell{padding:6px max(8px,env(safe-area-inset-right)) max(6px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left));gap:6px}
 .workspace-shell .composition-layout{grid-template-columns:minmax(0,1fr);gap:0}
 .workspace-shell .composition-paper{display:none}
 .workspace-shell .mobile-paper-open{display:inline-flex}
 .workspace-shell .paper-mobile-toolbar{display:flex;align-items:center;gap:6px;padding:4px 8px;flex:none;flex-wrap:wrap}
 .paper-mobile-toolbar .workspace-meta{flex:1;justify-content:flex-end}
 #paper-new-reply{font-size:12px;color:var(--green)}
 .workspace-shell .composition-paper.paper-open{display:flex;position:fixed;z-index:50;inset:var(--workspace-offset,0px) 0 auto;height:var(--workspace-height,100dvh);border-radius:0;padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);border:0}
 .workspace-toolbar{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:2px 6px}
 .workspace-navigation{grid-column:1 / -1;gap:8px}
 .workspace-context{flex:1}
 .workspace-navigation button,.workspace-navigation-actions button{padding:8px 6px;font-size:13px}
 .workspace-meta{font-size:12px}
 #workspace-save{min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;display:block;flex:1}
 .workspace-toolbar>button{padding:8px;font-size:14px}
 .workspace-toolbar>.row{gap:2px}
 #workspace-save{font-size:12px;padding:8px 4px}
 .workspace-shell .conversation-heading,.workspace-shell .article-heading{padding:8px 12px;min-height:60px}
 .workspace-shell h2{font-size:20px}
 .workspace-shell .conversation-heading>.row{gap:4px}
 .workspace-shell .conversation-heading button{font-size:13px;padding:8px}
 .workspace-shell .chat{padding:8px 12px}
 .workspace-shell .composer{padding:8px 12px}
 .workspace-shell .article-body{padding:14px 24px 24px}
 .workspace-shell .article-footer{padding:10px 12px 8px}
 .workspace-shell .article-footer button{font-size:14px;padding:8px 4px}
 .workspace-shell #workspace-tools{z-index:90}
}
/* At short heights/zoom, allow sequential scrolling. Never clip essential controls. */
.workspace-short .workspace-shell{height:auto;min-height:var(--workspace-height,100dvh);top:0}
.workspace-short .workspace-shell .composition-layout{flex:auto;min-height:0;align-items:start}
.workspace-short .workspace-shell .conversation-panel,.workspace-short .workspace-shell .composition-paper{overflow:visible}
.workspace-short .workspace-shell .chat{flex:none;min-height:180px;height:35dvh}
.workspace-short .workspace-shell .composer{max-height:none;overflow:visible}
.workspace-short .workspace-shell .paper-content{flex:auto}
.workspace-short .workspace-shell .article-body{min-height:180px;max-height:65dvh;flex:auto}
.workspace-short .workspace-shell .paper-open{overflow:auto;height:var(--workspace-height,100dvh)}
.workspace-short .workspace-shell .paper-open .article-body{flex:none;max-height:none;overflow:visible}
@media(prefers-reduced-motion:reduce){.workspace-shell *{scroll-behavior:auto!important;animation:none!important}}
/* Student work library and reading page share the existing paper / green palette. */
.works-intro{padding:40px 0 26px}.works-intro h1{font-size:36px;margin:8px 0}.works-intro>p{color:var(--muted)}.works-grid{grid-template-columns:repeat(auto-fill,minmax(270px,1fr))}.work-card h2{font-size:23px;line-height:1.5;overflow-wrap:anywhere}.home-secondary{margin:24px 0;gap:12px}.finished-work{max-width:850px;margin:auto}.reading-paper{background:var(--paper);border:1px solid var(--line);border-radius:22px;padding:clamp(24px,5vw,64px);margin:24px 0}.reading-paper h1{text-align:center;font-size:clamp(26px,4vw,36px);line-height:1.6;overflow-wrap:anywhere}.reading-paper .work-text{font-size:21px;line-height:2.1;overflow-wrap:anywhere}.reading-paper .work-text p{text-indent:2em}.finished-actions{justify-content:center}.topic-directions{font-size:16px;margin-top:12px}.topic-directions summary{cursor:pointer;color:var(--green)}#rename-form{max-width:520px}.setup h1{font-size:28px}#access-token{font-family:monospace}.work-card .tag{font-size:13px}.finished-work .panel{margin-top:24px}@media(max-width:600px){.works-intro{padding:20px 0}.works-intro h1{font-size:30px}.works-grid{grid-template-columns:1fr}.finished-actions>*{flex:1}.finished-work header{align-items:flex-start}.reading-paper{border-radius:16px}.reading-paper .work-text{font-size:20px}}

.field-voice-tools button{min-height:44px}
.field-voice-tools{display:flex;gap:8px;flex-wrap:wrap;align-items:center;margin:6px 0 10px;font-size:.9rem}
.field-voice-status{flex-basis:100%}.field-voice-status:empty{display:none}
.composer-context{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:6px;background:#f4f8f1;border-radius:8px}

.reading-review-heading{display:flex;align-items:center;justify-content:space-between;gap:12px}
.reading-review-heading>button{flex:none;min-height:44px}

/* Icons keep short labels; only live recording pulses. */
.ui-icon{width:22px;height:22px;flex:none;vertical-align:middle;pointer-events:none}
.ui-button-label{min-width:0}
button:has(>.ui-icon){min-height:44px;min-width:44px}
.voice-buttons{display:inline-flex;align-items:center;gap:6px;flex:none;white-space:nowrap}
.voice-buttons button{padding:7px 10px;min-height:44px}
.voice-phase{display:inline-flex;align-items:center;gap:5px;flex-wrap:wrap;font-size:13px;color:var(--muted);line-height:1.5}
.voice-phase.is-recording{color:var(--green)}
.voice-timer{font-variant-numeric:tabular-nums;white-space:nowrap}
.composer-actions .voice-phase{margin-left:auto}
.field-recording-actions{gap:8px}
.field-voice-status .field-recording-actions{margin:0}
[data-speech-state="loading"],[data-speech-state="playing"]{color:var(--green);background:var(--light)}
@media(prefers-reduced-motion:no-preference){
  .voice-phase.is-recording .ui-icon-mic{animation:recording-pulse 1.4s ease-in-out infinite}
  .voice-phase .ui-icon-spinner{animation:voice-working 1s linear infinite}
  @keyframes recording-pulse{0%,100%{opacity:1}50%{opacity:.45}}
  @keyframes voice-working{to{transform:rotate(360deg)}}
}
@media(max-width:400px){
  .workspace-shell .voice-buttons button{padding:7px 8px;font-size:15px}
  .workspace-shell .voice-phase{gap:4px;font-size:12px}
  .workspace-shell .voice-phase .ui-icon{width:20px;height:20px}
}
