/* Equation balancer layout; common styles live in ../resources/styles.css */
[hidden] { display: none !important; }
.wrap { grid-template-columns: 20rem minmax(0, 1fr); }
.side { overflow-y: auto; }
.side > * { flex-shrink: 0; }
.side .panel { flex: none; }
.screen-app #feedback { flex: none; min-height: 5rem; font-size: 1.15rem; }
#feedback div { margin-top: .25rem; }
#feedback .fb-head { margin: 0; font-weight: 700; }
.seg button.active { background: var(--seg-add); border-color: var(--accent); color: var(--btn-ink); }

/* ---------- Equation and particle boxes: one grid so each box sits under its formula ---------- */
.board-panel { padding: .8rem; }
#board {
    height: 100%;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: .8rem .5rem;
}
.words { grid-column: 1 / -1; text-align: center; font-size: 1.3rem; color: var(--muted); }

.species {
    container-type: inline-size;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .4rem;
}
/* --term-size is set by fitTerms() in main.js so every formula is the same size */
.term { display: flex; align-items: center; gap: .2em; width: max-content; font-size: var(--term-size, 2.4rem); }
.screen-app input.coef {
    width: 2.2em;
    padding: .05em .1em;
    font-size: .9em;
    font-weight: 800;
    text-align: center;
    color: var(--accent);
}
.formula { font-weight: 700; white-space: nowrap; }
.op { align-self: start; padding-top: .15em; font-size: 2.6rem; font-weight: 700; color: var(--muted); }

.stepper { display: flex; gap: .4rem; }
.screen-app .stepper button { width: 3rem; padding: .1rem 0; font-size: 1.4rem; line-height: 1.2; }

.pbox {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: var(--canvas);
    border: 2px solid var(--panel-border);
    border-radius: .8rem;
}
.pbox.invalid { border-color: var(--bad); }
.pdraw { position: relative; flex: 1; min-height: 0; }
.pdraw svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.pdraw text { font-family: var(--font); font-weight: 700; pointer-events: none; }
.particle circle { stroke: rgba(0, 0, 0, .45); stroke-width: 1.5; }
/* Board stays dark in every theme, so the caption uses a fixed light colour */
.pbox .cap { padding: .3rem; text-align: center; font-size: 1rem; color: #a9b3d9; }

/* ---------- Side panels ---------- */
#counts table { width: 100%; border-collapse: collapse; font-size: 1.1rem; text-align: center; }
#counts th, #counts td { padding: .25rem .4rem; border-bottom: 1px solid var(--border); }
#counts thead th { color: var(--muted); font-size: .9rem; }

.key-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem 1rem; }
.key-list li { display: flex; align-items: center; gap: .4rem; font-weight: 600; }
.swatch { width: 1.2rem; height: 1.2rem; flex: none; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .45); }
.key-note { margin: .6rem 0 0; font-size: .9rem; color: var(--muted); line-height: 1.35; }

@media (max-width: 900px) {
    body.screen-app { height: auto; overflow: auto; }
    .board-panel { min-height: 32rem; }
}
