/* Trachtenberg Speed Math — styles.
   Light/dark via [data-theme]; animations respect prefers-reduced-motion. */

:root {
  --bg: #f6f7fb;
  --bg2: #eef0f8;
  --card: #ffffff;
  --ink: #1c2033;
  --muted: #59607a;
  --line: #e2e5f0;
  --accent: #5457e0;
  --accent-soft: #ecedfd;
  --accent2: #8b5cf6;
  --good: #0e9f6e;
  --good-soft: #e3f7ef;
  --bad: #e02d51;
  --bad-soft: #fdebef;
  --warn: #b45309;
  --carry: #d97706;
  --carry-soft: #fef3e2;
  --shadow: 0 1px 2px rgba(28, 32, 51, .06), 0 8px 24px rgba(28, 32, 51, .07);
  --radius: 14px;
  --mono: "Cascadia Code", Consolas, "SF Mono", Menlo, monospace;
}
[data-theme="dark"] {
  --bg: #141623;
  --bg2: #191c2e;
  --card: #1f2338;
  --ink: #e8eaf6;
  --muted: #9aa1c0;
  --line: #2c3150;
  --accent: #818cf8;
  --accent-soft: #262a4b;
  --accent2: #a78bfa;
  --good: #34d399;
  --good-soft: #12352c;
  --bad: #fb7185;
  --bad-soft: #3d1f28;
  --warn: #fbbf24;
  --carry: #fbbf24;
  --carry-soft: #3a2f14;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 10px 28px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 4rem; /* clear the sticky header */ }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  min-height: 100vh;
}
h1 { font-size: 1.9rem; line-height: 1.2; margin: .4em 0 .35em; letter-spacing: -.02em; }
h2 { font-size: 1.35rem; margin: 1.2em 0 .4em; }
h3 { font-size: 1.05rem; margin: .2em 0 .5em; }
p { margin: .5em 0 .9em; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
kbd {
  font-family: var(--mono); font-size: .85em; padding: .08em .45em;
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; background: var(--bg2);
}
.muted { color: var(--muted); }
.mini { font-size: .82rem; }
.center { text-align: center; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---- header/nav ---- */
#tb-header {
  display: flex; align-items: center; gap: 1.1rem;
  padding: .65rem clamp(1rem, 4vw, 2.2rem);
  background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 40;
}
.brand { font-weight: 800; font-size: 1.12rem; color: var(--ink); letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand-bolt { color: var(--carry); }
.main-nav { display: flex; gap: .2rem; flex: 1; }
.main-nav a {
  padding: .42rem .8rem; border-radius: 999px; color: var(--muted); font-weight: 600; font-size: .93rem;
}
.main-nav a:hover { color: var(--ink); text-decoration: none; background: var(--bg2); }
.main-nav a.active { color: var(--accent); background: var(--accent-soft); }
.nav-badges { display: flex; gap: .4rem; }
.theme-btn, .burger {
  border: 1px solid var(--line); background: var(--card); border-radius: 999px;
  width: 2.2rem; height: 2.2rem; cursor: pointer; font-size: 1rem;
}
.burger { display: none; }

main#app { max-width: 1020px; margin: 0 auto; padding: 1.6rem clamp(1rem, 4vw, 2.2rem) 4rem; }

footer.site-foot {
  text-align: center; color: var(--muted); font-size: .82rem;
  padding: 1.4rem 1rem 2.2rem; border-top: 1px solid var(--line);
}

/* ---- generic bits ---- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem 1.25rem;
}
.btn {
  display: inline-flex; align-items: center; gap: .4rem; justify-content: center;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 999px; padding: .5rem 1.1rem; font-weight: 700; font-size: .95rem;
  cursor: pointer; transition: transform .08s ease, box-shadow .12s ease;
}
.btn:hover { text-decoration: none; box-shadow: var(--shadow); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); border-color: var(--bad); background: transparent; }
.btn.big { padding: .7rem 1.5rem; font-size: 1.02rem; }
.btn.tiny { padding: .25rem .7rem; font-size: .82rem; }
.btn:disabled { opacity: .45; cursor: default; box-shadow: none; }
.pill {
  display: inline-flex; align-items: center; gap: .3rem;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 999px;
  padding: .22rem .75rem; font-size: .86rem; font-weight: 600;
}
.pill.hot { background: var(--carry-soft); border-color: var(--carry); color: var(--warn); }
.mini-pill { font-size: .8rem; padding: .12rem .6rem; }
.big-pill { font-size: 1rem; }
.badge {
  font-size: .72rem; font-weight: 700; padding: .14rem .55rem; border-radius: 999px;
  background: var(--bg2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap;
}
.badge-m1 { color: var(--warn); border-color: var(--warn); background: transparent; }
.badge-m2 { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.badge-m3 { color: var(--good); border-color: var(--good); background: var(--good-soft); }
.done-badge { color: var(--good); border-color: var(--good); background: var(--good-soft); }
.next-badge { color: #fff; background: var(--accent); border-color: var(--accent); }
.back-link { display: inline-block; margin-bottom: .4rem; font-weight: 600; font-size: .9rem; }

/* ---- hero / home ---- */
.hero { display: grid; grid-template-columns: 1.15fr .85fr; gap: 1.6rem; align-items: center; margin: 1.2rem 0 1.8rem; }
.hero h1 { font-size: clamp(2rem, 5vw, 2.9rem); margin: 0 0 .35em; }
.lede { font-size: 1.08rem; color: var(--muted); max-width: 34rem; }
.hero-cta { display: flex; gap: .7rem; flex-wrap: wrap; margin-top: 1rem; }
.home-demo { padding: 1rem; }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; margin-bottom: 1.6rem; }
.stat-card { text-align: center; padding: .85rem .5rem; }
.stat-big { font-size: 1.35rem; font-weight: 800; letter-spacing: -.01em; }
.stat-label { font-size: .8rem; }
.feature-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: .9rem; }
.feature-card { display: block; color: var(--ink); transition: transform .12s ease; }
.feature-card:hover { text-decoration: none; transform: translateY(-3px); }
.feature-icon { font-size: 1.6rem; }

/* ---- digit grid (worked + practice) ---- */
.digit-grid {
  display: flex; justify-content: center; gap: .45rem;
  padding: 2.4rem .4rem .6rem; /* headroom for the number/neighbor labels above the carry dots */
  overflow-x: auto;
}
.digit-col { display: flex; flex-direction: column; align-items: center; gap: .3rem; }
.carry-slot {
  height: 1.1rem; font-size: 1rem; line-height: 1.1rem; color: var(--carry);
  font-weight: 900; letter-spacing: .1em; opacity: 0; transition: opacity .25s ease;
}
.carry-slot.lit { opacity: 1; animation: dropIn .3s ease; }
.digit-cell {
  width: 3rem; height: 3.4rem; display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 1.7rem; font-weight: 600;
  border-radius: 10px; border: 2px solid transparent;
}
.digit-cell.top { background: var(--bg2); border-color: var(--line); }
.digit-cell.top.pad { color: var(--muted); opacity: .65; }
.digit-cell.ans { background: var(--card); border-color: var(--line); border-style: dashed; color: var(--accent); }
.digit-cell.ans.filled { border-style: solid; border-color: var(--accent); background: var(--accent-soft); }
.digit-cell.ans.cursor { border-style: solid; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); animation: pulse 1.6s ease infinite; }
.digit-cell.ans.wrong { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }
.digit-cell.op, .digit-cell.op-blank { border: none; background: none; font-size: 1.25rem; color: var(--muted); width: auto; padding: 0 .3rem; }
.digit-cell.top.is-num { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 4px var(--accent-soft); position: relative; }
.digit-cell.top.is-nbr {
  border-color: var(--accent2); position: relative;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, .22);                      /* fallback */
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent2) 22%, transparent);
}
.digit-cell.top.is-num::after, .digit-cell.top.is-nbr::after {
  content: "number"; position: absolute; top: -2.35rem; left: 50%; transform: translateX(-50%);
  font-family: system-ui, sans-serif; font-size: .58rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .06em; color: var(--accent); white-space: nowrap;
}
.digit-cell.top.is-nbr::after { content: "neighbor"; color: var(--accent2); }
.digit-cell.pop { animation: pop .3s cubic-bezier(.3, 1.6, .5, 1); }
.shake { animation: shake .35s ease; }

@keyframes pop { 0% { transform: scale(.4); } 100% { transform: scale(1); } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 3px var(--accent-soft); } 50% { box-shadow: 0 0 0 7px var(--accent-soft); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
@keyframes dropIn { from { transform: translateY(-6px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---- worked component ---- */
.worked-legend { display: flex; gap: 1rem; justify-content: center; font-size: .78rem; color: var(--muted); margin-top: .5rem; }
.lg::before { content: "●"; margin-right: .3rem; }
.lg-num::before { color: var(--accent); }
.lg-nbr::before { color: var(--accent2); }
.lg-carry::before { color: var(--carry); }
.worked-narration { min-height: 5.4rem; margin-top: .6rem; }
.step-card { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: .6rem .9rem; }
.step-who { font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: .35rem; }
.step-chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .4rem; }
.chip {
  font-family: var(--mono); font-size: .85rem; padding: .18rem .55rem;
  border-radius: 8px; background: var(--card); border: 1px solid var(--line);
}
.chip-odd5 { border-color: var(--warn); color: var(--warn); font-weight: 700; }
.chip-carry { border-color: var(--carry); color: var(--carry); font-weight: 700; }
.step-result { font-weight: 700; }
.worked-controls { display: flex; gap: .5rem; align-items: center; justify-content: center; margin-top: .7rem; flex-wrap: wrap; }
.step-counter { font-size: .84rem; min-width: 6.5rem; text-align: center; }
.worked--compact .digit-cell { width: 2.4rem; height: 2.8rem; font-size: 1.35rem; }
.worked--compact .worked-narration { min-height: 4.6rem; font-size: .92rem; }

/* ---- practice ---- */
.session-bar { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .8rem; align-items: center; }
.rule-pill { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.practice-stage { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; }
.practice-cue { text-align: center; margin: .2rem 0 0; font-size: .88rem; }
.practice-feedback { min-height: 2.6rem; margin-top: .7rem; }
.feedback { border-radius: 10px; padding: .5rem .9rem; font-weight: 600; animation: dropIn .25s ease; }
.feedback.good { background: var(--good-soft); color: var(--good); }
.feedback.great { background: var(--good-soft); color: var(--good); font-size: 1.05rem; }
.feedback.bad { background: var(--bad-soft); color: var(--bad); }
.feedback.warn { background: var(--carry-soft); color: var(--warn); }
.hint-box { margin-top: .5rem; min-height: 1rem; }
.hint-card {
  display: flex; gap: .6rem; align-items: baseline; flex-wrap: wrap;
  background: var(--accent-soft); border: 1px solid var(--accent); border-radius: 10px;
  padding: .55rem .9rem; font-size: .95rem;
}
.hint-level { font-size: .72rem; font-weight: 800; text-transform: uppercase; color: var(--accent); }
.practice-actions { margin-top: .6rem; display: flex; gap: .6rem; }
.numpad { display: none; grid-template-columns: repeat(3, 1fr); gap: .45rem; margin: .9rem auto 0; max-width: 300px; }
.numpad-zero { grid-column: span 2; }
.numpad-key {
  height: 2.9rem; font-family: var(--mono); font-size: 1.25rem; font-weight: 700;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card); cursor: pointer;
}
.numpad-key:active { background: var(--accent-soft); }
.numpad-hint { font-family: inherit; font-size: .85rem; color: var(--accent); }

/* ---- drill ---- */
.drill-head { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: .6rem; }
.timebar-wrap { height: .55rem; background: var(--bg2); border-radius: 999px; overflow: hidden; margin-bottom: 1.1rem; }
.timebar { height: 100%; width: 100%; background: var(--accent); border-radius: 999px; transition: width 1s linear; }
.timebar.urgent { background: var(--bad); }
.drill-stage { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.6rem 1.2rem; }
.drill-form { display: flex; gap: .8rem; align-items: center; justify-content: center; flex-wrap: wrap; }
.drill-problem { font-family: var(--mono); font-size: clamp(1.5rem, 4vw, 2.2rem); font-weight: 700; }
.drill-input {
  font-family: var(--mono); font-size: clamp(1.5rem, 4vw, 2.2rem); font-weight: 700;
  width: 9ch; padding: .15rem .5rem; border: 2px solid var(--line); border-radius: 10px;
  background: var(--bg2); color: var(--ink); text-align: center;
}
.drill-input:focus { border-color: var(--accent); outline: none; }
.drill-feedback { min-height: 2.6rem; margin-top: .8rem; text-align: center; }
.drill-feedback .feedback { display: inline-block; }
.drill-summary { text-align: center; }
.drill-score { font-size: 3.2rem; font-weight: 900; letter-spacing: -.03em; }
.drill-stats { display: flex; gap: .5rem; justify-content: center; margin: .8rem 0; flex-wrap: wrap; }
.drill-again { display: flex; gap: .7rem; justify-content: center; flex-wrap: wrap; margin-top: .6rem; }
.drill-config { margin-bottom: 1rem; }
.drill-config-row { display: flex; gap: .8rem; align-items: center; margin: .55rem 0; flex-wrap: wrap; }
.drill-config-row > .mini { min-width: 3.2rem; }
.chip-row { display: flex; gap: .4rem; flex-wrap: wrap; }

/* ---- tiers ---- */
.tier-bar { display: flex; gap: .45rem; flex-wrap: wrap; margin: .6rem 0 1rem; }
.tier-chip {
  border: 1px solid var(--line); background: var(--card); border-radius: 999px;
  padding: .35rem .9rem; font-weight: 700; font-size: .88rem; cursor: pointer;
}
.tier-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---- lessons ---- */
.lesson-list { display: flex; flex-direction: column; gap: .6rem; margin-top: 1rem; }
.lesson-card { display: flex; gap: .9rem; align-items: center; color: var(--ink); transition: transform .1s ease; }
.lesson-card:hover { text-decoration: none; transform: translateX(4px); }
.lesson-card.next { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }
.lesson-card.done { opacity: .82; }
.lesson-icon { font-size: 1.7rem; width: 2.4rem; text-align: center; flex-shrink: 0; }
.lesson-icon.big { font-size: 2.6rem; width: auto; }
.lesson-body { flex: 1; display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.lesson-title { font-weight: 800; }
.lesson-tag { font-size: .88rem; }
.lesson-sub { font-size: .78rem; color: var(--accent); font-weight: 600; }
.lesson-status { display: flex; flex-direction: column; gap: .3rem; align-items: flex-end; flex-shrink: 0; }
.lesson-head { display: flex; gap: 1rem; align-items: center; margin-bottom: .6rem; }
.lesson-head h1 { margin: 0; }
.lesson-head p { margin: 0; }

.tab-bar { display: flex; gap: .3rem; border-bottom: 2px solid var(--line); margin: .8rem 0 1.2rem; }
.tab {
  border: none; background: none; padding: .55rem 1.1rem; font-weight: 700; font-size: .98rem;
  color: var(--muted); cursor: pointer; border-radius: 10px 10px 0 0; position: relative; top: 2px;
  border-bottom: 3px solid transparent;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.mnemonic-banner {
  font-size: 1.25rem; font-weight: 800; text-align: center; letter-spacing: -.01em;
  background: linear-gradient(120deg, var(--accent-soft), transparent);
  border: 1px dashed var(--accent); border-radius: var(--radius);
  padding: .9rem 1.2rem; margin-bottom: 1.1rem; color: var(--accent);
}
.concept p { max-width: 46rem; }
.concept table { border-collapse: collapse; margin: .6rem 0; }
.concept th, .concept td { border: 1px solid var(--line); padding: .3rem .7rem; font-family: var(--mono); text-align: center; }
.callout {
  border-left: 4px solid var(--accent); background: var(--accent-soft);
  border-radius: 0 10px 10px 0; padding: .65rem 1rem; margin: 1rem 0; max-width: 44rem;
}
.callout p { margin: 0; }
details.why { margin: 1rem 0; max-width: 46rem; }
details.why summary { cursor: pointer; font-weight: 700; color: var(--accent); }
.tips-cols { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; margin: 1.1rem 0; }
.tips-cols ul { margin: .3rem 0 0; padding-left: 1.15rem; }
.tips-cols li { margin: .35rem 0; font-size: .94rem; }
.phase-next { margin: 1.4rem 0 .4rem; display: flex; gap: .7rem; flex-wrap: wrap; }
.worked-holder { margin-top: .6rem; }
.win-line { margin-bottom: .8rem; display: flex; gap: .9rem; align-items: center; flex-wrap: wrap; }
.win-dots { display: flex; gap: .35rem; }
.win-dot {
  width: 1rem; height: 1rem; border-radius: 50%; background: var(--bg2); border: 2px solid var(--line);
  display: inline-block; transition: all .25s ease;
}
.win-dot.won { background: var(--good); border-color: var(--good); transform: scale(1.1); }
.lesson-complete { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; width: 100%; padding: .6rem 0; }

/* ---- trainers (basics / checking widgets) ---- */
.trainer { margin-top: 1.4rem; max-width: 34rem; }
.trainer-prompt { font-family: var(--mono); font-size: 2rem; font-weight: 800; text-align: center; min-height: 3rem; margin: .5rem 0; }
.trainer-keys { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; }
.trainer-keys .numpad-key { width: 3rem; }
.trainer-msg { text-align: center; min-height: 1.6rem; margin-top: .6rem; font-weight: 600; }
.check-form { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin: .6rem 0; }
.check-input {
  font-family: var(--mono); font-size: 1.15rem; width: 7.5ch; padding: .3rem .5rem;
  border: 2px solid var(--line); border-radius: 8px; background: var(--bg2); color: var(--ink); text-align: center;
}
.check-input:focus { border-color: var(--accent); outline: none; }
.check-x { font-family: var(--mono); font-size: 1.2rem; color: var(--muted); }
.check-steps p { margin: .35rem 0; font-family: var(--mono); font-size: .92rem; }
.check-steps .feedback { font-family: system-ui, sans-serif; }

/* ---- practice rule picker ---- */
.rule-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .8rem; margin-top: 1rem; }
.rule-card { color: var(--ink); transition: transform .1s ease; display: flex; flex-direction: column; gap: .3rem; }
.rule-card:hover { text-decoration: none; transform: translateY(-3px); }
.rule-big { font-family: var(--mono); font-size: 1.7rem; font-weight: 800; color: var(--accent); }
.rule-mn { min-height: 2.4em; }
.rule-meta { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }

/* ---- reference ---- */
.ref-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.ref-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .8rem; margin: 1rem 0; }
.ref-label { font-family: var(--mono); font-size: 1.4rem; font-weight: 800; color: var(--accent); }
.ref-rule { font-weight: 700; margin: .25rem 0 .4rem; }
.ref-detail { font-size: .9rem; }
.ref-detail ul { margin: .3rem 0; padding-left: 1.1rem; }
.ref-example { font-family: var(--mono); font-size: .9rem; margin-top: .5rem; background: var(--bg2); border-radius: 8px; padding: .35rem .6rem; display: inline-block; }
.halving-table-card { margin-top: .6rem; }
.ht-row { display: flex; gap: .3rem; font-family: var(--mono); font-size: 1.1rem; }
.ht-row span { width: 2.2rem; height: 2.2rem; display: flex; align-items: center; justify-content: center; background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; }
.ht-half span { color: var(--accent); font-weight: 700; margin-top: .3rem; }

/* ---- about ---- */
.about-body { max-width: 46rem; }
.data-card { margin-top: 1.6rem; max-width: 46rem; }

/* ---- confetti ---- */
.confetti-holder { position: fixed; z-index: 100; pointer-events: none; }
.confetti-piece {
  position: absolute; width: 9px; height: 9px; border-radius: 2px;
  animation: confetti 1.1s cubic-bezier(.2, .6, .4, 1) forwards;
}
@keyframes confetti {
  0% { transform: translate(0, 0) rotate(0); opacity: 1; }
  100% { transform: translate(var(--dx), calc(var(--dy) + 220px)) rotate(var(--rot)); opacity: 0; }
}

/* ---- a11y helpers ---- */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---- responsive ---- */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .feature-row { grid-template-columns: 1fr; }
  .tips-cols { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .main-nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    background: var(--card); border-bottom: 1px solid var(--line);
    flex-direction: column; padding: .6rem 1rem 1rem; gap: .2rem;
  }
  #tb-header.nav-open .main-nav { display: flex; }
  .burger { display: block; }
  .numpad { display: grid; }
  .digit-cell { width: 2.5rem; height: 3rem; font-size: 1.4rem; }
  .rule-pill { display: none; }
}
@media (pointer: coarse) { .numpad { display: grid; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* ---- print (cheat sheet) ---- */
@media print {
  #tb-header, .site-foot, .ref-head .btn { display: none; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; break-inside: avoid; }
}
