/* ============================================================
   iQOO / vivo OTA Index
   Palette: neutral slate + one blue accent + amber (full pkg).
   Fonts: Manrope + IBM Plex Mono.
   ============================================================ */

:root {
  --bg:              #F5F7FB;
  --bg-elev:         #FFFFFF;
  --bg-subtle:       #F1F1F3;
  --border:          #E1E6EF;
  --border-strong:   #D4D4D8;
  --text:            #0B0D10;
  --text-muted:      #4B4F57;
  --text-subtle:     #616B7A;
  --accent:          #254EDB;
  --accent-hover:    #1E3A8A;
  --accent-fg:       #FFFFFF;
  --accent-soft:     #EFF3FD;
  --warn:            #B45309;
  --warn-soft:       #FEF3C7;
  --ok:              #166534;
  --ok-soft:         #DCFCE7;
  --shadow-sm:       0 1px 2px rgba(11,13,16,.05);
  --shadow-md:       0 2px 8px rgba(11,13,16,.06), 0 1px 2px rgba(11,13,16,.04);

  /* Tightened corner radii */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 20px;

  --font-sans: 'Manrope', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Consolas, monospace;
}
[lang="zh"] {
  --font-sans: 'Noto Sans SC', 'Manrope', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

[data-theme="dark"] {
  --bg:              #0B0D10;
  --bg-elev:         #111418;
  --bg-subtle:       #16191F;
  --border:          #23272E;
  --border-strong:   #2E333B;
  --text:            #F1F2F4;
  --text-muted:      #B4B7BE;
  --text-subtle:     #7F848C;
  --accent:          #60A5FA;
  --accent-hover:    #93C5FD;
  --accent-fg:       #0B0D10;
  --accent-soft:     rgba(96,165,250,.10);
  --warn:            #F59E0B;
  --warn-soft:       rgba(245,158,11,.14);
  --ok:              #4ADE80;
  --ok-soft:         rgba(74,222,128,.12);
  --shadow-sm:       0 1px 2px rgba(0,0,0,.4);
  --shadow-md:       0 2px 8px rgba(0,0,0,.5), 0 1px 2px rgba(0,0,0,.3);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.container {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}
@media (max-width: 640px) {
  .container { width: calc(100% - 24px); }
  body { font-size: 14px; }
}

.mono { font-family: var(--font-mono); font-size: 0.9em; }

.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; }
/* ============= Topbar ============= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 68px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}
.brand .logo { color: var(--accent); }
.brand-title {
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.01em;
}
.topbar-actions { display: inline-flex; align-items: center; gap: 8px; }

.pill {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  background: var(--bg-elev);
}

/* ============= Buttons ============= */
.btn, .ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover, .ghost-btn:hover {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}
.btn.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.btn.ghost { background: transparent; }
.ghost-btn.icon-only { width: 40px; padding: 0; justify-content: center; }
.lang-btn { font-family: var(--font-mono); font-size: 12px; font-weight: 500; min-width: 40px; padding: 0 10px; }
.btn:focus-visible, .ghost-btn:focus-visible,
.chip:focus-visible, .tab:focus-visible, .device-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ============= Controls ============= */
.main { padding: 32px 0 64px; }

.controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  height: 54px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search svg { color: var(--text-subtle); flex-shrink: 0; }
.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
}
.search input::placeholder { color: var(--text-subtle); }
.search kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-subtle);
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  background: var(--bg-subtle);
}
@media (max-width: 480px) { .search kbd { display: none; } }

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.tabs {
  display: inline-flex;
  padding: 3px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  gap: 2px;
  width: fit-content;
}
.tab {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 10px 14px;
  border: 0;
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] {
  background: var(--bg-elev);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  background: var(--bg-elev);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}
.chip:hover { color: var(--text); border-color: var(--border-strong); }
.chip.active {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}

/* ============= Device grid ============= */
.device-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}

/* ============= Device card (v2 — magazine style) ============= */
.device-card {
  --brand-color: #737373;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 0;
  padding: 0;
  min-height: 200px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: var(--text);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 200ms cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.device-card[data-brand="iQOO"] { --brand-color: #BD2338; }
.device-card[data-brand="vivo"] { --brand-color: #1E3A8A; }
[data-theme="dark"] .device-card[data-brand="iQOO"] { --brand-color: #F87171; }
[data-theme="dark"] .device-card[data-brand="vivo"] { --brand-color: #60A5FA; }

.device-card::after {
  /* diagonal ghost mark in background */
  content: "";
  position: absolute;
  inset: auto -30% -50% auto;
  width: 180px; height: 180px;
  border-radius: 50%;
  background: var(--brand-color);
  opacity: 0.06;
  z-index: 0;
  transition: opacity 220ms ease, transform 300ms cubic-bezier(0.22, 1, 0.36, 1);
}
.device-card:hover {
  border-color: var(--brand-color);
  box-shadow: 0 6px 20px -8px color-mix(in srgb, var(--brand-color) 30%, transparent),
              0 2px 6px rgba(11,13,16,.05);
  transform: translateY(-2px);
}
.device-card:hover::after { opacity: 0.12; transform: scale(1.15); }
.device-card:active { transform: translateY(-1px); }
.device-card > * { position: relative; z-index: 1; }

/* Top row: brand wordmark + release count */
.dc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 8px;
}
.dc-brand-row { display: inline-flex; align-items: center; gap: 8px; }
.dc-brand {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand-color);
}
.dc-region {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-subtle);
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 2px;
}
.dc-count {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
}
.dc-count-num {
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1;
}
.dc-count-lbl {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Device name — the anchor */
.dc-name-row {
  padding: 4px 18px 14px;
  border-bottom: 1px solid var(--border);
}
.dc-name-block { display: flex; flex-direction: column; gap: 3px; }
.dc-name {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text);
}
.dc-launch {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-subtle);
  letter-spacing: 0.02em;
}
.dc-chip { color: var(--brand-color); font-weight: 500; }

/* Filter counts */
.filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  margin-left: 6px;
  background: var(--bg-subtle);
  color: var(--text-subtle);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
}
.tab[aria-selected="true"] .filter-count { background: var(--accent-soft); color: var(--accent); }
.chip.active .filter-count {
  background: rgba(255,255,255,.2);
  color: var(--accent-fg);
}

/* Big latest version — the second anchor */
.dc-version {
  padding: 14px 18px 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dc-vlabel {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-subtle);
}
.dc-vnum {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Codes footer — subtle */
.dc-codes {
  padding: 8px 18px 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-subtle);
}
.dc-model { color: var(--text-muted); font-weight: 500; }
.dc-sep { color: var(--border-strong); }
.dc-codename { color: var(--text-subtle); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============= Badges ============= */
.badge {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 6px;
  border-radius: var(--r-xs);
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-sans);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.badge.region-in { background: var(--accent-soft); color: var(--accent); }
.badge.region-cn { background: var(--warn-soft); color: var(--warn); }
.badge.type-inc  { background: var(--ok-soft);   color: var(--ok); }
.badge.type-full { background: var(--warn-soft); color: var(--warn); }

/* ============= Detail view ============= */
.detail-header { margin-bottom: 12px; }
.back-btn { padding-left: 8px; }

.detail-summary {
  padding: 16px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.detail-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.detail-meta {
  font-size: 12px;
  color: var(--text-subtle);
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.detail-meta .dot { color: var(--border-strong); }
.detail-meta .mono { color: var(--text-muted); }

.controls-detail { margin-bottom: 16px; }
.release-order { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 20px; }
.release-order label { font-size: 13px; font-weight: 600; }
.release-order select { max-width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--bg-elev); color: var(--text); font: inherit; font-size: 13px; }
.release-order select:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.release-order p { flex-basis: 100%; margin: 0; font-size: 12px; color: var(--text-subtle); line-height: 1.6; }
.version-date { margin-top: 5px; font-size: 12px; color: var(--text-subtle); }
.controls-detail .search { height: 38px; }

.versions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.version-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 20px 22px 18px;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}
.version-card::before {
  content: "";
  position: absolute;
  left: 0; top: 20px; bottom: 20px;
  width: 3px;
  background: var(--accent);
  opacity: 0.45;
  border-radius: 2px;
}
.version-card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 4px 14px -6px rgba(11,13,16,.10);
}
.version-card > * { position: relative; z-index: 1; }

.version-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.version-head > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.version-head-right {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.version-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text-subtle);
  cursor: pointer;
  transition: color 140ms ease, border-color 140ms ease, background 140ms ease;
}
.version-link:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.version-link:active { transform: translateY(1px); }
.version-highlight {
  animation: vh-flash 2.2s ease-out;
}
@keyframes vh-flash {
  0%   { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 50%, transparent); }
  70%  { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.version-arrow {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-subtle);
  content: "Release";
  font-family: var(--font-sans);
  margin-bottom: 2px;
}
.version-string {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.015em;
  line-height: 1.15;
}
.version-pkg-count {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-subtle);
}

.pkgs { display: flex; flex-direction: column; gap: 8px; }

.pkg {
  padding: 12px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 150ms ease;
}
.pkg:hover { border-color: var(--border-strong); }
.pkg-main {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
}
.pkg-size {
  font-weight: 600;
  color: var(--text);
  min-width: 60px;
}
.pkg-from {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 2px 8px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  font-size: 10.5px;
}
.pkg-from-lbl {
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
}
.pkg-from-ver {
  color: var(--text-muted);
  font-size: 11px;
}
.pkg-filename {
  color: var(--text-subtle);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.pkg-sha {
  font-size: 11px;
  color: var(--text-subtle);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 3px 6px;
  margin: 0 -6px;
  border-radius: 3px;
  transition: background 150ms ease, color 150ms ease;
}
.pkg-sha:hover { background: var(--bg-subtle); color: var(--text-muted); }

/* Version jump-list */
.version-jump {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 12px 14px;
  margin-bottom: 16px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.vj-lbl {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-right: 4px;
}
.vj-chip {
  padding: 4px 10px;
  font-size: 11px;
  color: var(--text-muted);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg-subtle);
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease;
}
.vj-chip:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.pkg-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pkg-actions .btn { height: 28px; padding: 0 10px; font-size: 12px; }

/* ============= Changelog (collapsible) ============= */
.changelog {
  margin-top: 12px;
  border-top: 1px dashed var(--border);
  padding-top: 10px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-muted);
}
.cl-teaser {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-muted);
  padding: 10px 12px;
  margin-bottom: 8px;
  background: var(--accent-soft);
  border-left: 2px solid var(--accent);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
}
.cl-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}
.cl-toggle:hover { color: var(--text); background: var(--bg-subtle); border-color: var(--border-strong); }
.cl-chev { transition: transform 180ms ease; }
.changelog.expanded .cl-chev { transform: rotate(180deg); }
.cl-body { margin-top: 10px; }
.cl-intro {
  margin: 0 0 10px;
  padding: 8px 10px;
  background: var(--accent-soft);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: 12.5px;
  border-left: 2px solid var(--accent);
}
.cl-section { margin-bottom: 8px; }
.cl-section h4 {
  margin: 10px 0 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.cl-section ul {
  margin: 0 0 6px;
  padding-left: 18px;
}
.cl-section li { margin: 2px 0; }
.cl-sub {
  margin-left: 8px;
  padding-left: 8px;
  border-left: 2px solid var(--border);
}
.cl-sub h5 {
  margin: 6px 0 2px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
}

/* ============= Empty & loading ============= */
/* Skeleton loading */
.device-card.skeleton { cursor: default; pointer-events: none; }
.device-card.skeleton::after { display: none; }
.sk-line {
  display: inline-block;
  height: 16px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--bg-subtle) 0%, var(--border) 50%, var(--bg-subtle) 100%);
  background-size: 200% 100%;
  animation: sk-pulse 1.4s ease-in-out infinite;
}
@keyframes sk-pulse {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.empty, .loading {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-subtle);
  font-size: 13px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.empty p, .loading p { margin: 0; }

/* ============= Request CTA ============= */
.request-cta { margin-top: 48px; margin-bottom: 40px; }
.request-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  flex-wrap: wrap;
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, var(--accent-soft), var(--bg-elev));
  box-shadow: var(--shadow-md);
}
.request-copy { max-width: 620px; }
.request-copy h2 { margin: 6px 0 8px; font-size: clamp(22px, 3vw, 30px); line-height: 1.2; }
.request-text { margin: 0; color: var(--text-muted); font-size: 15px; }
.request-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 18px 28px;
  border-radius: var(--r-md);
  background: var(--accent);
  color: var(--accent-fg);
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: var(--shadow-md);
  transition: background 150ms ease, transform 150ms ease;
}
.request-btn:hover { background: var(--accent-hover); transform: translateY(-1px); }
.request-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.request-handle { font-family: var(--font-mono); font-size: 14px; font-weight: 500; opacity: .85; }
@media (max-width: 640px) {
  .request-card { padding: 24px; }
  .request-btn { width: 100%; justify-content: center; flex-wrap: wrap; }
}

.update-note {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--ok-soft);
  color: var(--ok);
  font-weight: 700;
  font-size: 12px;
}
.request-update {
  display: inline-block;
  margin: 0 0 10px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--ok-soft);
  color: var(--ok);
  font-weight: 700;
  font-size: 14px;
}

/* ============= Footer ============= */
.footer {
  border-top: 1px solid var(--border);
  padding: 20px 0;
  background: var(--bg-elev);
  margin-top: auto;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.footer-note {
  margin: 0;
  color: var(--text-subtle);
  font-size: 12px;
  max-width: 640px;
}
.footer-attr {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-subtle);
  font-size: 12px;
  flex-shrink: 0;
}
.attr-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  transition: border-color 150ms ease, background 150ms ease;
}
.attr-link:hover { background: var(--bg-subtle); border-color: var(--border-strong); }

/* ============= Toast ============= */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 8px 14px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  z-index: 100;
}

/* ============= Responsive ============= */
@media (max-width: 640px) {
  .topbar-inner { height: 56px; }
  .brand-title { font-size: 15px; }
  .ghost-btn-label { display: none; }
  .device-grid { grid-template-columns: 1fr; }
  .filter-row { flex-direction: column; align-items: stretch; }
  .tabs, .chips { width: 100%; justify-content: flex-start; }
  .detail-title { font-size: 17px; }
  .pkg-size { min-width: auto; }
  .version-head { flex-wrap: wrap; align-items: flex-start; }
  .version-head-right { margin-left: auto; }
  .version-link { width: 44px; height: 44px; }
  .controls-detail .search { height: 48px; }
}

/* ============= Reduced motion ============= */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ============= Homepage: device library ============= */
:root {
  --hero-bg: #111D32;
  --hero-text: #FFFFFF;
  --hero-muted: #B8C7DC;
  --hero-line: #34445D;
  --hero-highlight: #BFD1FF;
}
#view-list { padding-top: 32px; }
.library-intro {
  display: grid;
  grid-template-columns: minmax(0,1fr);
  align-items: center;
  gap: 56px;
  padding: 40px;
  border-radius: 24px;
  background: var(--hero-bg);
  color: var(--hero-text);
}
.intro-copy { min-width: 0; }
.eyebrow { margin: 0 0 12px; font-size: 11px; font-weight: 700; letter-spacing: .13em; }
.intro-copy > .eyebrow { color: var(--hero-highlight); }
.library-intro h1 { max-width: 490px; margin: 0; font-size: clamp(36px, 4.2vw, 54px); font-weight: 700; line-height: 1.08; letter-spacing: -.035em; text-wrap: balance; }
.intro-description { max-width: 490px; margin: 18px 0 24px; font-size: 15px; line-height: 1.7; color: var(--hero-muted); }
.hero-search { height: 58px; padding: 0 18px; border-radius: 12px; background: #FFF; border-color: #FFF; color: #111D32; }
.hero-search input { color: #111D32; font-size: 15px; }
.hero-search input::placeholder, .hero-search svg { color: #596579; }
.hero-search kbd { color: #596579; background: #F3F5F8; border-color: #D9DFE8; }
.hero-search:focus-within { border-color: #AFC4FF; box-shadow: 0 0 0 4px #607DBF; }
.quick-searches { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; margin-top: 10px; font-size: 12px; }
.quick-searches > span { color: var(--hero-muted); }
.quick-searches button { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0; font: inherit; border: 0; background: transparent; color: var(--hero-text); cursor: pointer; }
.quick-searches button:hover { color: var(--hero-highlight); text-decoration: underline; text-underline-offset: 4px; }
.quick-searches button:focus-visible { outline: 2px solid var(--hero-highlight); outline-offset: 4px; border-radius: 2px; }
.catalog-meta { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 24px; padding: 22px 4px; border-bottom: 1px solid var(--border); }
.catalog-totals { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px; font-size: 12px; color: var(--text-muted); }
.catalog-totals strong { font-size: 14px; font-weight: 700; color: var(--text); }
.direct-source { display: flex; align-items: center; gap: 8px; }
.direct-source::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.catalog-updated { margin: 0; min-height: 19px; font-size: 11px; color: var(--text-subtle); }
.library-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 32px 0 20px; scroll-margin-top: 90px; }
.library-heading .eyebrow { color: var(--text-subtle); font-size: 10px; margin-bottom: 6px; }
.library-heading h2 { margin: 0; font-size: 26px; letter-spacing: -.04em; line-height: 1.2; }
.library-heading > span { font-size: 12px; color: var(--text-muted); }
.library-heading:focus-visible { outline: 2px solid var(--accent); outline-offset: 6px; border-radius: 4px; }
#view-list .controls { margin-bottom: 22px; }
#view-list .tabs { background: transparent; border: 0; padding: 0; gap: 4px; }
#view-list .tab { min-height: 44px; border: 1px solid transparent; border-radius: 8px; padding: 8px 12px; }
#view-list .tab[aria-selected="true"] { background: var(--bg-elev); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
#view-list .chip { min-height: 44px; border-radius: 8px; }
#view-list .device-grid { gap: 16px; grid-template-columns: repeat(3, minmax(0,1fr)); }
#view-list .device-card { min-height: 210px; border-radius: 12px; }
#view-list .device-card::after { display: none; }
#view-list .device-card:hover { transform: none; border-color: var(--accent); box-shadow: var(--shadow-md); }
#view-list .dc-top { padding: 18px 20px 10px; }
#view-list .dc-brand { font-size: 10px; }
#view-list .dc-count { gap: 4px; color: var(--text-subtle); }
#view-list .dc-count-num { font-size: 12px; color: var(--text-muted); }
#view-list .dc-count-lbl { font-size: 10px; letter-spacing: 0; text-transform: none; }
#view-list .dc-name-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 0 20px 16px; border: 0; }
#view-list .dc-name { font-size: 22px; line-height: 1.25; }
.dc-open { display: grid; place-items: center; width: 32px; height: 32px; flex-shrink: 0; border: 1px solid var(--border); border-radius: 50%; color: var(--text-subtle); transition: color 180ms ease, background 180ms ease; }
.device-card:hover .dc-open { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
#view-list .dc-version { margin: 0 20px; padding: 12px 0 4px; border-top: 1px solid var(--border); }
#view-list .dc-vnum { font-size: 13px; }
#view-list .dc-codes { padding: 8px 20px 18px; min-width: 0; flex-wrap: wrap; gap: 4px 6px; }
#view-list .dc-chip { color: var(--text-subtle); }
@media (max-width: 1050px) {
  .library-intro { gap: 28px; padding: 30px; grid-template-columns: minmax(0,1fr); }
  #view-list .device-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 760px) {
  #view-list { padding-top: 20px; }
  .library-intro { grid-template-columns: minmax(0,1fr); gap: 24px; padding: 28px; border-radius: 18px; }
  .library-intro h1 { max-width: 420px; font-size: 42px; }
  .intro-description { max-width: 520px; }
  .catalog-meta { padding: 18px 4px; }
}
@media (max-width: 480px) {
  .library-intro { padding: 24px 20px; }
  .library-intro h1 { font-size: 38px; }
  .intro-description { font-size: 14px; margin: 16px 0 20px; }
  .hero-search { padding: 0 12px; height: 54px; }
  .hero-search input { font-size: 14px; }
  .quick-searches { gap: 2px 12px; font-size: 11px; }
  .quick-searches > span { display: none; }
  .catalog-totals { gap: 10px 16px; }
  .direct-source { width: 100%; }
  .library-heading { margin-top: 26px; }
  .library-heading h2 { font-size: 24px; }
  #view-list .device-grid { grid-template-columns: minmax(0,1fr); }
  .topbar-actions .pill { display: none; }
  .topbar-actions { gap: 5px; }
  .btn, .ghost-btn, .chip { min-height: 44px; }
  .ghost-btn.icon-only { width: 44px; }
}

.update-history { display: grid; gap: 0; margin: 18px 0 28px; padding-left: 12px; border-left: 2px solid var(--border-strong); }
.update-history .update-note { position: relative; margin: 0; padding: 6px 10px; line-height: 1.6; border-radius: 0; background: transparent; color: var(--text-muted); font-weight: 500; }
.update-history .update-note::before { content: ''; position: absolute; width: 6px; height: 6px; background: var(--border-strong); border-radius: 50%; left: -16px; top: 13px; }
.update-history .update-note:last-child { color: var(--ok); font-weight: 700; }
.update-history .update-note:last-child::before { background: var(--ok); }
.badge.region-global { background: var(--accent-soft); color: var(--accent); }

/* Compact discovery area and a reachable, structured contact section. */
.library-intro { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 44px; padding: 36px; }
.library-intro h1 { font-size: clamp(32px, 3.5vw, 46px); }
.intro-description { margin-bottom: 0; }
.intro-find { min-width: 0; }
.contact-link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 8px; color: var(--text-muted); font-size: 12px; font-weight: 600; text-decoration: none; }
.contact-link:hover { color: var(--accent); }
.contact-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
#view-list .device-card { min-height: 190px; }
#view-list .dc-name { font-size: 20px; }
.request-cta { scroll-margin-top: 88px; }
.request-card { padding: 36px; gap: 32px; border-top: 3px solid var(--accent); box-shadow: none; }
.request-copy { flex: 1 1 480px; max-width: 690px; }
.request-copy > .eyebrow { color: var(--accent); }
.request-text { font-size: 14px; line-height: 1.7; }
.request-steps { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 18px; list-style: none; padding: 0; margin: 24px 0 0; counter-reset: request; }
.request-steps li { counter-increment: request; min-width: 0; }
.request-steps li::before { content: '0' counter(request); display: block; margin-bottom: 8px; font: 11px var(--font-mono); color: var(--accent); }
.request-steps strong { display: block; font-size: 13px; margin-bottom: 4px; }
.request-steps span { display: block; font-size: 12px; line-height: 1.6; color: var(--text-muted); }
.request-btn { display: grid; grid-template-columns: 22px 1fr; gap: 6px 12px; padding: 18px 22px; font-size: 15px; }
.request-btn svg { grid-row: span 2; align-self: center; }
.request-handle { font-size: 12px; }
@media (max-width: 760px) {
  .library-intro { grid-template-columns: minmax(0,1fr); gap: 24px; padding: 28px; }
  .request-card { padding: 24px; }
}
@media (max-width: 480px) {
  .library-intro { padding: 24px 20px; }
  .contact-link { font-size: 11px; padding: 0 4px; }
  .request-steps { grid-template-columns: minmax(0,1fr); gap: 16px; }
  .request-steps li { display: grid; grid-template-columns: 28px 1fr; gap: 0 8px; }
  .request-steps li::before { grid-row: span 2; padding-top: 2px; }
  .request-btn { width: 100%; grid-template-columns: 22px auto; justify-content: center; }
}
