/* ==========================================================================
   Easy-vLLM
   Mobile-first. One column by default; the results panel only becomes a
   sticky sidebar once there is room for it. Dark is the default theme,
   light is a variable swap.
   ========================================================================== */

:root {
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;

  --t: 180ms cubic-bezier(.2, .7, .2, 1);

  /* Space for the sticky mobile dock, so nothing hides behind it. */
  --dock-h: 0px;
}

:root[data-theme="dark"] {
  --bg: #0b0d12;
  --surface: #14171f;
  --surface-2: #1b1f2a;
  --surface-3: #232838;
  --border: #2a2f3d;
  --border-2: #3a4156;
  --text: #e7eaf2;
  --muted: #98a0b3;
  --faint: #6a7286;
  --accent: #7c5cff;
  --accent-2: #19c2ff;
  --on-accent: #fff;
  --accent-soft: rgba(124, 92, 255, .16);
  --good: #28d5a7;
  --good-soft: rgba(40, 213, 167, .14);
  --warn: #ffb454;
  --warn-soft: rgba(255, 180, 84, .16);
  --bad: #ff5d6c;
  --bad-soft: rgba(255, 93, 108, .14);
  --info: #5fb6ff;
  --info-soft: rgba(95, 182, 255, .14);
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

:root[data-theme="light"] {
  --bg: #f6f8fc;
  --surface: #fff;
  --surface-2: #f3f5fb;
  --surface-3: #e7ecf5;
  --border: #e2e6ef;
  --border-2: #c8cfde;
  --text: #161a23;
  --muted: #5a6276;
  --faint: #8b93a7;
  --accent: #6748ee;
  --accent-2: #1898d4;
  --on-accent: #fff;
  --accent-soft: rgba(103, 72, 238, .10);
  --good: #12886a;
  --good-soft: rgba(18, 136, 106, .12);
  --warn: #a86412;
  --warn-soft: rgba(168, 100, 18, .14);
  --bad: #c9283c;
  --bad-soft: rgba(201, 40, 60, .10);
  --info: #2166b4;
  --info-soft: rgba(33, 102, 180, .10);
  --shadow: 0 10px 30px rgba(20, 30, 60, .10);
}

* { box-sizing: border-box; }

/* Several components below set `display: flex`, which would otherwise beat the
 * browser's default rule for [hidden]. Everything here toggles visibility with
 * the hidden attribute, so it has to win. */
[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3 { line-height: 1.25; margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
a { color: var(--accent-2); }

code, pre, .input--mono { font-family: var(--mono); }
code { font-size: .92em; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--accent); color: var(--on-accent);
  padding: 10px 16px; border-radius: 0 0 var(--r-sm) 0;
}
.skip-link:focus { left: 0; }

:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ==========================================================================
   Top bar
   ========================================================================== */

.topbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar__inner {
  max-width: 1240px; margin: 0 auto;
  padding: 10px 16px;
  display: flex; align-items: center; gap: 12px;
}
.brand {
  display: flex; align-items: center; gap: 9px;
  color: var(--text); text-decoration: none; font-weight: 700;
  margin-right: auto;
}
.brand__logo { display: block; }
.brand__name { font-size: 17px; letter-spacing: -.02em; }
.brand__name--accent { color: var(--accent); }

.topbar__nav { display: flex; align-items: center; gap: 4px; }
.topbar__link {
  color: var(--muted); text-decoration: none;
  padding: 8px 12px; border-radius: var(--r-sm);
  font-size: 14px; font-weight: 600;
  min-height: 40px; display: inline-flex; align-items: center;
  transition: color var(--t), background var(--t);
}
.topbar__link:hover { color: var(--text); background: var(--surface-2); }
.topbar__link.is-active { color: var(--text); background: var(--surface-2); }
.topbar__link--icon { padding: 8px 10px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  background: none; border: 1px solid transparent; border-radius: var(--r-sm);
  color: var(--muted); cursor: pointer;
  transition: color var(--t), background var(--t);
}
.icon-btn:hover { color: var(--text); background: var(--surface-2); }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="light"] .icon-moon { display: none; }

/* ==========================================================================
   Page shell
   ========================================================================== */

.page {
  max-width: 1240px;
  margin: 0 auto;
  padding: 20px 16px calc(28px + var(--dock-h));
}
.view[hidden] { display: none; }

.hero { padding: 18px 0 26px; max-width: 720px; }
.hero__title {
  font-size: clamp(28px, 6.4vw, 44px);
  font-weight: 800; letter-spacing: -.03em;
}
.hero__accent {
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero__sub { margin-top: 12px; color: var(--muted); font-size: clamp(15px, 2.4vw, 17px); }
.hero__meta { margin-top: 10px; color: var(--faint); font-size: 13px; }

/* ==========================================================================
   Two-column layout (single column until there is room)
   ========================================================================== */

.layout { display: grid; grid-template-columns: 1fr; gap: 20px; align-items: start; }

@media (min-width: 1060px) {
  .layout { grid-template-columns: minmax(0, 1fr) 348px; gap: 24px; }
  .results { position: sticky; top: 74px; max-height: calc(100vh - 92px); overflow-y: auto; }
}

.build { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* ==========================================================================
   Cards
   ========================================================================== */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.card__head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.card__title {
  font-size: 16px; font-weight: 700;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.card__step {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; flex: none;
  border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  font-size: 13px; font-weight: 700;
}
.card__optional { color: var(--faint); font-weight: 500; font-size: 13px; }
.card__body { padding: 18px; display: flex; flex-direction: column; gap: 18px; }

/* Collapsible card */
.card--details > summary { list-style: none; cursor: pointer; }
.card--details > summary::-webkit-details-marker { display: none; }
.card__head--summary { display: flex; align-items: center; gap: 12px; }
.card__head--summary .card__title { margin-right: auto; }
.card--details:not([open]) .card__head--summary { border-bottom: 0; }
.card__head--summary:hover { background: var(--surface-3); }
.chev {
  width: 9px; height: 9px; flex: none;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); transition: transform var(--t);
}
.card--details[open] .chev { transform: rotate(-135deg); }

.rule { border: 0; border-top: 1px solid var(--border); margin: 0; }

/* ==========================================================================
   Form controls
   ========================================================================== */

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field--toggle { justify-content: center; }

.label { font-size: 14px; font-weight: 600; }
.opt { color: var(--faint); font-weight: 500; font-size: 12px; }

.input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  font: inherit; font-size: 15px;
  transition: border-color var(--t), box-shadow var(--t);
}
.input:hover { border-color: var(--muted); }
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input--mono { font-family: var(--mono); font-size: 13px; resize: vertical; }
textarea.input { min-height: 64px; }
select.input {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

.input-wrap { position: relative; display: block; }
.input-spinner {
  position: absolute; right: 12px; top: 50%; margin-top: -8px;
  width: 16px; height: 16px;
  border: 2px solid var(--border-2); border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hint { font-size: 12.5px; color: var(--muted); }
.hint--tight { margin-top: -8px; }
.hint code, .toggle__hint code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }

.status { font-size: 12.5px; min-height: 1em; }
.status--muted { color: var(--faint); }
.status--warn { color: var(--warn); }

.linkbtn {
  background: none; border: 0; padding: 0;
  color: var(--accent-2); font: inherit; font-size: inherit;
  cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
}
.linkbtn:hover { color: var(--accent); }

.grid-2 { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 620px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

/* Segmented control */
.segmented {
  display: grid; grid-template-columns: 1fr 1fr;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 4px; gap: 4px;
}
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label {
  display: flex; align-items: center; justify-content: center;
  min-height: 40px; padding: 8px 10px;
  border-radius: var(--r-sm);
  font-size: 14px; font-weight: 600; color: var(--muted);
  cursor: pointer; text-align: center;
  transition: background var(--t), color var(--t);
}
.segmented label:hover { color: var(--text); }
.segmented input:checked + label {
  background: var(--surface); color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .16);
}
.segmented input:focus-visible + label { outline: 2px solid var(--accent-2); outline-offset: 1px; }

/* Toggle */
.toggle {
  display: flex; gap: 12px; align-items: flex-start;
  cursor: pointer; padding: 4px 0; min-height: 44px;
}
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle__box {
  flex: none; margin-top: 2px;
  width: 40px; height: 23px; border-radius: 999px;
  background: var(--surface-3); border: 1px solid var(--border-2);
  position: relative; transition: background var(--t), border-color var(--t);
}
.toggle__box::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 17px; height: 17px; border-radius: 50%;
  background: var(--muted); transition: transform var(--t), background var(--t);
}
.toggle input:checked + .toggle__box { background: var(--accent); border-color: var(--accent); }
.toggle input:checked + .toggle__box::after { transform: translateX(17px); background: #fff; }
.toggle input:focus-visible + .toggle__box { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.toggle__text { font-size: 14px; font-weight: 600; display: flex; flex-direction: column; gap: 2px; }
.toggle__hint { font-weight: 400; font-size: 12.5px; color: var(--muted); }

/* Slider */
.slider-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.slider-out {
  font-family: var(--mono); font-size: 14px; font-weight: 700; color: var(--accent);
}
.slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px; margin: 8px 0;
  border-radius: 999px;
  background: linear-gradient(var(--accent), var(--accent)) 0 / var(--fill, 60%) 100% no-repeat,
              var(--surface-3);
  cursor: pointer;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--surface);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
}
.slider::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--surface);
}

/* Fieldsets inside the tuning card */
.group {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px 16px;
  margin: 0;
  display: flex; flex-direction: column; gap: 14px;
  min-width: 0;
}
.group legend {
  padding: 0 8px;
  font-size: 12px; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase;
  color: var(--accent);
}
.group__intro { font-size: 13px; color: var(--muted); }

/* Nested disclosure */
.sub {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.sub > summary {
  padding: 12px 16px; cursor: pointer;
  font-size: 14px; font-weight: 600; color: var(--muted);
  min-height: 44px; display: flex; align-items: center;
}
.sub > summary:hover { color: var(--text); }
.sub__body { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 14px; }

.dropzone {
  display: flex; align-items: center; gap: 12px;
  padding: 16px;
  border: 2px dashed var(--border-2); border-radius: var(--r-md);
  background: var(--surface);
  color: var(--muted); font-size: 13.5px;
  cursor: pointer; text-align: left;
  transition: border-color var(--t), background var(--t), color var(--t);
}
.dropzone:hover, .dropzone.is-over {
  border-color: var(--accent); color: var(--text);
  background: var(--accent-soft);
}
.dropzone svg { flex: none; }

/* Parsed model card */
.model-card {
  border: 1px solid color-mix(in srgb, var(--good) 34%, var(--border));
  background: var(--good-soft);
  border-radius: var(--r-md);
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.model-card__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.model-card__name { font-family: var(--mono); font-size: 14px; }
.model-card__clear { margin-left: auto; color: var(--muted); }
.model-card__grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px; margin: 0;
}
.model-card__grid > div { display: flex; flex-direction: column; min-width: 0; }
.model-card__grid dt {
  font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
}
.model-card__grid dd {
  margin: 0; font-family: var(--mono); font-size: 13.5px; font-weight: 600;
  overflow-wrap: anywhere;
}
.model-card__notes p { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px;
  border-radius: var(--r-sm); border: 1px solid var(--border-2);
  background: var(--surface-2); color: var(--text);
  font: inherit; font-size: 14.5px; font-weight: 600;
  cursor: pointer; text-decoration: none;
  transition: background var(--t), border-color var(--t), transform var(--t), opacity var(--t);
}
.btn:hover { background: var(--surface-3); border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--primary {
  background: linear-gradient(100deg, var(--accent), color-mix(in srgb, var(--accent) 62%, var(--accent-2)));
  border-color: transparent; color: var(--on-accent);
}
.btn--primary:hover { filter: brightness(1.08); border-color: transparent; }
.btn--ghost { background: transparent; }
.btn--danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--border)); }
.btn--danger:hover { background: var(--bad-soft); }
.btn--lg { min-height: 52px; padding: 12px 26px; font-size: 16px; }
.btn--small { min-height: 32px; padding: 5px 11px; font-size: 12.5px; }

.build__actions {
  display: flex; flex-wrap: wrap; gap: 10px;
  padding-bottom: 4px;
}
.build__actions .btn--primary { flex: 1 1 220px; }

/* ==========================================================================
   Results panel
   ========================================================================== */

.results {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
  display: flex; flex-direction: column; gap: 16px;
  min-width: 0;
}

.verdict { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.gauge { position: relative; width: 132px; height: 132px; }
.gauge__svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge__track { fill: none; stroke: var(--surface-3); stroke-width: 9; }
.gauge__fill {
  fill: none; stroke: var(--faint); stroke-width: 9; stroke-linecap: round;
  stroke-dasharray: 326.73; stroke-dashoffset: 326.73;
  transition: stroke-dashoffset 420ms cubic-bezier(.2, .7, .2, 1), stroke var(--t);
}
.verdict.is-good .gauge__fill { stroke: var(--good); }
.verdict.is-risky .gauge__fill { stroke: var(--warn); }
.verdict.is-oom .gauge__fill { stroke: var(--bad); }
.gauge__center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.gauge__pct { font-size: 30px; font-weight: 800; letter-spacing: -.03em; }
.gauge__unit { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.verdict__label { font-size: 16px; font-weight: 700; margin-top: 6px; }
.verdict.is-good .verdict__label { color: var(--good); }
.verdict.is-risky .verdict__label { color: var(--warn); }
.verdict.is-oom .verdict__label { color: var(--bad); }
.verdict__sub { font-size: 13px; color: var(--muted); }

.capacity {
  border: 1px solid color-mix(in srgb, var(--good) 32%, var(--border));
  background: var(--good-soft);
  border-radius: var(--r-md);
  padding: 12px 14px;
}
.capacity.is-short {
  border-color: color-mix(in srgb, var(--warn) 32%, var(--border));
  background: var(--warn-soft);
}
.capacity__row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.capacity__big { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.capacity__cap { font-size: 13px; font-weight: 600; color: var(--muted); }
.capacity__note { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

.breakdown { margin: 0; display: flex; flex-direction: column; gap: 2px; }
.breakdown > div {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  padding: 6px 0; border-bottom: 1px dashed var(--border);
}
.breakdown > div:last-child { border-bottom: 0; }
.breakdown dt { font-size: 13px; color: var(--muted); }
.breakdown dd { margin: 0; font-size: 13px; color: var(--muted); }
.breakdown b { font-family: var(--mono); font-size: 14px; color: var(--text); font-weight: 700; }
.breakdown__total dt, .breakdown__total dd { color: var(--text); font-weight: 700; }

.recipe {
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--border));
  background: var(--accent-soft);
  border-radius: var(--r-md);
  padding: 14px;
}
.recipe__head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.recipe__head h3 { font-size: 14px; margin-right: auto; }
.recipe__list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 7px; }
.recipe__list li { font-size: 12.8px; color: var(--muted); }
.recipe__done { color: var(--good) !important; font-weight: 600; }

.fixes__title { font-size: 14px; margin-bottom: 8px; }
.fixes__list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.fixes__list li {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 11px 12px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 5px;
}
.fixes__list strong { font-size: 13.5px; }
.fixes__list span { font-size: 12.5px; color: var(--muted); }

.notices { display: flex; flex-direction: column; gap: 8px; }
.notice {
  font-size: 12.5px; line-height: 1.5;
  padding: 9px 12px; border-radius: var(--r-sm);
  border-left: 3px solid var(--faint);
  background: var(--surface-2); color: var(--muted);
}
.notice--error, .notice--danger {
  border-left-color: var(--bad); background: var(--bad-soft); color: var(--text);
}
.notice--warning { border-left-color: var(--warn); background: var(--warn-soft); color: var(--text); }
.notice--info { border-left-color: var(--info); background: var(--info-soft); }

.cmdpeek { border-top: 1px solid var(--border); padding-top: 12px; }
.cmdpeek > summary {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; font-size: 13.5px; font-weight: 600;
  list-style: none; min-height: 36px;
}
.cmdpeek > summary::-webkit-details-marker { display: none; }
.cmdpeek > summary span { margin-right: auto; }

.pre {
  margin: 10px 0 0;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  overflow-x: auto;
  font-size: 12.5px; line-height: 1.65;
  white-space: pre;
  -webkit-overflow-scrolling: touch;
}
.pre code { white-space: pre; }

/* ==========================================================================
   Chips
   ========================================================================== */

.chip {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  background: var(--surface-3); color: var(--muted);
  border: 1px solid var(--border);
}
.chip--ok, .chip--good { background: var(--good-soft); color: var(--good); border-color: color-mix(in srgb, var(--good) 32%, var(--border)); }
.chip--risky { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 32%, var(--border)); }
.chip--oom { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 32%, var(--border)); }

/* ==========================================================================
   History
   ========================================================================== */

.history { margin-top: 40px; }
.history__head { margin-bottom: 14px; }
.history__head h2 { font-size: 18px; }
.history__sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.history__grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.hcard {
  display: flex; flex-direction: column; gap: 7px;
  padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md);
  text-decoration: none; color: var(--text);
  transition: border-color var(--t), transform var(--t), box-shadow var(--t);
}
.hcard:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.hcard header { display: flex; align-items: center; gap: 8px; }
.hcard header strong { font-size: 14.5px; margin-right: auto; overflow-wrap: anywhere; }
.hcard code { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.hcard p { font-size: 12px; color: var(--faint); }

/* ==========================================================================
   Result view
   ========================================================================== */

.result { display: flex; flex-direction: column; gap: 18px; }
.result__head { display: flex; flex-direction: column; gap: 12px; }
.result__title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.result__name { font-size: clamp(20px, 4vw, 26px); font-weight: 800; overflow-wrap: anywhere; }
.result__meta { display: flex; flex-wrap: wrap; gap: 8px; }
.result__meta span {
  display: inline-flex; flex-direction: column;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 6px 12px; min-width: 0;
}
.result__meta em {
  font-style: normal; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .06em; color: var(--faint);
}
.result__meta strong { font-size: 13px; overflow-wrap: anywhere; }
.result__actions { display: flex; flex-wrap: wrap; gap: 10px; }

.tabs {
  display: flex; gap: 4px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none;
  background: none; border: 0; border-bottom: 2px solid transparent;
  padding: 11px 16px; min-height: 44px;
  color: var(--muted); font: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: color var(--t), border-color var(--t);
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--accent); border-bottom-color: var(--accent); }

.panels { min-width: 0; }
.panel { display: flex; flex-direction: column; gap: 14px; }
.panel[hidden] { display: none; }
.panel__lead { font-size: 13.5px; color: var(--muted); }

.codecard {
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); overflow: hidden; min-width: 0;
}
.codecard__head {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.codecard__head code { font-size: 12.5px; font-weight: 600; margin-right: auto; overflow-wrap: anywhere; }
.codecard .pre { margin: 0; border: 0; border-radius: 0; background: var(--surface); max-height: 60vh; overflow: auto; }

/* ==========================================================================
   Cheat sheet
   ========================================================================== */

.sheet { max-width: 900px; display: flex; flex-direction: column; gap: 18px; padding-bottom: 20px; }
.sheet__title { font-size: clamp(26px, 5vw, 36px); font-weight: 800; }
.sheet__lead { color: var(--muted); font-size: 16px; }
.sheet h2 { font-size: 20px; margin-top: 18px; }

.tablewrap {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface);
}
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 560px; }
.table th, .table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th {
  background: var(--surface-2); font-size: 11.5px; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted); font-weight: 700; white-space: nowrap;
}
.table tr:last-child td { border-bottom: 0; }
.table small { color: var(--faint); font-size: 11.5px; }
.table code { background: var(--surface-2); padding: 2px 6px; border-radius: 4px; }
.yes { color: var(--good); font-weight: 700; }
.no { color: var(--faint); }
.row--dead { opacity: .6; }

.tips { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 12px; }
.tips li { padding-left: 4px; }
.tips strong { display: block; font-size: 15px; }
.tips span { font-size: 13.5px; color: var(--muted); }
.sheet__foot { margin-top: 12px; }

/* ==========================================================================
   Footer, dock, toasts
   ========================================================================== */

.footer {
  border-top: 1px solid var(--border);
  margin-top: 40px;
  padding: 26px 16px calc(26px + var(--dock-h));
  text-align: center;
  color: var(--muted); font-size: 13px;
}
.footer p + p { margin-top: 6px; }
.footer__thin { color: var(--faint); font-size: 12.5px; }

/* Sticky verdict bar, only while the results panel is out of sight. */
.dock { display: none; }
@media (max-width: 1059px) {
  :root { --dock-h: 60px; }
  .dock {
    position: fixed; left: 12px; right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    z-index: 35;
    display: flex; align-items: center; gap: 10px;
    min-height: 48px; padding: 10px 16px;
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border-2); border-radius: 999px;
    box-shadow: var(--shadow);
    font: inherit; font-size: 14px; font-weight: 600;
    cursor: pointer;
  }
  .dock[hidden] { display: none; }
  .dock__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--faint); flex: none; }
  .dock.is-good .dock__dot { background: var(--good); }
  .dock.is-risky .dock__dot { background: var(--warn); }
  .dock.is-oom .dock__dot { background: var(--bad); }
  .dock__text { margin-right: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .dock__pct { font-family: var(--mono); color: var(--muted); }
}

.toasts {
  position: fixed; z-index: 60;
  left: 50%; transform: translateX(-50%);
  bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none; width: min(92vw, 420px);
}
@media (min-width: 1060px) { .toasts { bottom: 24px; } }
.toast {
  background: var(--surface-3); color: var(--text);
  border: 1px solid var(--border-2); border-radius: 999px;
  padding: 10px 20px; font-size: 13.5px; font-weight: 600;
  box-shadow: var(--shadow);
  animation: rise 220ms cubic-bezier(.2, .7, .2, 1);
  text-align: center;
}
.toast--error { background: var(--bad); border-color: var(--bad); color: #fff; }
.toast.is-leaving { opacity: 0; transform: translateY(8px); transition: opacity 240ms, transform 240ms; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
