/* Arithmetic intensity & padding — LMS tokens, theme-aware, no CDNs. */
:root {
  --bg:#fff; --fg:#0f172a; --muted:#475569; --surface:#f1f5f9; --panel:#fff;
  --border:#e2e8f0; --inset:#f8fafc; --primary:#2563eb; --primary-contrast:#fff;
  --ok:#0f766e; --warn:#b91c1c; --weight:#7c3aed;
}
@media (prefers-color-scheme: dark) {
  :root { --bg:#0f172a; --fg:#f8fafc; --muted:#a5b1c2; --surface:#1e293b; --panel:#1e293b;
    --border:#334155; --inset:#0f172a; --primary:#60a5fa; --primary-contrast:#0b1220;
    --ok:#2dd4bf; --warn:#f87171; --weight:#a78bfa; }
}
[data-theme="light"] { --bg:#fff; --fg:#0f172a; --muted:#475569; --surface:#f1f5f9; --panel:#fff; --border:#e2e8f0; --inset:#f8fafc; --primary:#2563eb; --primary-contrast:#fff; --ok:#0f766e; --warn:#b91c1c; --weight:#7c3aed; }
[data-theme="dark"] { --bg:#0f172a; --fg:#f8fafc; --muted:#a5b1c2; --surface:#1e293b; --panel:#1e293b; --border:#334155; --inset:#0f172a; --primary:#60a5fa; --primary-contrast:#0b1220; --ok:#2dd4bf; --warn:#f87171; --weight:#a78bfa; }

* { 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; }
.mono { font-family: ui-monospace, Menlo, monospace; }
.mut { color: var(--muted); }
.ok { color: var(--ok); } .warn { color: var(--warn); }
code { font-family: ui-monospace, Menlo, monospace; background: var(--surface); padding: 1px 5px; border-radius: 4px; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.hint { font-size: 13px; color: var(--muted); margin-bottom: 14px; line-height: 1.5; }

.controls { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; margin-bottom: 16px; }
.controls label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.controls label b { color: var(--fg); font-variant-numeric: tabular-nums; }
input[type=range] { width: 180px; accent-color: var(--primary); }
.tiles { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.t { font: inherit; font-size: 12px; padding: 5px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--muted); cursor: pointer; }
.t.on { background: var(--weight); color: var(--primary-contrast); border-color: var(--weight); }

/* roofline */
.roofline { margin-bottom: 16px; }
.rl-axis { position: relative; height: 34px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.rl-fill { position: absolute; top: 0; bottom: 0; }
.rl-fill.mem { left: 0; background: color-mix(in srgb, var(--warn) 16%, transparent); }
.rl-fill.comp { background: color-mix(in srgb, var(--ok) 16%, transparent); }
.ridge { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--fg); }
.ridge span { position: absolute; top: -16px; left: 4px; font-size: 10px; color: var(--muted); white-space: nowrap; }
.wl { position: absolute; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 10px color-mix(in srgb, var(--primary) 60%, transparent); display: grid; place-items: center; }
.wl.compute { background: var(--ok); } .wl.memory { background: var(--warn); }
.wl span { position: absolute; top: -18px; font-size: 10px; font-weight: 700; color: var(--fg); }
.rl-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 6px; }

/* padding visual */
.pad { display: flex; align-items: center; gap: 18px; margin-bottom: 14px; }
.pad-grid { position: relative; width: 96px; height: 96px; flex: none; border: 1.5px solid var(--border); border-radius: 8px;
  background: repeating-linear-gradient(45deg, color-mix(in srgb, var(--warn) 18%, transparent), color-mix(in srgb, var(--warn) 18%, transparent) 5px, transparent 5px, transparent 10px); }
.useful { position: absolute; top: 0; left: 0; background: color-mix(in srgb, var(--primary) 55%, var(--panel)); border-right: 1px solid var(--primary); border-bottom: 1px solid var(--primary); border-radius: 6px 0 0 0; min-width: 4px; min-height: 4px; }
.pad-num { font-size: 13px; line-height: 1.8; }
.pad-num b { font-variant-numeric: tabular-nums; }

.readout { font-size: 14px; line-height: 1.6; color: var(--fg); border-top: 1px solid var(--border); padding-top: 12px; }
.readout b { font-variant-numeric: tabular-nums; }
