/* Lab Asam Basa: semua kegiatan. Awalan lab-. Gaya kartun datar: garis #1f2937, warna datar. */
.lab { --lab: #0e7490; --lab-soft: #cffafe; --ink2: #1f2937; }
.lab-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; padding: clamp(8px, 1.6vw, 18px); overflow-y: auto; overflow-x: hidden; background: linear-gradient(180deg, #ecfeff, #fff 55%); -webkit-overflow-scrolling: touch; user-select: text; -webkit-user-select: text; }
.lab-view { display: flex; flex-direction: column; gap: clamp(8px, 1.4vh, 14px); min-width: 0; }
.lab-view[hidden] { display: none; }
.lab-hud { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; }
.lab-hud:empty { display: none; }
.lab-chip { background: #fff; border: 3px solid var(--c); color: var(--ink); border-radius: 999px; padding: 2px 14px; font-weight: 800; font-size: clamp(13px, 1.6vw, 19px); display: inline-flex; gap: 6px; align-items: baseline; }
.lab-chip b { font-size: 1.2em; font-variant-numeric: tabular-nums; }
.lab-chip i { font-style: normal; }
.lab-chip.on { background: var(--c); color: #fff; }
.lab-qn { font-weight: 800; color: var(--muted); font-size: clamp(13px, 1.5vw, 17px); margin-left: 6px; }
.lab-turn { text-align: center; font-weight: 800; font-size: clamp(14px, 1.7vw, 18px); color: var(--c); }
.lab-names { display: grid; gap: 6px; }
.lab-names input { font: 700 16px var(--font); padding: 8px 14px; border: 2px solid var(--line); border-radius: 999px; min-width: 0; width: 100%; box-sizing: border-box; text-align: center; }
.lab-names input[hidden] { display: none; }
#game-opts[hidden], #g-level[hidden] { display: none; }
.lab sub, .lab-panelc sub, #overlay-result sub { font-size: .72em; line-height: 0; vertical-align: sub; }
.lab sup, #overlay-result sup { font-size: .72em; line-height: 0; vertical-align: super; }
.lab-err { text-align: center; font-weight: 800; color: var(--bad); padding: 20px; }
.lab-svg { display: block; width: 100%; height: auto; }

/* soal dan pilihan ganda */
.lab-prompt { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; background: #fff; border: 4px solid var(--lab); border-radius: 24px; padding: 10px 14px; min-height: 80px; }
.lab-qtext { margin: 0; text-align: center; font-weight: 800; color: var(--ink); font-size: clamp(16px, 2.2vw, 24px); line-height: 1.3; overflow-wrap: anywhere; }
.lab-eqbig { margin: 0; text-align: center; font-weight: 800; color: var(--ink); font-size: clamp(20px, 3.4vw, 38px); line-height: 1.5; overflow-wrap: anywhere; }
.lab-cerita { margin: 0; text-align: left; font-weight: 700; color: var(--ink); font-size: clamp(16px, 2.1vw, 24px); line-height: 1.5; overflow-wrap: anywhere; }
.lab-opts { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(8px, 1.2vw, 14px); }
.lab-opts.c3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 560px) { .lab-opts, .lab-opts.c3 { grid-template-columns: 1fr; } }
.lab-opt { position: relative; display: flex; align-items: center; justify-content: center; gap: 10px; min-height: clamp(56px, 9vh, 84px); padding: 6px 12px 6px 30px; border-radius: 18px; border: 4px solid var(--lab-soft); background: #fff; color: var(--ink); font: 800 clamp(16px, 2.1vw, 25px)/1.35 var(--font); cursor: pointer; text-align: center; overflow-wrap: anywhere; }
.lab-opt kbd { position: absolute; top: 3px; left: 8px; font: 800 12px var(--font); color: var(--muted); }
.lab-opt small { display: block; font-size: .6em; font-weight: 700; color: var(--muted); }
.lab-opt:hover:not(:disabled) { border-color: var(--lab); }
.lab-opt:disabled { cursor: default; }
.lab-opt.good { background: #bbf7d0; border-color: var(--ok); }
.lab-opt.bad { background: #fecdd3; border-color: var(--bad); }
.lab-fb { min-height: 1.4em; text-align: center; font-weight: 800; color: var(--muted); font-size: clamp(14px, 1.7vw, 19px); line-height: 1.45; }
.lab-fb.ok b.r { color: var(--ok); } .lab-fb.bad b.r { color: var(--bad); }
.lab-fb p { margin: 4px 0 0; font-weight: 700; color: var(--ink); text-align: left; background: #f8fafc; border: 2px solid var(--line); border-radius: 14px; padding: 8px 12px; font-size: clamp(14px, 1.5vw, 16px); }
.lab-fb p.lab-eq { text-align: center; font-size: clamp(16px, 2vw, 22px); background: #ecfeff; border-color: #a5f3fc; }
.lab-next { align-self: center; margin-top: 0; min-height: 52px; padding: 0 34px; font-size: clamp(18px, 2vw, 24px); }
.lab-next[hidden] { display: none; }
.lab-sact { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.lab-sact .primary, .lab-sact .secondary { margin-top: 0; min-height: 52px; padding: 0 30px; font-size: 20px; }
.lab-sact .primary:disabled { opacity: .45; box-shadow: none; cursor: not-allowed; }
.lab-task { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 16px; background: #fff; border: 4px solid var(--lab); border-radius: 22px; padding: 8px 14px; }
.lab-q { font-weight: 800; color: var(--ink); font-size: clamp(15px, 2vw, 22px); line-height: 1.35; text-align: center; overflow-wrap: anywhere; }
.lab-tgt { font-weight: 800; color: var(--lab); font-size: clamp(15px, 2vw, 22px); }
.lab-tgt small { color: var(--muted); font-weight: 700; font-size: .8em; }

/* meja lab: rak, botol, gelas */
.lab-bench { display: grid; grid-template-columns: 1fr minmax(150px, 220px) 1fr; gap: clamp(8px, 1.6vw, 20px); align-items: start; }
@media (max-width: 760px) { .lab-bench { grid-template-columns: 1fr 1fr; } .lab-mix { grid-column: 1 / -1; order: 3; } }
@media (max-width: 420px) { .lab-bench { grid-template-columns: 1fr; } .lab-mix { order: 0; } }
.lab-shelf { background: #fff; border: 3px solid var(--ink2); border-radius: 18px; padding: 6px 8px 0; min-width: 0; box-shadow: inset 0 -10px 0 #d6b98c; }
.lab-shelf h3 { margin: 0 0 4px; font-size: clamp(14px, 1.6vw, 18px); text-align: center; }
.lab-shelf.a h3 { color: #be123c; } .lab-shelf.b h3 { color: #1d4ed8; }
.lab-bots { display: grid; grid-template-columns: repeat(auto-fit, minmax(76px, 1fr)); gap: 6px 4px; padding-bottom: 14px; }
.lab-bot { display: flex; flex-direction: column; align-items: center; gap: 0; min-height: 44px; padding: 4px 2px 6px; border: 3px solid transparent; border-radius: 14px; background: transparent; cursor: pointer; font-family: var(--font); color: var(--ink); transition: transform .15s; }
.lab-bot .lab-svg { width: clamp(40px, 7vw, 56px); }
.lab-bot:hover:not(:disabled) { background: #f1f5f9; }
.lab-bot[aria-pressed="true"] { transform: translateY(-6px); background: #fef9c3; border-color: #ca8a04; }
.lab-bot:disabled { cursor: default; opacity: .75; }
.lab-bot[aria-pressed="true"]:disabled { opacity: 1; }
.lab-bf { font-weight: 800; font-size: clamp(14px, 1.6vw, 18px); line-height: 1.2; }
.lab-bn { font-size: 11.5px; font-weight: 700; color: var(--muted); line-height: 1.2; text-align: center; overflow-wrap: anywhere; }
.lab-mix { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.lab-mixbox { position: relative; width: clamp(96px, 16vw, 150px); }
.lab-sel { font-weight: 800; color: var(--ink); font-size: clamp(15px, 1.9vw, 21px); text-align: center; min-height: 1.5em; }
.lab-sel i { color: var(--muted); font-weight: 700; }
.lab-go { margin-top: 0; min-height: 52px; padding: 0 28px; font-size: clamp(18px, 2vw, 24px); }
.lab-go:disabled { opacity: .45; box-shadow: none; cursor: not-allowed; }
.lab-pour { position: absolute; top: -12px; width: 8px; height: 0; border-radius: 4px; opacity: 0; }
.lab-pour.a { left: 28%; background: #fb7185; } .lab-pour.b { right: 28%; background: #60a5fa; }
.lab-mixbox.mixing .lab-pour { animation: lab-pour 1.1s ease-in forwards; }
@keyframes lab-pour { 0% { height: 0; opacity: 1; } 50% { height: 56px; opacity: 1; } 100% { height: 56px; opacity: 0; } }
.lab-bub { fill: #fff; stroke: #1f2937; stroke-width: 1.5; opacity: 0; animation: lab-bub 1.1s ease-in infinite; }
@keyframes lab-bub { 0% { opacity: 0; transform: translateY(0); } 25% { opacity: .95; } 100% { opacity: 0; transform: translateY(-62px); } }
.lab-prod { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 10px; font-weight: 800; color: var(--ink); }
.lab-prod[hidden] { display: none; }
.lab-prodt { font-size: clamp(14px, 1.7vw, 18px); }
.lab-pchip { display: inline-flex; flex-direction: column; align-items: center; padding: 4px 16px; border-radius: 16px; border: 3px solid var(--ink2); font-size: clamp(18px, 2.4vw, 28px); line-height: 1.2; animation: lab-pop .35s ease-out; }
.lab-pchip small { font-size: 12px; font-weight: 700; color: var(--muted); }
.lab-pchip.garam { background: #fef9c3; } .lab-pchip.air { background: #dbeafe; }
@keyframes lab-pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* setarakan */
.lab-eqrow { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 6px; background: #fff; border: 3px solid var(--line); border-radius: 22px; padding: 12px 8px; }
.lab-term { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.lab-f { font-weight: 800; color: var(--ink); font-size: clamp(20px, 3vw, 32px); line-height: 1.2; white-space: nowrap; }
.lab-step { display: inline-flex; align-items: center; gap: 4px; background: var(--lab-soft); border-radius: 999px; padding: 3px; }
.lab-sb { width: 48px; height: 48px; border-radius: 50%; border: 3px solid var(--lab); background: #fff; color: var(--lab); font: 800 28px/1 var(--font); cursor: pointer; display: grid; place-items: center; padding: 0; touch-action: manipulation; }
.lab-sb:hover:not(:disabled) { background: var(--lab); color: #fff; }
.lab-sb:disabled { opacity: .5; cursor: default; }
.lab-k { min-width: 34px; text-align: center; font-weight: 800; font-size: clamp(22px, 3vw, 32px); color: var(--ink); font-variant-numeric: tabular-nums; }
.lab-op { font-weight: 800; color: var(--muted); font-size: clamp(22px, 3vw, 34px); padding: 0 4px; align-self: center; }
.lab-op.arrow { color: var(--lab); }
.lab-tblwrap { overflow-x: auto; border: 2px solid var(--line); border-radius: 16px; background: #fff; max-width: 100%; -webkit-overflow-scrolling: touch; }
.lab-tblwrap:focus-visible { outline: 3px solid var(--amber); }
.lab-tbl { border-collapse: collapse; width: 100%; font-size: clamp(13px, 1.5vw, 16px); color: var(--ink); }
.lab-tbl caption { text-align: left; padding: 6px 10px; font-weight: 800; color: var(--muted); font-size: 13px; }
.lab-tbl th, .lab-tbl td { padding: 6px 10px; border-top: 1px solid var(--line); text-align: left; vertical-align: top; line-height: 1.4; }
.lab-tbl thead th { background: #ecfeff; }
.lab-atbl th, .lab-atbl td { text-align: center; font-weight: 800; }
.lab-atbl tbody th { text-align: left; }
.lab-atbl td.same { color: var(--ok); background: #ecfdf5; } .lab-atbl td.diff { color: var(--bad); background: #fff1f2; }
.lab-tbl .up { color: #b45309; font-weight: 800; } .lab-tbl .down { color: #1d4ed8; font-weight: 800; } .lab-tbl .same { color: var(--muted); }

/* netralisasi: keypad */
.lab-ans { display: flex; align-items: baseline; justify-content: center; gap: 10px; background: #fff; border: 4px solid var(--lab); border-radius: 20px; padding: 4px 14px; min-height: 64px; }
.lab-ansv { font-weight: 800; font-size: clamp(30px, 5vw, 48px); color: var(--ink); font-variant-numeric: tabular-nums; min-width: 2ch; text-align: right; }
.lab-unit { font-weight: 800; font-size: clamp(18px, 2.4vw, 26px); color: var(--lab); }
.lab-keys { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; width: min(380px, 100%); margin: 0 auto; }
.lab-key { min-height: clamp(48px, 8vh, 64px); border-radius: 16px; border: 3px solid var(--lab-soft); background: #fff; color: var(--ink); font: 800 clamp(22px, 3vw, 30px) var(--font); cursor: pointer; touch-action: manipulation; }
.lab-key:hover:not(:disabled) { border-color: var(--lab); }
.lab-key.fn { background: #f1f5f9; }
.lab-key:disabled { opacity: .5; cursor: default; }

/* hasil */
.lab-score { display: flex; flex-direction: column; gap: 4px; font-size: clamp(15px, 2vw, 22px); margin-bottom: 6px; }
.lab-recap { text-align: left; max-height: 36vh; overflow: auto; margin: 6px 0; }
.lab-recap:empty { display: none; }
.lab-recap h3 { margin: 4px 0 6px; font-size: 16px; }
.lab-recap ol { margin: 0; padding-left: 22px; display: grid; gap: 8px; color: var(--ink); font-size: 14px; line-height: 1.5; }
.lab-recap li span { display: block; color: var(--muted); }
.lab-recap li span.a { color: var(--ink); font-weight: 700; }

/* ---------- simulasi: titrasi ---------- */
.lab-sim { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: clamp(8px, 1.6vw, 18px); align-items: start; }
@media (max-width: 860px) { .lab-sim { grid-template-columns: 1fr; } }
.lab-sim.t3 { grid-template-columns: minmax(0, 260px) minmax(0, 1fr) minmax(0, 1.15fr); }
.lab-col { display: flex; flex-direction: column; gap: clamp(8px, 1.2vw, 12px); min-width: 0; }
@media (max-width: 1100px) { .lab-sim.t3 { grid-template-columns: minmax(0, 260px) minmax(0, 1fr); } .lab-sim.t3 > .lab-col:nth-child(3) { grid-column: 1 / -1; } }
@media (max-width: 760px) { .lab-sim.t3 { grid-template-columns: 1fr; } }
.lab-card { background: #fff; border: 3px solid var(--line); border-radius: 18px; padding: 10px 12px; min-width: 0; color: var(--ink); }
.lab-card h3 { margin: 0 0 6px; font-size: clamp(15px, 1.8vw, 18px); }
.lab-tabs { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.lab-tab { min-height: 44px; padding: 0 16px; border-radius: 999px; border: 3px solid var(--line); background: #fff; color: var(--ink); font: 800 clamp(14px, 1.6vw, 17px) var(--font); cursor: pointer; }
.lab-tab[aria-pressed="true"] { background: var(--lab); border-color: var(--lab); color: #fff; }
.lab-field { display: flex; flex-direction: column; gap: 3px; margin: 0 0 8px; }
.lab-field > span { font-weight: 800; font-size: 14px; color: var(--muted); }
.lab-field select, .lab-field input[type="text"], .lab-field input[type="number"] { font: 700 16px var(--font); min-height: 44px; padding: 6px 12px; border: 2px solid var(--line); border-radius: 14px; background: #fff; color: var(--ink); width: 100%; min-width: 0; }
.lab-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.lab-pill { min-height: 44px; min-width: 44px; padding: 0 12px; border-radius: 999px; border: 3px solid var(--line); background: #fff; color: var(--ink); font: 800 15px var(--font); cursor: pointer; }
.lab-pill:hover:not(:disabled) { border-color: var(--lab); }
.lab-pill[aria-pressed="true"] { background: var(--lab); border-color: var(--lab); color: #fff; }
.lab-pill:disabled { opacity: .45; cursor: default; }
.lab-pill .sw { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--ink2); vertical-align: -1px; margin-right: 5px; }
.lab-note { margin: 6px 0 0; font-size: 14px; font-weight: 700; color: var(--muted); line-height: 1.45; }
.lab-note.warn { color: #92400e; background: #fffbeb; border: 2px solid #fde68a; border-radius: 12px; padding: 6px 10px; }
.lab-note.good { color: #065f46; background: #ecfdf5; border: 2px solid #6ee7b7; border-radius: 12px; padding: 6px 10px; }
.lab-note.bad { color: #9f1239; background: #fff1f2; border: 2px solid #fda4af; border-radius: 12px; padding: 6px 10px; }
.lab-rig { display: grid; grid-template-columns: minmax(70px, 110px) minmax(0, 1fr); gap: 10px; align-items: end; }
.lab-rigfig { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.lab-buretbox { position: relative; width: 100%; }
.lab-buretbox .lab-buret { width: 100%; max-height: 240px; }
.lab-tetes { animation: lab-drip .5s ease-in infinite; }
@keyframes lab-drip { 0% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(26px); opacity: .1; } }
.lab-flask { width: min(100%, 150px); margin: 0 auto; }
.lab-read { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 6px; }
.lab-rd { background: #f8fafc; border: 2px solid var(--line); border-radius: 12px; padding: 4px 8px; text-align: center; }
.lab-rd small { display: block; font-size: 12px; font-weight: 700; color: var(--muted); }
.lab-rd b { font-size: clamp(16px, 2vw, 22px); font-variant-numeric: tabular-nums; }
.lab-drops { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.lab-drops .lab-pill { min-width: 64px; }
.lab-slider { width: 100%; min-height: 44px; accent-color: var(--lab); }
.lab-kurvawrap .lab-kurva { width: 100%; height: auto; display: block; max-height: 300px; }
.lab-pita { width: 100%; height: auto; display: block; }
.lab-task2 { display: grid; gap: 6px; }

/* ---------- simulasi: indikator ---------- */
.lab-bahan { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 6px; }
.lab-bh { min-height: 48px; padding: 4px 8px; border-radius: 14px; border: 3px solid var(--line); background: #fff; color: var(--ink); font: 800 14px/1.25 var(--font); cursor: pointer; text-align: center; overflow-wrap: anywhere; }
.lab-bh:hover:not(:disabled) { border-color: var(--lab); }
.lab-bh[aria-pressed="true"] { border-color: var(--lab); background: var(--lab-soft); }
.lab-gelasbox { width: min(100%, 170px); margin: 0 auto; }
.lab-lbl { display: inline-block; padding: 2px 14px; border-radius: 999px; font-weight: 800; font-size: clamp(15px, 1.9vw, 20px); border: 3px solid var(--ink2); }
.lab-lbl.asam { background: #fecaca; } .lab-lbl.netral { background: #bbf7d0; } .lab-lbl.basa { background: #bfdbfe; }
.lab-hist { display: flex; flex-wrap: wrap; gap: 6px; }
.lab-hist span { display: inline-flex; align-items: center; gap: 6px; background: #f8fafc; border: 2px solid var(--line); border-radius: 12px; padding: 2px 10px; font-size: 14px; font-weight: 700; }
.lab-hist i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ink2); display: inline-block; }
.lab-urut { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.lab-uc { position: relative; min-height: 56px; padding: 6px 10px; border-radius: 14px; border: 3px solid var(--line); background: #fff; color: var(--ink); font: 800 15px/1.25 var(--font); cursor: pointer; text-align: center; }
.lab-uc[aria-pressed="true"] { border-color: var(--lab); background: var(--lab-soft); }
.lab-uc .no { position: absolute; top: -8px; left: -6px; min-width: 26px; height: 26px; border-radius: 50%; background: var(--lab); color: #fff; font-size: 14px; display: grid; place-items: center; }
.lab-uc.good { border-color: var(--ok); background: #ecfdf5; } .lab-uc.bad { border-color: var(--bad); background: #fff1f2; }
.lab-uc small { display: block; font-size: 12px; color: var(--muted); }

@media (max-height: 520px) {
  .lab-wrap { padding: 6px 8px; gap: 4px; }
  .lab-view { gap: 6px; }
  .lab-prompt { padding: 4px 10px; min-height: 0; border-radius: 16px; border-width: 3px; }
  .lab-opt { min-height: 46px; border-width: 3px; border-radius: 14px; }
  .lab-bench { grid-template-columns: 1fr minmax(120px, 170px) 1fr; }
  .lab-mixbox { width: 84px; }
  .lab-bot .lab-svg { width: 34px; }
  .lab-bots { padding-bottom: 6px; }
  .lab-shelf { padding-top: 2px; }
  .lab-key { min-height: 44px; font-size: 22px; }
  .lab-keys { grid-template-columns: repeat(6, minmax(0, 1fr)); width: min(520px, 100%); }
  .lab-ans { min-height: 46px; }
  .lab-sb { width: 46px; height: 46px; }
}
@media (prefers-reduced-motion: reduce) { .lab-bub, .lab-tetes, .lab-pchip, .lab-mixbox.mixing .lab-pour { animation: none; } .lab-bot { transition: none; } }

/* sentuhan 44 px untuk tombol bawaan topbar dan petunjuk putar pada layar kecil */
.lab .rotate-hint button { min-height: 44px; min-width: 70px; }
@media (max-height: 520px) {
  .lab .iconbtn { min-height: 44px; min-width: 44px; }
  .lab .iconbtn.ic { width: 44px; }
  .lab .topbar { padding: 3px 8px; }
}
@media (max-height: 520px) { .lab-turn { display: none; } }
