/* Moles & Formula Mass: tool-specific layout; common styles live in ../resources/styles.css */
[hidden] { display: none !important; }
.wrap { grid-template-columns: 19rem minmax(0, 1fr) 21rem; }
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; }
.seg button { flex: 1; }
.seg button.active { background: var(--seg-add); border-color: var(--accent); color: var(--btn-ink); }

/* Topic tick boxes */
.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: question + working */
.board { display: flex; flex-direction: column; gap: 1rem; padding: 1.2rem 1.4rem; }
.question { font-size: 1.6rem; line-height: 1.35; font-weight: 600; }
.data { font-size: 1.05rem; line-height: 1.5; color: var(--muted); }
.data:empty { display: none; }
.work { display: grid; grid-template-columns: minmax(12rem, 19rem) minmax(0, 1fr); gap: 1.4rem; align-items: start; }

/* Reference column: formula triangle, pV = nRT, Mr tips */
.ref { position: sticky; top: 0; }
.tri { display: block; width: 100%; height: auto; }
.tri polygon { fill: var(--surface); stroke: var(--accent); stroke-width: 3; stroke-linejoin: round; }
.tri polygon.const { fill: var(--panel); }
.tri polygon.unknown { fill: var(--accent); }
.tri.clickable polygon:not(.const) { cursor: pointer; }
.tri.clickable polygon:not(.const):hover { fill: var(--c-primary); }
.tri text { fill: var(--ink); text-anchor: middle; pointer-events: none; font-family: var(--font); }
.tri .sym { font-size: 34px; font-weight: 700; font-style: italic; }
.tri .sym.small { font-size: 21px; font-style: normal; }
.tri .sym.smaller { font-size: 16px; font-style: normal; }
.tri .val { font-size: 15px; fill: var(--muted); }
.tri .val.tiny { font-size: 11px; }
.tri .on-unk { fill: var(--bg); }
.ref-cap { margin-top: 0.4rem; text-align: center; color: var(--muted); font-size: 0.95rem; }
.eqbox { padding: 0.8rem; text-align: center; font-size: 2.4rem; font-weight: 700; border: 3px solid var(--accent);
    border-radius: 0.8rem; background: var(--surface); }
.eqbox.formula { font-size: 2rem; font-weight: 700; }
.ref-tips { margin: 0.8rem 0 0; padding-left: 1.3rem; line-height: 1.5; color: var(--muted); }
.units-table { width: 100%; margin-top: 0.8rem; border-collapse: collapse; font-size: 1.05rem; }
.units-table td { padding: 0.25rem 0.4rem; border-bottom: 1px solid var(--border); }
.units-table td:first-child { font-weight: 700; font-style: italic; }

/* Guided steps */
.step-list { display: flex; flex-direction: column; gap: 0.6rem; margin: 0; padding: 0; list-style: none; }
.step { padding: 0.6rem 0.9rem; font-size: 1.25rem; border: 2px solid var(--border); border-radius: 0.7rem;
    background: var(--surface); }
.step.active { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.step.done { display: flex; gap: 0.6rem; border-color: var(--good); }
.step.todo { color: var(--muted); font-size: 1rem; border-style: dashed; }
.step .tick { color: var(--good); font-weight: 700; }
.step p { margin: 0 0 0.5rem; color: var(--muted); font-size: 1.02rem; }
.step p.sfnote { margin: 0.5rem 0 0; }
.part-head { margin-top: 0.3rem; color: var(--accent); font-size: 1.1rem; font-weight: 700; }
.eq { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; font-size: 1.4rem; }
.screen-app input.blank { width: 7.5rem; padding: 0.3rem 0.4rem; text-align: center; font-size: 1.3rem; }
.screen-app input.blank.wide { width: 11rem; }
.screen-app input.blank.wrong, .screen-app #ansIn.wrong { border-color: var(--bad); }
.screen-app .eq select, .screen-app .answer-row select { width: auto; }
.choices { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.screen-app .choice { width: auto; padding: 0.4rem 1rem; font-size: 1.3rem; font-weight: 600; }
.screen-app .choice.wrong { border-color: var(--bad); opacity: 0.55; }
.screen-app .step-check { width: auto; margin-top: 0.6rem; padding: 0.4rem 1.6rem; }
.table-wrap { overflow-x: auto; }
.mr-table { border-collapse: collapse; font-size: 1.2rem; }
.mr-table th, .mr-table td { padding: 0.3rem 0.7rem; text-align: center; border: 1px solid var(--border); }
.mr-table th { font-size: 0.95rem; color: var(--muted); }
.screen-app .mr-table input.blank { width: 4.5rem; }

/* Test and Quick-fire answer row */
.answer-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; font-size: 1.4rem; }
.screen-app .answer-row input { width: 14rem; font-size: 1.4rem; }
.screen-app .answer-row button, .screen-app #workingBtn { width: auto; padding: 0.5rem 1.6rem; }
.working h3 { margin: 0 0 0.5rem; }
.working ol { margin: 0; padding-left: 1.6rem; font-size: 1.2rem; line-height: 1.6; }
.working li.part-head { list-style: none; margin-left: -1.6rem; }

/* Quick-fire */
.timebar { height: 0.9rem; overflow: hidden; border-radius: 0.45rem; background: var(--track); }
.timebar div { height: 100%; width: 100%; background: var(--accent); transition: width 0.1s linear; }
.timebar.low div { background: var(--bad); }
body[data-mode="quick"] .question { font-size: 2.4rem; }
.results h2 { margin: 0 0 0.4rem; font-size: 2rem; }
.results .big { margin: 0; font-size: 3rem; font-weight: 700; color: var(--accent); }
.results ul { padding-left: 1.4rem; font-size: 1.1rem; line-height: 1.6; }

@media (max-width: 900px) {
    body.screen-app { height: auto; overflow: auto; }
    .wrap { grid-template-columns: 1fr; }
    .work { grid-template-columns: 1fr; }
    .ref { position: static; max-width: 20rem; }
}
