/* Balancing Equations: additions to /resources/chem-10/styles.css */
.eqn { display: inline-flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: .15em .3em; }
.eqn .term { white-space: nowrap; }
.eqn .cf { margin-right: .06em; }
.eqn sub, .bal-eq sub, .word-eq sub, .lesson sub { font-size: .62em; line-height: 0; vertical-align: -0.25em; }
.op { color: var(--muted); font-weight: 600; margin: 0 .1em; }
.arrow { color: var(--muted); font-weight: 600; margin: 0 .2em; }
.ph { font-size: .55em; font-weight: 600; color: var(--muted); margin-left: .08em; }
.ph.hl, .arrow.hl, .cf.hl { color: var(--hl-ink); }
.q-main.eq-main { font-size: 1.75rem; font-weight: 700; }
.q-main.eq-main.small { font-size: 1.25rem; color: var(--muted); }
.q-main.eq-main.words, .q-word { font-size: 1.2rem; font-weight: 600; line-height: 1.45; margin-top: 8px; }
.q-word .op, .q-word .arrow { margin: 0 .15em; }
@media (max-width: 420px) { .q-main.eq-main { font-size: 1.45rem; } }

/* Menu additions */
.game-row .gt { display: flex; flex-direction: column; }
.game-row .gt small { color: var(--muted); font-size: .8rem; }
.game-row .mastered { margin-left: auto; color: #fff; background: var(--good); border-radius: 999px; width: 24px; height: 24px; display: grid; place-items: center; font-size: .8rem; font-weight: 800; flex: none; }
@media (prefers-color-scheme: dark) { .game-row .mastered { background: #1f9d5c; } }
:root[data-theme="dark"] .game-row .mastered { background: #1f9d5c; }
.game-row .mastered + .pr { margin-left: 8px; }
.lesson-row .num { font-size: 1.1rem; }
.type-pick { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; margin-bottom: 10px; }
.type-pick .btn { min-height: 64px; font-size: .98rem; padding: 8px; }
.type-pick .btn small { display: block; font-weight: 500; font-size: .78rem; opacity: .85; }
.sheet { max-height: 92dvh; overflow-y: auto; }
.lesson ol { padding-left: 1.2em; margin: 8px 0; }
.lesson li { margin: 10px 0; }
.lesson .ex { background: var(--bg); border-radius: 10px; padding: 8px 10px; margin-top: 6px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Choices that hold equations */
.choices.wide { grid-template-columns: 1fr; }
.choices.wide .choice { min-height: 56px; font-size: 1.05rem; text-align: left; padding: 12px 34px 12px 14px; }
.choices.skel .choice { font-size: 1.25rem; text-align: center; }
.choices.skel .choice .eqn { justify-content: center; }
.choices.skel .op, .choices.skel .arrow { color: rgba(255, 255, 255, .8); }
.step-label { font-weight: 700; color: var(--muted); margin: 4px 0 8px; font-size: .95rem; }
.step-note { margin: 10px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--bad-bg); font-weight: 600; font-size: .95rem; }

/* Balancing steppers */
.bal { margin-top: 14px; }
.bal-eq { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 4px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 14px 8px; box-shadow: var(--shadow); font-size: 1.5rem; font-weight: 700; }
.bal-eq .bt { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.stepper { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; }
.st { width: 40px; height: 30px; border-radius: 9px; border: 1px solid var(--line); background: var(--bg); font-size: 1.15rem; font-weight: 800; line-height: 1; padding: 0; }
.st:active { background: var(--accent); color: var(--accent-ink); }
.cf-in { width: 40px; height: 40px; text-align: center; border-radius: 10px; border: 2px solid var(--line); background: var(--bg); color: var(--ink); font-size: 1.3rem; font-weight: 800; padding: 0; }
.cf-in::placeholder { color: var(--muted); opacity: .45; }
.cf-in:focus { outline: none; border-color: var(--accent); }
.bal.done-ok .cf-in { border-color: var(--good); }
.bal.done-bad .cf-in { border-color: var(--bad); }
.bal-eq .op, .bal-eq .arrow { font-size: 1.2rem; }
@media (max-width: 420px) { .bal-eq { font-size: 1.25rem; } .st { width: 36px; } .cf-in { width: 36px; height: 36px; font-size: 1.15rem; } }
.tally-btn { margin-top: 6px; }
.tally { margin: 10px auto 0; max-width: 320px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; font-variant-numeric: tabular-nums; }
.tally .tr { display: grid; grid-template-columns: 1fr 1fr 1fr; text-align: center; padding: 6px 4px; border-top: 1px solid var(--line); font-weight: 700; }
.tally .tr.th { border-top: 0; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; background: var(--card); }
.tally .tr.even { color: var(--good); }
.tally .tr.even span:last-child::after { content: " ✓"; }
.bal-msg { text-align: center; }
.alg { margin-top: 10px; border: 1px dashed var(--line); border-radius: 14px; padding: 10px 12px; text-align: center; }
.alg-eq { font-size: 1.1rem; font-weight: 700; }
.ltr { color: var(--accent); font-weight: 800; margin-right: .1em; }
.sys { font-variant-numeric: tabular-nums; font-weight: 600; margin-top: 8px; line-height: 1.6; }
.sys .let { color: var(--muted); font-size: .9rem; }
.qcard .sys { font-size: 1.05rem; }

/* Level prompts */
#nudge:empty { display: none; }
.nudge { margin: 8px 0 0; padding: 12px 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow); animation: nudgeIn .3s ease-out; }
.nudge.up { border-color: color-mix(in srgb, var(--good) 55%, var(--line)); }
.nudge .nt { font-size: .98rem; }
.nudge .nb { display: flex; gap: 8px; margin-top: 10px; }
.nudge .nb .btn { min-height: 44px; padding: 8px 12px; font-size: .98rem; }
#suggest .nudge { margin: 12px 0; }
@keyframes nudgeIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.qcard.compact { min-height: 0; padding: 16px; }
.qcard.compact .q-label { font-size: 1rem; }
.eqn .term > .op, .eqn .term > .arrow { margin: 0 .3em 0 0; }
.bal-eq .bt > .op, .bal-eq .bt > .arrow { margin: 0 .25em 0 .1em; }
.type-checks { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; margin: 4px 0 14px; }
.type-checks .check { margin: 8px 0; color: var(--ink); font-weight: 600; font-size: .98rem; }
@media (max-width: 380px) { .type-checks { grid-template-columns: 1fr; } }
.q-ctx { font-size: 1.15rem; font-weight: 600; margin-top: 10px; }
.eword { font-style: italic; font-weight: 600; color: var(--muted); font-size: .8em; }
.arrow.cond { position: relative; display: inline-block; text-align: center; margin-top: .55em; }
.arrow.cond small { position: absolute; left: 0; right: 0; bottom: 100%; font-size: .4em; font-weight: 600; line-height: 1.1; white-space: nowrap; }
