/* ───────────────────────── tokens ───────────────────────── */
:root {
  /* dark is the default */
  --bg:        #0a0e17;
  --bg-grad:   radial-gradient(1200px 600px at 15% -10%, #16203a 0%, transparent 60%),
               radial-gradient(900px 500px at 95% 0%, #1a1630 0%, transparent 55%);
  --surface:   #111827;
  --surface-2: #17203352;
  --surface-3: #1c2740;
  --border:    #26324b;
  --border-2:  #35456a;
  --text:      #e8edf8;
  --text-2:    #aab6cd;
  --muted:     #7f8da8;

  --accent:    #60a5fa;
  --accent-dim:#1d4ed8;
  --heap:      #f59e0b;
  --stack:     #38bdf8;
  --meta:      #a78bfa;
  --code:      #34d399;
  --hot:       #fb7185;
  --old:       #f472b6;
  --ok:        #4ade80;

  --shadow:    0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
  --radius:    12px;
  --radius-sm: 8px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg:        #f4f7fc;
    --bg-grad:   radial-gradient(1100px 560px at 12% -10%, #dbe7fb 0%, transparent 60%),
                 radial-gradient(800px 460px at 96% 0%, #e9e2fb 0%, transparent 55%);
    --surface:   #ffffff;
    --surface-2: #eef2f9a8;
    --surface-3: #e6ecf6;
    --border:    #d8e0ec;
    --border-2:  #bac7da;
    --text:      #0f172a;
    --text-2:    #46566f;
    --muted:     #64748b;

    --accent:    #2563eb;
    --accent-dim:#93c5fd;
    --heap:      #b45309;
    --stack:     #0369a1;
    --meta:      #6d28d9;
    --code:      #047857;
    --hot:       #be123c;
    --old:       #be185d;
    --ok:        #15803d;
    --shadow:    0 1px 2px rgba(15,23,42,.06), 0 10px 26px -14px rgba(15,23,42,.28);
  }
}
:root[data-theme="light"] {
  --bg:        #f4f7fc;
  --bg-grad:   radial-gradient(1100px 560px at 12% -10%, #dbe7fb 0%, transparent 60%),
               radial-gradient(800px 460px at 96% 0%, #e9e2fb 0%, transparent 55%);
  --surface:   #ffffff;
  --surface-2: #eef2f9a8;
  --surface-3: #e6ecf6;
  --border:    #d8e0ec;
  --border-2:  #bac7da;
  --text:      #0f172a;
  --text-2:    #46566f;
  --muted:     #64748b;

  --accent:    #2563eb;
  --accent-dim:#93c5fd;
  --heap:      #b45309;
  --stack:     #0369a1;
  --meta:      #6d28d9;
  --code:      #047857;
  --hot:       #be123c;
  --old:       #be185d;
  --ok:        #15803d;
  --shadow:    0 1px 2px rgba(15,23,42,.06), 0 10px 26px -14px rgba(15,23,42,.28);
}

/* ───────────────────────── base ───────────────────────── */
* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background-color: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { line-height: 1.25; margin: 0; font-weight: 650; letter-spacing: -.015em; }
p { margin: 0; }
code { font-family: var(--mono); font-size: .92em; }
:not(pre) > code {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: .08em .36em;
  color: var(--text);
  white-space: nowrap;
}
a { color: var(--accent); text-underline-offset: 3px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 99;
  background: var(--accent); color: #fff; padding: .6rem 1rem; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ───────────────────────── header ───────────────────────── */
.site-header {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.6rem 16px 1.1rem;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
}
.brand { display: flex; gap: .85rem; align-items: center; min-width: 0; }
.brand-mark { width: 40px; height: 40px; flex: none; border-radius: 9px; }
.mark-bg { fill: var(--surface-3); }
.mark-fg { fill: var(--accent); }
.brand-text h1 { font-size: clamp(1.3rem, 1rem + 1.4vw, 1.85rem); }
.brand-text p { color: var(--muted); font-size: .9rem; margin-top: .15rem; }

.icon-btn {
  flex: none;
  display: inline-flex; align-items: center; gap: .45rem;
  background: var(--surface); color: var(--text-2);
  border: 1px solid var(--border); border-radius: 999px;
  padding: .45rem .85rem; font: inherit; font-size: .85rem; cursor: pointer;
}
.icon-btn:hover { border-color: var(--border-2); color: var(--text); }
.theme-icon {
  width: 14px; height: 14px; border-radius: 50%;
  background: linear-gradient(135deg, var(--heap) 50%, var(--stack) 50%);
}

/* ───────────────────────── tabs ───────────────────────── */
.tabs {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.tabs-inner {
  max-width: 1180px; margin: 0 auto; padding: 0 16px;
  display: flex; gap: .2rem; overflow-x: auto; scrollbar-width: thin;
}
.tab {
  flex: none;
  display: inline-flex; align-items: center; gap: .5rem;
  background: none; border: 0; border-bottom: 2px solid transparent;
  color: var(--muted); font: inherit; font-size: .9rem; font-weight: 550;
  padding: .8rem .75rem; cursor: pointer; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--text); border-bottom-color: var(--accent); }
.tab-n {
  display: grid; place-items: center;
  width: 1.35rem; height: 1.35rem; border-radius: 50%;
  background: var(--surface-3); color: var(--muted);
  font-size: .72rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.tab.is-active .tab-n { background: var(--accent); color: #fff; }

/* ───────────────────────── panels ───────────────────────── */
main { max-width: 1180px; margin: 0 auto; padding: 1.8rem 16px 4rem; }
.panel { display: none; animation: fade .25s ease both; }
.panel.is-active { display: block; }
.panel[hidden] { display: none; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.panel-head { margin-bottom: 1.6rem; }
.panel-head h2 { font-size: clamp(1.4rem, 1.1rem + 1.4vw, 2rem); }
.lede { color: var(--text-2); margin-top: .5rem; max-width: 62ch; }
.section-h { margin: 2.6rem 0 .5rem; font-size: 1.15rem; }
.note { color: var(--text-2); font-size: .92rem; max-width: 70ch; margin-bottom: 1rem; }
.hint { color: var(--muted); font-size: .8rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .9rem 1rem 1rem;
  box-shadow: var(--shadow);
  min-width: 0;
}
.card > h4 {
  font-size: .78rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin-bottom: .6rem;
  display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap;
}
.card-sub { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--muted); opacity: .8; }

.detail-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: .95rem 1.1rem;
  margin-top: 1rem;
  min-height: 4.5rem;
}
.detail-card.compact { min-height: 3.6rem; }
.detail-card h4 { font-size: 1rem; margin-bottom: .35rem; }
.detail-card p { color: var(--text-2); font-size: .92rem; }
.detail-card p + p { margin-top: .5rem; }
.detail-card .kv { display: flex; flex-wrap: wrap; gap: .4rem .9rem; margin-top: .6rem; }
.detail-card .kv span {
  font-family: var(--mono); font-size: .76rem;
  background: var(--surface-3); border: 1px solid var(--border);
  border-radius: 5px; padding: .15rem .45rem; color: var(--text-2);
}
.placeholder { color: var(--muted); font-style: italic; }

/* ───────────────────────── buttons ───────────────────────── */
.btn {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-2); border-radius: 8px;
  padding: .5rem .85rem; font: inherit; font-size: .87rem; font-weight: 550;
  cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; border-color: var(--border); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: none; border-color: var(--border); color: var(--text-2); }
.btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-row { display: flex; gap: .45rem; flex-wrap: wrap; }

.field { display: flex; flex-direction: column; gap: .25rem; font-size: .78rem; color: var(--muted); min-width: 0; }
.field > span { text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.field select, .field input[type="number"] {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-2); border-radius: 8px;
  padding: .45rem .6rem; font: inherit; font-size: .87rem;
}
.field-slider { min-width: 170px; }
.field-slider input { accent-color: var(--accent); width: 100%; }
.ctl-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; color: var(--muted); }

/* ───────────────────────── 1. pipeline ───────────────────────── */
.pipeline {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: .5rem;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}
.stage {
  width: 100%; text-align: left; min-width: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .75rem .8rem;
  font: inherit; color: var(--text); cursor: pointer;
  display: flex; flex-direction: column; gap: .2rem;
  position: relative; transition: border-color .15s, transform .15s;
}
.stage:hover { border-color: var(--border-2); transform: translateY(-2px); }
.stage.is-active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.stage-n {
  font-family: var(--mono); font-size: .68rem; color: var(--muted);
  letter-spacing: .1em;
}
.stage-title { font-weight: 650; font-size: .95rem; }
.stage-kind { font-size: .74rem; color: var(--muted); font-family: var(--mono); }
.stage.is-active .stage-n { color: var(--accent); }

.jvm-box {
  border: 1px dashed var(--border-2); border-radius: var(--radius);
  padding: 1rem; background: var(--surface-2); margin-top: .8rem;
}
.jvm-box-title {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); margin-bottom: .75rem;
}
.jvm-subsystems { display: grid; gap: .7rem; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.subsystem {
  text-align: left; min-width: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: .85rem .9rem;
  font: inherit; color: var(--text); cursor: pointer;
  display: flex; flex-direction: column; gap: .3rem;
  transition: border-color .15s, transform .15s;
}
.subsystem:hover { border-color: var(--accent); transform: translateY(-2px); }
.sub-kicker { font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.sub-title { font-weight: 650; font-size: 1.02rem; }
.sub-body { font-size: .86rem; color: var(--text-2); }
.sub-link { font-size: .8rem; color: var(--accent); font-weight: 600; margin-top: .2rem; }
.jvm-footer { display: grid; gap: .4rem; margin-top: .7rem; }
.jni-band, .os-band {
  text-align: center; font-family: var(--mono); font-size: .74rem;
  padding: .45rem; border-radius: var(--radius-sm); color: var(--text-2);
  border: 1px solid var(--border); background: var(--surface);
}
.os-band { background: var(--surface-3); color: var(--muted); }

.split-code { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.split-code figure { margin: 0; min-width: 0; }
figcaption {
  font-family: var(--mono); font-size: .76rem; color: var(--muted);
  margin-bottom: .35rem; display: flex; align-items: center; gap: .5rem;
}
.tag {
  font-size: .64rem; letter-spacing: .08em; text-transform: uppercase;
  background: var(--surface-3); border: 1px solid var(--border);
  border-radius: 999px; padding: .05rem .5rem; color: var(--text-2);
}
pre {
  margin: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .85rem 1rem;
  overflow-x: auto; font-size: .82rem; line-height: 1.7; box-shadow: var(--shadow);
}
pre code { white-space: pre; }
.lang-java .kw { color: var(--meta); }
.lang-java .typ { color: var(--stack); }
.lang-java .num { color: var(--heap); }
.lang-java .str { color: var(--code); }
.lang-java .cmt { color: var(--muted); font-style: italic; }
.lang-asm .off { color: var(--muted); }
.lang-asm .op { color: var(--stack); }
.lang-asm .cmt { color: var(--muted); }

/* ───────────────────────── 2. class loading ───────────────────────── */
.cl-controls { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-bottom: 1rem; }
.chip-row { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: 999px; padding: .35rem .75rem;
  font-family: var(--mono); font-size: .78rem; color: var(--text-2);
  cursor: pointer;
}
.chip:hover { border-color: var(--accent); color: var(--text); }
.chip.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.is-missing { border-style: dashed; }

.cl-stage { display: grid; gap: .9rem; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
@media (max-width: 760px) { .cl-stage { grid-template-columns: minmax(0, 1fr); } }

.loaders { display: flex; flex-direction: column; gap: .55rem; }
.loader {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .75rem .9rem;
  display: grid; grid-template-columns: 1fr auto; gap: .2rem .8rem;
  align-items: center; position: relative;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.loader-name { font-weight: 650; font-size: .95rem; }
.loader-desc { grid-column: 1; font-size: .82rem; color: var(--text-2); }
.loader-scope { grid-column: 1; font-family: var(--mono); font-size: .72rem; color: var(--muted); margin-top: .15rem; }
.loader-badge {
  grid-row: 1 / span 3; grid-column: 2;
  font-size: .7rem; letter-spacing: .06em; text-transform: uppercase;
  border-radius: 999px; padding: .2rem .6rem; border: 1px solid var(--border);
  color: var(--muted); white-space: nowrap;
}
.loader.state-asking { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.loader.state-asking .loader-badge { border-color: var(--accent); color: var(--accent); }
.loader.state-declined { border-color: var(--border-2); opacity: .75; }
.loader.state-declined .loader-badge { color: var(--muted); }
.loader.state-loaded { border-color: var(--ok); box-shadow: 0 0 0 1px var(--ok) inset; }
.loader.state-loaded .loader-badge { border-color: var(--ok); color: var(--ok); }
.loader.state-failed { border-color: var(--hot); }
.loader.state-failed .loader-badge { border-color: var(--hot); color: var(--hot); }

.cl-arrow {
  align-self: center; font-family: var(--mono); font-size: .72rem; color: var(--muted);
  display: flex; align-items: center; gap: .45rem; padding-left: .3rem; min-height: 1.2rem;
}
.cl-arrow.up::before { content: "▲"; color: var(--accent); }
.cl-arrow.down::before { content: "▼"; color: var(--ok); }
.cl-arrow.idle { opacity: .35; }
.cl-arrow.idle::before { content: "↕"; color: var(--muted); }

.cl-log-wrap h4, .jit-log-wrap h4, .gc-log-wrap h4 {
  font-size: .78rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin-bottom: .5rem;
  display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap;
}
.cl-log {
  list-style: none; margin: 0; padding: .7rem .8rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  font-family: var(--mono); font-size: .76rem; line-height: 1.75;
  max-height: 260px; overflow-y: auto; color: var(--text-2);
}
.cl-log li { display: flex; gap: .5rem; }
.cl-log li::before { content: attr(data-t); color: var(--muted); flex: none; }
.cl-log li.ok { color: var(--ok); }
.cl-log li.warn { color: var(--heap); }
.cl-log li.err { color: var(--hot); }
.cl-log li.hi { color: var(--accent); }
.cl-log .empty { color: var(--muted); font-style: italic; }

.phases { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.phase {
  width: 100%; text-align: left; min-width: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .6rem .7rem; font: inherit; color: var(--text); cursor: pointer;
  display: flex; flex-direction: column; gap: .1rem;
}
.phase:hover { border-color: var(--border-2); }
.phase.is-active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.phase-n { font-family: var(--mono); font-size: .68rem; color: var(--muted); }
.phase-name { font-weight: 600; font-size: .9rem; }
.phase-sub { font-size: .75rem; color: var(--muted); }
.phase.grouped { border-top: 2px solid var(--meta); }

.classfile { display: flex; flex-wrap: wrap; gap: .35rem; }
.cf-field {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .45rem .65rem; font: inherit; color: var(--text); cursor: pointer;
  display: flex; flex-direction: column; gap: .05rem; flex: 1 1 auto; min-width: 0; text-align: left;
}
.cf-field:hover { border-color: var(--border-2); }
.cf-field.is-active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.cf-name { font-family: var(--mono); font-size: .76rem; }
.cf-size { font-size: .68rem; color: var(--muted); }
.cf-field[data-group="header"] { border-left: 3px solid var(--stack); }
.cf-field[data-group="pool"]   { border-left: 3px solid var(--meta); }
.cf-field[data-group="ident"]  { border-left: 3px solid var(--heap); }
.cf-field[data-group="members"]{ border-left: 3px solid var(--code); }
.cf-field[data-group="attrs"]  { border-left: 3px solid var(--old); }

/* ───────────────────────── 3. memory ───────────────────────── */
.mem-controls { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: 1.1rem; }
.counter {
  font-family: var(--mono); font-size: 1rem; font-weight: 700;
  min-width: 2.2rem; text-align: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: .3rem 0;
}
.mem-controls .hint { flex: 1 1 260px; }

.mem-layout { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 860px) { .mem-layout { grid-template-columns: minmax(0, 1fr); } }
.mem-col-title {
  font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
  display: flex; align-items: center; gap: .45rem; margin-bottom: .55rem;
}
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dot-shared { background: var(--heap); }
.dot-thread { background: var(--stack); }

.mem-shared { display: grid; gap: .5rem; }
.mem-area {
  text-align: left; min-width: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--c, var(--accent));
  border-radius: var(--radius-sm); padding: .65rem .8rem;
  font: inherit; color: var(--text); cursor: pointer;
  display: flex; flex-direction: column; gap: .15rem;
  transition: border-color .15s, transform .15s;
}
.mem-area:hover { transform: translateX(2px); }
.mem-area.is-active { box-shadow: 0 0 0 1px var(--c, var(--accent)) inset; border-color: var(--c, var(--accent)); }
.area-name { font-weight: 640; font-size: .92rem; display: flex; align-items: center; gap: .45rem; }
.area-name .swatch { width: 8px; height: 8px; border-radius: 2px; background: var(--c); flex: none; }
.area-sub { font-size: .78rem; color: var(--text-2); }
.area-flag { font-family: var(--mono); font-size: .7rem; color: var(--muted); }
.mem-area.nested { margin-left: 1.1rem; }

.mem-threads { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); align-content: start; }
.thread-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .6rem .7rem; min-width: 0;
  animation: pop .25s ease both;
}
@keyframes pop { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
.thread-name {
  font-family: var(--mono); font-size: .76rem; color: var(--stack);
  margin-bottom: .45rem; display: flex; align-items: center; gap: .4rem;
}
.thread-name::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--stack); }
.thread-areas { display: grid; gap: .3rem; }
.thread-area {
  width: 100%; text-align: left;
  background: var(--surface-3); border: 1px solid transparent; border-radius: 6px;
  padding: .3rem .45rem; font: inherit; font-size: .78rem; color: var(--text-2); cursor: pointer;
}
.thread-area:hover { border-color: var(--border-2); color: var(--text); }
.thread-area.is-active { border-color: var(--accent); color: var(--text); }
.thread-area small { display: block; font-family: var(--mono); font-size: .66rem; color: var(--muted); }

/* ───────────────────────── 4. bytecode ───────────────────────── */
.bc-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .7rem; margin-bottom: 1rem; }
.bc-layout {
  display: grid; gap: .8rem;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr) minmax(0, 1fr);
  align-items: start;
}
@media (max-width: 1000px) { .bc-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .bc-state { grid-column: 1 / -1; } }
@media (max-width: 680px) { .bc-layout { grid-template-columns: minmax(0, 1fr); } }
.bc-source pre { border: 0; box-shadow: none; padding: 0; background: none; }
.bc-state { display: grid; gap: .6rem; }
@media (min-width: 681px) and (max-width: 1000px) { .bc-state { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.bc-listing {
  list-style: none; margin: 0; padding: 0;
  font-family: var(--mono); font-size: .8rem; line-height: 1.55;
  max-height: 420px; overflow-y: auto;
}
.bc-listing li {
  display: grid; grid-template-columns: 2.4rem 1fr; gap: .5rem;
  padding: .18rem .4rem; border-radius: 5px; border-left: 2px solid transparent;
  color: var(--text-2); scroll-margin: 60px;
}
.bc-listing .bc-off { color: var(--muted); text-align: right; }
.bc-listing .bc-ins { min-width: 0; }
.bc-listing .bc-cmt { color: var(--muted); }
.bc-listing li.is-current {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  border-left-color: var(--accent); color: var(--text);
}
.bc-listing li.is-current .bc-off { color: var(--accent); }
.bc-listing li.was-run { color: var(--text); }
.bc-listing li.is-target { border-left-color: var(--heap); }

.pc-readout {
  font-family: var(--mono); font-size: 1.5rem; font-weight: 700;
  color: var(--accent); font-variant-numeric: tabular-nums;
}
.pc-readout small { display: block; font-size: .72rem; font-weight: 400; color: var(--muted); }

.opstack { display: flex; flex-direction: column-reverse; gap: .25rem; min-height: 4.6rem; justify-content: flex-end; }
.slot {
  font-family: var(--mono); font-size: .82rem;
  background: var(--surface-3); border: 1px solid var(--border);
  border-radius: 6px; padding: .28rem .55rem;
  display: flex; justify-content: space-between; gap: .5rem;
  animation: slotin .18s ease both;
}
@keyframes slotin { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: none; } }
.slot .slot-tag { color: var(--muted); font-size: .7rem; }
.slot.top { border-color: var(--stack); box-shadow: 0 0 0 1px var(--stack) inset; }
.slot.top .slot-tag { color: var(--stack); }
.opstack .empty, .frames .empty, .locals .empty { color: var(--muted); font-size: .8rem; font-style: italic; }

.locals { display: grid; gap: .25rem; }
.local-row {
  display: grid; grid-template-columns: 1.6rem 1fr auto; gap: .5rem; align-items: center;
  font-family: var(--mono); font-size: .8rem;
  background: var(--surface-3); border: 1px solid var(--border);
  border-radius: 6px; padding: .26rem .5rem;
}
.local-row .li { color: var(--muted); }
.local-row .lv { text-align: right; font-weight: 600; }
.local-row .ln { color: var(--text-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.local-row.changed { border-color: var(--heap); box-shadow: 0 0 0 1px var(--heap) inset; }

.frames { display: flex; flex-direction: column; gap: .3rem; }
.frame-row {
  font-family: var(--mono); font-size: .78rem;
  background: var(--surface-3); border: 1px solid var(--border);
  border-radius: 6px; padding: .3rem .55rem; color: var(--text-2);
  display: flex; justify-content: space-between; gap: .5rem;
  animation: slotin .18s ease both;
}
.frame-row.current { border-color: var(--code); color: var(--text); box-shadow: 0 0 0 1px var(--code) inset; }
.frame-row .fr-tag { color: var(--muted); font-size: .7rem; }

.bc-bottom { display: grid; gap: .8rem; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); margin-top: .9rem; }
@media (max-width: 760px) { .bc-bottom { grid-template-columns: minmax(0, 1fr); } }
.detail-card .ins-name { font-family: var(--mono); color: var(--accent); }
.console {
  background: #05070d; border-color: #1c2740; color: #cfe3d6;
  min-height: 4.2rem; font-size: .8rem; box-shadow: none;
}
:root[data-theme="light"] .console { background: #0f172a; color: #d6ecdd; }

/* ───────────────────────── 5. jit ───────────────────────── */
.jit-controls { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.jit-layout { display: grid; gap: .8rem; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); align-items: start; }
@media (max-width: 860px) { .jit-layout { grid-template-columns: minmax(0, 1fr); } }
.jit-meters { display: grid; gap: 1rem; }
.meter-top {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  margin-bottom: .35rem;
}
.meter-top output { font-family: var(--mono); font-size: 1.05rem; font-weight: 700; color: var(--text); text-transform: none; }
.meter { height: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; border: 1px solid var(--border); }
.meter-fill { height: 100%; width: 0; background: var(--accent); transition: width .25s ease, background .3s; }
.meter-fill.speed { background: linear-gradient(90deg, var(--code), var(--heap)); }
.thresholds { display: flex; justify-content: space-between; margin-top: .3rem; font-size: .7rem; font-family: var(--mono); }
.th-c1 { color: var(--stack); }
.th-c2 { color: var(--hot); }
.jit-stats, .gc-stats { display: grid; gap: .4rem; margin: 0; }
.jit-stats > div, .gc-stats > div {
  display: flex; justify-content: space-between; gap: .6rem;
  border-top: 1px solid var(--border); padding-top: .4rem;
}
.jit-stats dt, .gc-stats dt { font-size: .8rem; color: var(--muted); }
.jit-stats dd, .gc-stats dd { margin: 0; font-family: var(--mono); font-size: .8rem; font-weight: 600; text-align: right; }

.tiers { display: grid; gap: .5rem; }
.tier {
  width: 100%; text-align: left; min-width: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .7rem .85rem;
  font: inherit; color: var(--text); cursor: pointer;
  display: grid; grid-template-columns: auto 1fr auto; gap: .2rem .7rem; align-items: center;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.tier-badge {
  grid-row: 1 / span 2;
  width: 2.1rem; height: 2.1rem; border-radius: 8px;
  display: grid; place-items: center;
  font-family: var(--mono); font-weight: 700; font-size: .9rem;
  background: var(--surface-3); color: var(--muted);
}
.tier-name { font-weight: 640; font-size: .93rem; }
.tier-sub { grid-column: 2; font-size: .8rem; color: var(--text-2); }
.tier-state {
  grid-row: 1 / span 2; grid-column: 3;
  font-size: .68rem; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); white-space: nowrap;
}
.tier.is-current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.tier.is-current .tier-badge { background: var(--accent); color: #fff; }
.tier.is-current .tier-state { color: var(--accent); }
.tier.is-done .tier-badge { background: color-mix(in srgb, var(--ok) 25%, var(--surface-3)); color: var(--ok); }
.tier.is-selected { border-color: var(--border-2); }

/* ───────────────────────── 6. gc ───────────────────────── */
.gc-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .6rem; margin-bottom: 1.1rem; }
.gc-controls output { font-family: var(--mono); color: var(--text); text-transform: none; }

.heap { display: grid; gap: .6rem; grid-template-columns: minmax(0, 2fr) minmax(0, 1.6fr); }
@media (max-width: 820px) { .heap { grid-template-columns: minmax(0, 1fr); } }
.region {
  background: var(--surface); border: 1px solid var(--border);
  border-top: 3px solid var(--c); border-radius: var(--radius);
  padding: .65rem .75rem .75rem; min-width: 0;
  transition: box-shadow .2s;
}
.region.collecting { box-shadow: 0 0 0 2px var(--c); }
.region-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: .5rem;
  margin-bottom: .5rem; flex-wrap: wrap;
}
.region-name { font-weight: 640; font-size: .9rem; }
.region-meta { font-family: var(--mono); font-size: .72rem; color: var(--muted); }
.region-desc { font-size: .76rem; color: var(--muted); margin-bottom: .5rem; }
.cells { display: grid; grid-template-columns: repeat(auto-fill, minmax(14px, 1fr)); gap: 3px; }
.cell {
  aspect-ratio: 1; border-radius: 3px;
  background: var(--surface-3); border: 1px solid transparent;
  transition: background .2s, transform .2s, opacity .2s;
}
.cell.live { background: var(--c); border-color: color-mix(in srgb, var(--c) 60%, #000); }
.cell.age1 { opacity: .55; }
.cell.age2 { opacity: .7; }
.cell.age3 { opacity: .85; }
.cell.age4 { opacity: 1; }
.cell.dying { background: var(--hot); transform: scale(.55); opacity: .45; }
.cell.fresh { animation: pop .2s ease both; }
.young-wrap { display: grid; gap: .6rem; }
.survivors { display: grid; gap: .6rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.region.inactive { opacity: .55; }
.region .from-to {
  font-size: .64rem; letter-spacing: .08em; text-transform: uppercase;
  border: 1px solid var(--border); border-radius: 999px; padding: 0 .4rem; color: var(--muted);
}
.region .from-to.from { border-color: var(--stack); color: var(--stack); }
.region .from-to.to { border-color: var(--code); color: var(--code); }

.gc-bottom { display: grid; gap: .8rem; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); margin-top: 1rem; }
@media (max-width: 760px) { .gc-bottom { grid-template-columns: minmax(0, 1fr); } }
.gc-stats {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .8rem .9rem; box-shadow: var(--shadow);
}
.gc-stats > div:first-child { border-top: 0; padding-top: 0; }

/* ───────────────────────── footer ───────────────────────── */
.site-footer {
  max-width: 1180px; margin: 0 auto; padding: 1.5rem 16px 3rem;
  border-top: 1px solid var(--border);
  color: var(--muted); font-size: .84rem;
}
.site-footer p + p { margin-top: .5rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: .5rem; }

/* attribute-driven hiding must beat the component's own display rule */
.field[hidden] { display: none; }
.bc-listing li.bc-head { color: var(--muted); padding-top: .4rem; }
.bc-listing li.bc-head:not(:first-child) { margin-top: .5rem; border-top: 1px solid var(--border); }

@media (max-width: 420px) {
  .site-header { padding-top: 1.1rem; }
  .brand-text p { display: none; }
  .brand-mark { width: 34px; height: 34px; }
}
