/* Bottleneck Checker - a restrained "diagnostic instrument" aesthetic.
   Cool graphite, one quiet azure accent, and a semantic green/amber/red
   severity system that carries the color where it means something. */

:root {
  --bg: #0b0e12;
  --panel: #14181f;
  --panel-2: #191e26;
  --elev: #1e242e;
  --line: #232a34;
  --line-2: #2e3742;
  --ink: #eaeef4;
  --ink-2: #9aa5b4;
  --muted: #626d7c;

  --accent: #4d9bf0;
  --accent-soft: rgba(77, 155, 240, 0.14);

  --good: #43b871;
  --warn: #e0a63a;
  --bad: #e5604d;

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;

  --r: 12px;
  --r-sm: 9px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background-image:
    radial-gradient(900px 500px at 78% -10%, rgba(77, 155, 240, 0.07), transparent 60%),
    linear-gradient(180deg, #0c0f14, #0a0d11);
  background-attachment: fixed;
}

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 20px 72px;
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 0 26px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand:hover { text-decoration: none; }
.glyph {
  width: 26px; height: 26px;
  fill: none;
  color: var(--accent);
  padding: 4px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--panel);
}
.brand-name { font-size: 15.5px; }
.brand-name-accent { color: var(--ink-2); font-weight: 500; }

.topnav { display: inline-flex; align-items: center; gap: 18px; font-size: 14px; }
.topnav > a { color: var(--ink-2); }
.topnav > a:hover { color: var(--ink); text-decoration: none; }
.btn-ghost {
  border: 1px solid var(--line-2);
  padding: 7px 13px;
  border-radius: var(--r-sm);
  color: var(--ink) !important;
}
.btn-ghost:hover { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- Intro ---------- */
.intro { padding: 14px 0 26px; max-width: 44ch; }
.intro h1 {
  margin: 0 0 12px;
  font-size: clamp(26px, 4.6vw, 37px);
  line-height: 1.1;
  letter-spacing: -0.025em;
  font-weight: 700;
}
.lede { margin: 0; color: var(--ink-2); font-size: 16px; }
.lede em { color: var(--ink); font-style: normal; border-bottom: 1.5px solid var(--accent); padding-bottom: 1px; }

/* ---------- Panels ---------- */
.panel {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 22px;
}

/* ---------- Inputs ---------- */
.inputs { display: grid; gap: 18px; }
.field-label {
  display: flex; align-items: baseline; gap: 8px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.02em;
  text-transform: uppercase; color: var(--ink-2);
  margin-bottom: 8px;
}
.field-hint {
  font-family: var(--mono); font-size: 10.5px; color: var(--muted);
  border: 1px solid var(--line-2); border-radius: 4px; padding: 1px 5px;
  text-transform: none; letter-spacing: 0;
}

/* Combobox */
.combo { position: relative; }
.combo-input {
  width: 100%;
  font-family: var(--sans);
  font-size: 16px;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  padding: 13px 40px 13px 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.combo-input::placeholder { color: var(--muted); }
.combo-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.combo.selected .combo-input { font-weight: 600; }
.combo-clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 26px; height: 26px; border: none; border-radius: 6px;
  background: transparent; color: var(--muted); font-size: 20px; line-height: 1;
  cursor: pointer;
}
.combo-clear:hover { background: var(--elev); color: var(--ink); }

.combo-list {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 6px);
  margin: 0; padding: 5px; list-style: none;
  max-height: 320px; overflow-y: auto;
  background: var(--elev);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.5);
}
.combo-opt {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 9px 11px; border-radius: 7px; cursor: pointer;
}
.combo-opt:hover, .combo-opt.active { background: var(--accent-soft); }
.combo-opt .opt-name { font-size: 14.5px; color: var(--ink); }
.combo-opt .opt-brand { font-size: 11px; color: var(--muted); font-family: var(--mono); }
.combo-opt .opt-score { font-family: var(--mono); font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.combo-empty { padding: 14px 11px; color: var(--muted); font-size: 14px; text-align: center; }

/* ---------- Controls ---------- */
.controls {
  display: flex; flex-wrap: wrap; gap: 18px 26px;
  padding-top: 20px; margin-top: 4px;
  border-top: 1px solid var(--line);
}
.control { display: flex; flex-direction: column; gap: 9px; }
.control-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--muted);
}
.segmented {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--bg); border: 1px solid var(--line-2); border-radius: 9px;
}
.segmented button {
  appearance: none; border: none; background: transparent;
  color: var(--ink-2); font-family: var(--sans); font-size: 13.5px; font-weight: 500;
  padding: 6px 13px; border-radius: 6px; cursor: pointer; transition: color .12s, background .12s;
}
.segmented button:hover { color: var(--ink); }
.segmented button[aria-checked="true"] {
  background: var(--elev); color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line-2);
}

/* Toggle */
.control-toggle { justify-content: flex-start; }
.toggle {
  display: inline-flex; align-items: center; gap: 10px;
  background: none; border: none; cursor: pointer; padding: 0;
}
.toggle-track {
  width: 42px; height: 24px; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--line-2);
  position: relative; transition: background .15s, border-color .15s;
}
.toggle-thumb {
  position: absolute; top: 2px; left: 2px; width: 18px; height: 18px;
  border-radius: 50%; background: var(--ink-2); transition: transform .16s, background .15s;
}
.toggle[aria-checked="true"] .toggle-track { background: var(--accent-soft); border-color: var(--accent); }
.toggle[aria-checked="true"] .toggle-thumb { transform: translateX(18px); background: var(--accent); }
.toggle-text { font-size: 13.5px; color: var(--ink-2); font-family: var(--mono); }

/* ---------- Result area ---------- */
.result-area { margin-top: 20px; }
.placeholder {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 54px 20px; text-align: center; color: var(--muted);
  border: 1px dashed var(--line-2); border-radius: var(--r);
}
.placeholder[hidden], .result[hidden] { display: none; }
.placeholder svg { width: 46px; height: 46px; fill: none; stroke: var(--line-2); opacity: .9; }
.placeholder p { margin: 0; font-size: 15px; }

.result { padding: 24px; }

.verdict {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 18px;
  margin-bottom: 22px;
}
.verdict-tag {
  display: inline-block; font-family: var(--mono); font-size: 11px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 5px; margin-bottom: 10px;
}
.verdict-tag.is-balanced { color: var(--good); background: rgba(67, 184, 113, 0.13); border: 1px solid rgba(67, 184, 113, 0.32); }
.verdict-tag.is-cpu, .verdict-tag.is-gpu { color: var(--warn); background: rgba(224, 166, 58, 0.12); border: 1px solid rgba(224, 166, 58, 0.3); }
.verdict-tag.is-severe { color: var(--bad); background: rgba(229, 96, 77, 0.12); border: 1px solid rgba(229, 96, 77, 0.32); }
.verdict-headline {
  margin: 0; font-size: clamp(20px, 3.4vw, 26px); line-height: 1.2;
  letter-spacing: -0.02em; font-weight: 700;
}
.confidence {
  display: inline-flex; align-items: center; gap: 7px; flex-shrink: 0;
  font-size: 12px; color: var(--ink-2); font-family: var(--mono);
  padding-top: 3px; white-space: nowrap;
}
.confidence-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.confidence.high .confidence-dot { background: var(--good); }
.confidence.medium .confidence-dot { background: var(--warn); }
.confidence.low .confidence-dot { background: var(--bad); }

/* Balance meter - the signature element */
.meter { margin: 6px 0 26px; }
.meter-scale {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--muted); font-family: var(--mono);
  text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 9px;
}
.meter-scale span:nth-child(2) { color: var(--ink-2); }
.meter-track {
  position: relative; height: 12px; border-radius: 999px;
  background: linear-gradient(90deg,
    var(--bad) 0%, var(--warn) 24%, var(--good) 50%, var(--warn) 76%, var(--bad) 100%);
  opacity: .92;
}
.meter-mid {
  position: absolute; left: 50%; top: -4px; bottom: -4px; width: 2px;
  transform: translateX(-50%); background: var(--line-2); border-radius: 2px;
}
.meter-marker {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  transition: left .45s cubic-bezier(.34, 1.2, .4, 1);
}
.meter-marker::after {
  content: ""; display: block; width: 18px; height: 18px; border-radius: 50%;
  background: var(--ink); border: 3px solid var(--bg);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.55);
}
.meter-marker-value {
  position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%);
  font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--ink);
  background: var(--elev); border: 1px solid var(--line-2);
  padding: 2px 8px; border-radius: 6px; white-space: nowrap;
}
.meter-marker-value::after {
  content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 4px solid transparent; border-top-color: var(--line-2);
}

/* Readouts */
.readouts {
  display: grid; grid-template-columns: 1fr 190px; gap: 22px;
  padding-top: 22px; border-top: 1px solid var(--line);
}
.util-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 7px; }
.util-name { font-size: 13px; color: var(--ink-2); }
.util-val { font-size: 14px; color: var(--ink); }
.util-bar { height: 7px; border-radius: 4px; background: var(--bg); overflow: hidden; margin-bottom: 15px; border: 1px solid var(--line); }
.util-bar:last-child { margin-bottom: 0; }
.util-bar span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 4px; transition: width .5s cubic-bezier(.4, 0, .2, 1); }
.util-bar-alt span { background: #6ea8e6; }

.fps {
  display: flex; flex-direction: column; justify-content: center;
  text-align: center; padding: 14px; border-radius: var(--r-sm);
  background: var(--bg); border: 1px solid var(--line);
}
.fps-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.fps-num { font-size: 34px; font-weight: 700; color: var(--ink); line-height: 1.1; margin: 4px 0 2px; }
.fps-sub { font-size: 11px; color: var(--muted); }

.explanation {
  margin: 22px 0 0; padding: 15px 17px; font-size: 15px; color: var(--ink-2); line-height: 1.6;
  background: var(--bg); border-left: 2px solid var(--accent); border-radius: 0 var(--r-sm) var(--r-sm) 0;
}

.cta {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px;
  margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line);
  font-size: 14px; color: var(--ink-2);
}
.cta a { font-weight: 600; }

/* ---------- Footer ---------- */
.footer {
  margin-top: 34px; padding-top: 22px; border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 13px; color: var(--muted);
}
.footer-note { max-width: 60ch; }
.footer-links { display: inline-flex; gap: 10px; align-items: center; }
.footer-links a { color: var(--ink-2); }
.dot-sep { color: var(--line-2); }

/* ---------- Responsive ---------- */
@media (max-width: 560px) {
  .verdict { flex-direction: column; gap: 10px; }
  .readouts { grid-template-columns: 1fr; gap: 18px; }
  .fps { flex-direction: row; align-items: baseline; justify-content: center; gap: 10px; text-align: left; }
  .fps-num { font-size: 26px; margin: 0; }
  .controls { gap: 16px; }
  .segmented button { padding: 6px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
