:root{
  --blue:#0b5ed7; --blue-2:#0d6efd; --navy:#0f2f57; --ink:#1f2a37; --muted:#667085;
  --line:#d9e2ec; --soft:#f4f8fc; --card:#fff; --danger:#c62828; --ok:#13795b; --warn:#9a6700;
  --shadow:0 10px 28px rgba(24,56,93,.10); --radius:16px;
}
*{box-sizing:border-box}
html,body{margin:0;min-height:100%;font-family:Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;color:var(--ink);background:#eef4f9}
button,select,input{font:inherit}
button{cursor:pointer}
.app-shell{min-height:100vh;display:flex;flex-direction:column;gap:10px;padding:10px;max-width:1920px;margin:auto}
.topbar{display:flex;align-items:center;justify-content:space-between;gap:14px;background:#fff;border:1px solid #dbe6f0;border-radius:18px;padding:8px 12px;box-shadow:var(--shadow)}
.brand{display:flex;align-items:center;gap:12px;min-width:260px}.brand-logo{width:76px;height:54px;object-fit:contain}.brand h1{font-size:1.18rem;margin:0;color:var(--navy)}.brand p{font-size:.78rem;color:var(--muted);margin:2px 0 0}
.top-actions{display:flex;align-items:end;gap:8px;flex-wrap:wrap;justify-content:flex-end}.compact-field{display:grid;gap:3px;font-size:.72rem;color:var(--muted)}
select,input[type="number"]{border:1px solid #cbd7e3;border-radius:9px;padding:7px 9px;background:#fff;color:var(--ink);min-width:0}.compact-field select{padding:6px 8px}
.lang-switch{display:flex;background:#edf3f8;border-radius:9px;padding:2px}.lang-btn{border:0;background:transparent;padding:7px 9px;border-radius:7px;font-weight:700;color:var(--muted)}.lang-btn.active{background:var(--blue);color:#fff}
.icon-btn{border:1px solid #cbd7e3;background:#fff;border-radius:10px;min-width:38px;height:38px;font-size:1.1rem}.icon-btn:hover,.ghost-btn:hover,.secondary-btn:hover,.tool-btn:hover{background:#f0f6fc}.danger-soft{color:var(--danger)}
.card{background:var(--card);border:1px solid #dbe6f0;border-radius:var(--radius);box-shadow:var(--shadow)}
.instructions{padding:9px 14px}.instructions-head{display:flex;justify-content:space-between;align-items:center}.instructions ol{display:grid;grid-template-columns:repeat(5,1fr);gap:12px;margin:8px 0 0;padding-left:24px;font-size:.82rem;color:#4a5c6d}.ghost-btn{border:0;background:transparent;color:var(--blue);font-weight:700}
.task-card{padding:12px 16px;display:flex;align-items:center;justify-content:space-between;gap:16px}.task-card h2{margin:3px 0;font-size:1.05rem}.task-card p{margin:3px 0;color:#495b6d}.eyebrow{text-transform:uppercase;letter-spacing:.09em;font-size:.68rem;color:var(--blue);font-weight:800}.challenge-answer{display:flex;gap:8px;align-items:end;flex-wrap:wrap}.challenge-answer label{display:grid;gap:3px;font-size:.76rem}.feedback{font-weight:700}.feedback.ok{color:var(--ok)}.feedback.warn{color:var(--warn)}.feedback.bad{color:var(--danger)}
.layout-grid{display:grid;grid-template-columns:minmax(250px,300px) minmax(520px,1fr) minmax(270px,330px);gap:10px;min-height:0;flex:1}.left-panel,.right-panel{padding:0;overflow:hidden;min-height:650px}.panel-scroll{overflow:auto}.panel-section{padding:13px;border-bottom:1px solid #e8eef5}.panel-section:last-child{border-bottom:0}.panel-section h2{font-size:1rem;margin:0}.panel-section h3{font-size:.88rem;color:var(--navy);margin:0 0 6px}.section-title-row{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:10px}
.vector-cards{display:grid;gap:8px}.vector-card{border:1px solid #dce6ef;border-radius:12px;padding:9px;background:#fbfdff}.vector-card-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:7px}.vector-name{display:flex;align-items:center;gap:7px;font-weight:800}.vector-swatch{width:12px;height:12px;border-radius:50%}.remove-vector{border:0;background:transparent;color:#9d2e2e;font-size:1rem}.vector-inputs{display:grid;grid-template-columns:1fr 1fr;gap:7px}.vector-inputs label{font-size:.69rem;color:var(--muted);display:grid;gap:3px}.vector-inputs input{padding:6px 7px}.vector-readout{margin-top:7px;display:grid;grid-template-columns:1fr 1fr;gap:4px;font-size:.72rem;color:#4c5c6b}.masked{letter-spacing:.08em;color:#98a2b3}
.primary-btn,.secondary-btn{border-radius:9px;padding:8px 10px;font-weight:750}.primary-btn{border:1px solid var(--blue);background:var(--blue);color:#fff}.primary-btn:hover{background:#094eaf}.primary-btn.small{padding:6px 9px;font-size:.8rem}.secondary-btn{border:1px solid #bfd0e0;background:#f8fbfe;color:var(--navy)}.full{width:100%;margin-top:10px}.compact-stack{display:grid;gap:8px}.compact-stack label{display:grid;gap:4px;font-size:.76rem;color:#58697b}.switch-row{display:flex!important;justify-content:space-between;align-items:center;gap:10px}.switch-row input{accent-color:var(--blue)}
.workspace-card{display:flex;flex-direction:column;min-width:0;min-height:650px;overflow:hidden}.workspace-head{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:8px 12px;border-bottom:1px solid #e7eef5;background:#fbfdff}.workspace-status{display:flex;gap:12px;color:#607285;font-size:.76rem}.view-options label{font-size:.72rem;color:#607285;display:flex;align-items:center;gap:6px}.view-options select{padding:5px 7px}
.svg-wrap{position:relative;flex:1;min-height:520px;overflow:hidden;background:#fff;touch-action:none;outline:none}.svg-wrap:focus-visible{box-shadow:inset 0 0 0 3px rgba(11,94,215,.2)}#workspace{width:100%;height:100%;display:block;user-select:none;-webkit-user-select:none}
.tool-dock{display:grid;grid-template-columns:repeat(9,1fr);border-top:1px solid #dfe8f1;background:#fbfdff}.tool-btn{border:0;border-right:1px solid #e4ebf2;background:#fbfdff;min-height:58px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;color:#526578}.tool-btn:last-child{border-right:0}.tool-btn span{font-size:1.18rem;font-weight:800}.tool-btn small{font-size:.65rem}.tool-btn.active{background:#eaf3ff;color:#0b5ed7;box-shadow:inset 0 3px 0 #0b5ed7}
.result-tabs{display:grid;grid-template-columns:repeat(3,1fr);border:1px solid #d7e2ec;border-radius:10px;overflow:hidden}.tab-btn{border:0;background:#f4f8fb;padding:7px;font-size:.72rem;color:#5a6c7e}.tab-btn.active{background:var(--blue);color:#fff}.tab-content{display:none;padding:10px 2px 2px;font-size:.8rem}.tab-content.active{display:block}.result-hero{border:1px solid #f0c6c6;background:#fff8f8;border-radius:12px;padding:10px}.result-hero strong{color:#b32727}.result-grid{display:grid;grid-template-columns:1fr 1fr;gap:6px;margin-top:8px}.result-cell{padding:7px;border-radius:9px;background:#f4f7fa}.math-line{font-family:"Cambria Math",Cambria,serif;background:#f7f9fc;border:1px solid #e3e8ef;border-radius:8px;padding:7px;margin:5px 0;overflow-wrap:anywhere}.components-table{width:100%;border-collapse:collapse;font-size:.72rem}.components-table th,.components-table td{padding:6px;border-bottom:1px solid #e5ebf1;text-align:right}.components-table th:first-child,.components-table td:first-child{text-align:left}
.footerbar{display:flex;justify-content:space-between;gap:10px;padding:4px 8px;color:#6d7f90;font-size:.7rem}
.hidden{display:none!important}
/* SVG */
.grid-line{stroke:#dce8f1;stroke-width:1}.grid-line.major{stroke:#c5d7e6;stroke-width:1.3}.axis-line{stroke:#6c7f91;stroke-width:2}.axis-label{font-size:16px;fill:#4c5d6d;font-weight:700}.origin-label{font-size:14px;fill:#4c5d6d}.vector-line{stroke-width:5;stroke-linecap:round;cursor:pointer;filter:url(#softShadow)}.vector-line:hover{stroke-width:7}.vector-handle{stroke:#fff;stroke-width:3;cursor:grab;filter:url(#softShadow)}.vector-handle:active{cursor:grabbing}.vector-label{font-weight:800;font-size:16px;paint-order:stroke;stroke:#fff;stroke-width:4;stroke-linejoin:round}.vector-info{font-size:12px;paint-order:stroke;stroke:#fff;stroke-width:4;stroke-linejoin:round}.component-line{stroke-width:1.8;stroke-dasharray:7 6;opacity:.7}.result-line{stroke:#d32f2f;stroke-width:7;stroke-linecap:round;filter:url(#softShadow)}.result-label{fill:#b71c1c;font-weight:900;font-size:18px;paint-order:stroke;stroke:#fff;stroke-width:5}.parallelogram-line{stroke:#6d7780;stroke-width:2;stroke-dasharray:8 7;opacity:.6}.ruler-body{fill:rgba(255,215,64,.48);stroke:#a06b00;stroke-width:1.5}.ruler-tick{stroke:#6a4a00;stroke-width:1}.ruler-tick.major{stroke-width:1.8}.ruler-text{fill:#5f4500;font-size:10px}.measure-tool{cursor:move}.measure-rotate{cursor:crosshair;fill:#fff;stroke:#34495e;stroke-width:2}.protractor-fill{fill:rgba(100,181,246,.18);stroke:#1565c0;stroke-width:2}.protractor-tick{stroke:#1565c0;stroke-width:1}.protractor-tick.major{stroke-width:2}.protractor-text{fill:#0d47a1;font-size:10px}.tooltip-box{fill:rgba(15,47,87,.92);rx:8}.tooltip-text{fill:#fff;font-size:12px;font-weight:700}
@media (max-width:1180px){.layout-grid{grid-template-columns:250px minmax(480px,1fr)}.right-panel{grid-column:1/-1;min-height:0;display:grid;grid-template-columns:1fr 2fr}.right-panel .panel-section{border-bottom:0;border-right:1px solid #e8eef5}.instructions ol{grid-template-columns:repeat(3,1fr)}}
@media (max-width:820px){.app-shell{padding:6px}.topbar{align-items:flex-start}.brand-logo{width:58px;height:42px}.brand h1{font-size:1rem}.brand p{display:none}.top-actions{gap:5px}.compact-field{display:none}.layout-grid{display:flex;flex-direction:column}.workspace-card{order:1;min-height:560px}.left-panel{order:2;min-height:0}.right-panel{order:3;display:block;min-height:0}.instructions{order:0}.instructions ol{grid-template-columns:1fr 1fr}.tool-dock{grid-template-columns:repeat(5,1fr)}.tool-btn{border-bottom:1px solid #e4ebf2}.svg-wrap{min-height:450px}.task-card{align-items:flex-start;flex-direction:column}.footerbar{flex-direction:column}}
@media (max-width:520px){.brand{min-width:0}.brand-logo{width:50px}.topbar{padding:7px}.top-actions .icon-btn{min-width:34px;height:34px}.lang-btn{padding:6px}.instructions ol{grid-template-columns:1fr;font-size:.77rem}.workspace-card{min-height:500px}.svg-wrap{min-height:390px}.workspace-head{flex-wrap:wrap}.tool-dock{grid-template-columns:repeat(3,1fr)}.vector-inputs{grid-template-columns:1fr}.right-panel .panel-section{border-right:0}.footerbar{font-size:.64rem}}
@media (prefers-reduced-motion:reduce){*{scroll-behavior:auto!important;transition:none!important}}
