.tensor-lab { margin:24px 0; border:1px solid #cbd5e1; border-radius:16px; background:#f8fafc; overflow:hidden; }
.ts-shape-practice summary { padding:8px 0; color:#365b7f; cursor:pointer; font-size:.9rem; }.ts-shape-practice .tasks { padding-left:16px; font-size:.84rem; }
.ts-heading { display:flex; align-items:center; justify-content:space-between; gap:14px; padding:18px 22px; border-bottom:1px solid #dfe6ef; }
.ts-heading strong { font-family:var(--f-hand); font-size:1.12rem; }.ts-heading small { display:block; color:#63758c; margin-top:4px; }
.ts-presets { display:flex; gap:7px; flex-wrap:wrap; padding:16px 22px 0; }.ts-presets .btn { background:white; }
.ts-controls { padding:16px 22px; display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; }
.ts-controls label { display:flex; flex-direction:column; gap:6px; color:#52647a; font-size:.78rem; }
.ts-controls select { width:100%; min-width:0; border:1px solid #c7d2e0; background:white; color:#24344d; border-radius:7px; min-height:38px; padding:7px; font: .84rem var(--f-body); }
.ts-formula { margin:0; padding:14px 22px; border-block:1px solid #dfe6ef; background:white; overflow-wrap:anywhere; color:#26415e; font:.9rem/1.6 var(--f-num); }
.ts-matrices { padding:22px; display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; align-items:start; }
.ts-matrix { min-width:0; }.ts-matrix h3 { margin:0 0 5px; font:600 .9rem var(--f-num); color:#314961; }.ts-matrix .ts-dims { display:block; font-size:.74rem; color:#64748b; min-height:2.8em; margin-bottom:8px; }
.ts-cells { display:grid; grid-template-columns:repeat(var(--ts-cols),minmax(0,1fr)); gap:3px; }
.ts-cell { display:flex; align-items:center; justify-content:center; background:white; color:#304354; border:1px solid #d7e0e9; border-radius:5px; min-height:34px; min-width:0; padding:5px 1px; font: .84rem var(--f-num); }
button.ts-cell { cursor:pointer; }.ts-cell.active { background:#e2edfc; border-color:#386da8; color:#163d69; }.ts-cell.selected { background:#263f60; border-color:#263f60; color:white; }.ts-matrix[data-tensor="b"] .ts-cell.active { background:#fff0d3; border-color:#b47b24; color:#6f4610; }
.ts-empty { grid-column:1/-1; border:1px dashed #c3cedb; border-radius:7px; padding:14px 8px; color:#65788e; font-size:.82rem; text-align:center; }
.ts-detail { padding:16px 22px; border-block:1px solid #dfe6ef; background:white; }.ts-detail strong { display:block; color:#294b6c; font-size:.85rem; margin-bottom:8px; }.ts-detail p { margin:0; font:.86rem/1.8 var(--f-num); overflow-wrap:anywhere; }
.ts-feedback { padding:14px 22px; margin:0; color:#3a546b; font-size:.86rem; line-height:1.7; background:#edf3f8; }.ts-feedback.bad { color:#873a2e; background:#fff0eb; }
.ts-footer { padding:14px 22px 18px; font-size:.8rem; color:#66768a; }.ts-footer p { margin:6px 0; }.ts-footer summary { cursor:pointer; color:#365b7f; }.ts-footer pre { overflow:auto; white-space:pre; background:white; padding:14px; border-radius:7px; font:.79rem/1.7 var(--f-num); }.ts-footer details[open] { margin-top:10px; }
.tensor-lab button:focus-visible,.tensor-lab select:focus-visible,.tensor-lab summary:focus-visible { outline:3px solid #ba781f; outline-offset:3px; }
@media(max-width:1100px) { .ts-matrices { grid-template-columns:repeat(2,minmax(0,1fr)); gap:20px; }.ts-cell { min-height:38px; } }
@media(max-width:640px) { .ts-controls { grid-template-columns:repeat(2,minmax(0,1fr)); }.ts-heading { flex-direction:column; align-items:flex-start; }.ts-heading,.ts-controls,.ts-formula,.ts-detail,.ts-feedback,.ts-footer { padding:16px; }.ts-presets { padding:16px 16px 0; }.ts-matrices { padding:16px; gap:14px; }.ts-cell { min-height:36px; font-size:.78rem; }.ts-matrix h3 { font-size:.84rem; } }
@media(max-width:380px) { .ts-matrices { grid-template-columns:1fr; }.ts-cells { max-width:240px; }.ts-controls { grid-template-columns:1fr; } }
@media(prefers-reduced-motion:reduce) { .tensor-lab * { animation:none!important; transition:none!important; } }
