/* Workspace layout: support tools stay available without displacing the tree. */
:root { --sub:#566452; }
.header { height:72px; }
main { padding-top:20px; }
.intro { margin-bottom:16px; }
.intro .eyebrow { display:none; }
h1 { font-size:clamp(23px,2vw,30px); letter-spacing:-.6px; }
.intro-note { max-width:230px; font-size:12px; }
.workspace-tabs { display:flex; gap:8px; margin-bottom:16px; border-bottom:1px solid var(--line); }
.workspace-tabs button { padding:12px 18px; min-height:44px; background:transparent; border:0; border-bottom:3px solid transparent; color:var(--sub); font-size:14px; }
.workspace-tabs button[aria-selected=true] { color:var(--green); border-color:var(--green); font-weight:650; }
.composer { padding:16px 20px; margin-bottom:12px; }
.input-mode { margin-bottom:12px; }
#parse-form { gap:16px; }
#parse-form label { font-size:10px; letter-spacing:1px; margin-bottom:6px; }
#parse-form .system-field { width:205px; }
#parse-form .grammar-field { width:180px; }
#parse-form select { font-size:13px; min-height:32px; }
#sentence { display:block; width:100%; resize:none; line-height:1.4; min-height:36px; max-height:180px; padding:2px 0; }
#sentence-hint { display:block; margin-top:4px; font-size:11px; color:var(--sub); }
#ai-controls { display:flex; flex-wrap:wrap; align-items:center; gap:8px 14px; padding:8px 12px; margin-top:12px; line-height:1.4; }
#method-title { font-size:12px; }
.assistance-switches { display:flex; gap:8px; flex-wrap:wrap; margin:0; }
.assistance-card { align-items:center; gap:8px; padding:8px 10px; min-height:44px; }
.assistance-card input[type=checkbox] { margin:0; }
.assistance-card-heading { gap:8px; }
.assistance-card-heading strong { font-size:13px; }
.assistance-state { font-size:10px; }
#assistance-hint { font-size:12px; color:var(--sub); }
.experimental-control { display:flex; align-items:center; gap:8px; flex-wrap:wrap; min-height:44px; padding:8px 10px; border:1px solid #b8a676; border-radius:6px; background:#fffdf5; font-size:13px; cursor:pointer; }
.experimental-control.enabled { background:#fff1c9; border-color:#8b6d2a; }
.experimental-control input { width:20px; height:20px; accent-color:#8b6d2a; }
#ai-controls .experimental-help { flex-basis:100%; font-size:12px; line-height:1.5; margin:0; color:var(--sub); }
.experimental-report { padding:14px 16px; background:#fff8e4; border-bottom:1px solid #b8a676; }
.experimental-report h3 { font-size:16px; margin:0 0 8px; }
.experimental-report p, .experimental-report summary { font-size:13px; line-height:1.5; }
.experimental-report pre { white-space:pre-wrap; overflow-wrap:anywhere; font:12px/1.5 var(--mono); padding:12px; background:#fffdf5; max-height:360px; overflow:auto; }
.experimental-attempt { margin-top:10px; }
.experimental-attempt > summary { min-height:36px; padding:8px 0; color:#6d511e; }
.personal-controls { display:flex; gap:8px 12px; align-items:center; flex-wrap:wrap; font-size:12px; }
.personal-controls select { max-width:100%; min-height:36px; font-size:12px; }
.personal-controls label { display:flex; gap:6px; align-items:center; }
.personal-controls input { width:20px; height:20px; }
.personal-controls > span { color:var(--sub); }
.grammar-workshop { width:min(900px,94vw); max-width:94vw; max-height:90vh; overflow:auto; padding:24px; border:1px solid var(--line); border-radius:10px; background:var(--bg,#f7f8f4); }
.grammar-workshop h2 { padding-right:40px; }
.grammar-workshop p, .grammar-workshop summary { font-size:13px; line-height:1.55; }
.grammar-workshop label { display:block; font-size:12px; margin:10px 0; }
.grammar-workshop input, .grammar-workshop textarea, .grammar-workshop select { width:100%; min-height:36px; padding:8px; border:1px solid var(--line); background:white; border-radius:4px; font:13px/1.5 var(--mono); }
.grammar-workshop textarea { resize:vertical; }
.grammar-workshop details { margin:14px 0; }
.grammar-workshop summary { padding:8px 0; }
.pack-card { min-width:0; border:1px solid var(--line); padding:12px; margin:12px 0; }
.pack-card legend { padding:0 5px; font-size:13px; }
.workshop-actions { display:flex; flex-wrap:wrap; gap:10px 16px; align-items:center; }
.grammar-workshop .primary { padding:12px; }
.grammar-workshop pre { white-space:pre-wrap; overflow-wrap:anywhere; font-size:12px; }
#assistance-info { font-size:12px; }
#assistance-info[open] { flex-basis:100%; }
.assistance-explanation { padding:8px 0; max-width:100ch; }
#ai-controls .text-button { min-height:36px; }
summary { cursor:pointer; }
summary:focus-visible { outline:3px solid #8ead82; outline-offset:3px; }
.parse-options { font-size:12px; margin-top:10px; }
.parse-options > summary { padding:6px 0; color:var(--green); }
.parse-options .scope-control, .parse-options .analysis-settings { margin:8px 0; }
.examples { margin-top:8px; padding-top:8px; gap:10px; }
#examples { gap:6px; }
#examples button { font-size:12px; min-height:32px; }
#all-examples { flex-shrink:0; min-height:36px; }
.fragment-context { font-size:12px; }
.method-result { display:flex; align-items:center; flex-wrap:wrap; gap:4px 16px; padding:7px 12px; margin-bottom:12px; font-size:12px; }
.method-result .method-usage { margin:0; }
.method-result details[open] { flex-basis:100%; }
.method-result details > strong { display:block; margin-top:8px; }
.method-usage .badge { font-size:11px; }
.bench-header { padding:10px 16px; }
.bench-header h2 { font-size:16px; }
.section-number { display:none; }
.bench-actions button, .semantics-heading .text-button { font-size:12px; }
.bench-actions { flex-wrap:wrap; gap:8px 12px; }
.view-button { border:1px solid var(--green); border-radius:5px; padding:8px 12px; min-height:40px; color:var(--green); background:#f5f8ef; font-weight:600; }
.view-button:hover:not(:disabled) { background:#e7efdf; }
.replay-actions { display:flex; flex-wrap:wrap; align-items:center; gap:6px 16px; }
.focus-context { padding:10px 16px; border-bottom:1px solid var(--line); background:#f5f8ef; }
.focus-context p { margin:4px 0; font-size:12px; line-height:1.5; overflow-wrap:anywhere; }
#focus-sentence { font:18px/1.4 var(--serif); max-height:5.6em; overflow:auto; }
#focus-grammar, #focus-usage { color:var(--sub); }
#focus-paragraph { display:flex; align-items:center; gap:10px; font-size:12px; }
#focus-sentence-select { min-height:40px; max-width:100%; }
.derivation-focused { overflow:hidden; }
.derivation-focused > .header, .derivation-focused main > :not(#parse-workspace),
.derivation-focused #parse-workspace > :not(.workbench) { display:none; }
.derivation-focused .workbench { position:fixed; inset:0; z-index:30; margin:0; border:0; border-radius:0; width:100%; height:100dvh; overflow:auto; background:var(--paper); }
.derivation-focused .bench-header { position:sticky; top:0; z-index:5; background:var(--paper); box-shadow:0 1px 0 var(--line); }
.derivation-focused .playback { position:sticky; bottom:0; z-index:4; background:var(--paper); box-shadow:0 -2px 8px #233c2015; }
.derivation-focused .word-tokens { max-height:80px; overflow:auto; }
.derivation-focused .tree-stage { height:clamp(280px,36vh,520px); }
.derivation-focused .playback-status { margin:0; border:0; border-bottom:1px solid var(--line); border-radius:0; }
.derivation-focused .inspector-drawer { align-self:start; position:sticky; top:70px; max-height:calc(100dvh - 80px); overflow:auto; }
.derivation-focused #trace-panel { max-height:calc(100dvh - 150px); }
.readings-panel, .playback-status { padding:8px 16px; }
.playback-status p { font-size:12px; }
.tree-toolbar { padding:8px 12px; height:auto; min-height:56px; gap:8px; flex-wrap:wrap; }
.segmented button { min-height:36px; font-size:12px; color:#53634d; }
#frame-label { font-size:12px; }
.zoom-controls { margin-left:auto; flex-wrap:wrap; gap:4px; }
.zoom-controls button, .zoom-controls #fit { min-width:36px; min-height:36px; color:var(--green); font-size:13px; }
.follow-control { display:flex; align-items:center; gap:5px; font-size:12px; min-height:36px; cursor:pointer; }
.follow-control input { accent-color:var(--green); width:18px; height:18px; }
.playback-explanation { display:flex; justify-content:space-between; flex-wrap:wrap; gap:4px 12px; padding:8px 16px; font-size:12px; }
.playback-explanation details[open] { flex-basis:100%; }
.playback-explanation summary { color:var(--sub); }
.playback-explanation p { font-size:12px; }
.operation-detail { padding:10px 16px; }
#operation-rule, .rule-kind { font-size:11px; }
.tree-stage { height:clamp(340px,43vh,500px); }
.transport { gap:8px; }
.transport button { min-width:36px; min-height:36px; }
.transport select { min-height:36px; }
.semantics-panel { padding:14px 16px; }
.semantics-body { grid-template-columns:minmax(0,1fr); gap:10px; margin-top:10px; }
#semantics { font-size:13px; padding:12px; min-height:60px; }
.semantics-note { padding:0; border:0; }
.semantics-note p { font-size:12px; }
.inspector-drawer { min-width:0; background:#fdfefb; border-left:1px solid var(--line); }
.inspector-drawer > summary { display:none; }
.inspector { border:0; }
.inspector-tabs button { font-size:12px; }
#action-list button, .program-line, .program-check { font-size:12px; }
.action-word, .action-rule { font-size:10px; color:#566452; }
.trace-note { font-size:12px; color:#566452; }
#trace-panel { max-height:670px; }
.result-evidence { border:1px solid var(--line); border-radius:8px; background:white; margin-top:14px; }
.result-evidence > summary { padding:14px 16px; color:var(--green); font-weight:550; }
#inspect-failure { margin-left:12px; min-height:36px; }
.result-evidence .diagnostics, .result-evidence .lexical-report { margin:0; border:0; border-radius:0; border-top:1px solid var(--line); }
.lexical-word-group { padding:10px 0; border-top:1px solid var(--line); }
.lexical-word-group > summary { font-size:14px; font-weight:550; }
.lexical-word-group .lexical-entry { margin-left:16px; font-size:12px; }
.lexical-entry summary .badge { margin-right:8px; }
.models-dialog { position:fixed; inset:0 0 0 auto; margin:0; width:min(620px,96vw); max-width:96vw; height:100dvh; max-height:100dvh; border:0; border-left:1px solid var(--line); padding:20px 24px; background:var(--paper); }
.models-dialog::backdrop { background:#162d2260; }
.models-dialog-header { display:flex; align-items:center; justify-content:space-between; gap:12px; position:sticky; top:-20px; background:var(--paper); padding:8px 0; z-index:1; }
.models-dialog-header h2 { font-size:20px; }
.models-dialog .lexical-settings { border:0; margin:0; padding:8px 0; }
.models-dialog .lexical-settings > summary { display:none; }
.models-dialog .openrouter-form { flex-wrap:wrap; }
.models-dialog .openrouter-form > label { flex-basis:100%; }
.models-dialog button { min-height:44px; }
.models-dialog select, .models-dialog input { font-size:16px; }
.models-dialog #openrouter-connect { padding:10px 20px; }
#research, #greek-lab, .library-panel { margin-top:0; padding-top:12px; }
.library-panel h2 { font:28px var(--serif); }
.library-panel > p { line-height:1.65; max-width:100ch; }
.library-filters { display:grid; grid-template-columns:2fr 1fr 1fr; gap:16px; margin:20px 0; }
.library-filters label { display:flex; flex-direction:column; gap:8px; font-size:13px; }
.library-filters input, .library-filters select { width:100%; min-height:44px; padding:10px; border:1px solid var(--line); background:white; border-radius:5px; font-size:14px; }
#library-results { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
.library-card { background:white; border:1px solid var(--line); padding:18px; border-radius:8px; }
.library-card h3 { font:20px/1.3 var(--serif); margin:8px 0; }
.library-card p { font-size:13px; line-height:1.6; margin:8px 0; }
.library-meta, .library-scope { color:var(--sub); }
.library-card details { font-size:13px; }
.library-links { display:flex; flex-wrap:wrap; gap:16px; }
.library-panel a { color:var(--green); }
@media(max-width:1050px) {
  .intro-note { display:none; }
  #parse-form .system-field, #parse-form .grammar-field { width:170px; }
}
@media(max-width:780px) {
  .header { height:64px; padding:0 16px; }
  main { padding:14px 12px 0; }
  h1 { font-size:22px; letter-spacing:-.3px; line-height:1.18; }
  .intro { margin-bottom:12px; }
  .workspace-tabs { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:0 8px; margin-bottom:12px; }
  .workspace-tabs button { padding:8px; font-size:13px; text-align:left; }
  .composer { padding:12px; }
  #parse-form { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
  #parse-form .system-field, #parse-form .grammar-field { width:auto; min-width:0; border:0; padding:0; display:block; }
  #parse-form .grammar-field select { width:100%; }
  #parse-form label { font-size:10px; letter-spacing:.5px; }
  #parse-form select { font-size:13px; min-height:36px; }
  #parse-form .sentence-field, #parse-button { grid-column:1/-1; }
  #sentence { font-size:20px; min-height:36px; }
  #parse-button { min-height:44px; justify-content:space-between; }
  #ai-controls { padding:8px; gap:4px 10px; }
  #method-title { flex-basis:100%; }
  .assistance-switches { display:grid; grid-template-columns:minmax(0,1.3fr) minmax(0,1fr); width:100%; gap:6px; }
  .experimental-control { grid-column:1/-1; }
  .experimental-control strong { flex:1; min-width:160px; }
  .assistance-card { padding:8px; gap:6px; }
  .assistance-card-heading { gap:4px; }
  .assistance-card-heading strong { font-size:12px; }
  .assistance-state { font-size:10px; }
  .assistance-card input[type=checkbox] { width:20px; height:20px; flex-basis:20px; }
  #assistance-hint { font-size:11px; }
  #assistance-info { flex-basis:100%; }
  #assistance-info > summary { min-height:32px; padding:8px 0; }
  .examples { flex-wrap:wrap; }
  #examples { width:100%; }
  #examples button, #all-examples { min-height:44px; }
  .method-result { gap:4px; }
  .method-result details > summary { padding:8px 0; }
  .bench-header { align-items:flex-start; flex-wrap:wrap; }
  .bench-actions { width:100%; justify-content:space-between; }
  .view-button, #fullscreen-derivation { min-height:44px; }
  .derivation-focused .bench-actions > #elapsed { display:none; }
  .derivation-focused .bench-header .section-title { flex-wrap:wrap; }
  .derivation-focused .tree-stage { height:300px; }
  .derivation-focused .inspector-drawer { position:static; max-height:none; }
  .derivation-focused #trace-panel { max-height:360px; }
  .playback-status { align-items:flex-start; }
  .tree-toolbar { gap:6px; }
  .tree-toolbar .segmented { flex:1; }
  .segmented button { min-height:44px; }
  .zoom-controls { margin:0; width:100%; justify-content:flex-end; }
  .follow-control { margin-right:auto; }
  .zoom-controls button, .zoom-controls #fit { min-width:44px; min-height:44px; }
  .transport button { min-width:44px; min-height:44px; }
  .transport select { min-height:44px; }
  .transport { gap:4px; flex-wrap:wrap; }
  .transport #timeline { flex-basis:100%; }
  #ai-controls #use-dictionaries { display:none; }
  #ai-controls:has(.assistance-card.enabled) #use-dictionaries { display:block; }
  #ai-controls .text-button { min-height:44px; }
  .tree-stage { height:340px; }
  .inspector-drawer { border-left:0; border-top:1px solid var(--line); }
  .inspector-drawer > summary { display:list-item; min-height:48px; padding:14px 16px; color:var(--green); font-size:13px; }
  #trace-panel { max-height:360px; }
  .semantics-heading { flex-wrap:wrap; gap:8px; }
  .semantics-heading .section-title { flex-basis:100%; }
  .semantics-heading button { min-height:44px; }
  .library-filters, #library-results { grid-template-columns:1fr; }
  .library-filters input, .library-filters select { font-size:16px; }
}
