/*
 * Periodic Table (Elemental): the tool's own components, styled in the site's design language (12 Nov 2026, automatic mode,
 * on the UltraCompress Pro template). The first part copies the Love Calculator's shared block (tokens, page, hero, buttons,
 * toolbar and pill tabs, fields, windows, toasts, information sections). Base: /libs/site-pages.css (tokens, Inter and
 * Space Grotesk, theme toggle, focus rings) and /libs/shared-nav.css (the site's header and footer). The second part is the
 * original's components (the table and its squares, the temperature and history dials, the legend, the element window,
 * the charts, Compare, the Lab and its 3D molecules, the quiz) on the site's tokens, with the original's family colours as
 * the tool's own. The original's top bar, bottom tab bar, segmented controls and its own page colours are gone. Light is the
 * default; dark applies when <html> has no data-theme. Written once from the Love Calculator's file and the original's
 * styles, then edited by hand: this file is the source.
 */


/* ----- Tokens the tool adds ----- */
:root {
    --surface: #ffffff;
    --surface-2: #f3f4f8;
    --ring: rgba(139, 92, 246, 0.18);
    --app-max: 1600px;
    --radius-lg: 16px;
    --line: rgba(0, 0, 0, 0.1);
    --line-strong: rgba(0, 0, 0, 0.24);
    --ok: #166534;
    --ok-soft: rgba(22, 101, 52, 0.09);
    --bad: #b91c1c;
    --bad-soft: rgba(185, 28, 28, 0.08);
    --warn: #92400e;
    --warn-soft: rgba(217, 119, 6, 0.1);
}
:root:not([data-theme="light"]) {
    --surface: #14141f;
    --surface-2: rgba(255, 255, 255, 0.05);
    --line: rgba(255, 255, 255, 0.1);
    --line-strong: rgba(255, 255, 255, 0.26);
    --ok: #4ade80;
    --ok-soft: rgba(74, 222, 128, 0.1);
    --bad: #f87171;
    --bad-soft: rgba(248, 113, 113, 0.1);
    --warn: #fbbf24;
    --warn-soft: rgba(251, 191, 36, 0.1);
}

/* ----- Page: full width, the page provides the side space ----- */
.container.app-container { max-width: calc(var(--app-max) + 2 * var(--content-gutter)); margin-top: 16px; }
@media (min-width: 640px) { .container.app-container { margin-top: 24px; } }

/* ----- The site header is the first thing on the page and stays at the top ----- */
body { padding-top: 0; }
body > header { position: sticky; top: 0; z-index: 50; }
header .site-nav { position: relative; top: auto; }
.theme-toggle { top: 90px; }
@media (max-width: 639.98px) { .theme-toggle { top: 75px; } } /* the header is 81 px tall from 640 px, 65 px below */
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ----- Hero ----- */
.app-hero { margin: 0 0 2rem; text-align: center; }
.app-brand { display: inline-flex; align-items: center; gap: 12px; margin-bottom: 1.25rem; font-family: 'Space Grotesk', 'Inter', sans-serif; font-weight: 700; font-size: 1.1rem; color: var(--text-strong); }
.app-brand img { width: 44px; height: 44px; border-radius: 12px; display: block; }
.app-hero h1 { margin-bottom: 0.75rem; }
.app-tagline { color: var(--text-2); font-size: 1.125rem; line-height: 1.6; max-width: 46rem; margin: 0 auto; }

/* ----- Small helpers ----- */
main [hidden], .dialog [hidden] { display: none !important; } /* the script hides fields that carry their own display */
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--text-2); }
.small { font-size: 0.9rem; }
.block { display: block; }
.hint { color: var(--text-3); font-size: 0.8rem; font-weight: 400; line-height: 1.45; }
.err { color: var(--bad); font-size: 0.85rem; font-weight: 600; }
.err:empty { display: none; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--link); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.link:hover { color: var(--link-hover); }
code { font-size: 0.85em; padding: 1px 6px; border-radius: 6px; background: var(--code-bg); color: var(--code-text); }
kbd { font-family: inherit; font-size: 0.72rem; font-weight: 700; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--chip-border); background: var(--chip); color: var(--text-strong); }

/* ----- Buttons ----- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 9999px; font-family: inherit; font-weight: 600; font-size: 0.95rem; line-height: 1.2; padding: 12px 24px; cursor: pointer; text-decoration: none; white-space: nowrap; transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, color 0.2s ease, background 0.2s ease; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn .ico { width: 17px; height: 17px; }
.btn-primary { background: var(--gradient-brand); color: #fff; box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3); }
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--text-strong); border: 1px solid var(--surface-border); padding: 11px 23px; }
.btn-secondary:hover:not(:disabled) { border-color: var(--brand); color: var(--link); transform: translateY(-2px); }
.btn-danger { background: var(--surface); color: var(--danger); border: 1px solid rgba(185, 28, 28, 0.35); padding: 11px 23px; }
.btn-danger:hover:not(:disabled) { background: var(--danger-strong); color: #fff; border-color: transparent; transform: translateY(-2px); }
.btn-sm { font-size: 0.85rem; padding: 9px 16px; }
.btn-secondary.btn-sm, .btn-danger.btn-sm { padding: 8px 15px; }
.btn-stack { display: flex; flex-wrap: wrap; gap: 8px; }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid transparent; background: transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: var(--text-2); flex-shrink: 0; padding: 0; font-family: inherit; transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease; }
.icon-btn:hover { border-color: var(--brand); color: var(--link); background: var(--surface); }
.icon-btn.del:hover { border-color: var(--danger); color: var(--danger); }
.icon-btn:focus-visible, .link:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ----- Toolbar ----- */
.app-shell { margin: 0 0 3rem; scroll-margin-top: 90px; }
.app-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin: 0 0 1.25rem; }
.toolbar-left, .toolbar-right { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.status-pill { display: inline-flex; align-items: center; gap: 10px; padding: 6px 16px 6px 10px; border-radius: 9999px; border: 1px solid var(--tint-brand-border); background: var(--tint-brand); min-width: 220px; max-width: 100%; }
.status-icon { font-size: 1.3rem; line-height: 1; }
.status-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.status-main { font-weight: 700; font-size: 0.85rem; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-sub { font-size: 0.72rem; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.view-tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 9999px; background: var(--surface-2); max-width: 100%; }
.view-tab { padding: 8px 16px; border: 0; border-radius: 9999px; background: transparent; font-family: inherit; font-size: 0.85rem; font-weight: 600; color: var(--text-2); cursor: pointer; white-space: nowrap; transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease; }
.view-tab:hover { color: var(--link); }
.view-tab.active { background: var(--gradient-brand); color: #fff; box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3); }
.view-tab:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.view[hidden] { display: none; }
.shell-hint { margin-top: 14px; }

/* ----- Fields ----- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; border: 0; padding: 0; margin: 0; }
.label { font-weight: 600; font-size: 0.85rem; color: var(--text-strong); }
.input, .select { width: 100%; min-width: 0; min-height: 44px; padding: 10px 14px; background: var(--field); border: 1px solid var(--field-border); border-radius: 12px; font-family: inherit; font-size: 0.95rem; color: var(--text); outline: none; transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.input:focus, .select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.input::placeholder { color: var(--placeholder); }
.input[aria-invalid="true"] { border-color: var(--bad); }
textarea.input { resize: vertical; min-height: 84px; line-height: 1.5; }
input[type="time"].input { color-scheme: light; width: 9em; }
:root:not([data-theme="light"]) input[type="time"].input { color-scheme: dark; }
.select { width: auto; max-width: 100%; appearance: none; -webkit-appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 14px; cursor: pointer; }
.select option { color: #0a0a14; background: #fff; }
.num-input { width: 7.5em; }
.num-input.wide { width: 10em; }
.check-row { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; font-size: 0.925rem; color: var(--text); padding: 4px 0; }
.check-row input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--brand); flex-shrink: 0; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 9999px; border: 1px solid var(--chip-border); background: var(--surface); font-family: inherit; font-size: 0.85rem; font-weight: 600; color: var(--text-2); cursor: pointer; transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease; }
.seg button:hover { border-color: var(--brand); color: var(--link); transform: translateY(-1px); }
.seg button[aria-checked="true"] { background: var(--gradient-brand); color: #fff; border-color: transparent; }
.seg button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 9999px; border: 1px solid var(--chip-border); background: var(--chip); font-family: inherit; font-size: 0.8rem; font-weight: 600; color: var(--text-2); cursor: pointer; transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease; }
.chip .ico { width: 15px; height: 15px; color: var(--link); }
.chip:hover { border-color: var(--brand); color: var(--link); transform: translateY(-1px); }
.chip:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ----- Windows ----- */
.dialog { margin: auto; border: 1px solid var(--surface-border); border-radius: 20px; padding: 0; width: min(520px, calc(100vw - 16px)); max-height: calc(100vh - 32px); background: var(--surface); color: var(--text); box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35); }
.dialog--narrow { width: min(420px, calc(100vw - 16px)); }
.dialog--wide { width: min(680px, calc(100vw - 16px)); }
.dialog::backdrop { background: rgba(10, 10, 20, 0.6); backdrop-filter: blur(6px); }
.dialog[open] { animation: pop 0.2s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(10px); } }
.dialog-head { padding: 18px 20px; border-bottom: 1px solid var(--surface-border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dialog-title { margin: 0; font-size: 1.15rem; }
.dialog-close { width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%; border: 1px solid var(--chip-border); background: var(--chip); color: var(--text-strong); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; transition: border-color 0.2s ease, color 0.2s ease; }
.dialog-close:hover { border-color: var(--brand); color: var(--link); }
.dialog-body { padding: 20px; overflow-y: auto; max-height: calc(100vh - 210px); display: flex; flex-direction: column; gap: 14px; }
.dialog-actions { padding: 14px 20px; border-top: 1px solid var(--surface-border); display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.confirm-message { margin: 0; color: var(--text); }
.help-body h3 { margin: 6px 0 0; font-size: 1rem; }
.help-body p { margin: 0; color: var(--text-2); }

/* ----- Toasts ----- */
.toasts { position: fixed; bottom: 24px; right: 24px; z-index: 3000; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; max-width: calc(100vw - 32px); pointer-events: none; }
.toast { pointer-events: auto; background: #0a0a14; color: #fff; border: 1px solid rgba(255, 255, 255, 0.12); border-left: 4px solid var(--brand); border-radius: 14px; padding: 12px 16px; display: flex; align-items: center; gap: 14px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3); min-width: 260px; max-width: 420px; font-size: 0.875rem; font-weight: 500; overflow-wrap: anywhere; animation: slideIn 0.3s ease; transition: opacity 0.3s ease, transform 0.3s ease; }
.toast button { background: none; border: 0; padding: 0; color: #c4b5fd; font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; white-space: nowrap; }
.toast.leaving { opacity: 0; transform: translateX(40px); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.toast.good { border-left-color: #4ade80; }
.toast.bad { border-left-color: #f87171; }

/* ----- Information sections ----- */
.info-section { margin: 0 0 2.5rem; }
.info-section h2 { font-size: 1.75rem; margin: 0 0 1.25rem; }
.info-section .info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.info-three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 1rem 0 1.5rem; }
.info-stack { display: grid; gap: 12px; }
.info-card { background: var(--surface); border: 1px solid var(--surface-border); border-radius: 16px; box-shadow: var(--surface-shadow); padding: 20px; transition: transform 0.3s ease, box-shadow 0.3s ease; }
.info-card:hover { transform: translateY(-4px); box-shadow: var(--surface-hover-shadow); }
.info-card--small { padding: 16px; box-shadow: none; }
.info-card h3 { margin: 0 0 0.75rem; font-size: 1.15rem; }
.info-card p { color: var(--text-2); margin-bottom: 0.75rem; }
.info-card p:last-child { margin-bottom: 0; }
.step-card { position: relative; padding-top: 24px; }
.step-num { position: absolute; top: -16px; left: 20px; width: 34px; height: 34px; border-radius: 50%; background: var(--gradient-brand); color: #fff; font-weight: 700; font-size: 0.95rem; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3); }
.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 0.75rem; }
.step-head h3 { margin: 0; }
.step-emoji { font-size: 1.6rem; line-height: 1; }
.info-section details.info-card { padding: 0; }
.info-section details.info-card summary { cursor: pointer; padding: 16px 20px; font-weight: 600; color: var(--text-strong); list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.info-section details.info-card summary::-webkit-details-marker { display: none; }
.info-section details.info-card summary::after { content: '+'; color: var(--link); font-weight: 700; font-size: 1.2rem; line-height: 1; flex-shrink: 0; }
.info-section details.info-card[open] summary::after { content: '\2212'; }
.info-section details.info-card p { padding: 0 20px 16px; margin: 0; color: var(--text-2); }

/* ===== Periodic Table components ===== */

/* ----- The site's text rules (p, ul, li, headings) must not reach the tool: same weight as the site's, loaded later ----- */
:where(.app-shell) p, :where(.app-shell) ul, :where(.app-shell) li, :where(.dialog) p, :where(.dialog) ul { margin: 0; line-height: 1.5; }
:where(.app-shell) h2, :where(.app-shell) h3, :where(.dialog) h2, :where(.dialog) h3 { margin: 0; line-height: 1.25; }

/* ----- The original's names for colours, on the site's tokens; the family colours are the tool's own ----- */
:root {
    --panel: var(--surface);
    --panel-2: var(--surface-2);
    --muted: var(--text-2);
    --border: var(--line);
    --border-strong: var(--line-strong);
    --good: var(--ok);
    --focus: var(--brand);
    --shadow: 0 10px 30px rgba(22, 25, 31, 0.08);
    --c-alkali: #e34948;
    --c-alkaline: #008300;
    --c-transition: #6250d6;
    --c-posttrans: #eb6834;
    --c-metalloid: #1baf7a;
    --c-nonmetal: #2a78d6;
    --c-noble: #eda100;
    --c-lanthanide: #e87ba4;
    --c-actinide: #8a185c;
    --c-unknown: #9aa0aa;
    --s1: #2a78d6;
    --s2: #eb6834;
    --s3: #1baf7a;
    --s4: #6250d6;
    --grid: #e5e7eb;
    --axis: #c3c2b7;
    --tint: 46%;
}
:root:not([data-theme="light"]) {
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    --c-alkali: #e66767;
    --c-alkaline: #008300;
    --c-transition: #9085e9;
    --c-posttrans: #d95926;
    --c-metalloid: #199e70;
    --c-nonmetal: #3987e5;
    --c-noble: #c98500;
    --c-lanthanide: #d55181;
    --c-actinide: #a20f9d;
    --c-unknown: #6b717c;
    --s1: #3987e5;
    --s2: #d95926;
    --s3: #199e70;
    --s4: #9085e9;
    --grid: #2c2c34;
    --axis: #383835;
    --tint: 42%;
}
.num { font-variant-numeric: tabular-nums; }
.app-shell sub, .app-shell sup, .dialog sub, .dialog sup { font-size: 0.72em; line-height: 0; }
.view-tab { display: inline-flex; align-items: center; gap: 6px; }
.view-tab .ico { width: 16px; height: 16px; }

/* ----- Buttons the original's script makes: plain ones outlined, primary ones the site's gradient pill ----- */
.app-shell .btn:not(.primary), .dialog .btn:not(.primary) { background: var(--surface); color: var(--text-strong); border: 1px solid var(--surface-border); }
.app-shell .btn:not(.primary):hover:not(:disabled), .dialog .btn:not(.primary):hover:not(:disabled) { border-color: var(--brand); color: var(--link); transform: translateY(-2px); }
.btn.primary { background: var(--gradient-brand); color: #fff; box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3); }
.btn.primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4); color: #fff; }
.app-shell .btn[aria-pressed="true"] { background: var(--gradient-brand); color: #fff; border-color: transparent; }
.small-btn { font-size: 0.85rem; padding: 8px 15px; min-height: 38px; }
.icon-btn:disabled { opacity: 0.4; cursor: default; }
.chip.sm { padding: 5px 11px; font-size: 0.78rem; }
.chip[aria-pressed="true"] { background: var(--gradient-brand); color: #fff; border-color: transparent; }
.chip[aria-pressed="true"] .ico, .chip[aria-pressed="true"] .muted { color: inherit; }
a.chip { text-decoration: none; }
.chip .muted { font-weight: 500; }
.seg-sm button { padding: 5px 11px; font-size: 0.8rem; }
.field.inline { flex-direction: row; align-items: center; gap: 10px; }
.label { display: inline-flex; align-items: center; gap: 6px; }

/* ----- Layout: the page gives the side space; sections add none (one layer) ----- */
.screen { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
#view-table { gap: 16px; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.view-title { font-size: 1.5rem; }
.lead { margin-top: 4px; color: var(--text-2); max-width: 72ch; }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.controls .push { margin-left: auto; }
/* the site styles a bare .search as a text box (site-pages.css): the tool's .search is only the box's holder */
.app-shell .search { position: relative; flex: 1 1 280px; min-width: 0; max-width: 520px; width: auto; padding: 0; background: none; border: 0; border-radius: 0; box-shadow: none; transition: none; }
.search > .ico { position: absolute; left: 13px; top: 13px; color: var(--text-3); pointer-events: none; }
.search-input { padding-left: 40px; }
.search-input::-webkit-search-cancel-button { cursor: pointer; }

/* ----- Temperature and history dials ----- */
.explore { display: grid; gap: 16px 40px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1024px) { .explore { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); } }
.explore.off #tempDial { display: none; }
.dial { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.dial-head { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; min-height: 38px; }
.dial-head .label .ico { width: 16px; height: 16px; color: var(--text-3); }
.dial-value { font-weight: 700; font-size: 1.05rem; margin-right: auto; display: inline-flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; color: var(--text-strong); }
.dial-value .glow { width: 14px; height: 14px; border-radius: 50%; background: var(--glow, transparent); box-shadow: 0 0 0 1px var(--border-strong), 0 0 10px var(--glow, transparent); }
.dial-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; min-height: 30px; }
.dial-foot .hint { font-variant-numeric: tabular-nums; }
.app-shell input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; margin: 0; background: transparent; cursor: pointer; }
.app-shell input[type="range"]:focus { outline: none; }
.app-shell input[type="range"]:focus-visible::-webkit-slider-thumb { outline: 3px solid var(--focus); outline-offset: 2px; }
.app-shell input[type="range"]:focus-visible::-moz-range-thumb { outline: 3px solid var(--focus); outline-offset: 2px; }
.app-shell input[type="range"]::-webkit-slider-runnable-track { height: 12px; border-radius: 999px; background: var(--track); border: 1px solid var(--border-strong); }
.app-shell input[type="range"]::-moz-range-track { height: 12px; border-radius: 999px; background: var(--track); border: 1px solid var(--border-strong); }
.app-shell input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 24px; height: 24px; margin-top: -7px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25); }
.app-shell input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25); }
/* The track is the colour hot matter glows at each temperature: nothing visible below about 800 K, then red, orange and white. */
.heat { --track: linear-gradient(90deg, #9ec5f4 0%, #c9ced6 5%, #8a8f98 11%, #5a2a1e 13.3%, #b3261e 16.7%, #ff5a1f 25%, #ff8a2b 33%, #ffb46b 50%, #ffd1a3 66.7%, #ffe4ce 83%, #fff4ea 100%); }
.years { --track: var(--surface-2); }
.years-wrap { position: relative; }
.years-ticks { position: absolute; left: 12px; top: -6px; width: calc(100% - 24px); height: 8px; pointer-events: none; color: var(--text-3); }

/* ----- Legend ----- */
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 36px; }
@media (max-width: 639px) { #explore { order: 3; } #legend { order: 4; } }
.legend .sep { width: 1px; align-self: stretch; background: var(--border); margin: 4px 6px; }
.key { display: inline-flex; align-items: center; gap: 7px; min-height: 32px; padding: 3px 10px 3px 6px; border: 1px solid transparent; border-radius: 9999px; background: transparent; font-family: inherit; font-size: 0.84rem; color: var(--text); cursor: pointer; }
.key:hover { background: var(--surface); border-color: var(--border-strong); }
.key[aria-pressed="true"] { background: var(--tint-brand); border-color: var(--brand); }
.key:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.key .sw { width: 16px; height: 16px; border-radius: 3px; flex: none; position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--hue); }
.key .sw::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: var(--fill, 100%); background: color-mix(in srgb, var(--hue) var(--tint), var(--surface)); }
.key .sw::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--hue); }
.key .sw.gas { border-style: dashed; }
.key .sw.unk { border-style: dotted; --hue: var(--c-unknown); }
.key .sw.unk::after { display: none; }
.key .count { color: var(--text-3); font-variant-numeric: tabular-nums; font-size: 0.78rem; }
.scale { display: flex; align-items: center; gap: 10px; font-size: 0.84rem; min-width: 0; flex-wrap: wrap; }
.scale-bar { width: min(320px, 60vw); height: 12px; border-radius: 3px; border: 1px solid var(--border); position: relative; }
.scale-bar .mark { position: absolute; top: -5px; bottom: -5px; width: 3px; margin-left: -1.5px; background: var(--text-strong); border-radius: 2px; box-shadow: 0 0 0 2px var(--surface); }
.scale .ends { font-variant-numeric: tabular-nums; color: var(--text-2); }
.scale .none { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.scale .none i { width: 14px; height: 14px; border-radius: 3px; border: 1px solid var(--border-strong); background: repeating-linear-gradient(45deg, var(--border-strong) 0 1px, transparent 1px 5px); }

/* ----- The table ----- */
.ptable-wrap { position: relative; min-width: 0; outline: none; }
.ptable { --gap: 2px; --ratio: 0.8; --r: 3px; --stripe: 2px; display: grid; gap: var(--gap); grid-template-columns: repeat(18, minmax(0, 1fr)); grid-auto-rows: auto; user-select: none; -webkit-user-select: none; }
.ptable.labels { grid-template-columns: 22px repeat(18, minmax(0, 1fr)); }
@media (min-width: 640px) { .ptable { --gap: 3px; --ratio: 0.94; --r: 4px; --stripe: 3px; } }
@media (min-width: 1024px) { .ptable { --gap: 4px; --ratio: 1.08; --r: 5px; } .ptable.labels { grid-template-columns: 26px repeat(18, minmax(0, 1fr)); } }
.ptable .gap-row { height: 10px; }
@media (min-width: 1024px) { .ptable .gap-row { height: 16px; } }
.axis-lab { border: 0; background: transparent; padding: 0; color: var(--text-2); font-family: inherit; font-size: 0.72rem; font-weight: 600; font-variant-numeric: tabular-nums; display: grid; place-items: center; border-radius: 4px; min-height: 20px; cursor: pointer; }
.axis-lab:hover { color: var(--text-strong); background: var(--surface); }
.axis-lab[aria-pressed="true"] { color: #fff; background: var(--brand); }
.axis-lab:disabled { cursor: default; }
.tile { --hue: var(--c-unknown); --fill: 100%; --fillc: color-mix(in srgb, var(--hue) var(--tint), var(--surface)); --ink: var(--text-strong);
    position: relative; display: block; padding: 0; margin: 0; min-width: 0; aspect-ratio: var(--ratio, 0.9); border-radius: var(--r, 4px);
    border: 1px solid color-mix(in srgb, var(--hue) 70%, var(--surface)); background: var(--surface); color: var(--ink); font-family: inherit;
    overflow: hidden; text-align: left; container-type: inline-size; cursor: pointer;
    transition: opacity 0.25s ease, transform 0.12s ease, box-shadow 0.12s ease; }
.tile::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: var(--fill); background: var(--fillc); transition: height 0.4s cubic-bezier(.3, .7, .3, 1), background-color 0.25s; }
.tile::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: var(--stripe, 3px); background: var(--hue); }
.tile.gas { border-style: dashed; border-color: var(--hue); }
.tile.unk { border-style: dotted; border-color: var(--border-strong); }
.tile.unk::before { background: repeating-linear-gradient(45deg, color-mix(in srgb, var(--hue) 30%, transparent) 0 1px, transparent 1px 5px); height: 100%; }
.tile.heat::after { display: none; }
.tile.heat { border-color: color-mix(in srgb, var(--fillc) 85%, var(--text)); }
.tile.heat.na::before { background: repeating-linear-gradient(45deg, var(--border-strong) 0 1px, transparent 1px 5px); }
.tile.heat.na { color: var(--text-2); border-color: var(--border); }
.tile > span { position: relative; display: block; pointer-events: none; }
.tile .z { position: absolute; top: max(3px, 7cqi); left: max(2px, 8cqi); font-size: clamp(6px, 17cqi, 12px); font-weight: 500; line-height: 1; font-variant-numeric: tabular-nums; opacity: 0.85; }
.tile .sym { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); text-align: center; font-size: clamp(9px, 37cqi, 30px); font-weight: 700; line-height: 1; letter-spacing: -0.02em; }
.tile .nm, .tile .val { position: absolute; left: 6cqi; right: 6cqi; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: clamp(6px, 13.5cqi, 11.5px); line-height: 1.1; }
.tile .nm { bottom: 24cqi; }
.tile .val { bottom: 8cqi; font-variant-numeric: tabular-nums; opacity: 0.85; }
@container (max-width: 33px) { .tile .z { display: none; } }
@container (max-width: 51px) { .tile .nm, .tile .val { display: none; } }
@container (min-width: 52px) { .tile .sym { top: 40%; } }
@container (max-width: 64px) { .tile .nm { letter-spacing: -0.02em; } }
.tile:hover { transform: scale(1.06); z-index: 2; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18); }
.tile:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; z-index: 3; }
.tile.on { box-shadow: 0 0 0 2px var(--text-strong); z-index: 2; }
.ptable.filtering .tile:not(.hit) { opacity: 0.18; }
.tile.ghost { opacity: 0.1; }
.ptable.filtering .tile.ghost { opacity: 0.06; }
.tile.ghost:hover { opacity: 0.55; }
.tile.pop { animation: pop-in 0.5s ease-out; }
@keyframes pop-in { 0% { transform: scale(0.6); opacity: 0.2; } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
.series-lab { display: grid; place-items: center; border-radius: var(--r, 4px); font-family: inherit; font-size: clamp(7px, 1vw, 11px); font-weight: 600; color: var(--text-2); border: 1px dashed color-mix(in srgb, var(--hue, var(--border-strong)) 70%, var(--surface)); aspect-ratio: var(--ratio, 0.9); font-variant-numeric: tabular-nums; text-align: center; line-height: 1.1; padding: 2px; overflow: hidden; background: color-mix(in srgb, var(--hue, transparent) 14%, transparent); cursor: pointer; }
.series-lab:hover { color: var(--text-strong); background: color-mix(in srgb, var(--hue, transparent) 30%, transparent); }
.series-lab:disabled { cursor: default; }

/* The inspector lives in the empty space above the transition metals */
.inspector { display: none; min-width: 0; }
@media (min-width: 640px) { .inspector { display: flex; gap: clamp(8px, 1.4vw, 20px); align-items: stretch; padding: 4px 4px 4px 2px; overflow: hidden; } }
.insp-tile { --hue: var(--c-unknown); position: relative; flex: none; aspect-ratio: 0.92; height: 100%; border-radius: 8px; overflow: hidden; border: 1px solid color-mix(in srgb, var(--hue) 70%, var(--surface)); background: color-mix(in srgb, var(--hue) var(--tint), var(--surface)); color: var(--ink, var(--text-strong)); container-type: inline-size; padding: 0; }
.insp-tile::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px; background: var(--hue); }
.insp-tile.heat::after { display: none; }
.insp-tile .z { position: absolute; left: 9cqi; top: 10cqi; font-size: 15cqi; font-weight: 600; font-variant-numeric: tabular-nums; }
.insp-tile .sym { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-52%); text-align: center; font-size: 46cqi; font-weight: 750; letter-spacing: -0.03em; line-height: 1; }
.insp-tile .ms { position: absolute; left: 0; right: 0; bottom: 9cqi; text-align: center; font-size: 13cqi; font-variant-numeric: tabular-nums; }
.insp-body { min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 2px; overflow: hidden; }
.insp-name { font-size: clamp(0.95rem, 1.9vw, 1.6rem); font-weight: 700; line-height: 1.1; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-strong); font-family: 'Space Grotesk', 'Inter', sans-serif; }
.insp-sub { color: var(--text-2); font-size: clamp(0.72rem, 1vw, 0.9rem); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.insp-ec { font-size: clamp(0.72rem, 1vw, 0.92rem); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.insp-val { font-size: clamp(0.72rem, 1vw, 0.92rem); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.insp-val strong { font-variant-numeric: tabular-nums; }
.insp-hint { color: var(--text-2); font-size: clamp(0.72rem, 1vw, 0.92rem); max-width: 46ch; }
.insp-key { display: flex; gap: 14px; margin-top: 8px; flex-wrap: wrap; }
.insp-key span { display: inline-flex; align-items: center; gap: 6px; font-size: clamp(0.72rem, 0.95vw, 0.86rem); }
.insp-key .tile.demo { width: clamp(22px, 2.4vw, 34px); }
@media (max-width: 1023px) { .insp-key, .insp-ec { display: none; } }
@media (max-width: 899px) { .insp-sub { display: none; } }

/* ----- List view and number tables ----- */
.list-wrap, .table-scroll { overflow-x: auto; min-width: 0; }
.list-wrap:focus-visible, .table-scroll:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
/* the site gives every table a frame and cell borders (site-pages.css); the tool's tables keep the original's plain rows */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; font-variant-numeric: tabular-nums; margin: 0; border: 0; background: none; box-shadow: none; border-radius: 0; overflow: visible; }
.data-table th, .data-table td { text-align: left; padding: 8px 14px 8px 0; border: 0; border-bottom: 1px solid var(--border); white-space: nowrap; color: var(--text); background: none; }
.data-table th { font-size: 0.8rem; color: var(--text-2); font-weight: 600; }
.data-table th button { border: 0; background: none; padding: 4px 0; font: inherit; font-weight: 600; color: inherit; display: inline-flex; gap: 4px; align-items: center; cursor: pointer; }
.data-table th button:hover, .data-table th[aria-sort] button { color: var(--text-strong); }
.data-table td.r, .data-table th.r { text-align: right; }
.data-table tbody tr { cursor: pointer; }
.data-table tbody tr:hover td { background: var(--surface-2); }
.data-table tbody tr:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.data-table .fam { display: inline-flex; align-items: center; gap: 6px; }
.data-table .fam i { width: 10px; height: 10px; border-radius: 2px; background: var(--hue); }
.data-table .symc { font-weight: 700; }
.checks tbody tr, .comp.no-open tbody tr { cursor: default; }

/* ----- Windows: the help window and the element window ----- */
.examples { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 6px; font-size: 0.925rem; color: var(--text-2); list-style: disc; }
.help-grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); align-items: center; }
@media (min-width: 560px) { .help-grid { grid-template-columns: auto minmax(0, 1fr); } }
.help-key { display: flex; gap: 6px; }
.tile.demo { width: 56px; cursor: default; display: inline-block; }
.tile.demo:hover { transform: none; box-shadow: none; }
.el-dialog { width: min(920px, calc(100vw - 16px)); max-height: calc(100vh - 32px); overflow: hidden; }
.el-dialog[open] { display: flex; flex-direction: column; }
.el-sheet { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.el-top { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px 18px; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--surface-border); }
.el-top .insp-tile { height: auto; width: clamp(88px, 16vw, 128px); }
.el-title h2 { font-size: clamp(1.4rem, 3.4vw, 2.1rem); letter-spacing: -0.02em; color: var(--text-strong); }
.el-title p { color: var(--text-2); margin-top: 2px; }
.el-title .chips { margin-top: 10px; }
.el-nav { display: flex; gap: 6px; align-self: start; }
.el-nav .close { margin-left: 10px; }
.el-scroll { overflow-y: auto; padding: 16px 20px; display: grid; gap: 28px; grid-template-columns: minmax(0, 1fr); overscroll-behavior: contain; }
@media (min-width: 820px) { .el-scroll { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); } .el-scroll .span2 { grid-column: 1 / -1; } }
.el-sec { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.el-sec h3 { font-size: 1rem; color: var(--text-strong); }
.el-sec > .link { align-self: flex-start; }
.facts { margin: 0; display: grid; gap: 0; grid-template-columns: minmax(0, 1fr); }
.fact { display: grid; grid-template-columns: minmax(0, 10.5em) minmax(0, 1fr); gap: 2px 12px; padding: 8px 0; border-bottom: 1px solid var(--border); align-items: baseline; }
.fact dt { color: var(--text-2); font-size: 0.86rem; }
.fact dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; color: var(--text-strong); }
.fact dd .unk { color: var(--text-2); font-weight: 400; }
.fact .rank { display: flex; align-items: center; gap: 10px; min-width: 0; margin-top: 4px; font-weight: 400; }
.fact .rank svg { flex: 1; min-width: 60px; height: 14px; display: block; }
.fact .rank small { color: var(--text-2); font-size: 0.75rem; font-variant-numeric: tabular-nums; flex: 0 1 auto; min-width: 0; }
.el-map svg { width: 100%; max-width: 300px; height: auto; display: block; }
.el-map .cell { fill: var(--surface-2); stroke: var(--border); stroke-width: 0.5; cursor: pointer; }
.el-map .cell:hover { fill: var(--border-strong); }
.el-map .cell.fam { fill: color-mix(in srgb, var(--hue) 40%, var(--surface)); }
.el-map .cell.me { fill: var(--text-strong); stroke: var(--text-strong); }
.bohr-wrap { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: center; }
.bohr { width: 200px; height: 200px; flex: none; max-width: 100%; }
.bohr .orbit { fill: none; stroke: var(--border-strong); stroke-width: 1; }
.bohr .e { fill: var(--text-strong); }
.bohr .nucleus { fill: color-mix(in srgb, var(--hue) 55%, var(--surface)); stroke: var(--hue); stroke-width: 1.5; }
.bohr .shell { transform-origin: 100px 100px; animation: spin var(--dur, 20s) linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.shell-list { font-variant-numeric: tabular-nums; color: var(--text-2); font-size: 0.86rem; }
.orbitals { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: flex-end; }
.sub { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.sub .boxes { display: flex; }
.sub .box { width: 22px; height: 30px; border: 1px solid var(--border-strong); margin-left: -1px; display: grid; grid-template-columns: 1fr 1fr; align-items: center; justify-items: center; background: var(--surface); }
.sub .box:first-child { margin-left: 0; }
.sub .box svg { width: 8px; height: 22px; }
.sub .box path { stroke: var(--text-strong); stroke-width: 1.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.sub small { font-size: 0.78rem; color: var(--text-2); font-variant-numeric: tabular-nums; }
.ec-line { font-size: 1rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.uses { margin: 0; padding-left: 1.1em; display: grid; gap: 4px 20px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); list-style: disc; color: var(--text); }
.story p + p { margin-top: 6px; }
.note { border-left: 3px solid var(--border-strong); padding: 2px 0 2px 12px; color: var(--text-2); font-size: 0.9rem; }

/* ----- Charts ----- */
.chart { margin: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.chart-title { font-weight: 650; color: var(--text-strong); }
.chart-box { position: relative; width: 100%; min-height: 260px; }
.chart-box svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.chart-box svg:focus-visible { outline: 2px solid var(--brand); outline-offset: 4px; border-radius: 4px; }
.chart-note { color: var(--text-2); font-size: 0.86rem; max-width: 80ch; }
.chart .grid line { stroke: var(--grid); stroke-width: 1; }
.chart text { fill: var(--text-2); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .band { fill: var(--surface-2); opacity: 0.8; }
.chart .band-lab { fill: var(--text-2); font-size: 10.5px; }
.chart .line { fill: none; stroke: var(--s1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: color-mix(in srgb, var(--s1) 10%, transparent); }
.chart .dot { fill: var(--s1); stroke: var(--surface); stroke-width: 2; }
.chart .dot.mark { fill: var(--s2); }
.chart .dot.hot { stroke: var(--text-strong); stroke-width: 2; }
.chart .lab { fill: var(--text-strong); font-size: 11px; font-weight: 600; }
.chart .cross { stroke: var(--text-2); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .off { visibility: hidden; }
.chart .ann line { stroke: var(--border-strong); stroke-dasharray: 2 3; }
.chart .ann text { fill: var(--text-2); font-size: 10.5px; }
.chart .fit { stroke: var(--text-2); stroke-width: 1.5; stroke-dasharray: 5 4; }
.tip { position: fixed; z-index: 70; pointer-events: none; background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: 10px; padding: 8px 10px; font-size: 0.84rem; box-shadow: var(--shadow); max-width: 280px; line-height: 1.35; }
.tip strong { font-size: 1rem; font-variant-numeric: tabular-nums; color: var(--text-strong); }
.tip .k { display: inline-block; width: 12px; height: 2px; background: var(--s1); vertical-align: middle; margin-right: 6px; }
.tip .muted { font-size: 0.8rem; }
.numbers summary { cursor: pointer; font-weight: 600; font-size: 0.9rem; color: var(--link); padding: 6px 0; }
.numbers summary:hover { color: var(--link-hover); }
.numbers .data-table { margin-top: 8px; }
.eras { display: grid; gap: 18px 32px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .eras { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1300px) { .eras { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.era { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--border); padding-top: 12px; min-width: 0; }
.era h3 { display: flex; justify-content: space-between; gap: 10px; font-size: 1rem; color: var(--text-strong); }
.era h3 span { color: var(--text-2); font-weight: 500; font-variant-numeric: tabular-nums; }
.era p { color: var(--text-2); font-size: 0.86rem; }
.el-chip { padding: 2px 10px 2px 3px; gap: 6px; font-size: 0.8rem; }
.el-chip b { display: inline-grid; place-items: center; min-width: 24px; height: 22px; padding: 0 3px; border-radius: 4px; background: color-mix(in srgb, var(--hue) var(--tint), var(--surface)); box-shadow: inset 0 2px 0 var(--hue); font-size: 0.78rem; color: var(--text-strong); }

/* ----- Compare ----- */
.combo { max-width: 420px; }
.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 25; margin: 0; padding: 4px; list-style: none; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow); max-height: 280px; overflow-y: auto; }
.suggest li { padding: 8px 10px; border-radius: 8px; cursor: pointer; display: flex; gap: 10px; align-items: center; color: var(--text); }
.suggest li[aria-selected="true"], .suggest li:hover { background: var(--surface-2); }
.suggest li .z { color: var(--text-2); font-size: 0.8rem; margin-left: auto; font-variant-numeric: tabular-nums; }
.cmp { display: grid; gap: 0; min-width: 0; overflow-x: auto; }
.cmp-grid { display: grid; min-width: max-content; }
.cmp-grid > div { padding: 10px 14px 10px 0; border-bottom: 1px solid var(--border); min-width: 0; }
.cmp-head { display: flex; align-items: center; gap: 10px; }
.cmp-head .insp-tile { width: 64px; height: auto; }
.cmp-head .meta { display: flex; flex-direction: column; min-width: 0; }
.cmp-head .meta .link { text-align: left; font-weight: 700; color: var(--text-strong); font-size: 1.05rem; }
.cmp-head .meta span { color: var(--text-2); font-size: 0.82rem; }
.cmp-lab { color: var(--text-2); font-size: 0.86rem; display: flex; align-items: center; }
.cmp-cell { display: flex; flex-direction: column; gap: 5px; font-variant-numeric: tabular-nums; }
.cmp-cell .v { font-weight: 600; color: var(--text-strong); }
.cmp-cell.top .v::after { content: " (highest)"; font-weight: 500; color: var(--text-2); font-size: 0.78rem; }
.cmp-cell .bar { height: 8px; border-radius: 0 4px 4px 0; background: var(--surface-2); position: relative; max-width: 220px; }
.cmp-cell .bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 0 4px 4px 0; background: var(--s1); }
.cmp-cell .unk { color: var(--text-2); font-weight: 400; }
.cmp-note { margin-top: 10px; }
#cmpPresets .hint { align-self: center; }
@media (max-width: 639px) {
    .cmp-grid { grid-template-columns: repeat(var(--n), minmax(0, 1fr)) !important; min-width: 0; column-gap: 10px; }
    .cmp-grid > .cmp-corner { display: none; }
    .cmp-grid > .cmp-lab { grid-column: 1 / -1; border-bottom: 0; padding: 12px 0 0; font-weight: 600; color: var(--text-strong); }
    .cmp-grid > .cmp-cell { padding: 4px 0 10px; }
    .cmp-head { flex-direction: column; align-items: flex-start; gap: 6px; }
    .cmp-head .insp-tile { width: 52px; }
    .cmp-cell.top .v::after { content: none; }
    .cmp-cell .v { overflow-wrap: anywhere; }
}
.empty { color: var(--text-2); border: 1px dashed var(--border-strong); border-radius: 12px; padding: 22px 8px; text-align: center; font-size: 0.925rem; }

/* ----- Lab ----- */
.tool { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.formula-input { font-size: 1.15rem; max-width: 640px; font-variant-numeric: tabular-nums; }
.result { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.result:empty { display: none; }
.big { font-size: clamp(1.6rem, 4vw, 2.4rem); font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.15; color: var(--text-strong); overflow-wrap: anywhere; }
.big small { font-size: 0.5em; font-weight: 600; color: var(--text-2); letter-spacing: 0; }
.formula-show { font-size: 1.15rem; margin-top: 2px; overflow-wrap: anywhere; }
.comp { width: 100%; max-width: 760px; margin-top: 4px; }
.comp td.bar-cell { width: 40%; min-width: 120px; }
.comp .bar { height: 10px; background: var(--surface-2); border-radius: 0 4px 4px 0; position: relative; }
.comp .bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--s1); border-radius: 0 4px 4px 0; }
.moles { display: grid; gap: 12px 18px; grid-template-columns: minmax(0, 1fr); max-width: 760px; align-items: end; }
@media (min-width: 720px) { .moles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.moles output { font-weight: 650; font-variant-numeric: tabular-nums; min-height: 44px; display: flex; align-items: center; overflow-wrap: anywhere; color: var(--text-strong); }
.sub-tool { display: flex; flex-direction: column; gap: 12px; border-top: 1px solid var(--border); padding-top: 18px; max-width: 760px; }
.sub-tool h2 { font-size: 1.15rem; color: var(--text-strong); }
.emp-rows { display: flex; flex-direction: column; gap: 8px; }
.emp-row { display: flex; gap: 8px; align-items: center; }
.emp-row .input { max-width: 140px; }
.emp-row .icon-btn { width: 36px; height: 36px; }
.eq-show { font-size: clamp(1.15rem, 2.6vw, 1.6rem); line-height: 1.5; overflow-wrap: anywhere; color: var(--text-strong); }
.eq-show .co { font-weight: 800; color: var(--s1); }
.eq-show .arrow { color: var(--text-2); padding: 0 0.3em; }
.checks { margin-top: 4px; max-width: 520px; }
.ok-row td:last-child { color: var(--good); font-weight: 600; }
.mol-layout { display: grid; gap: 18px 32px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1024px) { .mol-layout { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); } }
.mol-stage { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
#molCanvas { width: 100%; aspect-ratio: 4 / 3; max-height: 62vh; display: block; border-radius: 16px; border: 1px solid var(--surface-border); background: radial-gradient(circle at 50% 40%, var(--surface), var(--surface-2)); touch-action: none; cursor: grab; }
#molCanvas:active { cursor: grabbing; }
#molCanvas:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.mol-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mol-info { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.mol-info h2 { font-size: 1.4rem; letter-spacing: -0.01em; color: var(--text-strong); }
.mol-info .formula-show { color: var(--text-2); }
.mol-info dl { margin: 0; }
.mol-info .atoms { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.86rem; color: var(--text-2); }
.mol-info .atoms i { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; border: 1px solid rgba(0, 0, 0, 0.25); }
.mol-group { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.mol-group h3 { font-size: 0.9rem; color: var(--text-2); font-weight: 600; }

/* ----- Quiz ----- */
.quiz-area { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.q-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; }
.q-progress { flex: 1 1 200px; height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--border); max-width: 420px; }
.q-progress i { display: block; height: 100%; background: var(--gradient-brand); transition: width 0.3s; }
.q-score { font-variant-numeric: tabular-nums; color: var(--text-2); font-size: 0.9rem; }
.q-prompt { font-size: clamp(1.25rem, 3vw, 1.8rem); font-weight: 700; letter-spacing: -0.01em; color: var(--text-strong); font-family: 'Space Grotesk', 'Inter', sans-serif; }
.q-prompt .q-sym { display: inline-grid; place-items: center; min-width: 2.2em; padding: 0.15em 0.35em; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); margin-right: 0.3em; }
.q-options { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); max-width: 860px; }
.app-shell .q-opt { min-height: 56px; font-size: 1.02rem; justify-content: flex-start; text-align: left; border-radius: 16px; white-space: normal; }
.app-shell .q-opt.right { border-color: var(--good); background: var(--ok-soft); }
.app-shell .q-opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.q-feedrow { display: flex; align-items: center; gap: 10px 18px; flex-wrap: wrap; min-height: 48px; }
.q-feedrow .btn { flex: none; }
.q-feedback { min-height: 1.5em; font-weight: 600; max-width: 90ch; }
.q-feedrow .q-feedback { flex: 1 1 320px; }
.quiz-area > .btn, .q-done .btn { align-self: flex-start; }
.q-feedback.right { color: var(--good); }
.q-feedback.wrong { color: var(--bad); }
.q-feedback span { font-weight: 400; color: var(--text-2); }
.q-board .tile { --hue: var(--c-unknown); }
.q-board .tile.blank .sym, .q-board .tile.blank .z, .q-board .tile.blank .nm, .q-board .tile.blank .val { visibility: hidden; }
.q-board .tile.blank::after { opacity: 0.35; }
.q-board .tile.right { box-shadow: 0 0 0 3px var(--good); z-index: 2; }
.q-board .tile.wrong { box-shadow: 0 0 0 3px var(--bad); z-index: 2; }
.q-board .tile.missed { --hue: var(--bad) !important; opacity: 0.85; }
.q-done { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.all-bar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.all-bar .input { max-width: 360px; }
.all-count { font-size: 1.4rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text-strong); }

/* ----- Toasts: the shared block's, centred like the original's ----- */
.toast > span { flex: 1; }

/* ----- Phones ----- */
@media (max-width: 639px) {
    .app-hero { margin-bottom: 1.5rem; }
    .app-tagline { font-size: 1rem; }
    .view-tabs { display: flex; width: 100%; border-radius: 22px; }
    .view-tab { flex: 1 1 auto; padding: 8px 4px; justify-content: center; }
    .view-tab .ico { display: none; }
    .view-title { font-size: 1.3rem; }
    .el-dialog { width: 100%; max-width: 100%; height: 100%; max-height: 100%; margin: 0; border-radius: 0; border: 0; }
    .fact { grid-template-columns: minmax(0, 8.5em) minmax(0, 1fr); }
    .el-top { grid-template-columns: auto minmax(0, 1fr); padding: 12px 16px; }
    .el-nav { grid-column: 1 / -1; grid-row: 1; }
    .el-nav .close { margin-left: auto; }
    .el-top .insp-tile { width: 84px; }
    .el-scroll { padding: 16px; }
    .toasts { bottom: 16px; right: 16px; left: 16px; align-items: stretch; }
    .toast { min-width: 0; max-width: none; }
    .dialog-body, .dialog-head, .dialog-actions { padding-left: 16px; padding-right: 16px; }
    .info-section h2 { font-size: 1.4rem; }
    .info-section .info-grid, .info-three { grid-template-columns: 1fr; }
    .info-card { padding: 16px; }
    .step-num { left: 16px; }
}
@media (min-width: 640px) and (max-width: 1023px) { .info-section .info-grid { grid-template-columns: repeat(2, 1fr); } }

@media (prefers-reduced-motion: reduce) {
    .btn, .info-card, .dialog, .toast, .seg button, .chip, .tile, .tile::before, .tile.pop, .q-progress i, .bohr .shell, .view-tab, .key, .icon-btn { transition: none; animation: none; }
}
@media (forced-colors: active) {
    .tile { border: 1px solid CanvasText; }
    .tile.gas { border-style: dashed; }
    .tile::before { background: Highlight; opacity: 0.35; }
}

/* Phones: 16 px text, 44 px tap targets (AdSense audit H-04, 8 Oct 2026). The table's squares, its group and period
   numbers, the small map in the element window and the charts are drawings: 18 columns cannot be 44 px wide on a phone,
   and the List view, the search and the element window's previous and next buttons reach every element at full size. */
@media (max-width: 639.98px) {
    main button:not(.tile):not(.axis-lab):not(.series-lab), main select, main summary, main [role="button"],
    main input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]):not([type="range"]) { min-height: 44px; }
    main .seg button, main .view-tab, main .key, main .chip { min-height: 44px; }
    main .seg button, main .view-tab, main .data-table th button { min-width: 44px; justify-content: center; } /* the short tab Lab, the units and the list's column buttons, found by h04 at 360 px */
    main .app-shell input[type="range"] { height: 44px; }
    main .icon-btn, .dialog .icon-btn { width: 44px; height: 44px; min-width: 44px; }
    main :is(p, li, .hint, .label, .input, .select, .seg button, .view-tab, .muted, .chip, .key, .data-table, .lead, .chart-note, .q-score, .empty, .link, .err):not(.big, .q-prompt, .all-count) { font-size: 1rem; }
    .dialog button, .dialog .btn, .dialog .chip, .dialog input:not([type="checkbox"]) { min-height: 44px; }
    .dialog .dialog-close { width: 44px; height: 44px; }
    .dialog :is(p, li, .hint, .label, .input, .chip, dt, dd, small) { font-size: 1rem; }
}
