/* 3D химия зертханасы беті: сол жақта 3D көрініс, оң жақта басқару панелі (телефонда — астында). */
.lab-page { min-height: 100vh; }
.lab-top { display: flex; align-items: center; gap: 20px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: #fff; }
.lab-top h1 { font-size: 20px; flex: 1; }
.lab-top .back { font-size: 14px; text-decoration: none; white-space: nowrap; }

.lab { display: grid; grid-template-columns: minmax(0, 1fr) 380px; height: calc(100vh - 63px); }
.lab-view { position: relative; min-height: 0; background: #E4EEEC; }
.lab-canvas, .lab-canvas canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.lab-hint { position: absolute; left: 14px; bottom: 12px; font-size: 13px; color: #4a5560; background: rgba(255,255,255,.82); padding: 6px 12px; border-radius: 999px; pointer-events: none; }
.lab-cam { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 8px; }
.lab-cam button { font: inherit; font-size: 13px; font-weight: 600; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,.92); color: var(--ink); cursor: pointer; }
.lab-cam button:hover { border-color: var(--brand); color: var(--brand); }
.lab-tip { position: absolute; pointer-events: none; transform: translate(-50%, calc(-100% - 14px)); background: var(--ink); color: #fff; padding: 7px 12px; border-radius: 10px; font-size: 14px; white-space: nowrap; box-shadow: 0 6px 20px rgba(20,16,44,.2); }
.lab-tip b { font-weight: 800; margin-right: 6px; }
.lab-toast { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); max-width: min(560px, 90%); background: #fff4d6; color: #7a5200; padding: 10px 16px; border-radius: 12px; font-size: 14px; box-shadow: 0 6px 20px rgba(20,16,44,.12); animation: rise .25s ease both; }

.lab-side { overflow-y: auto; padding: 14px; display: grid; gap: 12px; align-content: start; background: var(--bg); border-left: 1px solid var(--line); }
.lab-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.lab-card h2 { font-size: 16px; margin-bottom: 10px; }
.small { font-size: 13px; margin: -4px 0 10px; }

.lab-vessels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.lab-vessels button { font: inherit; font-weight: 700; padding: 9px 6px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; }
.lab-vessels button small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); }
.lab-vessels button[aria-selected="true"] { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.lab-state { display: flex; justify-content: space-between; margin: 12px 0 8px; font-size: 14px; color: var(--text); }
.lab-state #vEnv { font-weight: 600; }
.lab-contents { display: flex; flex-wrap: wrap; gap: 6px; min-height: 30px; }
.lab-contents span { font-size: 13px; padding: 4px 10px; border-radius: 999px; background: #f1f3f6; color: var(--ink); }
.lab-contents span.ppt { background: #fff2d9; }
.lab-contents span.solid { background: #e9edf1; }
.lab-contents .empty { background: none; color: var(--muted); padding-left: 0; }
.lab-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-top: 12px; }
.lab-actions .btn { padding: 9px 6px; font-size: 13px; }
.lab-actions .btn.on { background: #fff0e6; border-color: #e8590c; color: #c2410c; }

.lab-result { border-color: #d6ccff; }
.lab-result .type { font-size: 12px; font-weight: 700; color: var(--brand); text-transform: uppercase; letter-spacing: .04em; }
.lab-result .eq { font-size: 19px; font-weight: 700; color: var(--ink); margin: 6px 0 10px; line-height: 1.35; }
.lab-result p { margin: 6px 0 0; font-size: 14.5px; }
.lab-result .obs { color: var(--ink); }
.lab-result .obs::before { content: "Бақылау: "; font-weight: 700; }
.lab-result .why { color: var(--text); }
.lab-result .why::before { content: "Неге: "; font-weight: 700; color: var(--ink); }
.lab-result .muted { margin: 0; font-size: 14px; }

.lab-group { margin-bottom: 10px; }
.lab-group:last-child { margin-bottom: 0; }
.lab-group h3 { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.lab-group div { display: flex; flex-wrap: wrap; gap: 6px; }
.lab-group button { font: inherit; font-size: 13px; padding: 6px 10px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; text-align: left; }
.lab-group button b { font-weight: 800; }
.lab-group button:hover { border-color: var(--brand); }
.lab-group button:disabled, .lab-exps button:disabled, .lab-actions .btn:disabled { opacity: .5; cursor: default; }

.lab-exps { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; counter-reset: e; }
.lab-exps button { width: 100%; font: inherit; font-size: 14px; text-align: left; padding: 9px 12px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; display: flex; gap: 10px; align-items: baseline; }
.lab-exps button::before { counter-increment: e; content: counter(e); flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.lab-exps button small { display: block; color: var(--muted); font-size: 12px; }
.lab-exps button:hover { border-color: var(--brand); }

.lab-log { margin: 0; padding-left: 18px; font-size: 13.5px; display: grid; gap: 6px; }
.lab-log li span { color: var(--muted); }

@media (max-width: 900px) {
  .lab { grid-template-columns: 1fr; height: auto; }
  .lab-view { height: 62vh; min-height: 340px; }
  .lab-side { border-left: 0; padding: 12px 16px 24px; }
  .lab-top { padding: 10px 16px; gap: 12px; }
  .lab-top .brand span:last-child, .lab-hint { display: none; }
  .lab-top h1 { font-size: 17px; }
  .lab-cam button { font-size: 12px; padding: 7px 10px; }
}

/* ---------- Сенсорлы тақта, планшет (body.touch — /lab/touch-ui.js қояды) ---------- */
.lab-full { font: inherit; font-size: 13px; font-weight: 600; padding: 7px 14px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; white-space: nowrap; }
.lab-page, .lab-view { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.lab-side input, .lab-side textarea { -webkit-user-select: text; user-select: text; }
body.touch .btn, body.touch .lab-cam button, body.touch .geo-sound, body.touch .lab-full { min-height: 48px; padding-left: 18px; padding-right: 18px; font-size: 15px; }
body.touch .lab-side button:not(.hint-btn) { min-height: 44px; }
body.touch .math-tools button { min-width: 50px; height: 50px; font-size: 20px; }
body.touch input[type="range"] { height: 32px; }
body.touch .lab-tip { font-size: 16px; padding: 9px 14px; }
body.touch .lab-hint { font-size: 14px; }
/* жүгірткі: саусаққа ыңғайлы үлкен тұтқа */
body.touch input[type="range"] { -webkit-appearance: none; appearance: none; height: 34px; background: transparent; }
body.touch input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: #D9D2FF; }
body.touch input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; margin-top: -11px; border-radius: 50%; background: var(--brand); border: 3px solid #fff; box-shadow: 0 1px 5px rgba(20,16,44,.35); }
body.touch input[type="range"]::-moz-range-track { height: 6px; border-radius: 3px; background: #D9D2FF; }
body.touch input[type="range"]::-moz-range-thumb { width: 24px; height: 24px; border-radius: 50%; background: var(--brand); border: 3px solid #fff; }

/* Сабақ барысының ішінде (iframe, ?embed=1) */
html.embed .lab-top { display: none; }
html.embed .lab, html.embed .wb { height: 100vh; }
.lab-to-board { text-decoration: none; background: var(--brand-soft); color: var(--brand); border-color: #d6ccff; }

/* Телефон (sheber.education-ға қосқанда): жолақ бір қатарға сыйсын, бет көлденең айналмасын */
@media (max-width: 600px) {
  .lab-top { gap: 8px; padding: 8px 12px; }
  .lab-top .brand-logo { width: 32px; height: 32px; }
  .lab-top h1 { font-size: 15px; line-height: 1.2; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .lab-top .lab-full, .lab-top #sound { padding: 6px 10px; font-size: 13px; white-space: nowrap; }
  .lab-top .lab-full { display: none; }
  .lab-top .back { font-size: 0; }
  .lab-top .back::before { content: "←"; font-size: 22px; padding: 6px 8px; }
}
