/* TPU VM anatomy — interactive cutaway across generations. LMS tokens, theme-aware, no CDNs. */
:root {
  --bg: #ffffff; --fg: #202124; --muted: #5f6368; --border: #dadce0;
  --panel: #ffffff; --primary: #1558b0; --primary-contrast: #ffffff; --surface: #f8fafc;
  --amber: #fbc02d; --amber-fg: #3c2e00;
  --chip-bg: #c5d9fb; --chip-fg: #202124;
  --core-bg: #ffffff; --core-fg: #202124;
  --unit: #d2e3fc; --unit-fg: #174ea6;
  --mxu: #fde293; --mxu-fg: #5c4400;
  --hbm: #1e7e34; --hbm-fg: #ffffff;
  --ici: #1a5fd0; --ici-fg: #ffffff;
  --neighbor: #aecbfa; --neighbor-fg: #202124;
  --marker: #1a73e8; --marker-fg: #fff;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a; --fg: #e8eaed; --muted: #9aa0a6; --border: #3c4043;
    --panel: #1e293b; --primary: #8ab4f8; --primary-contrast: #0b1220; --surface: #1e293b;
    --amber: #f9ab00; --amber-fg: #201600;
    --chip-bg: #1c3357; --chip-fg: #e8eaed;
    --core-bg: #16233a; --core-fg: #e8eaed;
    --unit: #28456e; --unit-fg: #c7dbff;
    --mxu: #c9a227; --mxu-fg: #1a1400;
    --hbm: #34a853; --hbm-fg: #0b1220;
    --ici: #4285f4; --ici-fg: #0b1220;
    --neighbor: #28456e; --neighbor-fg: #e8eaed;
    --marker: #4285f4; --marker-fg: #0b1220;
  }
}
[data-theme="light"] {
  --bg: #ffffff; --fg: #202124; --muted: #5f6368; --border: #dadce0; --panel: #ffffff; --primary: #1558b0; --primary-contrast: #ffffff; --surface: #f8fafc;
  --amber: #fbc02d; --amber-fg: #3c2e00; --chip-bg: #c5d9fb; --chip-fg: #202124; --core-bg: #ffffff; --core-fg: #202124;
  --unit: #d2e3fc; --unit-fg: #174ea6; --mxu: #fde293; --mxu-fg: #5c4400; --hbm: #1e7e34; --hbm-fg: #fff;
  --ici: #1a5fd0; --ici-fg: #fff; --neighbor: #aecbfa; --neighbor-fg: #202124; --marker: #1a73e8; --marker-fg: #fff;
}
[data-theme="dark"] {
  --bg: #0f172a; --fg: #e8eaed; --muted: #9aa0a6; --border: #3c4043; --panel: #1e293b; --primary: #8ab4f8; --primary-contrast: #0b1220; --surface: #1e293b;
  --amber: #f9ab00; --amber-fg: #201600; --chip-bg: #1c3357; --chip-fg: #e8eaed; --core-bg: #16233a; --core-fg: #e8eaed;
  --unit: #28456e; --unit-fg: #c7dbff; --mxu: #c9a227; --mxu-fg: #1a1400; --hbm: #34a853; --hbm-fg: #0b1220;
  --ici: #4285f4; --ici-fg: #0b1220; --neighbor: #28456e; --neighbor-fg: #e8eaed; --marker: #4285f4; --marker-fg: #0b1220;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
#app { padding: 16px; max-width: 900px; margin: 0 auto; }
/* Only the cutaway scrolls sideways, as a focusable, named region, where the whole app used to (LMS-content#130). The
   padding keeps a part's focus ring inside the scrolling box, and the scroll padding keeps it there when a focused part is
   scrolled into view. */
.stage-scroll { overflow-x: auto; padding: 6px; scroll-padding-inline: 8px; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.hint { font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 16px; }

.stage { display: flex; align-items: center; gap: 8px; width: max-content; min-width: 100%; justify-content: center; }
.arr { color: var(--muted); font-size: 18px; flex: none; }

.part { position: relative; cursor: pointer; transition: box-shadow .15s, filter .15s, background-color 0.3s; }
.part.sel { box-shadow: 0 0 0 3px var(--marker), 0 0 16px color-mix(in srgb, var(--marker) 35%, transparent); }

.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 14px; }
.gentabs { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--border); border-radius: 999px; padding: 3px; gap: 3px; background: var(--panel); }
.gtab { font: inherit; font-size: 13px; font-weight: 600; padding: 6px 14px; border: 0; border-radius: 999px;
  background: transparent; color: var(--muted); cursor: pointer; transition: all 0.2s; }
.gtab.on { background: var(--marker); color: var(--marker-fg); }
.gennote { margin-top: 14px; font-size: 13px; color: var(--muted); line-height: 1.5; min-height: 40px; }
.gennote strong { color: var(--fg); }

.cae { flex: 1; background: color-mix(in srgb, var(--marker) 22%, var(--core-bg)); color: var(--fg);
  border: 1.5px solid var(--marker); font-weight: 700; }
.u.big { background: color-mix(in srgb, var(--marker) 24%, var(--unit)); border: 1.5px solid var(--marker); }
.x3 { font-size: 10px; font-weight: 800; color: var(--marker-fg); background: var(--marker);
  border-radius: 4px; padding: 0 4px; margin-left: 2px; }

.side { flex: none; display: grid; place-items: center; border-radius: 10px; font-weight: 700; font-size: 14px; text-align: center; padding: 8px; }
.host { width: 78px; height: 92px; background: var(--amber); color: var(--amber-fg); }
.pcie { width: 64px; height: 300px; background: var(--amber); color: var(--amber-fg); }
.ici { width: 64px; height: 300px; background: var(--ici); color: var(--ici-fg); }
.neighbor { width: 78px; height: 300px; background: var(--neighbor); color: var(--neighbor-fg); }

.chip { flex: none; position: relative; padding: 14px 14px 26px; border-radius: 16px; background: var(--chip-bg); }
.chip-name { position: absolute; bottom: 6px; left: 0; right: 0; text-align: center; font-size: 13px; font-weight: 600; color: var(--chip-fg); text-transform: uppercase; letter-spacing: 0.05em; }
.cores { display: flex; gap: 12px; }
.tensorcore { background: var(--core-bg); color: var(--core-fg); border-radius: 12px; padding: 12px; }
.tc-label { text-align: center; font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.tc-units { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.u { background: var(--unit); color: var(--unit-fg); border-radius: 8px; padding: 10px 8px; font-size: 12px; font-weight: 600; text-align: center; min-height: 42px; display: grid; place-items: center; transition: all 0.3s; }
.mxus { display: flex; gap: 8px; }
.mxu { background: var(--mxu); color: var(--mxu-fg); border-radius: 8px; width: 40px; height: 84px; display: grid; place-items: end center; padding-bottom: 8px; font-size: 12px; font-weight: 700; }
.hbm { margin-top: 12px; height: 44px; background: var(--hbm); color: var(--hbm-fg); border-radius: 8px; display: grid; place-items: center; font-weight: 700; font-size: 15px; }
.sparse { display: flex; gap: 12px; margin-top: 12px; height: 48px; }
.sc { flex: 1; background: var(--unit); color: var(--unit-fg); border-radius: 8px; height: 100%; display: grid; place-items: center; font-weight: 600; font-size: 13px; }

.detail { margin-top: 18px; padding: 18px 20px; border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: 12px; background: var(--panel); min-height: 100px; }
.dname { font-weight: 800; font-size: 18px; margin-bottom: 6px; }
.drole { font-size: 14.5px; line-height: 1.5; color: var(--fg); }
.dspec { margin-top: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--muted); padding-top: 12px; border-top: 1px dashed var(--border); min-height: 12px; }

@media (prefers-reduced-motion: reduce) {
  .part, .u, .gtab { transition: none; }
}
