/* Robo electronics — Laboratoriya */
.lab-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 196px 1fr 340px; }
.lab-side { background: var(--panel); border-right: 1px solid var(--line); padding: 10px 8px; overflow-y: auto; }
.lab-side h2 { margin: 4px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.lab-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.lab-tools button { display: flex; flex-direction: column; align-items: center; gap: 1px; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; color: var(--text); padding: 6px 2px; cursor: pointer; font: inherit; }
.lab-tools button span { font-size: 19px; line-height: 1.1; }
.lab-tools button b { font-size: 11px; font-weight: 600; text-align: center; line-height: 1.15; }
.lab-tools button:hover { border-color: var(--accent2); }
.lab-tools button.on { border-color: var(--accent); background: #2e2a12; color: var(--accent); }
.lab-hint { min-height: 34px; margin: 8px 2px 12px; }
.lab-scenes { display: flex; flex-direction: column; gap: 4px; }
.lab-scene { text-align: left; background: none; border: 1px solid var(--line); border-radius: 9px; color: var(--text); padding: 6px 8px; font: inherit; font-size: 12.5px; cursor: pointer; }
.lab-scene:hover { border-color: var(--accent2); background: var(--panel2); }

.lab-stage { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #f8f7f2; }
#lab-cv { display: block; touch-action: none; user-select: none; }
.lab-bar { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); display: flex; gap: 6px; align-items: center; background: rgba(18, 26, 46, .92); border: 1px solid var(--line); border-radius: 12px; padding: 5px 7px; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); }
.lab-bar .btn { padding: 6px 11px; }
.lab-bar select { padding: 6px 8px; }
.lab-time { font: 600 13px Consolas, monospace; color: var(--accent2); min-width: 92px; text-align: center; }
.lab-opts { position: absolute; left: 10px; bottom: 10px; display: flex; gap: 12px; background: rgba(255, 255, 255, .9); border: 1px solid #d8d4c6; border-radius: 10px; padding: 5px 10px; }
.lab-opts .chk { color: #3a3f47; font-size: 12.5px; }
.lab-fail { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 30px; color: #8a3b30; font-weight: 700; background: #f8f7f2; }
.lab-stage .toast { bottom: 54px; }

.lab-right { background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; }
.lab-right .card { margin: 0 0 10px; }
.lab-right .live { margin: 0 0 8px; }
.lab-props { display: flex; flex-direction: column; gap: 4px; }
.lab-props label { display: grid; grid-template-columns: 96px 1fr 76px; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); margin: 0; }
.lab-props input[type=range] { width: 100%; accent-color: var(--accent); }
.lab-props b { color: var(--accent); font-size: 12px; text-align: right; white-space: nowrap; }
.lab-gbtn { display: flex; flex-wrap: wrap; gap: 4px; margin: 2px 0 6px; }
.lab-gbtn .btn { padding: 3px 8px; font-size: 12px; }
.lab-oh { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.lab-oh b { font-size: 15px; }
.lab-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.lab-row input[type=color] { width: 34px; height: 26px; border: 1px solid var(--line); border-radius: 6px; background: none; padding: 0; cursor: pointer; }
.lab-row select { padding: 4px 8px; font-size: 12.5px; }
.lab-scene-info { background: #1b2540; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; margin-bottom: 10px; }
.lab-scene-info:empty { display: none; }
.lab-scene-info p { margin: 4px 0 0; }
#lab-form .formula { text-align: left; font-size: 12.5px; margin: 0 0 6px; }
.lab-ebar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: #0c1324; margin-top: 8px; }
.lab-ebar i { display: block; height: 100%; transition: width .15s; }
.lab-ebar .ke, .lab-elegend .ke { background: #3ddc84; color: #3ddc84; }
.lab-ebar .pe, .lab-elegend .pe { background: #5bd0ff; color: #5bd0ff; }
.lab-elegend { display: flex; gap: 14px; font-size: 11px; margin-top: 3px; }
.lab-elegend span { background: none !important; }
#lab-graph { width: 100%; height: 150px; display: block; border-radius: 8px; border: 1px solid var(--line); }
#lab-graph-box h4 { display: flex; justify-content: space-between; align-items: center; }
#lab-gkey { padding: 3px 6px; font-size: 12px; }

@media (max-width: 1100px), (max-height: 620px) {
  html:has(body.lab) { height: auto; }
  body.lab { height: auto; min-height: 100%; }
  .lab-layout { grid-template-columns: 150px 1fr; grid-template-rows: minmax(400px, 78vh) auto; }
  .lab-right { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); }
  .lab-tools { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .lab-layout { grid-template-columns: 1fr; grid-template-rows: auto minmax(380px, 70vh) auto; }
  .lab-side { max-height: 160px; }
  .lab-tools { grid-template-columns: repeat(4, 1fr); }
  .lab-bar { flex-wrap: wrap; justify-content: center; width: calc(100% - 20px); }
}

.lab-grp { margin-bottom: 4px; }
.lab-grp summary { cursor: pointer; font-size: 12px; font-weight: 700; color: var(--accent2); padding: 5px 2px; user-select: none; }
.lab-grp .lab-scene { display: block; width: 100%; margin: 3px 0; text-decoration: none; }
.lab-scene.on { border-color: var(--accent); color: var(--accent); }
.lab-link { color: var(--accent2) !important; font-style: italic; }
.lab-gas:empty { display: none; }
.lab-gas { margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--line); }
.lab-props .chk { display: flex; grid-template-columns: none; }
.lab-row select { max-width: 150px; }
