.grammar-header { display: flex; align-items: start; justify-content: space-between; gap: 15px; }
.grammar-header .eyebrow { margin-bottom: 7px; }
.grammar-goal { max-width: 55rem; }
.activity-tabs { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 12px; }
.activity-tabs button { padding: 5px 9px; font-size: 12px; text-align: left; font-weight: 550; }
.activity-tabs [aria-current="step"] { background: #6245c4; color: white; border-color: #6245c4; }
.activity-tabs .activity-tick { display: inline-block; margin-right: 5px; font-weight: 750; }
.grammar-task { margin: 0 0 14px; }
.grammar-task h2 { margin: 8px 0; font-size: 20px; }
.activity-badge { color: #5c4a8b; font-size: 12px; }
.lesson-outcomes { margin-bottom: 12px; }
.lesson-outcomes p { margin-top: 5px; font-size: 13px; }
.terms-panel { margin-bottom: 14px; padding: 12px 15px; background: #fff; border: 1px solid #dce0e9; border-radius: 11px; }
.terms-panel > summary { font-size: 14px; font-weight: 700; cursor: pointer; }
.term-inline { padding: 10px 0; border-bottom: 1px solid #e9e6f1; }
.term-inline:last-child { border-bottom: 0; }
.term-inline h3 { font-size: 14px; color: #423364; }
.term-inline p { font-size: 13px; margin-top: 4px; }
.term-inline .action-row { margin-top: 7px; }
.term-inline button { font-size: 12px; padding: 3px 8px; }
.work-grid { display: grid; grid-template-columns: minmax(0,.9fr) minmax(0,1.1fr); gap: 13px; }
.work-grid > * { min-width: 0; }
.work-stack { display: grid; gap: 13px; }
.work-card { padding: 17px; border: 1px solid #dce0e9; border-radius: 12px; background: white; min-width: 0; }
.work-card h2 { font-size: 16px; margin-bottom: 8px; }
.work-card h3 { font-size: 14px; margin: 12px 0 5px; }
.work-card p { margin: 5px 0; font-size: 13px; }
.work-card details { margin-top: 9px; }
.work-card summary { cursor: pointer; color: #4b3b7f; font-size: 13px; }
.field { display: block; margin-top: 9px; font-size: 13px; font-weight: 650; }
.field input, .field select, .field textarea, .grammar-select { display: block; width: 100%; max-width: 100%; min-width: 0; margin-top: 5px; border: 1px solid #bac3d5; border-radius: 7px; padding: 7px 9px; background: #fff; color: #293348; font: 13px/1.6 var(--code); }
.field textarea { min-height: 115px; resize: vertical; }
.field .source-code, .source-code { min-height: 145px; background: #252a3e; color: #f4f2ff; }
.compact-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
.code-output { white-space: pre-wrap; overflow-wrap: anywhere; background: #f5f4f9; border-radius: 8px; padding: 10px; font: 13px/1.8 var(--code); margin: 8px 0; max-height: 340px; overflow-y: auto; }
.symbol-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; align-items: center; }
.symbol-button { min-width: 38px; min-height: 39px; padding: 5px 10px; font: 650 14px/1.5 var(--code); background: #f8f8fc; }
.symbol-button small { display: block; font: 10px/1.3 system-ui; color: #626b7c; }
.symbol-button[aria-pressed="true"] { background: #e9e1ff; border-color: #7f5ecc; color: #442a81; box-shadow: 0 0 0 1px #a98ad9; }
.symbol-button.confirmed-symbol { background: #e7f4ec; border-color: #a7cdb5; color: #235d3a; }
.symbol-button.fixed-symbol { background: #f5f6fa; border: 1px solid var(--line); border-radius: 8px; padding: 5px 9px; }
.derivation-work { display: grid; gap: 10px; }
.pair-preview { padding: 7px 0; }
.symbol-button.nonterminal { border-style: dashed; border-color: #a192ce; }
.symbol-button .token-lexeme { font: 10px/1.4 var(--code); display: block; }
.epsilon { color: #76678d; padding: 5px 9px; font: italic 15px var(--code); border: 1px dashed #cabeda; border-radius: 7px; }
.rule-list { display: grid; gap: 6px; margin-top: 10px; }
.rule-list button { width: 100%; text-align: left; font: 13px/1.6 var(--code); background: #f7f6fb; overflow-wrap: anywhere; }
.rule-list button[aria-pressed="true"] { border-color: #8d73cc; background: #eae3fc; }
.rule-list button small { font: 11px/1.5 system-ui; display: block; color: #626a7c; margin-top: 3px; }
.trace-records { max-height: 200px; overflow-y: auto; margin: 8px 0 0; padding: 0; list-style: none; }
.trace-records li { padding: 4px 8px; border-left: 2px solid #d5c9ee; font: 12px/1.7 var(--code); overflow-wrap: anywhere; }
.tree-scroll { max-height: 450px; overflow: auto; padding: 7px 1px; }
.formal-tree { margin: 0; padding: 0 0 0 12px; list-style: none; }
.formal-tree .formal-tree { margin: 3px 0 3px 9px; border-left: 1px solid #d9d0e9; }
.formal-tree > li { padding: 3px 0; }
.tree-node { display: inline-block; font: 12px/1.6 var(--code); background: #f7f5fc; border: 1px solid #ded7ec; border-radius: 6px; padding: 3px 7px; }
.tree-node.terminal { color: #566173; background: #f4f6f8; }
.tree-rule { font-size: 10px; color: #687184; margin-left: 5px; overflow-wrap: anywhere; }
.formal-tree button { font: 12px/1.5 var(--code); padding: 4px 7px; }
.formal-tree button[aria-pressed="true"] { background: #ece3ff; border-color: #8b6cc7; }
.exercise-feedback { margin: 12px 0; padding: 11px 13px; border-radius: 9px; border: 1px solid #dcd5ed; background: #f3effc; font-size: 13px; white-space: pre-wrap; }
.exercise-feedback[data-tone="warn"] { background: #fff4e4; border-color: #e4cb9e; color: #764718; }
.exercise-feedback[data-tone="good"] { background: #e8f6ee; border-color: #a6cdb8; color: #245d44; }
.result-pair { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin-top: 10px; }
.result-pair article { border: 1px solid #ded9ec; background: #f8f6fc; padding: 11px; border-radius: 8px; min-width: 0; }
.result-pair b { font-size: 13px; }
.language-tiles { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.language-tiles span { background: #efecf8; border-radius: 5px; font: 12px/1.6 var(--code); padding: 3px 7px; overflow-wrap: anywhere; }
.activity-reflection { margin-top: 16px; }
.activity-reflection p { font-size: 13px; }
.grammar-footer { display: flex; flex-wrap: wrap; gap: 9px; justify-content: space-between; margin-top: 15px; }
.evidence-note { font-size: 12px; color: #5e687b; margin-top: 8px; }
.notation-svg { display: block; max-width: 100%; width: 460px; height: auto; }
.notation-svg text { font: 13px var(--code); fill: #41375b; }
.notation-svg path { fill: none; stroke: #86729f; stroke-width: 2; }
.notation-svg rect { fill: #f2edfc; stroke: #b9a4d4; rx: 5; }
.conditional-map { padding: 15px; border-left: 3px solid #d2c1ef; background: #f7f4fc; margin-top: 10px; }
.conditional-map .conditional-map { margin-left: 16px; }
.grammar-optional { padding: 3px 7px; border-radius: 5px; background: #e8eef6; color: #4e6283; font-size: 11px; }
.grammar-save-note { font-size: 12px; color: #665b7e; }
#knowledge-search { width: 100%; padding: 8px; margin: 6px 0 10px; border: 1px solid #b7bfd0; border-radius: 7px; }
@media (max-width: 1000px) { .work-grid { grid-template-columns: minmax(0,1fr); } }
@media (max-width: 715px) { .work-card { padding: 13px; } .grammar-header { display: block; } .activity-tabs { gap: 5px; } .activity-tabs button { font-size: 12px; } }
@media (max-width: 380px) { .compact-fields, .result-pair { grid-template-columns: minmax(0,1fr); } }
