/* Electrochemical Cells: tool-specific layout; common styles live in ../resources/styles.css */
[hidden] { display: none !important; }
header p { flex: 1 1 0; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modeswitch { display: inline-flex; gap: 0.3rem; flex: none; }
.modeswitch .btn { width: auto; text-decoration: none; padding: 0.4rem 1.1rem; font-size: 1.1rem; white-space: nowrap; }
.modeswitch .btn.active { background: var(--accent); color: var(--bg, #06121f); border-color: var(--accent); }
.controls-inline { display: flex; gap: 0.6rem; margin-top: 0.6rem; }

/* ---------- Cell diagram (board is always dark, so colours here are fixed) ---------- */
.cell-svg { display: block; width: 100%; height: 100%; background: var(--canvas); border: 1px solid var(--panel-border); border-radius: 0.8rem; }
.cell-svg text { font-family: var(--font); fill: #e7ecff; text-anchor: middle; }
.cell-svg .lbl { font-size: 23px; font-weight: 600; }
.cell-svg .lbl.small { font-size: 21px; fill: #c3cbe8; }
.cell-svg .lbl.dim { fill: #8b96bf; }
.cell-svg .lbl.el { font-size: 24px; font-weight: 800; }
.cell-svg .lbl.mt { font-size: 17px; font-weight: 800; fill: #0b1020; }
.cell-svg .lbl.flow { font-size: 24px; font-weight: 800; fill: #ffd166; }
.cell-svg .glass { fill: none; stroke: #cfe3ff; stroke-width: 3; stroke-linejoin: round; opacity: 0.85; }
.cell-svg .wire { fill: none; stroke: #e7ecff; stroke-width: 4; stroke-linejoin: round; }
.cell-svg .bridge { fill: none; stroke: #e8dcc0; stroke-width: 22; stroke-linejoin: round; opacity: 0.9; }
.cell-svg .vm { fill: #121933; stroke: #e7ecff; stroke-width: 4; }
.cell-svg .vm-v { font-size: 26px; font-weight: 800; }
.cell-svg .vm-r { font-size: 20px; font-weight: 800; fill: #5bd1ff; }
.cell-svg .electron { fill: #ffd166; stroke: #0b1020; stroke-width: 1.5; }
.cell-svg .bubble { fill: none; stroke: #e7ecff; stroke-width: 1.5; opacity: 0.8; }
.cell-svg circle.pos { fill: #b91c1c; stroke: #fecaca; stroke-width: 2; }
.cell-svg circle.neg { fill: #1d4ed8; stroke: #bfdbfe; stroke-width: 2; }
.cell-svg .sign { font-size: 26px; font-weight: 800; }

/* ---------- Explore ---------- */
body[data-mode="explore"] .wrap { grid-template-columns: 28rem minmax(0, 1fr) 20rem; }
.series-wrap { overflow: auto; border: 2px solid var(--border); border-radius: 0.6rem; }
.series { width: 100%; border-collapse: collapse; font-size: 0.92rem; table-layout: fixed; }
.series th:nth-child(2) { width: 3.6rem; }
.series th:nth-child(3) { width: 5rem; }
.series td.heq { overflow: hidden; }
.series th { position: sticky; top: 0; padding: 0.35rem 0.4rem; text-align: left; font-size: 0.85rem; color: var(--muted); background: var(--panel); }
.series td { padding: 0.25rem 0.4rem; border-top: 1px solid var(--border); line-height: 1.3; }
.series td.e0 { white-space: nowrap; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.series td.use { white-space: nowrap; }
.screen-app .series button.lr { width: 2rem; padding: 0.15rem 0; font-size: 0.9rem; border-radius: 0.4rem; }
.screen-app .series button.lr + button.lr { margin-left: 0.25rem; }
.series tr.on-l td, .series tr.on-r td { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.series tr.on-l button[data-side="left"], .series tr.on-r button[data-side="right"] { background: var(--seg-add); border-color: var(--accent); color: var(--btn-ink); }
.series-note { margin: 0.4rem 0 0; font-size: 0.9rem; color: var(--muted); }
#controls { display: flex; flex-direction: column; }
#controls .series-wrap { flex: 1 1 auto; min-height: 0; }
.toolbar { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0.5rem; }
.screen-app .toolbar button { width: auto; padding: 0.4rem 1.2rem; }
.screen-app .toolbar label.tick { display: inline-flex; align-items: center; gap: 0.5rem; margin: 0; padding: 0.4rem 0.7rem; font-size: 1rem; font-weight: 500;
    cursor: pointer; border: 2px solid var(--border); border-radius: 0.6rem; background: var(--surface); }
.toolbar input { width: 1.2rem; height: 1.2rem; margin: 0; flex: none; accent-color: var(--accent); }

.board-col { display: flex; flex-direction: column; gap: 0.6rem; }
#board { flex: 1; min-height: 0; display: grid; place-items: center; }
#board .cell-svg { max-height: 100%; width: auto; max-width: 100%; aspect-ratio: 800 / 525; height: auto; }
.results2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.6rem; }
.card { min-width: 0; }

#results { overflow: auto; }
.card { padding: 0.6rem 0.9rem; border: 2px solid var(--border); border-radius: 0.8rem; background: var(--surface); }
.card h3 { margin: 0 0 0.3rem; font-size: 1rem; color: var(--muted); }
.card p { margin: 0.3rem 0; font-size: 1.1rem; line-height: 1.45; }
.card .big { margin: 0; font-size: 2.2rem; font-weight: 800; color: var(--accent); }
.card .note { font-size: 0.95rem; color: var(--muted); }
.card .nota { font-size: 1.2rem; font-weight: 600; }
.card .warnnote { padding: 0.4rem 0.6rem; font-size: 1rem; border-radius: 0.5rem; background: var(--err-bg); color: var(--err-ink); }
.pos-t { color: var(--bad); font-size: 1.3rem; }
.neg-t { color: var(--accent); font-size: 1.3rem; }
.screen-app .reveal { width: auto; padding: 0.35rem 1.4rem; }

/* ---------- Test ---------- */
/* Test: controls, score and feedback share the left column; the board shows the question and diagram
   beside the answer parts, so everything fits on one screen */
body[data-mode="test"] .wrap { grid-template-columns: 21rem minmax(0, 1fr); }
.leftcol > #controls { flex: none; }
body[data-mode="test"] .board { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 1.2rem; align-content: start; }
.qcol { display: flex; flex-direction: column; gap: 0.9rem; min-width: 0; }
.topics { display: flex; flex-direction: column; gap: 0.35rem; }
.screen-app .topics label.tick { display: flex; align-items: center; gap: 0.6rem; margin: 0; padding: 0.4rem 0.6rem; font-size: 1.02rem; font-weight: 500;
    cursor: pointer; border: 2px solid var(--border); border-radius: 0.6rem; background: var(--surface); }
.topics input { width: 1.2rem; height: 1.2rem; margin: 0; flex: none; accent-color: var(--accent); }
.board { display: flex; flex-direction: column; gap: 0.9rem; padding: 1.2rem 1.4rem; }
.question { font-size: 1.5rem; line-height: 1.35; font-weight: 600; }
.data { font-size: 1.2rem; line-height: 1.6; }
.data:empty { display: none; }
#diagram { width: 100%; }
#diagram .cell-svg { height: auto; }
.parts { display: flex; flex-direction: column; gap: 0.8rem; margin: 0; padding: 0; list-style: none; }
.part { padding: 0.7rem 1rem; border: 2px solid var(--border); border-radius: 0.7rem; background: var(--surface); }
.part.right { border-color: var(--good); }
.part.wrong { border-color: var(--bad); }
.part-q { margin-bottom: 0.5rem; color: var(--muted); font-size: 1.1rem; }
.part-n { font-weight: 700; color: var(--accent); }
.part-sol { margin-top: 0.6rem; padding-top: 0.5rem; font-size: 1.15rem; border-top: 1px dashed var(--border); color: var(--good); }
.eq { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; font-size: 1.4rem; }
.screen-app input.blank { width: 8rem; padding: 0.3rem 0.5rem; text-align: center; font-size: 1.3rem; }
.screen-app input.blank.wrong { border-color: var(--bad); }
.choices { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.screen-app .choice { width: auto; max-width: 100%; padding: 0.4rem 1rem; font-size: 1.15rem; font-weight: 600; text-align: left; white-space: normal; }
.nw { white-space: nowrap; }
.screen-app .choice.selected { background: var(--seg-add); border-color: var(--accent); color: var(--btn-ink); }
.test-actions { display: flex; gap: 0.6rem; }
.screen-app .test-actions button { width: auto; padding: 0.5rem 1.6rem; }

@media (max-width: 1100px) {
    body[data-mode="explore"] .wrap { grid-template-columns: 22rem minmax(0, 1fr); }
    body[data-mode="explore"] #results { grid-column: 1 / -1; }
}
@media (max-width: 1100px) {
    body[data-mode="test"] .board { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
    body.screen-app { height: auto; overflow: auto; }
    .wrap, body[data-mode="explore"] .wrap, body[data-mode="test"] .wrap { grid-template-columns: 1fr; }
    header p { white-space: normal; }
}
