:root {
    /* the family's palette (mathzetta-sites/src/site.css), under this page's own names */
    --ink: var(--mz-fg);
    --soft: var(--mz-muted);
    --line: var(--mz-line);
    --paper: var(--mz-bg);
    --accent: var(--mz-accent);
    --ok: var(--mz-ok);
    --bad: var(--mz-err);
    --mono: var(--mz-mono);
    --kw: #8a3ab9;
    --mod: #a35a00;
}
/* The page sits in mathzetta.com's Shioh frame (pastel cells over black, mountChrome): the cells keep the
   light palette whatever the system's, so the highlighting does too. The input, the drawings and the
   cards are white surfaces inside the cells. */
button, select, input { font: inherit; }
.ss-cell > .lead { margin: 0 0 1rem; max-width: 52rem; }
.legend { margin: 0.25rem 0 0; font-size: 0.85rem; max-width: 60rem; }
.legend b { font-weight: 600; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.source { background: var(--mz-bg); border: 1px solid var(--line); border-radius: 8px; padding: 1rem 1.25rem; }
#input textarea, #input pre { font-size: 1.15rem; }
.big-math { font-size: 1.9rem; min-height: 3rem; padding: 0.75rem 0 0.25rem; overflow-x: auto; text-align: center; }
.examples { font-size: 0.85rem; color: var(--soft); display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: baseline; }
#examples { display: contents; }
#examples button { border: 1px solid var(--line); background: var(--mz-bg); color: var(--ink); border-radius: 999px; padding: 0.15rem 0.7rem; cursor: pointer; }
#examples button:hover { border-color: var(--accent); color: var(--accent); }
body.stale #cards, body.stale .big-math { opacity: 0.5; }

#formats { border: none; margin: 1rem 0 0.5rem; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; font-size: 0.9rem; color: var(--soft); }
#formats legend { float: left; margin-right: 0.5rem; padding: 0; font-weight: 600; color: var(--ss-ink, var(--ink)); }
#formats { color: var(--ss-ink, var(--soft)); }

#cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 30rem), 1fr)); gap: 1rem; }
.card { background: var(--mz-bg); border: 1px solid var(--line); border-radius: 8px; padding: 0.7rem 0.9rem; min-width: 0; }
.card[hidden] { display: none; }
.card header { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.8rem; margin-bottom: 0.5rem; }
.card h2 { font-size: 1rem; margin: 0; }
.option { font-size: 0.85rem; color: var(--soft); }
.badge { font-size: 0.78rem; margin-left: auto; color: var(--soft); }
.badge.ok { color: var(--ok); }
.badge.bad { color: var(--bad); }
.badge.src { color: var(--accent); }
.copy, .say { border: 1px solid var(--line); background: var(--mz-bg); color: var(--ink); border-radius: 4px; padding: 0.15rem 0.6rem; cursor: pointer; font-size: 0.85rem; }
.copy:hover, .say:hover { border-color: var(--accent); color: var(--accent); }
.math { font-size: 1.25rem; min-height: 1.5rem; padding-top: 0.5rem; overflow-x: auto; }
.math math { font-size: 1.6em; }
.problem { color: var(--bad); font-size: 0.85rem; margin: 0.4rem 0 0; }

/* The editor: a transparent textarea over the highlighted <pre>; same font, padding, wrapping. */
.code-editor { position: relative; border: 1px solid var(--line); border-radius: 5px; background: var(--mz-soft); }
.code-editor:focus-within { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 1px; }
.code-editor pre, .code-editor textarea {
    margin: 0; padding: 0.5rem 0.65rem; border: 0; font-family: var(--mono); font-size: 0.86rem; line-height: 1.45;
    white-space: pre-wrap; overflow-wrap: anywhere; tab-size: 4; box-sizing: border-box; width: 100%;
}
.code-editor pre { min-height: 2.3em; }
.code-editor textarea {
    position: absolute; inset: 0; height: 100%; resize: none; overflow: hidden;
    color: transparent; background: transparent; caret-color: var(--ink);
}
.code-editor textarea::selection { background: var(--mz-accent-soft); color: transparent; }
.code-editor textarea:focus { outline: none; }

.t-kw { color: var(--kw); }
.t-fn { color: var(--accent); }
.t-mod { color: var(--mod); }
.t-num { color: var(--ok); }
.t-str { color: var(--bad); }
.t-op { color: var(--soft); }
.t-com { color: var(--soft); font-style: italic; }
.t-cmd { color: var(--accent); }
.t-tag { color: var(--kw); }
.t-attr { color: var(--mod); }

@media (max-width: 40rem) {
    .badge { margin-left: 0; }
    .source { padding: 0.75rem; }
}
