/* Galvanic cell — scoped styles */
.sim-panel .gc-eqs { display: flex; flex-direction: column; gap: 6px; direction: ltr; }
.sim-panel .gc-eq {
  display: flex; flex-direction: column; gap: 2px;
  padding: 7px 9px; border-radius: 9px; background: var(--surface-2);
  border-inline-start: 4px solid var(--line-strong); font-size: 13px; color: var(--ink-2);
}
[dir="rtl"] .sim-panel .gc-eq b { direction: rtl; text-align: right; }
.sim-panel .gc-eq b { font-size: 11.5px; font-weight: 700; letter-spacing: .02em; color: var(--muted); }
.sim-panel .gc-eq span { font-family: "Cambria Math", "STIX Two Math", Georgia, serif; font-size: 16px; color: var(--ink); }
.sim-panel .gc-eq small { font-size: 11px; color: var(--muted); }
.sim-panel .gc-eq.an { border-color: #dc2626; }
.sim-panel .gc-eq.an b { color: #b91c1c; }
.sim-panel .gc-eq.ca { border-color: #2563eb; }
.sim-panel .gc-eq.ca b { color: #1d4ed8; }
.sim-panel .gc-eq.all { border-color: var(--subject); }
.sim-panel .gc-eq.wait { font-style: italic; border-color: var(--subject); }
[dir="rtl"] .sim-panel .gc-eq.wait { direction: rtl; text-align: right; }

.sim-panel .gc-formula { font-size: 15px; line-height: 1.6; }
.sim-panel .gc-formula sub { font-size: 10.5px; }
.sim-panel .gc-nernst { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line-strong); font-size: 14px; }
.sim-panel .gc-nernst .frac { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; font-size: 11.5px; line-height: 1.15; }
.sim-panel .gc-nernst .frac span:first-child { border-bottom: 1px solid currentColor; padding: 0 2px; }

.sim-panel .gc-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sim-panel .gc-table th { text-align: start; font-size: 11.5px; color: var(--muted); font-weight: 700; padding: 0 6px 4px; }
.sim-panel .gc-table th:last-child, .sim-panel .gc-table td:last-child { text-align: end; white-space: nowrap; font-family: var(--mono); }
.sim-panel .gc-table td { padding: 4px 6px; border-top: 1px solid var(--line); color: var(--ink-2); }
.sim-panel .gc-table td:first-child { font-family: "Cambria Math", "STIX Two Math", Georgia, serif; font-size: 14.5px; }
[dir="rtl"] .sim-panel .gc-table td:first-child { text-align: right; }
.sim-panel .gc-table tr.sel td { background: var(--subject-soft); color: var(--ink); font-weight: 600; }
.sim-panel .gc-table tr.is-an td { background: #fdecec; }
.sim-panel .gc-table tr.is-ca td { background: #e8effd; }
.sim-panel .gc-table em {
  display: inline-block; margin-inline-start: 6px; padding: 0 6px; border-radius: 999px;
  font: 700 10.5px/17px system-ui, sans-serif; font-style: normal; color: #fff; background: #64748b; vertical-align: 1px;
}
.sim-panel .gc-table tr.is-an em { background: #dc2626; }
.sim-panel .gc-table tr.is-ca em { background: #2563eb; }

/* metal picker on the stage */
.sim-stage .gc-picker {
  position: absolute; z-index: 3; width: 236px; padding: 10px;
  background: rgba(255, 255, 255, .97); border: 1px solid var(--line-strong); border-radius: 14px;
  box-shadow: var(--shadow-lg, 0 10px 30px rgba(20, 26, 46, .2));
}
.sim-stage .gc-picker-title { font-size: 12px; font-weight: 700; color: var(--muted); margin: 0 2px 8px; }
.sim-stage .gc-picker-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.sim-stage .gc-picker button {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; color: var(--ink);
}
.sim-stage .gc-picker button:hover:not(:disabled) { border-color: var(--subject); }
.sim-stage .gc-picker button.on { border-color: var(--subject); background: var(--subject-soft); }
.sim-stage .gc-picker button:disabled { opacity: .35; cursor: not-allowed; }
.sim-stage .gc-picker i { width: 30px; height: 10px; border-radius: 3px; display: block; }
.sim-stage .gc-picker b { font-size: 14px; }
.sim-stage .gc-picker small { font-size: 10.5px; color: var(--muted); font-family: var(--mono); }

/* narrow screens: give the stage the scene's own aspect ratio instead of 62vh */
@media (max-width: 860px) {
  body.sim-body .sim-stage { height: min(62vh, calc(100vw * 0.76 + 12px)); min-height: 240px; }
  body.sim-body .sim-stage .stage-hint { white-space: normal; text-align: center; width: max-content; max-width: calc(100% - 24px); }
}

/* RTL: keep numeric read-outs ("1,00 mol/L", "14,7 g (−0,27)") in LTR order */
[dir="rtl"] .sim-panel output { direction: ltr; unicode-bidi: isolate; }
.sim-panel .gc-formula b { font-weight: 700; }
