/* vm.css: shared styles for the Week 8 walkthroughs.
   Part 1 is the shared engine theme (byte-identical to the KERNEL block in ../../worksheet6/sched/sched.css and ../../worksheet7/cache/cache.css).
   Part 2 is specific to these pages: listings, stats, process badges, the hex toggle, the address bits, page-table pages, the PTE, the TLB, fault cards. */
  /* === KERNEL-START === */
  /* ---------- theme ---------- */
  :root {
    --bg: #f6f5f1;
    --panel: #ffffff;
    --ink: #1c1c1c;
    --muted: #6b6b6b;
    --line: #d9d6cf;
    --hot: #ffcf33;
    --hot-ink: #6b4d00;
    --new: #1e9e5a;
    --gone: #c0392b;
    --lookup: #7b3fe4;
    --cat: #e0662a;
    --py: #2266d3;
    --kernel: #555;
    font-size: 17px;
  }
  @media (min-width: 1500px) { :root { font-size: 19px; } }
  @media (max-width: 1200px) { :root { font-size: 14px; } }
  * { box-sizing: border-box; }
  html, body { height: 100%; margin: 0; }
  body {
    background: var(--bg); color: var(--ink);
    font-family: -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
    display: flex; flex-direction: column; height: 100vh; overflow: hidden;
  }
  code, .mono { font-family: "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; }
  b { font-weight: 700; }

  /* ---------- header ---------- */
  header {
    display: flex; align-items: center; gap: 1.2rem;
    padding: .55rem 1.2rem; background: #fff; border-bottom: 2px solid var(--line);
  }
  header .title { font-weight: 800; font-size: 1.15rem; letter-spacing: .01em; }
  header .title span { color: var(--muted); font-weight: 500; margin-left: .6rem; font-size: .95rem; }
  header .stepno { margin-left: auto; color: var(--muted); font-size: .95rem; white-space: nowrap; }
  header .stepno b { color: var(--ink); }
  header .part { color: var(--ink); font-weight: 600; }
  nav { display: flex; gap: .4rem; }
  nav button {
    font: inherit; font-weight: 700; padding: .4rem .9rem; border-radius: .5rem;
    border: 2px solid var(--ink); background: #fff; cursor: pointer;
  }
  nav button:hover { background: #f0efe9; }
  nav button:disabled { opacity: .35; cursor: default; }
  .progress { height: 4px; background: #e8e6df; }
  .progress i { display: block; height: 100%; background: var(--ink); transition: width .25s; }

  /* ---------- main grid ---------- */
  main {
    flex: 1; display: grid; gap: 1rem; padding: 1rem 1.2rem; min-height: 0;
  }
  .col { min-width: 0; display: flex; flex-direction: column; gap: .7rem; overflow-y: auto; overflow-x: hidden; padding: .3rem .35rem; }
  .col > h2 {
    margin: 0; font-size: 1rem; text-transform: uppercase; letter-spacing: .06em;
    display: flex; flex-direction: column; gap: .1rem;
  }
  .col > h2 small {
    text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--muted);
    font-family: "SF Mono", Menlo, Consolas, monospace; font-size: .8rem;
  }
  .empty { color: var(--muted); font-style: italic; padding: .4rem .2rem; }

  /* ---------- generic boxes ---------- */
  .box { background: var(--panel); border: 2px solid var(--line); border-radius: .7rem; padding: .45rem .7rem; position: relative; }
  .proc { background: var(--panel); border: 2px solid var(--c); border-radius: .7rem; overflow: hidden; position: relative; }
  .proc .phead {
    background: var(--c); color: #fff; padding: .35rem .7rem; font-weight: 700;
    display: flex; justify-content: space-between; align-items: baseline; gap: .6rem;
  }
  .proc .phead small { font-weight: 500; opacity: .9; }
  .chip {
    display: inline-block; font-size: .75rem; font-weight: 700; padding: .05rem .45rem; border-radius: 1rem;
    border: 1px solid var(--line); background: #fafaf7; color: #333; white-space: nowrap;
  }
  .badge { font-size: .75rem; font-weight: 700; padding: .05rem .45rem; border-radius: 1rem; background: var(--gone); color: #fff; }

  /* ---------- states ---------- */
  .hot { box-shadow: 0 0 0 4px var(--hot); animation: pulse 1.1s ease-in-out 2; position: relative; z-index: 1; }
  @keyframes pulse { 0%,100% { box-shadow: 0 0 0 4px var(--hot); } 50% { box-shadow: 0 0 0 8px #ffe28a; } }
  .new { border-color: var(--new) !important; position: relative; }
  .new::after {
    content: "NEW"; position: absolute; top: -.6rem; right: .6rem; background: var(--new); color: #fff;
    font-size: .65rem; font-weight: 800; padding: .05rem .4rem; border-radius: .3rem; letter-spacing: .05em; z-index: 1;
  }
  .gone { opacity: .5; border-style: dashed !important; border-color: var(--gone) !important; position: relative; }
  .gone::after {
    content: "FREED"; position: absolute; top: -.6rem; right: .6rem; background: var(--gone); color: #fff;
    font-size: .65rem; font-weight: 800; padding: .05rem .4rem; border-radius: .3rem; letter-spacing: .05em; z-index: 1;
  }
  .gone.lost::after { content: "LOST"; }

  /* ---------- footer ---------- */
  footer {
    background: #fff; border-top: 2px solid var(--line); padding: .7rem 1.2rem .9rem;
    display: grid; grid-template-columns: 1fr; gap: .5rem; min-height: 9.5rem;
  }
  .call {
    display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; min-height: 2rem;
    font-family: Menlo, monospace; font-size: 1.05rem;
  }
  .call .who {
    background: var(--c, var(--kernel)); color: #fff; padding: .15rem .6rem; border-radius: .4rem;
    font-family: -apple-system, "Segoe UI", sans-serif; font-weight: 700; font-size: .9rem;
  }
  .call .sys { font-weight: 700; }
  .call .ret { color: var(--new); font-weight: 800; }
  .call .bytes { background: var(--hot); color: var(--hot-ink); padding: 0 .4rem; border-radius: .3rem; font-weight: 700; }
  .call .note { color: var(--muted); font-family: -apple-system, "Segoe UI", sans-serif; font-size: .9rem; }
  .crumbs { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; font-size: .95rem; }
  .crumb { border: 2px solid var(--line); border-radius: .4rem; padding: .05rem .5rem; color: var(--muted); }
  .crumb.done { border-color: var(--lookup); color: var(--lookup); font-weight: 700; }
  .crumb.cur { background: var(--lookup); border-color: var(--lookup); color: #fff; font-weight: 800; }
  .crumb small { font-weight: 500; opacity: .8; }
  .narr h3 { margin: 0 0 .25rem; font-size: 1.1rem; }
  .narr p { margin: 0; font-size: 1.05rem; line-height: 1.45; max-width: 95ch; }
  .narr ul { margin: .2rem 0 0; padding-left: 1.3rem; font-size: 1rem; line-height: 1.4; columns: 2; column-gap: 2.5rem; }
  .narr li { break-inside: avoid; margin-bottom: .25rem; }
  .narr code { background: #f0efe9; padding: 0 .3rem; border-radius: .25rem; font-size: .95em; }
  .narr table { border-collapse: collapse; font-size: .95rem; margin-top: .3rem; }
  .narr th, .narr td { border: 1px solid var(--line); padding: .15rem .6rem; text-align: left; }
  .narr .k { color: var(--lookup); font-weight: 700; }
  .narr .cat { color: var(--cat); font-weight: 700; }
  .narr .py { color: var(--py); font-weight: 700; }
  nav button#explain { border-color: var(--line); font-weight: 600; color: var(--muted); }
  nav button#explain[aria-pressed="true"] { background: var(--hot); border-color: var(--hot-ink); color: var(--hot-ink); }
  footer.collapsed { min-height: 0; }
  footer.collapsed .narr > :not(h3) { display: none; }
  footer.collapsed .narr h3 { cursor: pointer; }
  footer.collapsed .narr h3::after { content: ": explanation hidden · press E or “Explain”"; color: var(--muted); font-weight: 500; font-size: .85rem; }

  /* ---------- arrow overlay ---------- */
  #arrows { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 2; }
  #arrows path { fill: none; stroke-width: 2.5; stroke: var(--kernel); }
  #arrows polygon { fill: var(--kernel); }
  #arrows path.lookup { stroke: var(--lookup); stroke-dasharray: 7 5; stroke-width: 3; }
  #arrows polygon.lookup { fill: var(--lookup); }
  #arrows path.new { stroke: var(--new); stroke-width: 3; }
  #arrows polygon.new { fill: var(--new); }
  #arrows path.gone { stroke: var(--gone); stroke-dasharray: 4 4; stroke-width: 3; }
  #arrows polygon.gone { fill: var(--gone); }
  #arrows path.hotarrow { stroke: var(--hot-ink); stroke-width: 3.5; }
  #arrows polygon.hotarrow { fill: var(--hot-ink); }
  #arrows .dim { opacity: .3; }
  /* === KERNEL-END === */

  /* ---------- page: virtual-memory walkthroughs ---------- */
  :root {
    --p1: #425B9A; --p2: #76C0EC; --p2-ink: #3A9AD9; --p2-tint: #E3F2FB; --p3: #FFF6DC; --p4: #FF95A5; --p4-ink: #E5607A; --p4-tint: #FFE6EA;
    --lookup: #425B9A;
    --proc-a: #8f5518; --proc-a-t: #f7ead9; --proc-b: #b9460f; --proc-b-t: #fde5d7; --proc-c: #c99400; --proc-c-t: #fbf3d6; --mmu: #5b6b8c;
    --l2: #425B9A; --l2-t: #E6EAF5; --l1: #3A9AD9; --l1-t: #E3F2FB; --l0: #1e9e5a; --l0-t: #e3f4ea; --off: #E5607A; --off-t: #FFE6EA;
    --fault: #c0392b; --fault-t: #fdecea;
  }
  main { padding: .6rem 1.2rem .5rem; gap: .9rem; }
  /* process names: the same pills as the worksheet text (index.html .pa-a / .pa-b) */
  .pa-a, .pa-b { font-weight: 700; border-radius: .35em; padding: 0 .28em; white-space: nowrap; }
  .pa-a { color: var(--proc-a); background: var(--proc-a-t); } .pa-b { color: var(--proc-b); background: var(--proc-b-t); }
  .col > h2 .pa-a, .col > h2 .pa-b { align-self: flex-start; }
  header .title { white-space: nowrap; }
  @media (max-width: 1400px) { header .title span { display: none; } header .title { font-size: 1rem; } header { gap: .8rem; } nav button { padding: .4rem .65rem; } }
  nav button { white-space: nowrap; }
  .col > h2 { font-size: .9rem; }
  .col > h2 small { font-size: .72rem; }
  .call:empty { display: none; }
  .narr p { max-width: 125ch; }
  .narr .r { color: var(--gone); font-weight: 700; }
  .narr .g { color: var(--new); font-weight: 700; }
  .narr mark { background: #fff1b8; padding: 0 .2rem; border-radius: .2rem; }
  .narr .l2 { color: var(--l2); font-weight: 700; } .narr .l1 { color: var(--l1); font-weight: 700; } .narr .l0 { color: var(--l0); font-weight: 700; } .narr .off { color: var(--off); font-weight: 700; }
  .mono { font-family: "SF Mono", Menlo, Consolas, monospace; }

  /* who acts: a process has a cat-head badge; the MMU has a small chip icon; the kernel has none */
  .face { width: 1.6em; height: 1.6em; object-fit: contain; vertical-align: -.45em; margin-right: .3em; }
  .actor { font-weight: 800; color: var(--c); white-space: nowrap; }
  .actor::before { content: ""; display: inline-block; width: 1.6em; height: 1.6em; margin-right: .3em; vertical-align: -.5em; background: var(--img) center / contain no-repeat; }
  .actor.proc-a { --c: var(--proc-a); --img: url(cat-brown.webp); } .actor.proc-b { --c: var(--proc-b); --img: url(cat-orange.webp); } .actor.proc-c { --c: var(--proc-c); --img: url(cat-yellow.webp); }
  .actor.mmu { --c: var(--mmu); --img: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235b6b8c' stroke-width='2' stroke-linecap='round'%3E%3Crect x='6' y='6' width='12' height='12' rx='2'/%3E%3Crect x='9.5' y='9.5' width='5' height='5' rx='.5' fill='%235b6b8c'/%3E%3Cpath d='M9.5 2.5v3.5M14.5 2.5v3.5M9.5 18v3.5M14.5 18v3.5M2.5 9.5h3.5M2.5 14.5h3.5M18 9.5h3.5M18 14.5h3.5'/%3E%3C/svg%3E"); }
  .actor.mmu::before { width: 1.15em; height: 1.15em; vertical-align: -.2em; }
  .actor.kernel { --c: var(--kernel); } .actor.kernel::before { display: none; }
  .narr h3 .actor.proc-a::before, .narr h3 .actor.proc-b::before, .narr h3 .actor.proc-c::before { width: 1.75em; height: 1.75em; vertical-align: -.55em; }

  /* "Show hex": hex values sit next to the decimal ones, hidden until body.hex */
  .hx { display: none; font-family: "SF Mono", Menlo, Consolas, monospace; font-weight: 500; font-size: .85em; color: var(--muted); margin-left: .4em; }
  body.hex .hx { display: inline; }
  .reg .hx { color: #dfe4f0; }
  .pa .row.hx { display: none; margin-left: 0; font-size: .74rem; }
  body.hex .pa .row.hx { display: flex; }
  nav button#hexbtn { border-color: var(--line); font-weight: 600; color: var(--muted); }
  nav button#hexbtn[aria-pressed="true"] { background: #eef0f5; border-color: var(--mmu); color: var(--mmu); }

  /* an address as four colored groups, in decimal */
  .vag { display: inline-flex; flex-wrap: wrap; gap: .15em; font-family: -apple-system, "Segoe UI", sans-serif; font-weight: 800; }
  .vag i { font-style: normal; padding: 0 .3em; border-radius: .25em; color: #fff; white-space: nowrap; }
  .vag .g2 { background: var(--l2); } .vag .g1 { background: var(--l1); } .vag .g0 { background: var(--l0); } .vag .go { background: var(--off); }

  /* memory reads, one square each: table reads slate, the data read pink */
  .rdsq { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; }
  .rdsq > i { width: 1.15rem; height: 1.15rem; border-radius: .2rem; border: 2px dashed var(--line); }
  .rdsq i.t { background: var(--mmu); border: 2px solid var(--mmu); } .rdsq i.d { background: var(--off); border: 2px solid var(--off); }
  .rdsq span { margin-left: auto; font-size: .7rem; color: var(--muted); }
  .rdsq span i { display: inline-block; width: .7rem; height: .7rem; border-radius: .15rem; vertical-align: -1px; margin: 0 .15rem 0 .4rem; }

  /* the program, as a listing; real xv6 source uses the same look */
  .prog { background: #fff; border: 2px solid var(--line); border-radius: .7rem; position: relative; }
  .prog .ph { font-family: "SF Mono", Menlo, Consolas, monospace; font-size: .74rem; font-weight: 700; padding: .22rem .6rem; background: #fbfaf6; border-bottom: 1px solid var(--line); border-radius: .5rem .5rem 0 0; display: flex; justify-content: space-between; align-items: center; gap: .6rem; white-space: nowrap; }
  .prog .ph small { font-weight: 500; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
  .prog .ph .face { width: 1.35em; height: 1.35em; vertical-align: -.35em; }
  .prog ol { list-style: none; margin: 0; padding: .18rem .3rem .25rem; font-family: "SF Mono", Menlo, Consolas, monospace; font-size: .72rem; line-height: 1.4; }
  .prog li { display: grid; grid-template-columns: 1.2rem 1fr; gap: .3rem; align-items: start; white-space: pre-wrap; padding: 0 .25rem; border-radius: .3rem; color: #6d6a63; }
  .prog.src li { grid-template-columns: 1.75rem 1fr; }
  .prog li .tx { padding-left: var(--ind, 0); text-indent: calc(-1 * var(--ind, 0)); overflow-wrap: anywhere; }
  .prog li .ln { color: #c2bfb7; text-align: right; }
  .prog li .tx .c { color: #9a978f; }
  .prog li.gap .ln { color: #c2bfb7; }
  .prog li.cur { background: var(--hot); color: var(--ink); font-weight: 700; }
  .prog li.cur .ln { color: var(--hot-ink); }
  .prog.src .ph { background: var(--p2-tint); }

  /* key/value stats */
  .kv { display: grid; grid-template-columns: 1fr; gap: .25rem; }
  .kvr { display: flex; justify-content: space-between; gap: .8rem; align-items: baseline; background: #fff; border: 1.5px solid var(--line); border-radius: .45rem; padding: .2rem .6rem; font-size: .82rem; }
  .kvr .k { color: var(--muted); }
  .kvr .v { font-family: "SF Mono", Menlo, Consolas, monospace; font-weight: 800; white-space: nowrap; }
  .kv.row3 { grid-template-columns: repeat(3, 1fr); }
  .kv.row3 .kvr { flex-direction: column; align-items: center; gap: 0; padding: .12rem .3rem; }
  .kv.row3 .kvr .k { font-size: .7rem; } .kv.row3 .kvr .v { font-size: 1.05rem; }
  .kvr.good .v { color: var(--new); } .kvr.tblr .v { color: var(--mmu); } .kvr.dt .v { color: var(--off); } .kvr.bad .v { color: var(--gone); } .kvr.ind .v { color: var(--p1); }

  /* fault card */
  .fault { border: 2px solid var(--fault); background: var(--fault-t); border-radius: .7rem; padding: .35rem .65rem .45rem; }
  .fault .fh { font-size: .78rem; font-weight: 800; letter-spacing: .05em; color: var(--fault); text-transform: uppercase; }
  .fault .fr2 { display: flex; justify-content: space-between; gap: .6rem; font-size: .78rem; margin-top: .1rem; }
  .fault .fr2 span { color: #7a2e25; }
  .fault .fr2 b { font-family: "SF Mono", Menlo, Consolas, monospace; text-align: right; }
  .fault .ff { font-size: .76rem; color: #444; line-height: 1.35; margin-top: .3rem; border-top: 1px dashed #f0b7b0; padding-top: .25rem; }
  .fault .ff code { font-size: .95em; }
  .okcard { border: 2px solid var(--new); background: #eef8f1; border-radius: .7rem; padding: .35rem .65rem .45rem; font-size: .8rem; }
  .okcard .fh { font-size: .78rem; font-weight: 800; letter-spacing: .05em; color: var(--new); text-transform: uppercase; }
  .okcard.wrong { border-color: var(--fault); background: var(--fault-t); } .okcard.wrong .fh { color: var(--fault); }

  /* ---------- the virtual address, split into fields ---------- */
  .vabox { background: #fff; border: 2px solid var(--line); border-radius: .7rem; padding: .4rem .6rem .5rem; }
  .vabox .big { font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 1.25rem; font-weight: 800; text-align: center; letter-spacing: .02em; }
  .vabox .big .vag { font-size: .66em; justify-content: center; }
  .vabox .big.name { font-size: 1.15rem; }
  .vabox .big small { display: block; font-size: .68rem; font-weight: 500; color: var(--muted); letter-spacing: 0; font-family: -apple-system, "Segoe UI", sans-serif; }
  .bitbar { display: flex; height: 1.05rem; border-radius: .3rem; overflow: hidden; margin: .25rem 0 .1rem; border: 1.5px solid #cfcbc2; }
  .bitbar i { display: block; height: 100%; font-style: normal; font-size: .58rem; font-weight: 800; color: #fff; text-align: center; line-height: 1rem; white-space: nowrap; overflow: hidden; }
  .bitbar .u { flex: 25; background: #e4e1da; color: #8d8a83; } .bitbar .b2 { flex: 9; background: var(--l2); } .bitbar .b1 { flex: 9; background: var(--l1); } .bitbar .b0 { flex: 9; background: var(--l0); } .bitbar .bo { flex: 12; background: var(--off); }
  .bitbar-ax { display: flex; justify-content: space-between; font-family: "SF Mono", Menlo, Consolas, monospace; font-size: .58rem; color: var(--muted); }
  .fields { display: flex; flex-direction: column; gap: .2rem; margin-top: .25rem; }
  .fld { display: grid; grid-template-columns: 4.3rem 1fr auto; gap: .4rem; align-items: center; border: 1.5px solid var(--c); background: var(--t); border-radius: .4rem; padding: .08rem .45rem; font-size: .72rem; position: relative; }
  .fld .fn { font-weight: 800; color: var(--c); line-height: 1.1; }
  .fld .fn small { display: block; font-weight: 500; color: var(--muted); font-size: .62rem; font-family: "SF Mono", Menlo, Consolas, monospace; }
  .fld .fb { font-family: "SF Mono", Menlo, Consolas, monospace; letter-spacing: .04em; color: #333; overflow-wrap: anywhere; }
  .fld .fv { font-family: "SF Mono", Menlo, Consolas, monospace; font-weight: 800; color: var(--c); white-space: nowrap; }
  .fld.u { --c: #8d8a83; --t: #f3f2ee; } .fld.f2 { --c: var(--l2); --t: var(--l2-t); } .fld.f1 { --c: var(--l1); --t: var(--l1-t); } .fld.f0 { --c: var(--l0); --t: var(--l0-t); } .fld.fo { --c: var(--off); --t: var(--off-t); }
  .fld.use { box-shadow: 0 0 0 3px var(--c); }

  /* ---------- the page-table pages, as a tree from satp downwards ---------- */
  .tree { display: flex; flex-direction: column; gap: 1.05rem; }
  .reg { align-self: center; display: flex; gap: .5rem; align-items: baseline; background: var(--p1); color: #fff; border-radius: .5rem; padding: .2rem .6rem; font-size: .8rem; }
  .reg b { font-family: "SF Mono", Menlo, Consolas, monospace; }
  .reg small { opacity: .85; }
  .ptp { background: #fff; border: 2px solid var(--c); border-radius: .6rem; overflow: hidden; position: relative; }
  .ptp.l2 { --c: var(--l2); --t: var(--l2-t); } .ptp.l1 { --c: var(--l1); --t: var(--l1-t); } .ptp.l0 { --c: var(--l0); --t: var(--l0-t); }
  .ptp.dpage { --c: var(--proc-a); --t: var(--proc-a-t); border-style: solid; }
  .ptp .th .face { width: 1.3em; height: 1.3em; vertical-align: -.35em; }
  .ptp.idle { opacity: .45; border-style: dashed; }
  .ptp .th { background: var(--t); color: var(--c); font-weight: 800; font-size: .74rem; padding: .15rem .55rem; display: flex; justify-content: space-between; gap: .5rem; white-space: nowrap; }
  .ptp .th small { font-weight: 500; color: #555; font-family: "SF Mono", Menlo, Consolas, monospace; }
  .ptr { display: grid; grid-template-columns: 2.6rem 1fr auto; gap: .45rem; align-items: center; padding: .12rem .55rem; font-size: .74rem; border-top: 1px solid #eeece6; }
  .ptr .ix { font-family: "SF Mono", Menlo, Consolas, monospace; font-weight: 800; color: var(--c); }
  .ptr .pv { font-family: "SF Mono", Menlo, Consolas, monospace; color: #333; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ptr .pv small { color: var(--muted); font-family: -apple-system, "Segoe UI", sans-serif; }
  .ptr .fl { font-family: "SF Mono", Menlo, Consolas, monospace; font-size: .68rem; font-weight: 800; letter-spacing: .06em; color: var(--new); white-space: nowrap; }
  .ptr.inv .fl { color: var(--gone); }
  .ptr.inv .pv { color: var(--muted); }
  .ptr.more { display: block; color: var(--muted); font-style: italic; font-size: .7rem; padding: .1rem .55rem .16rem; }
  .ptr.used { background: #f6f8fc; }
  .ptr.read { background: var(--hot); }
  .ptr.bad { background: var(--fault-t); box-shadow: inset 4px 0 0 var(--fault); }
  .ptp .cell { padding: .25rem .55rem .3rem; font-size: .74rem; display: flex; justify-content: space-between; gap: .5rem; border-top: 1px solid #eeece6; }
  .ptp .cell b { font-family: "SF Mono", Menlo, Consolas, monospace; }

  /* ---------- one PTE, bit by bit ---------- */
  .ptebox { background: #fff; border: 2px solid var(--line); border-radius: .7rem; padding: .4rem .6rem .5rem; }
  .ptebox.l2 { border-color: var(--l2); } .ptebox.l1 { border-color: var(--l1); } .ptebox.l0 { border-color: var(--l0); }
  .ptebox .ph2 { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; font-size: .74rem; color: var(--muted); }
  .ptebox .ph2 span small { font-size: .9em; }
  .ptebox .ph2 b { text-align: right; font-family: "SF Mono", Menlo, Consolas, monospace; font-size: .8rem; color: var(--ink); }
  .ptebits { display: grid; grid-template-columns: 3fr repeat(8, 1fr); gap: 2px; margin-top: .35rem; }
  .pf { border: 1.5px solid #cfcbc2; border-radius: .25rem; background: #f6f5f1; text-align: center; padding: .1rem 0 .12rem; min-width: 0; position: relative; }
  .pf small { display: block; font-size: .52rem; color: var(--muted); font-family: "SF Mono", Menlo, Consolas, monospace; }
  .pf b { display: block; font-size: .78rem; }
  .pf span { display: block; font-family: "SF Mono", Menlo, Consolas, monospace; font-size: .74rem; font-weight: 800; }
  .pf.ppn { background: var(--p2-tint); border-color: var(--p2-ink); }
  .pf.ppn span { font-size: .74rem; }
  .pf.on { background: #e6f4ea; border-color: var(--new); color: #17603a; }
  .pf.off span { color: #a7a39a; }
  .pf.g { opacity: .45; }
  .pf.lit { box-shadow: 0 0 0 3px var(--hot-ink); z-index: 1; }
  .pf.no { background: var(--fault-t); border-color: var(--fault); color: var(--fault); }
  .ptebox .means { font-size: .78rem; margin-top: .4rem; line-height: 1.35; }
  .checks { display: flex; flex-direction: column; gap: .2rem; }
  .ck { display: grid; grid-template-columns: 1.3rem 1fr; gap: .3rem; align-items: baseline; background: #fff; border: 1.5px solid var(--line); border-radius: .45rem; padding: .16rem .5rem; font-size: .78rem; }
  .ck b { font-size: .9rem; text-align: center; }
  .ck.ok { border-color: #9fd3b3; } .ck.ok b { color: var(--new); }
  .ck.no { border-color: var(--fault); background: var(--fault-t); } .ck.no b { color: var(--fault); }
  .ck code { font-size: .92em; }
  .pa { background: #fff; border: 2px solid var(--proc-a); border-radius: .7rem; padding: .35rem .6rem .45rem; font-family: "SF Mono", Menlo, Consolas, monospace; font-size: .8rem; }
  .pa .row { display: flex; justify-content: space-between; gap: .5rem; }
  .pa .row span { color: var(--muted); font-family: -apple-system, "Segoe UI", sans-serif; font-size: .74rem; }
  .pa .row.sum { border-top: 1.5px solid var(--proc-a); margin-top: .2rem; padding-top: .2rem; font-weight: 800; font-size: .95rem; color: var(--proc-a); }

  /* ---------- the TLB ---------- */
  .tlb { background: #fff; border: 2px solid var(--p1); border-radius: .7rem; overflow: hidden; }
  .tlb .th { background: var(--p1); color: #fff; font-weight: 800; font-size: .78rem; padding: .2rem .6rem; display: flex; justify-content: space-between; gap: .5rem; }
  .tlb .th small { font-weight: 500; opacity: .9; }
  .te { display: grid; grid-template-columns: 2.9rem 2.6rem 1.2rem 1fr 3.6rem 2.6rem; gap: .35rem; align-items: center; padding: .28rem .55rem; border-top: 1px solid #eeece6; font-size: .8rem; position: relative; min-height: 2.2rem; }
  .te.hd { background: #f6f5f1; font-size: .62rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; min-height: 0; padding: .14rem .55rem; }
  .te .as { font-family: "SF Mono", Menlo, Consolas, monospace; font-weight: 800; font-size: .74rem; }
  .te .vp, .te .pp { font-family: "SF Mono", Menlo, Consolas, monospace; font-weight: 800; }
  .te .ar { color: var(--muted); }
  .te .fl { font-family: "SF Mono", Menlo, Consolas, monospace; font-size: .68rem; font-weight: 800; color: var(--new); letter-spacing: .06em; white-space: nowrap; }
  .te .age { font-size: .64rem; color: var(--muted); text-align: right; }
  .te .age.lru { color: var(--gone); font-weight: 800; }
  .te.free { color: #b8b4ab; font-style: italic; }
  .te.proc-a { box-shadow: inset 5px 0 0 var(--proc-a); } .te.proc-b { box-shadow: inset 5px 0 0 var(--proc-b); background: #f5f4f1; }
  .te.hit { background: #e6f4ea; }
  .te.ins { background: #fff7d6; }
  .te.stale { background: var(--fault-t); }
  .te.stale .fl { color: var(--fault); }
  .te .tag { font-size: .55rem; font-weight: 800; text-transform: uppercase; padding: .02rem .3rem; border-radius: .25rem; color: #fff; background: var(--new); position: absolute; right: .35rem; top: -.45rem; letter-spacing: .04em; }
  .te.ins .tag { background: #b8860b; } .te.stale .tag { background: var(--fault); }
  .te .owner { display: inline-flex; align-items: center; }
  .te .owner .face { width: 1.25em; height: 1.25em; margin-right: .2em; vertical-align: -.3em; }
  .evicted { display: flex; align-items: center; gap: .5rem; font-size: .74rem; color: var(--gone); padding: .2rem .55rem .3rem; border-top: 1px dashed var(--gone); background: #fff3f1; }
  .evicted s { font-family: "SF Mono", Menlo, Consolas, monospace; font-weight: 700; }
  .lookup { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; background: #fff; border: 2px solid var(--line); border-radius: .6rem; padding: .3rem .6rem; font-size: .8rem; }
  .lookup .q { font-family: "SF Mono", Menlo, Consolas, monospace; font-weight: 800; }
  .lookup .res { font-weight: 800; padding: .02rem .45rem; border-radius: .3rem; color: #fff; }
  .lookup .res.h { background: var(--new); } .lookup .res.m { background: var(--gone); } .lookup .res.n { background: #8d8a83; }
  .lookup small { color: var(--muted); }

  /* the page tables, one row per page */
  .pt { background: #fff; border: 2px solid var(--c); border-radius: .6rem; overflow: hidden; }
  .pt .th { background: var(--t); color: var(--c); font-weight: 800; font-size: .76rem; padding: .18rem .55rem; display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
  .pt .th small { font-weight: 500; color: #555; }
  .pt .th .face { width: 1.35em; height: 1.35em; vertical-align: -.35em; }
  .pt.proc-a { --c: var(--proc-a); --t: var(--proc-a-t); } .pt.proc-b { --c: var(--proc-b); --t: var(--proc-b-t); }
  .pr { display: grid; grid-template-columns: 2.2rem .8rem 4.3rem auto 1fr; gap: .35rem; align-items: center; padding: .16rem .55rem; border-top: 1px solid #eeece6; font-size: .76rem; position: relative; }
  .pr .vp, .pr .pp { font-family: "SF Mono", Menlo, Consolas, monospace; font-weight: 800; }
  .pr .ar { color: var(--muted); }
  .pr .fl { font-family: "SF Mono", Menlo, Consolas, monospace; font-size: .68rem; font-weight: 800; letter-spacing: .06em; color: var(--new); white-space: nowrap; }
  .pr .what { color: var(--muted); font-size: .68rem; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .pr.walk { background: var(--hot); }
  .pr.chg { background: var(--fault-t); }
  .pr.chg .fl { color: var(--fault); }
  .walkcost { font-size: .62rem; font-weight: 800; color: var(--hot-ink); background: #fff; border: 1.5px solid var(--hot-ink); border-radius: .3rem; padding: 0 .3rem; white-space: nowrap; }
  .seq { display: flex; flex-wrap: wrap; gap: .25rem; background: #fff; border: 2px solid var(--line); border-radius: .7rem; padding: .45rem; }
  .acc { padding: .12rem .35rem; text-align: center; border-radius: .35rem; border: 2px solid #cfcbc2; font-family: "SF Mono", Menlo, Consolas, monospace; font-weight: 800; font-size: .7rem; background: #fbfaf6; color: #6d6a63; }
  .acc small { font-weight: 500; }
  .acc.h { background: #e6f4ea; border-color: var(--new); color: var(--new); }
  .acc.m { background: #fbe3df; border-color: var(--gone); color: var(--gone); }
  .acc.f { background: var(--fault-t); border-color: var(--fault); color: var(--fault); }
  .acc.mo { border-style: dashed; }
  .acc.now { box-shadow: 0 0 0 3px var(--hot-ink); }
  .acc.sw { background: #1c1c1c; color: #ffcf33; border-color: #1c1c1c; }
  .legend { display: flex; flex-wrap: wrap; gap: .3rem .9rem; font-size: .7rem; color: var(--muted); }
  .legend i { display: inline-block; width: .9rem; height: .7rem; border-radius: .2rem; border: 2px solid; vertical-align: -1px; margin-right: .25rem; }
  .running { display: flex; align-items: center; gap: .5rem; background: #fff; border: 2px solid var(--c); border-radius: .6rem; padding: .25rem .6rem; font-size: .8rem; }
  .running .face { width: 1.8em; height: 1.8em; }
  .running b { color: var(--c); }
  .running small { color: var(--muted); margin-left: auto; font-family: "SF Mono", Menlo, Consolas, monospace; }
