.deck {
  --accent: #6741d9;
  --accent-deep: #4c2fa8;
  --accent-soft: #ebe5fb;
  --accent-ink: #fff;
  --c0: #6741d9;
  --c1: #00a29c;
  --c2: #e8590c;
  --c3: #1c7ed6;
  --c4: #d6336c;
  --c5: #5c940d;
  --hatch: repeating-linear-gradient(-45deg, #e3e8ee 0 4px, #f6f8fa 4px 8px);
}
/* Local accent overrides for shared bits that default to Go blue */
.deck code { background: var(--accent-soft); }
.deck .btn code, .deck .opt code { background: none; padding: 0; }
.deck a { color: var(--accent-deep); }
.deck .btn:hover:not(:disabled) { background: var(--accent-soft); }
.deck .btn.primary:hover:not(:disabled), .deck .btn.sel:hover:not(:disabled) { background: var(--accent-deep); border-color: var(--accent-deep); color: #fff; }
.deck .points li::marker { color: var(--accent); }
.deck .deck-progress span { background: var(--accent); }
.deck :focus-visible { outline-color: var(--accent); }
.muted { color: var(--muted); }
.ok { color: #00756e; }
.bad { color: var(--block); }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 6px; flex: none; }
.num-in {
  font: inherit; font-family: var(--mono); font-size: 0.85em; width: 9.5em; padding: 6px 10px; border-radius: 8px;
  border: 1.5px solid var(--ink); background: var(--panel); color: var(--ink); min-height: 40px; min-width: 0;
}
.num-in.wide { width: 100%; max-width: 20em; flex: 1; }
.num-in.txt { font-family: var(--font); font-size: 1em; }
.cost-track { height: 12px; background: var(--paper); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; display: block; }
.cost-fill { display: block; height: 100%; background: var(--accent); transition: width 0.2s; }
.demo .controls + .controls { margin-top: -6px; }

/* Title: a hexdump with one byte opened up */
.title-slide { flex-direction: row; align-items: center; gap: clamp(28px, 6vw, 80px); }
.title-slide h1 { font-size: clamp(2.4rem, 4.4vw + 0.5rem, 4.6rem); max-width: 12ch; }
.title-slide .lead { font-size: clamp(1.05rem, 0.8vw + 0.8rem, 1.3rem); max-width: 44ch; }
.hero-mem {
  flex: none; width: min(100%, 360px); padding: 16px; border-radius: 14px; background: var(--ink); color: #c9d6e2;
  font-family: var(--mono); font-size: 0.8em; display: grid; gap: 6px;
}
.hm-row { display: grid; grid-template-columns: 3.4em repeat(8, 1fr); gap: 4px; align-items: center; }
.hm-a { color: #7f93a6; font-size: 0.85em; }
.hm-row i { font-style: normal; text-align: center; padding: 4px 0; border-radius: 4px; background: #1f3a52; }
.hm-row i.v { background: var(--c0); color: #fff; }
.hm-row i.p { background: var(--value); color: var(--ink); font-weight: 700; }
.hm-row i.f { background: #2f6f8f; color: #fff; }
.hm-row i.s { background: var(--c1); color: #fff; }
.hm-bits { display: flex; align-items: center; gap: 4px; margin-top: 10px; padding-top: 12px; border-top: 1px dashed #3b566e; }
.hm-bits span { color: #7f93a6; font-size: 0.85em; padding: 0 4px; }
.hm-bits b { flex: 1; text-align: center; padding: 5px 0; border-radius: 4px; border: 1.5px solid #3b566e; }
.hm-bits b.on { background: var(--value); color: var(--ink); border-color: var(--value); }
@media (max-width: 900px) {
  .title-slide { flex-direction: column-reverse; align-items: stretch; }
  .hero-mem { width: 100%; }
}

/* Bit buttons, shared by hex32 and register */
.bit {
  font: inherit; font-family: var(--mono); font-weight: 700; font-size: 0.8em;
  width: clamp(24px, 6.4vw, 30px); height: 32px; padding: 0; border-radius: 5px; cursor: pointer;
  border: 1.5px solid var(--line); background: var(--panel); color: var(--muted); touch-action: manipulation;
}
.bit.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.bit.sign { border-color: var(--block); }
.bit.sign.on { background: var(--block); }

/* hex32 */
.hx-head { display: grid; grid-template-columns: repeat(3, auto); gap: 4px 16px; justify-content: start; }
.hx-head div { display: flex; flex-direction: column; }
.hx-head b { font-family: var(--mono); font-size: 1.05em; font-variant-numeric: tabular-nums; }
.hx-rows { display: grid; gap: 5px; }
.hx-row { display: flex; align-items: center; gap: 8px; }
.hx-bn { font-size: 0.72em; color: var(--muted); width: 3.6em; flex: none; }
.hx-nib { display: inline-flex; gap: 2px; align-items: center; }
.hx-digit { font-family: var(--mono); color: var(--accent-deep); width: 1.2em; text-align: center; font-size: 1.05em; }
.hx-dec { font-family: var(--mono); font-size: 0.8em; color: var(--muted); margin-left: auto; min-width: 2.2em; text-align: right; }
@media (max-width: 480px) {
  .hx-bn { display: none; }
  .hx-row { gap: 4px; }
  .hx-head { grid-template-columns: 1fr 1fr; }
}

/* memory */
.mem-grid { display: grid; grid-template-columns: 4.2em repeat(8, minmax(0, 1fr)); gap: 3px; font-family: var(--mono); }
.mem-addr { font-size: 0.72em; color: var(--muted); align-self: center; }
.mem-b {
  font: inherit; font-size: 0.78em; padding: 6px 0; border-radius: 4px; cursor: pointer; text-align: center;
  border: 2px solid transparent; background: color-mix(in srgb, var(--c) 18%, white); color: var(--ink); --c: #aab6c2;
}
.mem-b.pad { background: var(--hatch); color: var(--muted); }
.mem-b.sel { border-color: var(--ink); background: var(--c); color: #fff; }
.mem-b.pad.sel { background: var(--ink); }
.v1 { --c: var(--c0); } .v2 { --c: var(--c2); } .v3 { --c: var(--c3); } .v4 { --c: var(--c1); } .v5 { --c: var(--c4); }
.mem-chip { border-color: var(--c); }
.mem-chip.sel, .deck .mem-chip.sel:hover:not(:disabled) { background: var(--c); border-color: var(--c); color: #fff; }

/* register */
.rg-bits { display: flex; gap: 4px; justify-content: space-between; max-width: 340px; }
.rg-bit { display: flex; flex-direction: column; align-items: center; gap: 2px; flex: 1; }
.rg-bit .bit { width: 100%; max-width: 38px; height: 38px; font-size: 0.95em; }
.rg-bit small { font-family: var(--mono); font-size: 0.62em; color: var(--muted); }
.rg-body { display: flex; align-items: center; gap: 18px; }
.rg-wheel { width: 180px; flex: none; }
.rg-ring { fill: none; stroke: var(--accent-soft); stroke-width: 12; }
.rg-neg { fill: none; stroke: var(--block-soft); stroke-width: 12; }
.rg-t { font-family: var(--mono); font-size: 11px; fill: var(--muted); text-anchor: middle; dominant-baseline: middle; }
.rg-t.s { fill: var(--block); }
.rg-wrap { stroke: var(--ink); stroke-width: 3; }
.rg-wrap.s { stroke: var(--block); }
.rg-hand { stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.rg-dot { fill: var(--accent); stroke: #fff; stroke-width: 2; }
.rg-c { font-family: var(--mono); font-size: 18px; font-weight: 700; text-anchor: middle; fill: var(--ink); }
.rg-c.s { font-size: 12px; fill: var(--block); font-weight: 400; }
.rg-vals { display: grid; gap: 8px; }
.rg-vals div { display: flex; flex-direction: column; }
.rg-vals b { font-family: var(--mono); font-size: 1.5em; line-height: 1.1; }
.rg-vals b.neg { color: var(--block); }
@media (max-width: 420px) { .rg-wheel { width: 150px; } .rg-body { gap: 12px; } }

/* counter */
.ct-out { display: grid; gap: 6px; }
.ct-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.ct-row b { font-family: var(--mono); font-size: 0.9em; }
.ct-row b.big { font-family: var(--font); font-size: 1.6em; color: var(--accent-deep); }
.ct-scale { position: relative; height: 1.2em; font-size: 0.7em; color: var(--muted); margin: 0 2em 0 0; }
.ct-scale span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.ct-scale span:first-child { transform: none; }

/* float */
.fl-bits { font-family: var(--mono); font-size: 0.82em; overflow-wrap: anywhere; word-break: break-all; line-height: 1.7; letter-spacing: 0.02em; }
.fl-bits span { padding: 2px 3px; border-radius: 4px; }
.fs { background: #f9dfe7; color: #a3184a; }
.fe { background: var(--accent-soft); color: var(--accent-deep); }
.fm { background: var(--ok-soft); color: #00665f; }
.sw.fs { background: var(--block); } .sw.fe { background: var(--accent); } .sw.fm { background: var(--ok); }
.fl-parts { display: grid; gap: 3px; font-size: 0.85em; }
.fl-parts div { display: grid; grid-template-columns: auto 9.5em 1fr; align-items: baseline; gap: 4px; }
.fl-parts b { font-family: var(--mono); font-weight: 400; font-size: 0.92em; }
.fl-parts b b { font-weight: 700; }
.fl-exact { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 8px; background: var(--paper); }
.fl-exact b { font-family: var(--mono); font-size: 0.85em; overflow-wrap: anywhere; word-break: break-all; }
.fl-exact b .muted { font-family: var(--font); font-weight: 400; }
@media (max-width: 480px) { .fl-parts div { grid-template-columns: auto 1fr; } .fl-parts b { grid-column: 2; } }

/* money */
.mn-table { display: grid; border-top: 2px solid var(--ink); }
.mn-row { display: grid; grid-template-columns: 8.5em 1fr 6em; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); align-items: baseline; font-size: 0.9em; }
.mn-row.head { font-size: 0.72em; color: var(--muted); font-weight: 600; }
.mn-row b { font-family: var(--mono); font-size: 0.9em; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.mn-row code { background: none; padding: 0; }
.mn-row > span:last-child { text-align: right; font-weight: 600; font-size: 0.9em; }
@media (max-width: 480px) { .mn-row { grid-template-columns: 5.6em 1fr 5.6em; gap: 6px; } .demo .stat b { font-size: 1.05em; } }

/* endian */
.en-mem { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.en-cell { display: flex; flex-direction: column; align-items: center; padding: 8px 4px; border-radius: 8px; border: 1.5px solid var(--ink); transition: background 0.2s; }
.en-cell b { font-family: var(--mono); font-size: 1.5em; }
.en-cell small { font-size: 0.7em; min-height: 1.2em; }
.en-cell.s3 { background: var(--accent-deep); color: #fff; }
.en-cell.s2 { background: var(--accent); color: #fff; }
.en-cell.s1 { background: #b9a7ef; }
.en-cell.s0 { background: var(--accent-soft); }
.en-cell.s3 .label, .en-cell.s2 .label { color: #e6defc; }
.en-reads { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.en-reads div { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 8px; border-left: 4px solid var(--ok); background: var(--paper); color: var(--ink); }
.en-reads div.bad { border-color: var(--block); }
.en-reads b { font-family: var(--mono); }
.en-reads small { font-size: 0.75em; color: var(--muted); }
@media (max-width: 420px) { .en-reads { grid-template-columns: 1fr; } }

/* struct */
.st-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.st-list { display: grid; gap: 4px; }
.st-f { display: flex; align-items: center; gap: 6px; padding: 3px 4px 3px 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 0.85em; }
.st-f code { background: none; padding: 0; flex: 1; white-space: nowrap; }
.st-f small { font-family: var(--mono); color: var(--muted); font-size: 0.75em; }
.st-mv { font: inherit; width: 30px; height: 30px; border-radius: 6px; border: 1.5px solid var(--line); background: var(--panel); cursor: pointer; color: var(--ink); padding: 0; touch-action: manipulation; }
.st-mv:hover:not(:disabled) { border-color: var(--accent); }
.st-mv:disabled { opacity: 0.3; cursor: default; }
.st-mem { display: flex; flex-direction: column; gap: 6px; }
.st-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 2px; }
.st-b { height: 24px; border-radius: 3px; font-size: 0.58em; font-weight: 700; color: #fff; padding: 2px 3px; overflow: visible; white-space: nowrap; line-height: 20px; position: relative; z-index: 1; }
.st-b.pad { background: var(--hatch); }
.f0 { background: var(--c0); } .f1 { background: var(--c1); } .f2 { background: var(--c2); }
.f3 { background: var(--c3); } .f4 { background: var(--c4); } .f5 { background: var(--c5); }
@media (max-width: 560px) { .st-cols { grid-template-columns: 1fr; } }

/* boxed */
.bx-mem { display: grid; gap: 2px; }
.bx-line { display: grid; grid-template-columns: 2.4em repeat(16, minmax(0, 1fr)); gap: 1px; padding: 2px; border-radius: 4px; transition: background 0.2s; }
.bx-line.ld { background: #fdf0a6; }
.bx-addr { font-family: var(--mono); font-size: 0.6em; color: var(--muted); align-self: center; }
.bx-line i, .bx-legend .sw { height: 12px; border-radius: 2px; background: #e9edf1; }
.bx-line i.val, .bx-legend .sw.val { background: var(--accent); }
.bx-line i.ref, .bx-legend .sw.ref { background: var(--c3); }
.bx-line i.hdr, .bx-legend .sw.hdr { background: #8aa0b4; }
.bx-line i.oth, .bx-legend .sw.oth { background: #dfe5eb; }
.bx-line i.free { background: transparent; outline: 1px dashed #c7d1da; outline-offset: -1px; }
.bx-line i.el { box-shadow: 0 0 0 1px var(--ink); }
.bx-line i.cur { box-shadow: 0 0 0 2px var(--block); position: relative; z-index: 1; }
.bx-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; font-size: 0.72em; color: var(--muted); }
.bx-legend .sw { width: 12px; margin-right: -8px; }
.bx-legend .sw.ld { background: #fdf0a6; border: 1px solid #e0c840; }

/* python int */
.py-obj { display: grid; gap: 3px; }
.py-row { display: grid; grid-template-columns: 7.5em 2.8em 1fr; gap: 8px; align-items: center; padding: 4px 10px; border-radius: 6px; font-size: 0.85em; }
.py-row.hd { background: #e9edf1; }
.py-row.dg { background: var(--accent-soft); }
.py-row.more { display: block; color: var(--muted); background: none; font-size: 0.78em; }
.py-row code { background: none; padding: 0; }
.py-row small { color: var(--muted); font-family: var(--mono); }
.py-row b { font-family: var(--mono); font-size: 0.9em; text-align: right; }
.py-bar { display: flex; height: 26px; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); font-size: 0.7em; font-weight: 700; }
.py-bar span { display: grid; place-items: center; white-space: nowrap; overflow: hidden; }
.py-bar .hd { background: #8aa0b4; color: #fff; }
.py-bar .dg { background: var(--accent); color: #fff; }
.py-bar .pd { background: var(--hatch); }

/* utf-8 */
.stats.four { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 480px) { .stats.four { grid-template-columns: 1fr 1fr; } }
.u8-chars { display: flex; flex-wrap: wrap; gap: 4px; }
.u8-c {
  font: inherit; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 4px 6px; min-width: 52px;
  border: 1.5px solid var(--line); border-radius: 8px; background: var(--panel); cursor: pointer; color: var(--ink);
}
.u8-c .g { font-size: 1.25em; line-height: 1.2; min-height: 1.2em; }
.u8-c small { font-family: var(--mono); font-size: 0.6em; color: var(--muted); }
.u8-c .bs { font-family: var(--mono); font-size: 0.62em; font-weight: 700; }
.u8-c.n2 .bs { color: var(--c3); } .u8-c.n3 .bs { color: var(--c2); } .u8-c.n4 .bs { color: var(--c4); }
.u8-c.sel { border-color: var(--accent); background: var(--accent-soft); }
.u8-bits { display: grid; gap: 6px; padding: 8px 10px; border-radius: 8px; background: var(--paper); }
.u8-head { font-size: 0.85em; }
.u8-head b { font-size: 1.2em; }
.u8-bytes { display: flex; flex-wrap: wrap; gap: 6px; }
.u8-byte { display: inline-flex; align-items: baseline; font-family: var(--mono); font-size: 0.85em; padding: 3px 6px; border-radius: 6px; background: var(--panel); border: 1px solid var(--line); }
.u8-byte i { font-style: normal; color: #9aa9b7; }
.u8-byte b { color: var(--accent-deep); }
.u8-byte small { margin-left: 6px; font-size: 0.8em; color: var(--muted); }
.u8-bits .note { font-size: 0.78em; }

/* truncate */
.tr-strip { display: flex; flex-wrap: wrap; gap: 2px; }
.tr-strip span { font-family: var(--mono); font-size: 0.72em; padding: 3px 4px; min-width: 2.2em; text-align: center; border-radius: 3px; border-bottom: 3px solid var(--accent); background: var(--accent-soft); }
.tr-strip span.odd { border-bottom-color: var(--c1); background: var(--ok-soft); }
.tr-strip.cp span, .tr-strip.gr span { font-family: var(--font); font-size: 0.95em; min-width: 1.8em; }
.tr-strip span.cut { opacity: 0.28; }
.tr-strip span.last { box-shadow: 3px 0 0 var(--block); }
.tr-result { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 8px; background: var(--paper); }
.tr-result b { font-size: 1.3em; font-weight: 600; }
.tr-result small { color: var(--muted); font-size: 0.75em; }
.tr-result code { background: none; padding: 0; }

/* string length table */
.lens { display: grid; border-top: 2px solid var(--ink); font-size: 0.92em; }
.ln { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1.1fr) 5em 3em; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.ln.head { font-size: 0.8em; color: var(--muted); font-weight: 600; }
.ln b { font-family: var(--mono); color: var(--accent-deep); text-align: right; }
.ln.head code { text-align: right; background: none; }
.ln > span:nth-child(2) { color: var(--muted); }
@media (max-width: 480px) { .ln { grid-template-columns: minmax(0, 1fr) 4.2em 2.2em; } .ln > span:nth-child(2) { display: none; } }

@media (min-width: 901px) { .split.practice { grid-template-columns: minmax(0, 4fr) minmax(0, 6fr); } }
.deck a.btn { color: var(--ink); }
.deck a.btn.primary { color: #fff; }
