  /* ---------- 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; } }
  * { 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; }
  header .stepno b { color: var(--ink); }
  header .part { color: var(--ink); font-weight: 600; }
  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; }
  nav button.toggle { border-color: var(--line); color: var(--muted); font-weight: 600; margin-right: .6rem; }
  nav button.toggle[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
  .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;
    grid-template-columns: 1.05fr 1.05fr 1.55fr 1.05fr; min-height: 0;
  }
  .col { min-width: 0; display: flex; flex-direction: column; gap: .7rem; overflow-y: auto; overflow-x: hidden; padding: .3rem .35rem; }
  @media (max-width: 1200px) { :root { font-size: 14px; } }
  .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; }

  /* ---------- processes ---------- */
  .proc {
    background: var(--panel); border: 2px solid var(--c); border-radius: .7rem; overflow: hidden;
  }
  .proc .phead {
    background: var(--c); color: #fff; padding: .35rem .7rem; font-weight: 700;
    display: flex; justify-content: space-between; align-items: baseline;
  }
  .proc .phead small { font-weight: 500; opacity: .9; }
  .fdrow {
    display: flex; align-items: center; gap: .6rem; padding: .3rem .7rem;
    border-top: 1px solid var(--line); transition: background .2s;
  }
  .fdrow .fdnum {
    width: 1.7rem; height: 1.7rem; border-radius: .35rem; display: inline-flex;
    align-items: center; justify-content: center; font-weight: 800;
    background: #eee; font-family: Menlo, monospace;
  }
  .fdrow.live .fdnum { background: var(--c); color: #fff; }
  .fdrow .fdval { font-family: Menlo, monospace; }
  .fdrow.tty { color: var(--muted); }
  .fdrow.free .fdval { color: var(--muted); font-style: italic; }

  /* ---------- open file table ---------- */
  .oft {
    background: var(--panel); border: 2px solid var(--c, var(--line)); border-radius: .7rem;
    padding: .45rem .7rem; display: grid; grid-template-columns: auto 1fr; gap: .2rem .8rem; align-items: center;
  }
  .oft .oid {
    font-weight: 800; font-family: Menlo, monospace; font-size: 1.15rem;
    background: var(--c, #999); color: #fff; border-radius: .4rem; padding: .1rem .45rem;
    grid-row: span 2;
  }
  .oft .owner { font-size: .8rem; color: var(--muted); }
  .oft .fields { display: flex; flex-wrap: wrap; gap: .25rem .9rem; font-family: Menlo, monospace; font-size: .92rem; }
  .oft .fields span { white-space: nowrap; }
  .oft .fields span i { font-style: normal; color: var(--muted); }
  .oft .fields b { font-size: 1.05em; }

  /* ---------- inode table ---------- */
  .ino {
    background: var(--panel); border: 2px solid var(--line); border-radius: .7rem;
    padding: .45rem .7rem; position: relative;
  }
  .ino.dir { padding: .3rem .7rem; font-size: .9rem; color: #333; display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
  .ino .inum { font-weight: 800; font-family: Menlo, monospace; }
  .ino .itype { color: var(--muted); }
  .ino .ihead { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
  .ino .imeta { display: flex; gap: .9rem; font-family: Menlo, monospace; font-size: .88rem; margin-top: .25rem; flex-wrap: wrap; color: #333; }
  .ino .cnt { border: 1px solid var(--line); border-radius: .35rem; padding: 0 .4rem; background: #fafaf7; }
  .ino .cnt b { font-size: 1.1em; }
  .ino .cnt.zero { border-color: var(--gone); color: var(--gone); }
  .namehint {
    font-size: .78rem; color: var(--muted); border: 1px dashed var(--line); border-radius: 1rem;
    padding: 0 .5rem; cursor: help;
  }
  .namehint.none { color: var(--gone); border-color: var(--gone); }
  .badge {
    font-size: .75rem; font-weight: 700; padding: .05rem .45rem; border-radius: 1rem;
    background: var(--gone); color: #fff;
  }
  .idata { margin-top: .4rem; display: flex; gap: .5rem; align-items: flex-start; }
  .idata .lbl { font-family: Menlo, monospace; font-size: .85rem; color: var(--muted); padding-top: .25rem; }
  .chars { position: relative; display: flex; flex-wrap: wrap; padding-bottom: 1.35rem; --cw: 1.35rem; }
  .ch {
    width: var(--cw); height: 1.6rem; border: 1px solid var(--line); margin-left: -1px;
    display: inline-flex; align-items: center; justify-content: center;
    font-family: Menlo, monospace; font-size: .95rem; background: #fcfcfa;
  }
  .ch.nl { color: var(--muted); font-size: .75rem; }
  .ch.readhl { background: var(--hot); color: var(--hot-ink); font-weight: 800; }
  .ch.dead { background: repeating-linear-gradient(45deg,#f4d3cf 0 4px,#fff 4px 8px); color: var(--gone); }
  .cursor {
    position: absolute; top: 1.55rem; transform: translateX(-50%);
    display: flex; flex-direction: column; align-items: center; color: var(--c);
    font-size: .72rem; font-weight: 800; font-family: Menlo, monospace; line-height: 1;
  }
  .cursor::before { content: ""; border: .38rem solid transparent; border-bottom-color: var(--c); border-top: 0; }
  .cursor.up { top: 1.55rem; }
  .cursor.up2 { top: 2.3rem; }

  /* ---------- directory entries ---------- */
  .dirblk { background: var(--panel); border: 2px solid var(--line); border-radius: .7rem; overflow: hidden; }
  .dirblk .dhead {
    display: flex; justify-content: space-between; padding: .3rem .7rem; background: #efede6;
    font-family: Menlo, monospace; font-weight: 700; font-size: .92rem;
  }
  .dirblk .dhead span { font-weight: 500; color: var(--muted); }
  .dent {
    display: flex; justify-content: space-between; padding: .25rem .7rem .25rem 1.3rem;
    border-top: 1px solid var(--line); font-family: Menlo, monospace; font-size: .92rem;
  }
  .dent .dino { color: var(--muted); }
  .dent.gone { text-decoration: line-through; color: var(--gone); }
  .dent.gone .dino { color: var(--gone); }

  /* ---------- states ---------- */
  .hot { box-shadow: 0 0 0 4px var(--hot); animation: pulse 1.1s ease-in-out 2; position: relative; z-index: 1; }
  .fdrow.hot { background: #fff6cf; }
  .dent.hot { background: #fff6cf; }
  .ino.dir.hot { background: #fff6cf; }
  @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; }
  .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;
  }
  .oft.new, .ino.new { position: relative; }
  .gone { opacity: .45; border-style: dashed !important; border-color: var(--gone) !important; }
  .gone .oid { background: var(--gone) !important; text-decoration: line-through; }
  .oft.gone::after, .ino.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;
  }
  .oft.gone { position: relative; }

  /* ---------- footer ---------- */
  footer {
    background: #fff; border-top: 2px solid var(--line); padding: .7rem 1.2rem .9rem;
    display: grid; grid-template-columns: 1fr minmax(24rem, 36%); gap: .5rem 1.5rem; min-height: 11rem;
  }
  .ftext { display: flex; flex-direction: column; gap: .5rem; min-width: 0; }
  .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 .k { color: var(--lookup); font-weight: 700; }
  .narr .cat { color: var(--cat); font-weight: 700; }
  .narr .py { color: var(--py); font-weight: 700; }

  /* ---------- 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; }
  #arrows path.lookup { stroke: var(--lookup); stroke-dasharray: 7 5; stroke-width: 3; }
  #arrows polygon.lookup { fill: var(--lookup); }
  #arrows .dim { opacity: .35; }

/* ---------- presentation mode (presentation.html): title only, no description ---------- */
body[data-mode="presentation"] footer { min-height: 9.5rem; }
  body[data-mode="presentation"] .code { height: 8.5rem; }
body[data-mode="presentation"] .narr h3 { font-size: 2.1rem; line-height: 1.2; margin: .1rem 0 0; }
body[data-mode="presentation"] .narr p { display: none; }
body[data-mode="presentation"] .narr ul { font-size: 1.15rem; }
body[data-mode="presentation"] .call { font-size: 1.25rem; }

/* ---------- code panel (bottom right) ---------- */
.code {
  height: 10rem; display: flex; flex-direction: column; border: 2px solid var(--line);
  border-radius: .6rem; overflow: hidden; background: #fbfaf7; font-size: .95rem;
}
.code .chead {
  display: flex; align-items: center; gap: .7rem; padding: .25rem .7rem; background: #efede6;
  border-bottom: 1px solid var(--line); font-family: Menlo, monospace; font-size: .85rem;
}
.code .chead .who {
  background: var(--c); color: #fff; padding: .05rem .5rem; border-radius: .35rem;
  font-family: -apple-system, "Segoe UI", sans-serif; font-weight: 700; font-size: .8rem;
}
.code .chead .fname { color: var(--muted); }
.clines { position: relative; flex: 1; overflow-y: auto; overflow-x: hidden; padding: .2rem 0; }
.ln { display: flex; align-items: baseline; line-height: 1.5rem; font-family: "SF Mono", Menlo, Consolas, monospace; white-space: pre; }
.ln .lno { width: 2.4rem; text-align: right; padding-right: .7rem; color: #aaa; font-size: .8rem; flex: none; user-select: none; }
.ln .src { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ln b { font-weight: 800; }
.ln.cur { background: var(--hot); color: var(--hot-ink); font-weight: 700; }
.ln.cur .lno { color: var(--hot-ink); }
.ln.cur .lno::before { content: "▶ "; font-size: .65rem; }

/* ---------- "Show code" button and modal ---------- */
.proc .phead .showcode {
  margin-left: auto; font: inherit; font-size: .78rem; font-weight: 700; cursor: pointer;
  background: rgba(255,255,255,.22); color: #fff; border: 1.5px solid rgba(255,255,255,.75);
  border-radius: .4rem; padding: .1rem .55rem; white-space: nowrap; flex: none;
}
.proc .phead .showcode:hover { background: #fff; color: var(--c); }
.proc .phead small { margin-left: .6rem; margin-right: .3rem; white-space: nowrap; }
.proc .phead { flex-wrap: nowrap; }
.modal[hidden] { display: none; }
.modal {
  position: fixed; inset: 0; z-index: 10; background: rgba(20, 20, 20, .55);
  display: flex; align-items: center; justify-content: center; padding: 2rem;
}
.mbox {
  background: #fbfaf7; border-radius: .8rem; width: min(62rem, 100%); max-height: 85vh;
  display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.35);
  border: 3px solid var(--c); font-size: 1.05rem;
}
.mhead {
  display: flex; align-items: center; gap: .8rem; padding: .5rem .6rem .5rem 1rem;
  background: #efede6; border-bottom: 1px solid var(--line); font-family: Menlo, monospace;
}
.mhead .who {
  background: var(--c); color: #fff; padding: .1rem .6rem; border-radius: .4rem;
  font-family: -apple-system, "Segoe UI", sans-serif; font-weight: 700; font-size: .9rem;
}
.mhead .fname { color: var(--muted); }
.mhead .mnote { margin-left: auto; color: var(--muted); font-family: -apple-system, "Segoe UI", sans-serif; font-size: .85rem; }
.mclose {
  width: 2.1rem; height: 2.1rem; border-radius: .45rem; border: 0; cursor: pointer;
  background: var(--gone); color: #fff; font-size: 1.15rem; font-weight: 800; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.mclose:hover { background: #a93226; }
.mlines { overflow-y: auto; padding: .6rem 0; }
.mlines .ln { line-height: 1.7rem; }
.mlines .ln .lno { width: 3rem; }
