:root {
  --bg: #0a0b0e;
  --ink: #f1f2f6;
  --soft: rgba(241, 242, 246, 0.56);
  --line: rgba(241, 242, 246, 0.1);
  --accent: #7f9dff;
  --warm: #ffb44a;
  --hot: #ff5b4c;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Mona Sans Variable", "Mona Sans", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.stage {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: clamp(10px, 3vh, 30px) clamp(14px, 4vw, 40px);
}

/* sized on width and on height, so it sits whole in a short box too */
.cpu { width: min(560px, 100%); height: min(440px, calc(100vh - 2 * clamp(10px, 3vh, 30px))); display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(70px, 1fr) auto; gap: clamp(8px, 2.200vh, 16px); }

.cpu__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; font-weight: 640; }
.cpu__host { display: flex; align-items: center; gap: 8px; font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.500px; font-weight: 600; white-space: nowrap; }
.cpu__host svg { width: 18px; height: 18px; fill: none; stroke: var(--accent); stroke-width: 1.400; stroke-linecap: round; }
.cpu__spec { color: var(--soft); font-weight: 580; white-space: nowrap; }

.cpu__read { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
/* the number gets heavier as the load grows (--w comes from the script) */
.cpu__total { display: flex; align-items: baseline; gap: 3px; }
.cpu__total b { --w: 500; font-size: clamp(40px, min(14vw, 12vh), 76px); line-height: 0.9; font-weight: 400; font-variation-settings: "wght" var(--w), "wdth" 106; letter-spacing: -0.03em; }
.cpu__total i { font-style: normal; font-size: clamp(16px, 3vh, 22px); font-weight: 640; color: var(--soft); }
.cpu__side { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; padding-bottom: 3px; }
.cpu__roll { display: block; overflow: hidden; }
.cpu__roll > span { display: block; white-space: nowrap; }
.cpu__state { height: 20px; line-height: 20px; font-size: 14px; font-weight: 700; color: var(--tone, var(--accent)); }
.cpu__temp { font-size: 12.500px; font-weight: 600; color: var(--soft); }

.cpu__cols { position: relative; min-height: 0; }
.cpu__cols svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; touch-action: pan-y; }
.cpu__cols g { transition: opacity 0.25s ease; }
.cpu__cols g.is-dim { opacity: 0.38; }
.cpu__seg { fill: var(--ink); fill-opacity: 0.07; }
.cpu__seg.is-a { fill: var(--accent); }
.cpu__seg.is-b { fill: var(--warm); }
.cpu__seg.is-c { fill: var(--hot); }
.cpu__cap { fill: var(--ink); }
.cpu__tip { position: absolute; left: 0; top: 0; padding: 5px 9px 4px; border-radius: 9px; background: #f1f2f6; color: #0a0b0e; font-size: 11.500px; font-weight: 700; white-space: nowrap; pointer-events: none; opacity: 0; box-shadow: 0 8px 18px -8px rgba(0, 0, 0, 0.7); }

.cpu__foot { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cpu__run { position: relative; flex: none; display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 17px 0 14px; border: 0; border-radius: 22px; background: rgba(241, 242, 246, 0.08); box-shadow: inset 0 0 0 1px var(--line), inset 0 1px 0 rgba(255, 255, 255, 0.07); color: var(--ink); font: inherit; font-size: 13.500px; font-weight: 700; cursor: pointer; overflow: hidden; outline: none; -webkit-tap-highlight-color: transparent; transition: transform 0.35s cubic-bezier(0.3, 1.6, 0.5, 1), background 0.2s ease; }
.cpu__run:active { transform: scale(0.96); }
.cpu__run:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.cpu__run[disabled] { cursor: default; }
.cpu__run svg { position: relative; width: 14px; height: 14px; fill: var(--accent); }
.cpu__run .cpu__roll { position: relative; height: 18px; line-height: 18px; }
.cpu__fill { position: absolute; inset: 0; background: color-mix(in srgb, var(--accent) 34%, transparent); transform: scaleX(0); transform-origin: 0 50%; }
.cpu__proc { flex: 1; min-width: 0; height: 18px; line-height: 18px; font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; font-weight: 500; color: var(--soft); }
.cpu__proc > span { overflow: hidden; text-overflow: ellipsis; }

@media (hover: hover) {
  .cpu__run:not([disabled]):hover { background: rgba(241, 242, 246, 0.13); }
}

.ghost { position: absolute; left: 0; top: 0; width: 24px; height: 24px; margin: -3px 0 0 -5px; pointer-events: none; opacity: 0; fill: #ffffff; stroke: #000000; stroke-width: 1.200; stroke-linejoin: round; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5)); z-index: 5; }

@media (prefers-reduced-motion: reduce) {
  .cpu__cols g, .cpu__run { transition: none; }
}
