/* The workshop keeps its quiet palette; secondary tools live in dialogs. */
.workspace-title{max-width:150px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.topbar-actions{gap:10px}
.grimoire-tools{margin:0 0 16px}
.grimoire-tools input{width:100%;height:39px;border:1px solid #e3e7f0;border-radius:8px;padding:0 11px;font:inherit;font-size:14px;background:#fbfcfe;color:#39435e}
.grimoire-filters{display:flex;gap:4px;margin-top:9px}
.grimoire-filters button{padding:7px 10px;border-radius:6px;font-size:14px;color:#8991a5}
.grimoire-filters button[aria-pressed=true]{color:var(--accent);background:#f0f2ff}
.grimoire-filters span{font-size:12px;margin-left:3px}
.grimoire-card{position:relative;min-width:0}
.grimoire-card>.catalog-item{width:100%;padding-right:24px;min-height:50px}
.favorite-toggle{position:absolute;right:2px;top:3px;width:23px;height:23px;display:flex;align-items:center;justify-content:center;color:#c4cada;border-radius:5px;z-index:1}
.favorite-toggle svg{width:13px;height:13px}
.favorite-toggle[aria-pressed=true]{color:#b6944f}
.favorite-toggle[aria-pressed=true] svg{fill:#e8d29966}
.favorite-toggle:hover{color:#a78039;background:#fffaf0}
.knowledge-card{position:relative;padding-right:23px}
.knowledge-card .favorite-toggle{top:7px}
.sidebar{container-type:inline-size;container-name:grimoire}
@container grimoire (max-width:260px){.category-items{grid-template-columns:minmax(0,1fr)}}
.grimoire-empty{font-size:14px;line-height:1.7;color:#8791a7;padding:12px 3px}
.grimoire-knowledge summary:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:4px}
.board{touch-action:none;overflow:clip}
.nodes{inset:auto;top:0;left:0;width:0;height:0;transform-origin:0 0}
.view-controls{position:absolute;left:22px;top:22px;z-index:4;display:flex;align-items:center;gap:2px;background:#ffffffed;border:1px solid #e7ebf3;border-radius:10px;padding:3px}
.view-controls .icon-button{width:30px;height:30px;font-size:20px}
.view-controls #zoom-level{font-size:12px;color:#7d879d;width:47px;height:30px}
.view-controls #pan-button[aria-pressed=true]{background:#eef1ff;color:var(--accent)}
.view-controls svg{width:16px;height:16px}
.board.panning,.board.panning .node{cursor:grab}
.board.camera-moving,.board.camera-moving .node{cursor:grabbing}
.active-challenge{position:absolute;left:23px;top:73px;z-index:4;max-width:300px;text-align:left;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;padding:8px 12px;border:1px solid #e5e9f5;border-radius:8px;background:#fff;font-size:13px;color:#687499}
.active-challenge.completed{color:#40886c;background:#f2faf6;border-color:#dbeee4}
.active-challenge[hidden]{display:none}
.selection-panel{top:120px}
.lesson{max-width:610px}
.lesson-copy{min-width:0}
.lesson-replay{margin-left:auto;flex-shrink:0;padding:7px 9px;border-radius:6px;color:var(--accent);font-size:13px}
.lesson-replay:hover{background:#f0f2ff}
.secondary-button{display:inline-flex;align-items:center;justify-content:center;min-height:40px;padding:9px 14px;border:1px solid #e0e6f1;border-radius:8px;color:#66728d;font-size:14px;background:#fff}
.secondary-button:hover{background:#f8faff;border-color:#bac6e2}
.dialog-footer{display:flex;justify-content:flex-end;align-items:center;flex-wrap:wrap;gap:10px;margin-top:22px}
.form-feedback{padding:12px;border:1px solid #efd9c9;border-radius:8px;color:#ac6940;background:#fff9f5;font-size:14px;line-height:1.5}
.learning-dialog,.animation-dialog{max-width:640px}
.teacher-dialog{max-width:750px}
.geometry-dialog{max-width:700px}
.level-tabs{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px;margin:20px 0 16px}
.level-tabs button{padding:11px 4px;font-size:14px;border:1px solid #e4e9f3;border-radius:8px;color:#8993a9}
.level-tabs button[aria-pressed=true]{color:var(--accent);border-color:#c9d1fc;background:#f4f6ff}
.level-description{font-size:14px;line-height:1.6;color:#7f8ba3}
.challenge-list{display:grid;gap:9px;margin-top:18px}
.challenge-card{padding:15px;border:1px solid #e3e9f2;border-radius:10px;background:#fff}
.challenge-card.active{border-color:#bac6f9;background:#fafbff}
.challenge-card.completed{border-color:#d7eadd}
.challenge-card-head{display:flex;gap:12px;align-items:center;justify-content:space-between}
.challenge-card strong{font-size:15px;font-weight:500}
.challenge-card p{font-size:14px;line-height:1.7;color:#7f899e;margin:7px 0}
.challenge-card .challenge-status{font-size:12px;color:#8590a7}
.challenge-hints{margin-top:11px;border-top:1px solid #e8ecf5;padding-top:9px}
.challenge-hints li{font-size:14px;color:#7583a2;line-height:1.7;margin:7px 0}
.challenge-card button{font-size:13px;min-height:35px;padding:7px 10px}
.profile-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:20px 0}
.profile-card{padding:15px;border:1px solid #e1e7f1;border-radius:10px}
.profile-card.current{border-color:#bec8f6;background:#fbfcff}
.profile-card strong{font-size:15px;font-weight:500}
.profile-card p{font-size:13px;line-height:1.7;color:#7f8ba1;margin:8px 0}
.profile-card button{font-size:13px;padding:7px 9px;min-height:34px;margin-right:5px}
.profile-progress{height:4px;border-radius:5px;background:#edf1f8;margin:10px 0}
.profile-progress span{display:block;height:100%;border-radius:5px;background:#6271eb}
.profile-create,.teacher-goal-form{padding:18px 0;border-top:1px solid #e7ebf3}
.profile-create h3,.teacher-goal-form h3{font-size:16px;font-weight:500;margin:0 0 14px}
.profile-create-fields{display:grid;grid-template-columns:1fr 1fr auto;align-items:end;gap:10px}
.dialog label{font-size:14px;line-height:1.6;color:#717e96}
.dialog input:not([type=range]):not([type=checkbox]),.dialog select{border:1px solid #dee5f0;border-radius:7px;padding:9px 10px;min-height:40px;background:white;color:#384861;font-size:14px;width:100%}
.teacher-goal-form select{margin-bottom:12px}
.teacher-goal-form fieldset{border:0;padding:10px 0;margin:4px 0}
.teacher-goal-form legend{font-size:14px;color:#63728b;padding:0}
.teacher-goal-options{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.teacher-goal-options label{display:flex;gap:8px;align-items:flex-start;padding:8px;border:1px solid #e7ebf3;border-radius:7px;color:#738099}
.teacher-goal-options input{margin-top:5px;accent-color:var(--accent)}
.teacher-note{font-size:13px;line-height:1.7;color:#8a94a6}
.geometry-instruction{font-size:14px;color:#7f8ca3;line-height:1.7;margin-bottom:15px}
.geometry-canvas{display:block;width:100%;height:300px;max-height:40dvh;background:#fafcff;border:1px solid #e1e9f4;border-radius:11px;touch-action:none;overflow:hidden}
.drawn-shape{fill:#68a89212;stroke:#4a927a;stroke-width:1.8;stroke-linejoin:round;vector-effect:non-scaling-stroke}
.invalid-shape{stroke:#bd775d;fill:#bd775d0a}
.vertex-handle{fill:white;stroke:#5a6ceb;stroke-width:1.5;vector-effect:non-scaling-stroke}
.vertex-handle.active{fill:#5a6ceb}
.vertex-hit{fill:transparent;stroke:none}
[data-vertex]{cursor:move;outline:none}
[data-vertex]:focus-visible .vertex-handle{stroke:#b48938;stroke-width:3}
.geometry-canvas text{fill:#7986a2;pointer-events:none;font-family:inherit}
.geometry-canvas [data-vertex] text{pointer-events:auto}
.keyboard-cursor{fill:#5a6ceb33;stroke:#5a6ceb;stroke-dasharray:2 2;vector-effect:non-scaling-stroke}
.geometry-controls{display:grid;gap:13px;margin-top:18px}
.geometry-controls label{display:block;text-transform:none}
.geometry-controls input[type=range]{display:block;width:100%;accent-color:#5b6bea;margin:8px 0}
.geometry-controls output{font-size:13px;color:#60709f}
.measure-inputs{display:flex;gap:14px;align-items:center}
.measure-inputs input[type=number]{max-width:90px}
.vertex-editor{display:grid;grid-template-columns:1fr 1fr 1fr;gap:9px;align-items:end}
.vertex-editor button{grid-column:span 1;font-size:13px;padding:8px}
.geometry-stats{padding:14px 16px;background:#f8faff;border:1px solid #e4eaf5;border-radius:9px;margin-top:18px;font-size:14px;color:#7583a0;line-height:1.8}
.geometry-stats p{font-size:14px!important;margin:4px 0}
.geometry-totals{display:flex;justify-content:space-between;gap:15px;flex-wrap:wrap}
.geometry-totals strong{display:block;color:#526f88;font-weight:500}
.vertex-stats{display:grid;grid-template-columns:1fr 1fr;gap:5px 12px;margin-top:12px}
.vertex-stats span{font-size:12px}
.vertex-stats b{color:#5e70b1;margin-right:6px}
.animation-status{font-size:13px;color:#8290b1;margin-top:20px}
#animation-content h3{font-weight:500;font-size:18px;margin:16px 0}
#animation-content>p{font-size:16px;color:#79879f;line-height:1.7;min-height:55px}
.explanation-visual{min-height:160px;display:flex;align-items:center;justify-content:center;padding:15px 0}
.explanation-formula{text-align:center;font-size:23px;color:#5262de;line-height:1.6;overflow-wrap:anywhere;background:#f6f8ff;border-radius:10px;padding:14px}
.explain-groups{display:flex;align-items:center;justify-content:center;gap:18px;flex-wrap:wrap;width:100%}
.explain-group{padding:13px;border:1px dashed #d8e1f2;border-radius:12px;min-width:55px}
.explain-groups span,.equal-shares span{display:block;text-align:center;font-size:13px;color:#8896af;margin-top:10px}
.explain-dots{display:grid;grid-template-columns:repeat(6,12px);justify-content:center;align-content:center;gap:9px;min-height:12px}
.explain-dots i{width:12px;height:12px;border-radius:50%;background:#5969e6;animation:unit-appear .5s both;animation-delay:var(--delay)}
.explain-dots.green i{background:#4a9a7e}
.explain-joined{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:9px;padding:20px;border-radius:12px;background:#f8faff}
.explain-joined .explain-dots{display:contents}
.explain-dots .removed-unit{position:relative;opacity:.25;animation:unit-remove .9s both}
.removed-unit::after{content:"";position:absolute;height:2px;width:17px;left:-2px;top:5px;background:#b16c58;transform:rotate(-45deg)}
.fraction-bars{display:grid;gap:6px;min-width:110px;max-width:270px;width:100%}
.fraction-bar{display:grid;grid-template-columns:repeat(var(--parts),minmax(0,1fr));height:26px;border:1px solid #cbd7f3;border-radius:4px;overflow:hidden}
.fraction-bar i{border-right:1px solid #cad4ed;background:#fff}
.fraction-bar i:last-child{border-right:0}
.fraction-bar i.filled{background:#6b7be2;animation:unit-appear .6s both;animation-delay:var(--delay)}
.equal-shares{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:13px;width:100%}
.equal-shares>div{padding:10px;border:1px solid #e0e8f5;border-radius:8px}
.equal-shares span{margin:0 0 10px}
.large-fraction{font-size:34px;color:var(--accent)}
.explain-shape{color:#6073e5;font-size:50px;text-align:center}
.explain-shape svg{width:150px;height:150px;fill:none;stroke:#4c967d;stroke-width:1.5}
.explain-shape svg path,.explain-shape svg polygon{stroke-dasharray:260;animation:draw-outline 1.3s both}
.explain-shape .node-point{display:block;margin:auto}
.explain-shape .quantity-dots{margin:auto}
.area-grid{display:grid;grid-template-columns:repeat(var(--side),19px);gap:3px}
.area-grid i{width:19px;height:19px;background:#6b81df33;border:1px solid #667de2;border-radius:2px;animation:unit-appear .6s both}
.number-line{width:100%;max-width:400px;font-size:13px;fill:#7786a6}
.explanation-controls{justify-content:space-between}
@keyframes unit-appear{from{opacity:0;transform:translateY(-10px) scale(.6)}to{opacity:1;transform:none}}
@keyframes unit-remove{from{opacity:1;transform:none}to{opacity:.2;transform:translateY(5px)}}
@keyframes draw-outline{from{stroke-dashoffset:260}to{stroke-dashoffset:0}}
@media(max-width:1100px){.workspace-subtitle{display:none}.topbar-actions{gap:7px}.save-state{display:none}}
@media(max-width:700px){
  #journal-button span,#challenge-button span{display:none}
  #journal-button,#challenge-button{width:32px;height:32px;padding:0;justify-content:center}
  .topbar-left{gap:9px}.topbar-actions{gap:3px}.workspace-title{max-width:120px}
  .view-controls{top:14px;left:12px;padding:2px;gap:0}
  .view-controls .icon-button{width:28px;height:29px}
  .view-controls #zoom-level{width:43px;padding:0 2px;white-space:nowrap;font-size:12px}
  .board-top-actions{top:15px;right:12px;gap:1px}
  .active-challenge{top:66px;left:13px;max-width:calc(100% - 26px);font-size:12px}
  .selection-panel{top:115px}
  .lesson-replay{width:32px;font-size:0;padding:5px}
  .lesson-replay::after{content:"▷";font-size:18px}
  .lesson{gap:8px}
  .level-tabs{grid-template-columns:1fr 1fr}
  .profile-list{grid-template-columns:1fr}
  .profile-create-fields{grid-template-columns:1fr}
  .teacher-goal-options{grid-template-columns:1fr}
  .vertex-editor{grid-template-columns:1fr 1fr}
  .vertex-editor label:first-child{grid-column:1/-1}
  .geometry-canvas{height:240px}
  .vertex-stats{grid-template-columns:1fr}
  .explain-groups{gap:10px}
  .explain-dots{grid-template-columns:repeat(5,10px);gap:7px}
  .explain-dots i{width:10px;height:10px}
  .explanation-controls{gap:6px}
  .explanation-controls button{font-size:12px;padding:8px 9px}
  .explanation-formula{font-size:20px}
}
@media(prefers-reduced-motion:reduce){.explanation-visual *{animation:none!important}}
