/* Year 9 Science: the interactive notes pieces (Bohr guide, atom explorer,
 * "try it first"). Behaviour lives in science/static/science/ix-*.js; the
 * rules they follow are in .claude/rules/science-interactive-notes.md.
 *
 * Tokens only. Each quantity keeps ONE colour everywhere it appears (symbol
 * card, working and diagram): protons / Z, mass number A, neutrons,
 * electrons. Every piece sits in `.ix`, a size container, so it stacks by the
 * width of its column and not of the window.
 *
 * Without JavaScript the pieces fall back to plain lists (`.ix-fallback`);
 * `.ix.is-live` is set by the scripts and swaps them for the real thing. */

.ix {
    --ix-cyan-soft: color-mix(in srgb, var(--cyan) 14%, var(--paper));
    --ix-cyan-deep: color-mix(in srgb, var(--cyan) 58%, var(--ink));
    --ix-cyan-ink: color-mix(in srgb, var(--cyan) 38%, var(--ink));
    --ix-gold-soft: color-mix(in srgb, var(--gold) 14%, var(--paper));
    --ix-peach: color-mix(in srgb, var(--tangerine) 12%, var(--paper));
    --ix-peach-line: color-mix(in srgb, var(--tangerine) 35%, var(--paper));
    --ix-teal-line: color-mix(in srgb, var(--teal) 40%, var(--paper));
    --ix-slate-line: color-mix(in srgb, var(--ink) 20%, var(--paper));
    /* one colour per quantity */
    --ix-p: color-mix(in srgb, var(--tangerine) 72%, var(--ink));
    --ix-a: color-mix(in srgb, var(--gold) 58%, var(--ink));
    --ix-n: color-mix(in srgb, var(--ink) 70%, var(--paper));
    --ix-m: var(--ix-cyan-ink);
    --ix-e: var(--teal-deep);
    --ix-bad: color-mix(in srgb, var(--tangerine) 78%, var(--ink));
    container-type: inline-size;
    margin: 22px 0 26px;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--ink);
}
.ix *, .ix *::before, .ix *::after { box-sizing: border-box; }
.ix p { margin: 0; }
.ix button { font-family: inherit; }
.ix :focus-visible {
    outline: 3px solid var(--teal-deep);
    outline-offset: 3px;
    border-radius: 8px;
}

.ix-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* what is only useful with the scripts is hidden until they are running, and
   the plain fallback is hidden once they are */
.ix:not(.is-live) .ix-needs-js { display: none !important; }
.ix.is-live .ix-fallback { display: none; }
.ix-fallback { margin: 0; padding: 16px 22px 16px 40px; }
.ix-fallback li { margin: 4px 0; }

/* ---------------------------------------------------------------- card */

.ix-card {
    background: var(--paper);
    border: 2px solid var(--line);
    border-radius: 22px;
    overflow: hidden;
}
.ix-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 2px solid var(--line);
    background: var(--ix-cyan-soft);
}
.ix-ic {
    flex: none;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: var(--ix-cyan-deep);
    color: var(--paper);
}
.ix-head b { display: block; font-size: 1.02rem; line-height: 1.3; }
.ix-head small { display: block; color: var(--muted); font-size: 0.82rem; line-height: 1.3; }

.ix-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ix-chip {
    min-width: 44px;
    min-height: 44px;
    padding: 0 15px;
    border: 2px solid var(--line);
    border-radius: 999px;
    background: var(--paper);
    color: var(--ink);
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
}
.ix-chip:hover { border-color: var(--teal-deep); }
.ix-chip.is-on, .ix-chip[aria-pressed="true"] {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--paper);
}
.ix-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 20px;
    border: 2px solid transparent;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
}
.ix-btn.is-teal { background: var(--teal-deep); border-color: var(--teal-deep); color: var(--paper); }
.ix-btn.is-teal:hover { background: var(--ink); border-color: var(--ink); }
.ix-btn.is-ghost { background: var(--paper); border-color: var(--line); color: var(--teal-deep); }
.ix-btn.is-ghost:hover { border-color: var(--teal-deep); }
.ix-btn:disabled { opacity: 0.38; cursor: default; }

/* -------------------------------------------------------- the symbol card
 * One font-size drives everything, so it scales without drifting. The symbol's
 * line box is trimmed to cap height so the mass number sits level with the top
 * of the letters and the atomic number with their baseline; an empty charge
 * takes no space. */

.ix-nuclide {
    display: inline-grid;
    grid-template-columns: auto auto auto;
    grid-template-rows: auto auto;
    column-gap: 0.05em;
    font-size: 4.2rem;
    line-height: 1;
    padding: 0.2em 0.3em;
    border-radius: 0.24em;
    background: var(--ix-cyan-soft);
}
.ix-nuclide:has(.ix-q:empty) { padding-right: 0.26em; }
.ix-nuclide .ix-a, .ix-nuclide .ix-z, .ix-nuclide .ix-q {
    position: relative;
    margin: 0;
    border: 0;
    background: none;
    font: inherit;
    font-size: 0.36em;
    font-weight: 700;
    line-height: 0.8;
    padding: 0.08em 0.14em;
    border-radius: 0.25em;
    font-variant-numeric: tabular-nums;
}
.ix-nuclide .ix-a, .ix-nuclide .ix-z { grid-column: 1; text-align: right; }
.ix-nuclide .ix-a { grid-row: 1; align-self: start; margin-top: -0.095em; color: var(--ix-a); }
.ix-nuclide .ix-z { grid-row: 2; align-self: end; margin-bottom: -0.105em; color: var(--ix-p); }
.ix-nuclide .ix-sym {
    position: relative;
    grid-column: 2;
    grid-row: 1 / 3;
    margin: 0;
    border: 0;
    background: none;
    font: inherit;
    font-weight: 800;
    line-height: 0.74;
    letter-spacing: -0.02em;
    padding: 0 0.02em;
    border-radius: 0.1em;
    color: var(--ink);
}
.ix-nuclide .ix-q {
    grid-column: 3;
    grid-row: 1;
    align-self: start;
    margin-top: -0.08em;
    font-weight: 800;
    padding: 0.08em 0.1em;
    color: var(--ix-bad);
}
.ix-nuclide .ix-q:empty { display: none; }
/* tappable parts: the touch area reaches past the digits without moving them */
.ix-nuclide button { cursor: pointer; }
.ix-nuclide button::after { content: ""; position: absolute; inset: -4px -10px; }
.ix-nuclide .ix-a::after { inset: -22px -10px -2px; }
.ix-nuclide .ix-z::after { inset: -2px -10px -22px; }
.ix-nuclide .ix-q::after { inset: -14px -12px -14px; }
.ix-nuclide button:hover, .ix-nuclide button[aria-pressed="true"] { background: var(--gold); color: var(--ink); }
.ix-nuclide .ix-q:hover, .ix-nuclide .ix-q[aria-pressed="true"] { color: var(--ink); }
.ix-big .ix-nuclide { font-size: 5.6rem; }

/* ---------------------------------------------------------------- guide */

.ix-guide {
    --ix-gcard: clamp(2.8rem, 8.2cqi, 4.4rem);
    outline-offset: 4px;
}
.ix-stage {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(250px, 40cqi, 340px);
    gap: 24px;
    align-items: center;
    min-height: 380px;
    padding: 24px 26px 10px;
}
.ix-stepno {
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--teal-deep);
}
.ix-txt h3 { margin: 6px 0 10px; font-size: 1.45rem; font-weight: 700; line-height: 1.25; color: var(--ink); }
.ix-gline { margin: 0 0 18px; color: var(--muted); font-size: 1.02rem; max-width: 46ch; }
.ix-viz svg { display: block; width: 100%; height: auto; }

/* the working: large and bold, never in a box */
.ix-eqn {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 4px 14px;
    margin: 0 0 14px;
    font-size: clamp(1.3rem, 4.2cqi, 2.15rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.01em;
}
.ix-op { color: var(--muted); font-weight: 500; }
.ix-lhs { white-space: nowrap; }
/* a run of the working that must not break across lines */
.ix-grp { display: inline-flex; align-items: flex-start; gap: 0 12px; white-space: nowrap; }
.ix-v { display: inline-block; min-width: 0.6em; white-space: nowrap; transition: opacity 0.45s ease; }
.ix-c-z, .ix-c-p { color: var(--ix-p); }
.ix-c-a { color: var(--ix-a); }
.ix-c-n { color: var(--ix-n); }
.ix-c-e { color: var(--ix-e); }
.ix-fade { opacity: 0; }
.ix-later { opacity: 0; transition: opacity 0.9s ease; }
.ix-later.is-shown { opacity: 1; }
.ix-res { display: inline-block; opacity: 0; transform: scale(0.9); transition: opacity 0.9s ease, transform 0.9s ease; }
.ix-res.is-shown { opacity: 1; transform: none; }
.ix-tick { color: var(--teal); font-size: 0.9em; }
.ix-why { margin: 2px 0 12px; max-width: 46ch; color: var(--muted); font-size: 0.95rem; }
.ix-answer {
    margin: 8px 0 12px;
    font-size: clamp(1.7rem, 7cqi, 2.5rem);
    font-weight: 800;
    line-height: 1.1;
    color: var(--ix-e);
}
.ix-answer small {
    display: block;
    margin-bottom: 4px;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}
.ix-summary { max-width: 46ch; color: var(--muted); font-size: 0.95rem; }
.ix-replay {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 44px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--teal-deep);
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
}
.ix-replay:hover { text-decoration: underline; }

/* shells counting up in step 3 */
.ix-shellnum { display: inline-flex; flex-direction: column; align-items: center; min-width: 1.4em; }
.ix-shellnum b { color: var(--ix-e); }
.ix-shellnum.is-empty b { color: var(--line); }
.ix-shellnum.is-full b { color: var(--teal); }
.ix-shells { font-size: clamp(1.25rem, 3.6cqi, 1.8rem); gap: 6px 8px; }
.ix-shellnum small span { display: block; }
.ix-shellnum small {
    max-width: 6em;
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0;
    line-height: 1.2;
    text-align: center;
    color: var(--muted);
}
.ix-of { align-self: center; font-size: 0.5em; font-weight: 600; color: var(--muted); }
.ix-pace { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 6px; }
.ix-pacectl { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; flex-basis: 100%; }
.ix-seg {
    display: inline-flex;
    overflow: hidden;
    border: 2px solid var(--line);
    border-radius: 12px;
    background: var(--paper);
}
.ix-seg button {
    min-height: 44px;
    padding: 0 14px;
    border: 0;
    background: none;
    color: var(--ink);
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
}
.ix-seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.ix-seg button:focus-visible { outline-offset: -3px; }

/* card with its name labels on lines */
/* Step 1: the card and its caption sit together, centred in a column as tall
   as the text beside it. As a two-row grid they were pulled to opposite ends
   of a short box and left a blank band under the card. */
.ix-gcardwrap { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 340px; }
.ix-gcardwrap .ix-nuclide { font-size: var(--ix-gcard); }
.ix-cardcap { margin: 10px 0 0; font-weight: 700; color: var(--muted); text-align: center; }
.ix-gsplit { display: grid; justify-items: center; gap: 10px; }
.ix-gsplit.is-nucleus svg { max-width: 180px; }
.ix-gsplit svg { max-width: 300px; }
.ix-gsplit .ix-anncard .ix-nuclide { font-size: var(--ix-gcard); }
.ix-anncard { display: grid; grid-template-columns: auto auto; align-items: stretch; gap: 0; }
.ix-lbls { display: flex; flex-direction: column; justify-content: space-between; padding: 0.55em 0; }
.ix-lbl {
    position: relative;
    padding-right: 40px;
    font-size: 0.86rem;
    font-weight: 700;
    line-height: 1.3;
    text-align: right;
    white-space: nowrap;
    transition: opacity 0.9s ease;
}
.ix-lbl::after { content: ""; position: absolute; right: 6px; top: 50%; width: 28px; border-top: 2px solid currentColor; opacity: 0.7; }
.ix-lbl-a { color: var(--ix-a); }
.ix-lbl-z { color: var(--ix-p); }
.ix-lbl.is-gone { opacity: 0; }
.ix-gcard .ix-a, .ix-gcard .ix-z { transition: opacity 0.45s ease; }

.ix-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 14px;
    padding: 14px 28px 20px;
    border-top: 2px solid var(--line);
}
.ix-dots { display: flex; gap: 8px; margin-right: auto; }
.ix-dots i { width: 30px; height: 8px; border-radius: 99px; background: var(--line); }
.ix-dots i.is-on { background: var(--teal-deep); }
.ix-dots i.is-done { background: var(--teal); }
.ix-try {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 12px 28px;
    border-top: 2px solid var(--line);
    background: var(--cream);
    font-size: 0.9rem;
    font-weight: 600;
}

/* key under every diagram */
.ix-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    justify-content: center;
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.82rem;
}
.ix-legend span { display: inline-flex; align-items: center; gap: 6px; }
.ix-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; }
.ix-legend .ix-lp { background: var(--tangerine); }
.ix-legend .ix-ln { border: 2px solid var(--ink); background: var(--paper); }
.ix-legend b { color: var(--ix-e); font-size: 1.1rem; line-height: 1; }

/* the Bohr drawing (booklet style: crosses for electrons, filled proton,
   empty neutron) */
.ix-shell { fill: none; stroke: var(--line); stroke-width: 2.5; }
.ix-shell.is-hl { stroke: var(--gold); stroke-width: 4; }
.ix-nuc { fill: var(--ix-peach); stroke: var(--ix-peach-line); stroke-width: 2; }
.ix-np { fill: var(--tangerine); }
.ix-nn { fill: var(--paper); stroke: var(--ink); stroke-width: 1.8; }
.ix-edisc { fill: var(--paper); }
.ix-ex { stroke: var(--ix-e); stroke-width: 3.4; stroke-linecap: round; }
.ix-nt-p, .ix-nt-n { text-anchor: middle; font-family: inherit; font-weight: 800; }
.ix-nt-p { fill: var(--ink); }
.ix-nt-n { fill: var(--muted); font-weight: 700; }

/* ------------------------------------------------------------- explorer */

.ix-xgrid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 26px;
    padding: 24px 28px;
}
.ix-xleft, .ix-xright { min-width: 0; }
.ix-callout { min-height: 3.2em; margin-top: 14px; font-size: 0.98rem; }
.ix-callout b, .ix-xwhat b, .ix-stat b { color: var(--teal-deep); }
.ix-xviz { max-width: 260px; margin-top: 4px; }
.ix-xviz svg { display: block; width: 100%; height: auto; }
.ix-counters { display: grid; gap: 10px; }
.ix-counter {
    display: grid;
    grid-template-columns: 1fr auto 3ch auto;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border: 2px solid var(--line);
    border-radius: 14px;
    background: var(--paper);
}
.ix-counter.is-p { border-color: var(--ix-peach-line); }
.ix-counter.is-n { border-color: var(--ix-slate-line); }
.ix-counter.is-e { border-color: var(--ix-teal-line); }
.ix-counter .ix-nm { font-weight: 700; line-height: 1.25; }
.ix-counter.is-p .ix-nm { color: var(--ix-p); }
.ix-counter.is-n .ix-nm { color: var(--ix-n); }
.ix-counter.is-e .ix-nm { color: var(--ix-e); }
.ix-nm small { display: block; font-size: 0.8rem; font-weight: 500; color: var(--muted); }
.ix-counter output { font-size: 1.4rem; font-weight: 800; text-align: center; }
.ix-counter button {
    width: 44px;
    height: 44px;
    border: 2px solid var(--line);
    border-radius: 12px;
    background: var(--paper);
    color: var(--ink);
    font-size: 1.2rem;
    font-weight: 800;
    cursor: pointer;
}
.ix-counter button:hover:not(:disabled) { border-color: var(--teal-deep); }
.ix-counter button:disabled { opacity: 0.35; cursor: default; }
.ix-xwhat { margin-top: 16px; font-size: 0.95rem; }
.ix-xwhat:empty { display: none; }
.ix-stat {
    display: grid;
    grid-template-columns: 72px 14px minmax(0, 1fr);
    gap: 4px 10px;
    align-items: start;
    margin-top: 10px;
    padding: 11px 14px;
    border: 2px solid var(--line);
    border-radius: 14px;
    background: var(--paper);
    font-size: 0.93rem;
    line-height: 1.5;
}
.ix-stat .ix-lab {
    padding-top: 3px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}
.ix-stat .ix-dot { width: 14px; height: 14px; margin-top: 4px; border-radius: 50%; background: var(--teal); }
.ix-stat.is-ok { border-color: var(--teal); background: var(--mint); }
.ix-stat.is-warn { border-color: var(--gold); background: var(--ix-gold-soft); }
.ix-stat.is-warn .ix-dot { background: var(--gold); }
.ix-stat.is-bad { border-color: var(--tangerine); background: var(--ix-peach); }
.ix-stat.is-bad .ix-dot { background: var(--tangerine); }
.ix-stat .ix-fix { grid-column: 3; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.ix-stat .ix-fix .ix-chip { font-size: 0.84rem; padding: 0 12px; }
.ix-facts { display: grid; gap: 6px; margin-top: 14px; }
.ix-facts div {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 2px 12px;
    padding: 7px 12px;
    border-radius: 12px;
    background: var(--cream);
    color: var(--muted);
    font-size: 0.84rem;
}
.ix-facts b { color: var(--ink); font-size: 1rem; white-space: nowrap; }
.ix-presets { padding: 12px 28px 18px; border-top: 2px solid var(--line); background: var(--cream); }
.ix-presets > span { margin-right: 4px; color: var(--muted); font-size: 0.82rem; font-weight: 700; }
.ix-xsrc {
    margin: 0;
    padding: 10px 28px 14px;
    border-top: 1px solid var(--line);
    background: var(--cream);
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.5;
}
.ix-xsrc a { color: var(--teal-deep); font-weight: 600; }

/* ------------------------------------------------------ metals and acid
 * Five test tubes, the metal waiting above each until it is dropped in. The
 * metal and the bubbles are redrawn from state every frame, so none of it has
 * a CSS animation. */

.ix-acid {
    --ix-acid: color-mix(in srgb, var(--tangerine) 85%, var(--ink));
    --ix-glass: color-mix(in srgb, var(--ink) 28%, var(--paper));
    --ix-bubble: color-mix(in srgb, var(--cyan) 62%, var(--ink));
}
.ix-astage { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); }
.ix-asvg { display: block; width: 100%; height: auto; }
.ix-ahit { fill: transparent; pointer-events: all; }
.ix-aglass { fill: var(--paper); stroke: var(--ix-glass); stroke-width: 3; }
.ix-aliq { fill: var(--ix-cyan-soft); stroke: none; }
.ix-abub { fill: var(--paper); stroke: var(--ix-bubble); stroke-width: 1.5; }
.ix-ametal { stroke: var(--ix-slate-line); stroke-width: 1.5; fill: var(--ix-glass); }
.ix-ametal.is-cu { fill: color-mix(in srgb, var(--tangerine) 78%, var(--ink)); }
.ix-ametal.is-zn { fill: color-mix(in srgb, var(--ink) 38%, var(--paper)); }
.ix-ametal.is-mg { fill: color-mix(in srgb, var(--ink) 12%, var(--paper)); }
.ix-ametal.is-fe { fill: color-mix(in srgb, var(--ink) 72%, var(--paper)); }
.ix-ametal.is-ca { fill: color-mix(in srgb, var(--gold) 20%, var(--paper)); }
.ix-atube { cursor: pointer; }
.ix-atube:hover .ix-aglass, .ix-atube:focus-visible .ix-aglass { stroke: var(--teal-deep); stroke-width: 4.5; }
.ix-atube.is-done { cursor: default; }
.ix-atube.is-done .ix-aglass { stroke: var(--teal); }
.ix-asym { font-family: inherit; font-size: 26px; font-weight: 800; text-anchor: middle; fill: var(--ink); }
.ix-aname { font-family: inherit; font-size: 18px; font-weight: 600; text-anchor: middle; fill: var(--muted); }
.ix-agas { font-family: inherit; font-size: 22px; font-weight: 700; fill: var(--ix-e); }
.ix-aleader { fill: none; stroke: var(--ix-e); stroke-width: 2; stroke-linecap: round; }
.ix-astick { stroke: var(--ix-a); stroke-width: 6; stroke-linecap: round; }
.ix-aflame { fill: var(--gold); }
.ix-aflame.is-out { fill: var(--paper); stroke: var(--line); stroke-width: 2; }
.ix-aburst { stroke: var(--tangerine); stroke-width: 4; stroke-linecap: round; }
.ix-apop { font-family: inherit; font-size: 44px; font-weight: 900; fill: var(--ix-acid); }
.ix-acap { margin-top: 6px; color: var(--muted); font-size: 0.88rem; text-align: center; }
.ix-ladderwrap { margin-top: 8px; }
.ix-ladderhead {
    margin: 0 0 6px;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}
.ix-ladder { margin: 0; padding-left: 1.4em; font-size: 1.05rem; }
.ix-ladder li { margin: 4px 0; }
.ix-ladder span { margin-left: 8px; color: var(--muted); font-size: 0.92rem; }
.ix-acount { margin-top: 6px; color: var(--muted); font-size: 0.88rem; }
.ix-pickhead { margin: 0 0 6px; font-size: 0.95rem; font-weight: 700; }
.ix-pickm { margin-bottom: 16px; }
.ix-weq {
    display: grid;
    grid-template-columns: 1.1em minmax(0, 1fr);
    gap: 2px 8px;
    align-items: baseline;
    font-size: clamp(1.3rem, 3.4cqi, 1.7rem);
}
.ix-weq .ix-op { text-align: center; }
.ix-pacectl + .ix-answer { margin-top: 20px; }
.ix-aresult { font-size: clamp(1.35rem, 4.4cqi, 1.8rem); line-height: 1.2; }
.ix-afocus { fill: none; stroke: transparent; stroke-width: 3; pointer-events: none; }
.ix-atube:focus { outline: none; }
.ix-atube:focus-visible .ix-afocus { stroke: var(--teal-deep); }
.ix-c-acid { color: var(--ix-acid); }
.ix-c-h { color: var(--ix-e); }
.ix-c-blank { color: var(--muted); }
.ix-asalt { color: var(--muted); }
.ix-asalt.is-named { color: var(--ix-a); }

/* ------------------------------------------------- electron transfer guide
 * Dot-and-cross as in the booklet: the metal's electrons are dots, the
 * non-metal's are crosses. The SVG is redrawn from state every frame, so it
 * carries no CSS animation: an entry animation would replay on each redraw. */

.ix-btn[hidden] { display: none; }
.ix-xstage { grid-template-columns: 1fr; align-items: start; min-height: 0; }
.ix-xholder { width: 100%; }
.ix-xsvg { display: block; width: 100%; height: auto; }
.ix-xshell { fill: none; stroke: var(--line); stroke-width: 2.5; }
.ix-xshell.is-outer { stroke: var(--ix-teal-line); }
.ix-xnuc.is-metal { fill: var(--ix-cyan-soft); stroke: var(--cyan); stroke-width: 2; }
.ix-xnuc.is-non { fill: var(--ix-peach); stroke: var(--tangerine); stroke-width: 2; }
.ix-xsym { font-family: inherit; font-size: 21px; font-weight: 800; text-anchor: middle; fill: var(--ink); }
.ix-xdot { fill: var(--ix-e); }
.ix-xcross line { stroke: var(--ink); stroke-width: 3.2; stroke-linecap: round; }
.ix-xbr { fill: none; stroke: var(--ink); stroke-width: 2.5; }
.ix-xq { font-family: inherit; font-size: 30px; font-weight: 800; }
.ix-xq.is-pos { fill: var(--ix-m); }
.ix-xq.is-neg { fill: var(--ix-p); }
.ix-xname { font-family: inherit; font-size: 22px; font-weight: 700; text-anchor: middle; fill: var(--muted); }
.ix-xpull { font-family: inherit; font-size: 40px; font-weight: 800; text-anchor: middle; fill: var(--gold); }
.ix-latm { fill: var(--ix-cyan-soft); stroke: var(--cyan); stroke-width: 2; }
.ix-latn { fill: var(--ix-peach); stroke: var(--tangerine); stroke-width: 2; }
.ix-latm.is-first, .ix-latn.is-first { stroke: var(--gold); stroke-width: 4; }
.ix-lt { font-family: inherit; font-size: 15px; font-weight: 800; text-anchor: middle; fill: var(--ink); }
.ix-xeq { gap: 4px 22px; }
.ix-gline + .ix-answer { margin-top: 18px; }
.ix-xrow { display: inline-flex; gap: 10px; align-items: baseline; white-space: nowrap; }
.ix-xarr { color: var(--ink); }
.ix-c-m { color: var(--ix-m); }
.ix-c-nm { color: var(--ix-p); }
.ix-res.is-pos { color: var(--ix-m); }
.ix-res.is-neg { color: var(--ix-p); }
.ix-legend .ix-ldot { background: var(--ix-e); }
.ix-formula { display: inline-block; margin-left: 0.2em; color: var(--ink); }

/* ---------------------------------------------------------- try it first */

.ix-tryfirst {
    padding: 22px 26px;
    border: 2px solid var(--line);
    border-left: 6px solid var(--ix-cyan-deep);
    border-radius: 18px;
    background: var(--paper);
}
.ix-tag {
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ix-cyan-ink);
}
.ix-q { margin: 4px 0 14px; font-size: 1.15rem; font-weight: 700; line-height: 1.5; }
.ix-answer-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ix-answer-row input {
    width: 110px;
    min-height: 44px;
    padding: 6px 12px;
    border: 2px solid var(--line);
    border-radius: 12px;
    background: var(--paper);
    color: var(--ink);
    font: inherit;
    font-size: 1.2rem;
    font-weight: 700;
}
.ix-fb { margin: 12px 0 0; font-weight: 600; }
.ix-fb:empty { display: none; }
.ix-fb.is-ok { color: var(--teal-deep); }
.ix-fb.is-no { color: var(--ix-bad); }
.ix-steps { margin: 14px 0 0; padding-left: 1.3em; }
.ix-steps li { margin: 6px 0; }
.ix-steps li[hidden] { display: none; }

/* ------------------------------------------------------ narrow columns */

@container (max-width: 600px) {
    .ix-guide {
        --ix-gcard: 3.8rem;
    }
    .ix-stage, .ix-xgrid { grid-template-columns: 1fr; }
    .ix-gcardwrap { min-height: 0; }
    .ix-stage { min-height: 0; gap: 18px; padding: 22px 20px 8px; }
    .ix-xgrid { gap: 20px; padding: 20px; }
    .ix-viz { width: 100%; max-width: 320px; margin-inline: auto; }
    .ix-foot { padding: 12px 20px 18px; }
    .ix-try, .ix-presets, .ix-xsrc { padding-left: 20px; padding-right: 20px; }
    .ix-xviz { margin-inline: auto; }
}
@container (max-width: 440px) {
    .ix-head { padding: 12px 14px; }
    .ix-big .ix-nuclide { font-size: 4.2rem; }
    /* three atoms across a phone: the labels would be unreadably small and
       collide, and step 4 names the ions in words */
    .ix-xsvg.is-three .ix-xname { display: none; }
    .ix-counter { grid-template-columns: minmax(0, 1fr) auto 2.4ch auto; gap: 6px; padding: 6px 8px; }
    .ix-stat { grid-template-columns: 14px minmax(0, 1fr); }
    .ix-stat .ix-lab { grid-column: 2; padding-top: 0; }
    .ix-stat .ix-dot { grid-column: 1; grid-row: 1; }
    .ix-stat .ix-msg { grid-column: 1 / -1; }
    .ix-stat .ix-fix { grid-column: 1 / -1; }
    .ix-tryfirst { padding: 18px 16px; }
    .ix-dots { flex-basis: 100%; }
    .ix-dots i { width: 22px; }
    .ix-foot .ix-btn { flex: 1 1 0; }
}

@media (prefers-reduced-motion: reduce) {
    .ix *, .ix *::before, .ix *::after { transition: none !important; }
}

/* "type -> or =": the font would draw -> as an arrow, which defeats the line. */
.ix-tline { font-feature-settings: "calt" 0; }
