/* ─── Design tokens — LIGHT THEME ─────────────────────────────────────────── */
:root {
  /* Surfaces */
  --bg:        #f6f8fb;
  --surface:   #ffffff;
  --surface-2: #fcfdfe;
  --surface-3: #eef2f7;

  /* Borders */
  --border:        #e4e8ef;
  --border2:       #cdd4e0;
  --border-strong: #9aa4b5;

  /* Text */
  --text:  #1a202c;
  --text2: #4a5568;
  --text3: #6b7385;
  --text4: #a0aab8;

  /* Brand + semantic */
  --accent:        #2563eb;
  --accent-hover:  #1d4ed8;
  --accent-soft:   rgba(37, 99, 235, 0.08);
  --accent-border: rgba(37, 99, 235, 0.28);
  --accent2:       #7c3aed;
  --accent2-soft:  rgba(124, 58, 237, 0.08);

  --green:  #16a34a;
  --yellow: #d97706;
  --red:    #dc2626;
  --orange: #ea580c;

  --green-soft:  rgba(22, 163, 74, 0.10);
  --yellow-soft: rgba(217, 119, 6, 0.10);
  --red-soft:    rgba(220, 38, 38, 0.08);

  /* Typography */
  --sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Consolas, Menlo, monospace;

  /* Radius */
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;

  /* Shadow — lighter for light theme */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 6px 18px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 20px 40px rgba(15, 23, 42, 0.10);

  /* Transition */
  --t-fast: 0.12s ease;
  --t-base: 0.2s ease;

  color-scheme: light;
}

/* ─── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  font-feature-settings: "cv11", "ss01", "ss03";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overflow-x: hidden;
}

button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }

/* Subtle ambient glow */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(900px circle at 12% -12%, rgba(37, 99, 235, 0.06), transparent 55%),
    radial-gradient(800px circle at 110% 18%, rgba(124, 58, 237, 0.05), transparent 60%);
  pointer-events: none;
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px 24px 64px;
  position: relative;
  z-index: 1;
}

/* ─── Header ────────────────────────────────────────────────────────────── */
header { margin-bottom: 28px; }
.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
  transition: transform var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
}
.brand-mark:hover {
  transform: translateY(-1px);
  border-color: var(--accent-border);
  box-shadow: var(--shadow-md);
}
.brand-mark img { display: block; height: 26px; width: auto; }

h1 {
  font-family: var(--sans);
  font-size: clamp(1.7rem, 3.6vw, 2.25rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.1;
  color: var(--text);
}
h1 span {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  padding: 0 0.04em;
  margin: 0 -0.04em;
  font-weight: 800;
}
.header-sub {
  color: var(--text3);
  font-size: 12.5px;
  font-family: var(--mono);
  margin-top: 6px;
  letter-spacing: -0.01em;
}
.source-link {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--text2);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: var(--r-md);
  text-decoration: none;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
}
.source-link:hover {
  color: var(--accent);
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

/* ─── Layout ────────────────────────────────────────────────────────────── */
.main-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 20px;
  align-items: start;
}

/* ─── Panel ─────────────────────────────────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px;
  position: relative;
  box-shadow: var(--shadow-sm);
}
.panel-title {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ─── Search ────────────────────────────────────────────────────────────── */
.search-wrap { position: relative; margin-bottom: 14px; }
.search-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: var(--r-md);
  padding: 11px 12px 11px 36px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.search-input::placeholder { color: var(--text3); }
.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  pointer-events: none;
  display: inline-flex;
}

/* ─── Category tabs ─────────────────────────────────────────────────────── */
.category-tabs { display: flex; gap: 4px; margin-bottom: 14px; flex-wrap: wrap; }
.cat-tab {
  padding: 7px 11px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text2);
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t-fast);
  min-height: 32px;
}
.cat-tab:hover { color: var(--text); border-color: var(--border2); }
.cat-tab.active,
.cat-tab[aria-selected="true"] {
  border-color: var(--accent-border);
  color: var(--accent);
  background: var(--accent-soft);
}

/* ─── Model list ────────────────────────────────────────────────────────── */
.model-list {
  max-height: 360px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 2px;
}
.model-item {
  padding: 10px 12px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  background: var(--bg);
  cursor: pointer;
  transition: all var(--t-fast);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.model-item:hover { border-color: var(--border2); background: var(--surface-3); }
.model-item.selected,
.model-item[aria-selected="true"] {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent-border) inset;
}
.model-item-left { flex: 1; min-width: 0; }
.model-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}
.model-meta {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text3);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.model-badges { display: flex; gap: 4px; flex-wrap: wrap; flex-shrink: 0; }
.badge {
  font-family: var(--mono);
  font-size: 9.5px;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.badge-moe   { background: var(--accent2-soft); color: #6d28d9; border: 1px solid rgba(124,58,237,0.28); }
.badge-dense { background: var(--accent-soft);  color: #1d4ed8; border: 1px solid var(--accent-border); }
.badge-size  { background: var(--green-soft);   color: #15803d; border: 1px solid rgba(22,163,74,0.28); }
.badge-ocr   { background: rgba(22,163,74,0.10); color: #15803d; border: 1px solid rgba(22,163,74,0.28); }
.badge-embed { background: rgba(217,119,6,0.10); color: #92400e; border: 1px solid rgba(217,119,6,0.28); }
.badge-rerank{ background: rgba(124,58,237,0.08); color: #6d28d9; border: 1px solid rgba(124,58,237,0.22); }
.badge-tts   { background: rgba(8,145,178,0.10); color: #0e7490; border: 1px solid rgba(8,145,178,0.28); }

.aa-link {
  color: var(--text3);
  text-decoration: none;
  border: 1px solid var(--border2);
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 9.5px;
  font-family: var(--mono);
  font-weight: 500;
  transition: all var(--t-fast);
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.aa-link:hover { color: var(--accent); border-color: var(--accent-border); background: var(--accent-soft); }

/* ─── Config panel ──────────────────────────────────────────────────────── */
.config-panel { display: flex; flex-direction: column; gap: 0; }
.ctrl-block { padding: 18px 0; border-bottom: 1px solid var(--border); }
.ctrl-block:first-of-type { padding-top: 0; }
.ctrl-block:last-child { border-bottom: none; padding-bottom: 0; }

.ctrl-label {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}
.ctrl-val {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}

/* ─── Quant grid ────────────────────────────────────────────────────────── */
.quant-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(76px, 1fr));
  gap: 5px;
}
.q-btn {
  padding: 10px 4px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text2);
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all var(--t-fast);
  line-height: 1.3;
  letter-spacing: -0.01em;
  min-height: 40px;
}
.q-btn .q-sub { font-size: 9.5px; opacity: 0.65; display: block; margin-top: 2px; font-weight: 500; }
.q-btn:hover { border-color: var(--border-strong); color: var(--text); }
.q-btn.active,
.q-btn[aria-pressed="true"] {
  border-color: var(--accent-border);
  color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent-border) inset;
}

.q-source-note {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text3);
  margin-bottom: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.q-source-note a {
  color: var(--accent);
  text-decoration: none;
  border: 1px solid var(--accent-border);
  padding: 2px 8px;
  border-radius: 4px;
  transition: all var(--t-fast);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.q-source-note a:hover { background: var(--accent-soft); border-color: var(--accent); }

/* ─── Slider ────────────────────────────────────────────────────────────── */
.slider-wrap { position: relative; padding-bottom: 22px; }
input[type=range] {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border2);
  border-radius: 999px;
  outline: none;
  cursor: pointer;
  transition: background var(--t-fast);
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--surface);
  cursor: grab;
  box-shadow: 0 0 0 1px var(--accent-border), 0 2px 6px rgba(37,99,235,0.25);
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}
input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.15); }
input[type=range]::-webkit-slider-thumb:active { cursor: grabbing; transform: scale(1.05); }
input[type=range]::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--surface);
  cursor: grab;
  box-shadow: 0 0 0 1px var(--accent-border), 0 2px 6px rgba(37,99,235,0.25);
}
.slider-ticks {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text3);
  margin-top: 8px;
  position: absolute;
  bottom: 0;
  left: 0; right: 0;
}

/* ─── Right column ──────────────────────────────────────────────────────── */
.right-col { display: flex; flex-direction: column; gap: 20px; }

/* ─── Result panel ──────────────────────────────────────────────────────── */
.result-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

/* ① Result top — VRAM big + inline alert (verdict-first layout) */
.result-top {
  padding: 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  background:
    radial-gradient(420px circle at 12% 0%, rgba(37, 99, 235, 0.06), transparent 70%),
    transparent;
}
.result-vram { flex-shrink: 0; }
.vram-big {
  font-family: var(--mono);
  font-size: clamp(2.6rem, 5.5vw, 3.4rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
  transition: color var(--t-base);
  font-feature-settings: "tnum";
}
.vram-label {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text3);
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
}

/* Inline alert in result-top — verdict next to the big number */
.result-top .alert {
  flex: 1;
  margin: 0;
  padding: 14px 16px;
  border-radius: var(--r-md);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.5;
  border: 1px solid;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-weight: 500;
  min-width: 240px;
}
.alert-icon { display: inline-flex; flex-shrink: 0; margin-top: 1px; }
.alert.show { display: flex; }
.alert.ok     { background: var(--green-soft);  border-color: rgba(22,163,74,0.32);  color: #166534; }
.alert.warn   { background: var(--yellow-soft); border-color: rgba(217,119,6,0.32); color: #92400e; }
.alert.danger { background: var(--red-soft);    border-color: rgba(220,38,38,0.32); color: #991b1b; }

/* ─── ② Live tweak strip ─────────────────────────────────────────────── */
.live-controls {
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  gap: 0 24px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 100%);
}
.lc-group { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.lc-divider { width: 1px; background: var(--border); align-self: stretch; }
.lc-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 28px;
}
.lc-title {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
}
.lc-title .lc-val {
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  font-family: var(--mono);
}
.lc-val {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  font-feature-settings: "tnum";
}

.lc-user-input { display: flex; align-items: center; gap: 4px; }
.lc-user-input .u-btn { width: 30px; height: 30px; font-size: 13px; }
.lc-user-input .user-input { width: 80px; padding: 5px 8px; font-size: 13px; flex: 0 0 auto; }

.u-btn {
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border2);
  background: var(--bg);
  color: var(--text2);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t-fast);
  flex-shrink: 0;
  font-family: var(--mono);
  line-height: 1;
}
.u-btn:hover:not(:disabled) {
  border-color: var(--accent-border);
  color: var(--accent);
  background: var(--accent-soft);
}
.u-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.user-input {
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: var(--r-md);
  padding: 7px 10px;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  min-width: 0;
  font-feature-settings: "tnum";
  -moz-appearance: textfield;
  appearance: textfield;
}
.user-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.user-input::-webkit-outer-spin-button,
.user-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.slider-wrap-inline { position: relative; padding-bottom: 0; }
.slider-wrap-inline .slider-ticks { position: relative; bottom: auto; margin-top: 4px; }

.ctx-note {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text3);
  margin-top: 8px;
}
.ctx-note.warn { color: var(--yellow); }
.ctx-hint {
  font-size: 11px;
  color: var(--text3);
  margin-top: 6px;
  line-height: 1.4;
}

/* ─── ③ MoE / OCR banners ─────────────────────────────────────────────── */
.moe-banner {
  margin: 0 24px;
  padding: 9px 14px;
  background: var(--accent2-soft);
  border: 1px solid rgba(124,58,237,0.22);
  border-radius: var(--r-md);
  font-family: var(--sans);
  font-size: 12px;
  color: #5b21b6;
  display: none;
  line-height: 1.5;
}
.moe-banner.show { display: block; margin-bottom: 14px; }
.moe-banner.ocr {
  background: rgba(22, 163, 74, 0.08);
  border-color: rgba(22, 163, 74, 0.28);
  color: #15803d;
}
.moe-banner.show:first-of-type { margin-top: 14px; }

/* ─── ④ GPU section ──────────────────────────────────────────────────── */
.gpu-section { padding: 18px 24px; }
#gpuGrid { display: flex; flex-direction: column; gap: 18px; }
.gpu-tier { display: flex; flex-direction: column; gap: 10px; }
.gpu-tier-header {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.gpu-tier-header > span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.gpu-tier-header::before {
  content: '';
  width: 4px;
  height: 14px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--accent), var(--accent2));
  flex-shrink: 0;
}
.gpu-tier-header::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.gpu-tier-count {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  padding: 1px 8px;
  border-radius: 999px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
  white-space: nowrap;
}
.gpu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}
.gpu-card {
  padding: 12px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: border-color var(--t-base), background var(--t-base), transform var(--t-fast);
  position: relative;
  overflow: hidden;
}
.gpu-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 2px;
  transition: background var(--t-base);
}
.gpu-card.fit::before   { background: var(--green); }
.gpu-card.tight::before { background: var(--yellow); }
.gpu-card.no::before    { background: transparent; }
.gpu-card.fit   { border-color: rgba(22,163,74,0.32); }
.gpu-card.tight { border-color: rgba(217,119,6,0.32); }
.gpu-card.no    { background: var(--surface-3); color: var(--text3); }
.gpu-card.no .gpu-name { color: var(--text2); }
.gpu-card:hover { transform: translateY(-1px); }

.gpu-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.gpu-name {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.gpu-status { display: inline-flex; flex-shrink: 0; }
.gpu-status.fit   { color: var(--green); }
.gpu-status.tight { color: var(--yellow); }
.gpu-status.no    { color: var(--text3); }

.gpu-vram-row { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.gpu-vram-bar-wrap {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.gpu-vram-bar { height: 100%; border-radius: 2px; transition: width 0.4s ease; }
.gpu-vram-bar.fit   { background: linear-gradient(90deg, #1f8c5b, var(--green)); }
.gpu-vram-bar.tight { background: linear-gradient(90deg, #a87d1f, var(--yellow)); }
.gpu-vram-bar.no    { background: var(--text4); }

.gpu-vram-label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text2);
  white-space: nowrap;
  font-weight: 600;
}
.gpu-note { font-family: var(--mono); font-size: 10.5px; margin-top: 4px; }
.gpu-note.fit   { color: var(--green); }
.gpu-note.tight { color: #92400e; }
.gpu-note.no    { color: var(--text3); }
.gpu-price {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text3);
  margin-top: 2px;
}
.gpu-cloud {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent);
  margin-top: 3px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
}

/* ─── ⑤ Speed section + framework mini-toggle ────────────────────────── */
.speed-section {
  padding: 18px 24px 22px;
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 100%);
}
.speed-section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.speed-headline { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.speed-section-title {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.speed-fw-desc {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text3);
}
.speed-moe-note {
  color: #6d28d9;
  margin-left: 8px;
  font-weight: 600;
}
.speed-empty {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--text3);
  font-style: italic;
}

.fw-mini {
  display: inline-flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 2px;
  gap: 2px;
  flex-shrink: 0;
}
.fw-mini-btn {
  background: transparent;
  border: 0;
  padding: 6px 10px;
  border-radius: 4px;
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text3);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all var(--t-fast);
  white-space: nowrap;
  letter-spacing: -0.005em;
}
.fw-mini-btn .fw-mini-sub {
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 500;
  color: var(--text4);
  letter-spacing: 0;
}
.fw-mini-btn:hover { color: var(--text); }
.fw-mini-btn.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.fw-mini-btn.active .fw-mini-sub { color: var(--accent); opacity: 0.7; }

.speed-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}
.speed-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px;
  text-align: center;
  transition: border-color var(--t-fast), transform var(--t-fast);
}
.speed-card:hover { border-color: var(--border2); transform: translateY(-1px); }
.speed-num {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-feature-settings: "tnum";
}
.speed-label {
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 700;
  margin-top: 4px;
  letter-spacing: 0.005em;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  justify-content: center;
}
.speed-icon { display: inline-flex; }
.speed-gpu {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text2);
  margin-top: 6px;
  font-weight: 500;
}
.speed-note {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--text3);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.speed-source {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text3);
  width: 100%;
  margin-top: 10px;
  opacity: 0.75;
}

/* ─── ⑥ Bar section (memory breakdown viz) ─────────────────────────── */
.bar-section { padding: 18px 24px; border-top: 1px solid var(--border); }
.bar-section-title {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 12px;
}
.stacked-bar {
  height: 28px;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  margin-bottom: 14px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.05);
}
.bar-seg {
  height: 100%;
  transition: width 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 0;
}
.seg-w { background: linear-gradient(90deg, #2563eb, #3b82f6); }
.seg-k { background: linear-gradient(90deg, #7c3aed, #a78bfa); }
.seg-o { background: linear-gradient(90deg, #ea580c, #f97316); }
.bar-legend { display: flex; gap: 18px; flex-wrap: wrap; }
.leg-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text2);
}
.leg-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.leg-val {
  color: var(--text);
  font-weight: 700;
  font-feature-settings: "tnum";
  margin-left: 4px;
}

/* ─── Empty state ───────────────────────────────────────────────────────── */
.no-model {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 24px;
  color: var(--text3);
  font-family: var(--sans);
  font-size: 13px;
  text-align: center;
  gap: 12px;
}
.no-model .icon-lg {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text3);
}

/* ─── ⑦ Formula detail (educational, collapsed by default) ─────────── */
.formula-detail {
  padding: 18px 24px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.fd-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.fd-toggle {
  background: transparent;
  border: 0;
  padding: 4px 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text3);
  transition: color var(--t-fast);
  font-family: inherit;
  min-height: 32px;
}
.fd-toggle:hover { color: var(--accent); }
.fd-chevron { transition: transform 0.2s ease; flex-shrink: 0; }
.fd-toggle[aria-expanded="false"] .fd-chevron { transform: rotate(-90deg); }
.fd-title-text {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.fd-body[hidden] { display: none; }
.fd-body { margin-top: 12px; }
.fd-source {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text3);
  text-decoration: none;
  transition: color var(--t-fast);
}
.fd-source:hover { color: var(--accent); }

.fd-headline {
  background: linear-gradient(180deg, var(--accent-soft), var(--surface-3));
  border: 1px solid var(--accent-border);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  margin-bottom: 14px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text);
  text-align: center;
  letter-spacing: -0.005em;
}
.fd-headline strong { color: var(--accent); font-weight: 700; }

.fd-blocks { display: flex; flex-direction: column; gap: 10px; }
.fd-block {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: border-color var(--t-fast);
}
.fd-block:hover { border-color: var(--border2); }
.fd-num {
  width: 24px; height: 24px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
  font-feature-settings: "tnum";
}
.fd-block-content { flex: 1; min-width: 0; }
.fd-block-title {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  letter-spacing: -0.005em;
}
.fd-tag {
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 3px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}
.fd-tag-moe { background: var(--accent2-soft); color: #6d28d9; border-color: rgba(124,58,237,0.28); }
.fd-hint {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  color: var(--text3);
  letter-spacing: 0;
}
.fd-formula {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text3);
  margin-bottom: 3px;
  word-break: break-word;
}
.fd-substitute {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text2);
  margin-bottom: 3px;
  word-break: break-word;
  font-feature-settings: "tnum";
}
.fd-result {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
  font-weight: 700;
  font-feature-settings: "tnum";
}
.fd-total {
  margin-top: 4px;
  padding: 12px 14px;
  background: linear-gradient(135deg, var(--accent-soft) 0%, var(--accent2-soft) 100%);
  border: 1px solid var(--accent-border);
  border-radius: var(--r-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-family: var(--mono);
}
.fd-total-label {
  font-size: 10.5px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}
.fd-total-eq {
  font-size: 11.5px;
  color: var(--text2);
  flex: 1;
  text-align: center;
  min-width: 180px;
  font-feature-settings: "tnum";
}
.fd-total-val {
  font-size: 14px;
  color: var(--accent);
  font-weight: 700;
  font-feature-settings: "tnum";
}

/* ─── Page footer ───────────────────────────────────────────────────────── */
.page-footer {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 24px 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
  z-index: 1;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text3);
  letter-spacing: 0.02em;
}
.footer-text { font-weight: 500; }
.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  color: var(--text2);
  font-weight: 600;
  font-family: var(--sans);
  font-size: 12.5px;
  padding: 5px 10px;
  border-radius: var(--r-sm);
  transition: all var(--t-fast);
  letter-spacing: -0.005em;
}
.footer-brand:hover { color: var(--accent); background: var(--accent-soft); }
.footer-brand img { display: block; height: 18px; width: auto; }

/* ─── Scrollbars ────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: 4px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }
.model-list::-webkit-scrollbar { width: 6px; }
.model-list::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; border: none; }

/* ─── Focus ring (a11y) ─────────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}
input[type=range]:focus-visible { outline: none; }
input[type=range]:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 4px var(--accent-soft), 0 0 0 1px var(--accent), 0 2px 6px rgba(37,99,235,0.25);
}

/* ─── Responsive — tablet ───────────────────────────────────────────────── */
@media (max-width: 820px) {
  .main-grid { grid-template-columns: 1fr; }
  .container { padding: 28px 16px 48px; }
  .live-controls {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 16px;
  }
  .lc-divider { display: none; }
  .fd-total { flex-direction: column; align-items: stretch; text-align: center; }
  .fd-total-eq { min-width: 0; }
}

/* ─── Responsive — phone (touch targets ≥ 44px, hide tick crowding) ───── */
@media (max-width: 720px) {
  .container { padding: 24px 14px 40px; }
  header { margin-bottom: 20px; }
  .source-link { padding: 10px 14px; min-height: 44px; }

  .panel { padding: 18px; }
  .cat-tab { padding: 11px 13px; font-size: 12.5px; min-height: 44px; }
  .q-btn { padding: 13px 6px; min-height: 48px; font-size: 12.5px; }
  .u-btn { width: 40px; height: 40px; font-size: 16px; }
  .lc-user-input .u-btn { width: 36px; height: 36px; }
  .lc-user-input .user-input { width: 90px; padding: 8px 10px; font-size: 14px; }
  .fw-mini-btn { padding: 9px 12px; min-height: 36px; }

  .result-top { padding: 18px; gap: 16px; }
  .result-top .alert { padding: 12px 14px; font-size: 12.5px; }
  .gpu-section { padding: 14px 16px; }
  .speed-section { padding: 16px; }
  .bar-section { padding: 14px 16px; }
  .formula-detail { padding: 14px 16px 18px; }
  .moe-banner { margin: 0 16px; }

  .speed-cards { grid-template-columns: repeat(2, 1fr); }
  .gpu-grid { grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); }
  .speed-section-head { flex-direction: column; align-items: stretch; }
  .fw-mini { align-self: flex-end; }
}

/* ─── Responsive — small phone (320–480) ────────────────────────────── */
@media (max-width: 480px) {
  .container { padding: 18px 12px 36px; }
  .header-top { flex-direction: column; align-items: flex-start; gap: 12px; }
  h1 { font-size: 1.6rem; }
  .source-link { width: 100%; justify-content: center; }

  .speed-cards { grid-template-columns: 1fr 1fr; gap: 8px; }
  .speed-card { padding: 10px; }
  .speed-num { font-size: 17px; }

  .gpu-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .gpu-card { padding: 10px 12px; }

  .stacked-bar { height: 22px; }
  .bar-legend { gap: 12px; font-size: 11px; }

  /* Hide every other slider tick for clarity */
  .slider-ticks span:nth-child(even) { visibility: hidden; }

  .fd-total { padding: 10px; }
  .fd-total-eq { font-size: 10.5px; }

  .fw-mini { width: 100%; justify-content: stretch; }
  .fw-mini-btn { flex: 1; justify-content: center; }
}

/* ─── Reduced motion (a11y) ───────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  html { scroll-behavior: auto; }
}

/* ─── Beginner Guide Banner ─────────────────────────────────────────────── */
.beginner-guide {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.06) 0%, rgba(124, 58, 237, 0.05) 100%);
  border: 1px solid var(--accent-border);
  border-radius: var(--r-lg);
  padding: 20px 22px;
  margin-bottom: 24px;
  position: relative;
  z-index: 1;
}
.beginner-guide.hidden { display: none; }
.guide-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.guide-icon { font-size: 20px; flex-shrink: 0; }
.guide-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}
.guide-close {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text3);
  font-size: 18px;
  cursor: pointer;
  transition: all var(--t-fast);
  flex-shrink: 0;
}
.guide-close:hover { color: var(--red); border-color: var(--red); background: var(--red-soft); }

.guide-steps {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.guide-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex: 1;
  min-width: 200px;
  font-size: 13px;
  color: var(--text2);
  line-height: 1.5;
}
.guide-step-num {
  width: 22px;
  height: 22px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--mono);
  flex-shrink: 0;
  margin-top: 1px;
}
.guide-step strong { color: var(--text); }

.guide-glossary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
}
.guide-glossary-title {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text2);
  margin-bottom: 10px;
}
.guide-terms {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.guide-term {
  font-size: 12.5px;
  color: var(--text2);
  line-height: 1.5;
  padding-left: 12px;
  border-left: 2px solid var(--accent-border);
}
.guide-term strong { color: var(--text); font-family: var(--mono); font-size: 11.5px; }

/* ─── Tooltip icons ─────────────────────────────────────────────────────── */
.tip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  font-family: var(--mono);
  cursor: help;
  position: relative;
  border: 1px solid var(--accent-border);
  transition: all var(--t-fast);
  vertical-align: middle;
  margin-left: 4px;
  text-transform: none;
  letter-spacing: 0;
}
.tip-icon.tip-sm { width: 16px; height: 16px; font-size: 9px; }
.tip-icon:hover { background: var(--accent); color: #fff; }

.tip-icon::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  padding: 10px 14px;
  border-radius: var(--r-md);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
  white-space: normal;
  width: max-content;
  max-width: 300px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 100;
  box-shadow: var(--shadow-lg);
  text-transform: none;
  letter-spacing: 0;
}
.tip-icon:hover::after { opacity: 1; pointer-events: auto; }

/* Arrow for tooltip */
.tip-icon::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 3px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--text);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 101;
}
.tip-icon:hover::before { opacity: 1; }

/* ─── Quant explanation line ────────────────────────────────────────────── */
.quant-explain {
  font-size: 11.5px;
  color: var(--text3);
  margin-bottom: 12px;
  line-height: 1.5;
  font-style: italic;
  padding: 8px 12px;
  background: var(--surface-3);
  border-radius: var(--r-sm);
  border-left: 3px solid var(--accent);
}

/* ─── Legend hint text ──────────────────────────────────────────────────── */
.leg-hint {
  font-size: 10px;
  color: var(--text3);
  font-weight: 400;
}

@media (max-width: 720px) {
  .beginner-guide { padding: 16px; }
  .guide-steps { flex-direction: column; gap: 12px; }
  .guide-step { min-width: 0; }
  .tip-icon::after { max-width: 220px; left: auto; right: -10px; transform: none; }
  .tip-icon::before { left: auto; right: 6px; transform: none; }
}
@media (max-width: 480px) {
  .guide-glossary { padding: 12px; }
  .guide-terms { gap: 8px; }
}


/* ─── Presets (Use-case) Section ─────────────────────────────────────────── */
.presets-section {
  position: relative;
  z-index: 1;
  margin-bottom: 24px;
}
.presets-header { margin-bottom: 14px; }
.presets-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
.presets-subtitle {
  font-size: 12.5px;
  color: var(--text3);
  font-weight: 400;
  margin-left: 8px;
}
.presets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}
.preset-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  cursor: pointer;
  transition: all var(--t-fast);
  text-align: left;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.preset-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: transparent;
  transition: background var(--t-fast);
}
.preset-card:hover {
  border-color: var(--accent-border);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.preset-card:hover::before { background: var(--accent); }
.preset-card.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 2px var(--accent-border);
}
.preset-card.active::before { background: var(--accent); }

.preset-icon {
  font-size: 26px;
  flex-shrink: 0;
  margin-top: 2px;
}
.preset-info { flex: 1; min-width: 0; }
.preset-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.preset-desc {
  font-size: 12.5px;
  color: var(--text2);
  line-height: 1.5;
  margin-bottom: 8px;
}
.preset-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.preset-tag {
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--surface-3);
  color: var(--text3);
  border: 1px solid var(--border);
}

/* ─── Preset Result Panel ───────────────────────────────────────────────── */
.preset-result {
  margin-top: 16px;
  background: var(--surface);
  border: 1px solid var(--accent-border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.pr-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}
.pr-detail {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.5;
}

.pr-stack { padding: 18px 22px; border-bottom: 1px solid var(--border); }
.pr-stack-title {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}
.pr-models {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pr-model {
  padding: 12px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.pr-model-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.pr-model-role {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.pr-model-vram {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.pr-model-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}
.pr-model-label {
  font-size: 12px;
  color: var(--text2);
}
.pr-model-note {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text3);
  margin-top: 4px;
}

.pr-total {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  background: var(--surface-2);
}
.pr-total-left { flex-shrink: 0; }
.pr-total-label {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 2px;
}
.pr-total-val {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
  font-feature-settings: "tnum";
}
.pr-total-ctx {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text3);
  margin-top: 4px;
}
.pr-verdict {
  flex: 1;
  min-width: 240px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  border: 1px solid;
}
.pr-verdict.ok     { background: var(--green-soft);  border-color: rgba(22,163,74,0.32);  color: #166534; }
.pr-verdict.warn   { background: var(--yellow-soft); border-color: rgba(217,119,6,0.32); color: #92400e; }
.pr-verdict.danger { background: var(--red-soft);    border-color: rgba(220,38,38,0.32); color: #991b1b; }

.pr-gpus { padding: 14px 22px; border-bottom: 1px solid var(--border); }
.pr-gpus-title {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}
.pr-gpu-list { display: flex; gap: 10px; flex-wrap: wrap; }
.pr-gpu-chip {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 14px;
  background: var(--green-soft);
  border: 1px solid rgba(22,163,74,0.28);
  border-radius: var(--r-md);
  font-family: var(--mono);
  font-size: 11.5px;
  min-width: 140px;
  position: relative;
}
.pr-gpu-name { font-weight: 700; color: var(--text); font-size: 12px; }
.pr-gpu-vram { color: var(--text2); font-size: 11px; }
.pr-gpu-spare { color: var(--green); font-weight: 600; font-size: 11px; }

.pr-actions { padding: 14px 22px; }
.pr-action-btn {
  width: 100%;
  padding: 12px 18px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: var(--r-md);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--t-fast);
}
.pr-action-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ─── Preset Controls (users slider) ───────────────────────────────────── */
.pr-controls {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--surface-2);
}
.pr-ctrl-group {
  display: flex;
  align-items: center;
  gap: 12px;
}
.pr-ctrl-label {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text2);
}
.pr-user-ctrl {
  display: flex;
  align-items: center;
  gap: 4px;
}
.pr-u-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--text2);
  font-size: 16px;
  font-weight: 600;
  font-family: var(--mono);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t-fast);
}
.pr-u-btn:hover:not(:disabled) { border-color: var(--accent-border); color: var(--accent); background: var(--accent-soft); }
.pr-u-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.pr-user-input {
  width: 60px;
  padding: 6px 8px;
  border: 1px solid var(--border2);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  outline: none;
  -moz-appearance: textfield;
  appearance: textfield;
}
.pr-user-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pr-user-input::-webkit-outer-spin-button,
.pr-user-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pr-ctrl-info {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text3);
}

/* ─── Preset badge & header ─────────────────────────────────────────────── */
.pr-header {
  padding: 18px 22px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, rgba(124, 58, 237, 0.04) 100%);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.pr-header-left { flex: 1; }
.pr-badge {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--green);
  background: var(--green-soft);
  border: 1px solid rgba(22,163,74,0.28);
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ─── GPU recommended highlight ─────────────────────────────────────────── */
.pr-gpu-chip.recommended {
  background: linear-gradient(135deg, var(--accent-soft) 0%, rgba(124,58,237,0.06) 100%);
  border-color: var(--accent-border);
  box-shadow: 0 0 0 2px var(--accent-soft);
  position: relative;
  padding-top: 28px;
}
.pr-gpu-rec-badge {
  position: absolute;
  top: 4px;
  left: 8px;
  font-size: 9.5px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.pr-gpu-price {
  font-size: 10px;
  color: var(--text3);
}
.pr-gpu-hint {
  font-size: 12.5px;
  color: var(--text3);
  line-height: 1.5;
  margin-top: 6px;
}
.pr-total-unit {
  font-size: 16px;
  font-weight: 500;
}

@media (max-width: 720px) {
  .presets-grid { grid-template-columns: 1fr; }
  .pr-total { flex-direction: column; align-items: stretch; gap: 14px; }
  .pr-verdict { min-width: 0; }
  .preset-card { padding: 14px; }
}
@media (max-width: 480px) {
  .presets-grid { grid-template-columns: 1fr; gap: 8px; }
  .pr-header { padding: 14px 16px; }
  .pr-stack { padding: 14px 16px; }
  .pr-total { padding: 14px 16px; }
  .pr-gpus { padding: 12px 16px; }
  .pr-actions { padding: 12px 16px; }
}

/* ─── Header actions wrapper ────────────────────────────────────────────── */
.header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* ─── AA size segmented control ─────────────────────────────────────────── */
.aa-segment {
  display: inline-flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 3px 4px 3px 10px;
  gap: 2px;
  flex-wrap: wrap;
  row-gap: 4px;
  box-shadow: var(--shadow-sm);
}
.aa-segment-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text3);
  font-family: var(--mono);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding-right: 9px;
  border-right: 1px solid var(--border2);
  margin-right: 4px;
}
.aa-seg-btn {
  background: transparent;
  border: none;
  color: var(--text2);
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 500;
  padding: 7px 11px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all var(--t-fast);
  letter-spacing: -0.005em;
  white-space: nowrap;
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  min-height: 32px;
}
.aa-seg-btn:hover { color: var(--accent); background: var(--accent-soft); }
.aa-seg-btn.is-current {
  color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent-border) inset;
}
.aa-seg-range {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text3);
  font-weight: 500;
  transition: color var(--t-fast);
}
.aa-seg-btn:hover .aa-seg-range,
.aa-seg-btn.is-current .aa-seg-range { color: var(--accent); opacity: 0.85; }

/* ─── AA Benchmarks Drawer ──────────────────────────────────────────────── */
.aa-drawer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
}
.aa-drawer[hidden] { display: none; }
.aa-drawer-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: aaFade 0.2s ease;
}
.aa-drawer-panel {
  position: relative;
  margin-left: auto;
  width: min(1180px, 94vw);
  height: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: aaSlide 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}
.aa-drawer-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  flex-shrink: 0;
}
.aa-drawer-title {
  flex: 1;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.aa-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 0 6px rgba(37, 99, 235, 0.35);
  flex-shrink: 0;
}
.aa-action {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text2);
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: var(--r-sm);
  padding: 7px 10px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all var(--t-fast);
  white-space: nowrap;
  min-height: 32px;
}
.aa-action:hover { color: var(--accent); border-color: var(--accent-border); background: var(--accent-soft); }
.aa-action.aa-close { width: 32px; height: 32px; padding: 0; justify-content: center; }
.aa-drawer-body {
  flex: 1;
  position: relative;
  background: var(--bg);
  overflow: hidden;
}
#aaIframe {
  position: relative;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.aa-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: var(--text2);
  font-size: 13px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.aa-loading.hidden { opacity: 0; }
.aa-spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--border2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: aaSpin 0.7s linear infinite;
}

@keyframes aaFade  { from { opacity: 0; } to { opacity: 1; } }
@keyframes aaSlide { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes aaSpin  { to { transform: rotate(360deg); } }

@media (max-width: 720px) {
  .aa-drawer-panel { width: 100vw; }
  .aa-seg-btn { padding: 9px 11px; min-height: 40px; }
}
@media (max-width: 540px) {
  .aa-seg-range { display: none; }
}
