/* 汐颜 ROM 中心 · 2026-10-21
   深色优先、切主题不闪、下拉搜索零网络往返（机型列表一次载入本地过滤）
   细节版：分层阴影 + 柔和描边 + 精修排版 + 焦点环 + 自定义滚动条 */

:root {
  --bg: #11161d;
  --bg-soft: #161c24;
  --panel: #1a212a;
  --panel-2: #202731;
  --panel-3: #272f3a;
  --line: #323b47;
  --line-soft: #29323d;
  --text: #eef1f4;
  --text-2: #c2c9d1;
  --muted: #8d99a7;
  --brand: #6d9bea;
  --brand-2: #6d9bea;
  --brand-soft: rgba(109, 155, 234, .13);
  --ok: #55bd8b;
  --warn: #d8aa5b;
  --danger: #e07877;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .16);
  --shadow: 0 8px 24px -20px rgba(0, 0, 0, .55);
  --shadow-lg: 0 18px 44px -32px rgba(0, 0, 0, .65);
  --ring: 0 0 0 3px rgba(109, 155, 234, .2);
  --grad: linear-gradient(0deg, var(--brand), var(--brand));
}

html[data-theme="light"] {
  --bg: #f5f6f7;
  --bg-soft: #ffffff;
  --panel: #ffffff;
  --panel-2: #fafafa;
  --panel-3: #f1f3f4;
  --line: #dfe3e7;
  --line-soft: #e9ecee;
  --text: #1e252d;
  --text-2: #46515d;
  --muted: #727d88;
  --brand: #2f64c7;
  --brand-2: #2f64c7;
  --brand-soft: rgba(47, 100, 199, .08);
  --shadow-sm: 0 1px 2px rgba(25, 35, 45, .04);
  --shadow: 0 8px 24px -22px rgba(25, 35, 45, .35);
  --shadow-lg: 0 18px 48px -38px rgba(25, 35, 45, .4);
  --ring: 0 0 0 3px rgba(47, 100, 199, .13);
  --grad: linear-gradient(0deg, var(--brand), var(--brand));
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 14.5px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  transition: background-color .2s ease, color .2s ease;
}

::selection { background: rgba(79, 140, 255, .3); }

/* 自定义滚动条 */
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: padding-box; }

.wrap { width: min(1080px, 100% - 36px); margin: 0 auto; }

/* ── 顶栏 ── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 64px; }

.brandmark {
  display: flex; align-items: center; gap: 9px;
  text-decoration: none; color: inherit;
}
.brandmark .dot {
  width: 9px; height: 9px; border-radius: 2px; flex: none;
  background: var(--brand);
}
.brandmark h1 {
  font-size: 16px; font-weight: 650; margin: 0;
  letter-spacing: 0;
}
.brandmark b { color: var(--brand); }

.topbar-actions { display: flex; align-items: center; gap: 10px; }

.status {
  font-size: 12px; color: var(--muted);
  display: inline-flex; align-items: center; gap: 6px;
}
.status::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--muted); flex: none;
}
.status.ok { color: var(--ok); }
.status.ok::before { background: var(--ok); }
.status.bad { color: var(--warn); }
.status.bad::before { background: var(--warn); }

.theme-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 11px; border-radius: 7px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel);
  color: var(--text-2); font-size: 12.5px; font-family: inherit;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease;
}
.theme-btn:hover { border-color: var(--brand); color: var(--text); }
.theme-btn:active { transform: none; }
.theme-btn:focus-visible { outline: none; box-shadow: var(--ring); }
.ico-moon { opacity: .85; }

/* ── 品牌切换 ── */
.pills { display: flex; gap: 6px; flex-wrap: wrap; padding: 22px 0 4px; }
.pill {
  padding: 7px 12px; border-radius: 7px; cursor: pointer;
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  font-size: 12.5px; font-family: inherit; letter-spacing: 0;
  transition: color .16s ease, border-color .16s ease, background-color .16s ease;
}
.pill:hover { color: var(--text); border-color: var(--line); background: var(--panel); transform: none; }
.pill:active { transform: none; }
.pill:focus-visible { outline: none; box-shadow: var(--ring); }
.pill.active {
  color: #fff; border-color: var(--brand);
  background: var(--brand);
  box-shadow: none;
}

/* ── 面板 ── */
.panel {
  margin: 16px 0; padding: 20px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: none;
}
.panel-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; margin-bottom: 16px;
}
.panel-title h2 { font-size: 17px; margin: 0; font-weight: 650; letter-spacing: .2px; }
.sub { margin: 5px 0 0; color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.count {
  flex: none; color: var(--muted); font-size: 11.5px;
  padding: 3px 8px; border-radius: 5px;
  background: var(--panel-2); border: 1px solid var(--line-soft);
  white-space: nowrap;
}

/* ── 搜索框 ── */
.searchbox {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel-2);
  transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}
.searchbox:focus-within { border-color: var(--brand); box-shadow: var(--ring); background: var(--panel); }
.searchbox svg { color: var(--muted); flex: none; transition: color .18s ease; }
.searchbox:focus-within svg { color: var(--brand); }
.searchbox input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  color: var(--text); font-size: 14.5px; font-family: inherit;
}
.searchbox input::placeholder { color: var(--muted); opacity: .85; }
.searchbox .clear {
  border: 0; background: var(--panel-3); color: var(--muted);
  width: 22px; height: 22px; border-radius: 5px; flex: none;
  font-size: 16px; line-height: 1; cursor: pointer; padding: 0;
  display: grid; place-items: center;
  transition: background-color .16s ease, color .16s ease;
}
.searchbox .clear:hover { background: var(--line); color: var(--text); }

/* ── 系列 chips ── */
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 13px 0 2px; }
.chips:empty { display: none; }
.chip {
  padding: 5px 10px; border-radius: 6px; cursor: pointer; font-size: 12px;
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  font-family: inherit;
  transition: color .16s ease, border-color .16s ease, background-color .16s ease;
}
.chip:hover { color: var(--text); border-color: var(--brand); }
.chip:focus-visible { outline: none; box-shadow: var(--ring); }
.chip.active {
  border-style: solid; border-color: var(--brand);
  color: var(--brand); background: var(--brand-soft); font-weight: 550;
}
.chip .muted { opacity: .7; margin-left: 2px; }

/* ── 机型网格 ── */
.model-grid {
  display: grid; gap: 11px; margin-top: 14px;
  grid-template-columns: repeat(auto-fill, minmax(218px, 1fr));
}
.model {
  position: relative;
  text-align: left; cursor: pointer; padding: 13px 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); font-family: inherit;
  overflow: hidden;
  transition: border-color .16s ease, background-color .16s ease;
}
.model:hover {
  border-color: color-mix(in srgb, var(--brand) 55%, var(--line));
  transform: none;
  background: var(--panel);
}
.model:active { transform: none; }
.model:focus-visible { outline: none; box-shadow: var(--ring); }
.model .name {
  font-size: 14px; font-weight: 600; display: block; line-height: 1.45;
  letter-spacing: .1px;
}
.model .meta { display: block; margin-top: 5px; color: var(--muted); font-size: 11.5px; line-height: 1.5; }
.model .model-code {
  display: inline-block; margin-top: 9px; padding: 2px 9px; border-radius: 6px;
  font: 11.5px/1.7 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--brand-soft); color: var(--brand);
  letter-spacing: .2px;
}
.model.no-rom { opacity: .52; }
.model.no-rom:hover { transform: none; box-shadow: var(--shadow-sm); }

/* 分类组头 */
.group-head {
  grid-column: 1 / -1;
  display: flex; align-items: center; justify-content: space-between;
  margin: 18px 2px 2px; padding-bottom: 8px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
}
.group-head:first-child { margin-top: 2px; }
.group-head span:first-child { font-weight: 600; color: var(--text); letter-spacing: .2px; }
.group-n {
  font-size: 11px; padding: 2px 7px; border-radius: 5px;
  background: var(--panel-2); border: 1px solid var(--line-soft); color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* 骨架屏 */
.skel {
  height: 76px; border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--panel-2) 25%, var(--panel-3) 37%, var(--panel-2) 63%);
  background-size: 400% 100%; animation: shimmer 1.3s ease infinite;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* ── 版本列表 ── */
.version-list { display: flex; flex-direction: column; gap: 11px; margin-top: 8px; }
.ver {
  padding: 14px 15px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--panel-2);
  transition: border-color .16s ease, background-color .16s ease;
}
.ver:hover { border-color: color-mix(in srgb, var(--brand) 32%, var(--line)); background: var(--panel); }
.ver-top { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.ver-main { flex: 1 1 260px; min-width: 0; }
.ver-title {
  font-size: 15px; font-weight: 640; word-break: break-all;
  letter-spacing: .15px; line-height: 1.5;
}
.ver-meta {
  margin-top: 7px; color: var(--muted); font-size: 12px;
  display: flex; gap: 8px 14px; flex-wrap: wrap; align-items: center;
}
.ver-meta .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-all; font-size: 11px;
}
.ver-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ver-reason { font-size: 12px; }

/* 版本标签 */
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.tag {
  padding: 2px 7px; border-radius: 5px; font-size: 11px;
  background: var(--brand-soft); color: var(--brand);
  border: 1px solid transparent;
}
.tag.full { background: rgba(53, 208, 127, .13); color: var(--ok); }
.tag.chan { background: rgba(124, 92, 255, .15); color: var(--brand-2); }
.tag.warn { background: rgba(255, 176, 32, .14); color: var(--warn); }

/* ── OTA 更新说明 ── */
.log-wrap {
  margin-top: 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-soft); background: var(--panel);
  overflow: hidden;
}
.log-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 8px 13px;
  background: var(--panel-3); border-bottom: 1px solid var(--line-soft);
}
.log-title {
  font-size: 11px; font-weight: 650; letter-spacing: .03em;
  color: var(--brand);
  display: inline-flex; align-items: center; gap: 6px;
}
.log-title::before {
  content: ''; width: 4px; height: 4px; border-radius: 50%;
  background: var(--brand);
}
.log-tools { display: flex; gap: 6px; align-items: center; }
.log-tag {
  font-size: 10.5px; color: var(--muted);
  padding: 2px 7px; border-radius: 5px;
  background: var(--panel-2); border: 1px solid var(--line-soft);
  white-space: nowrap;
}
.log-tag.on { color: var(--brand); border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); background: var(--brand-soft); }
.log-toggle {
  padding: 3px 9px; border-radius: 5px; cursor: pointer;
  font-size: 11px; font-family: inherit; font-weight: 550;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text-2);
  transition: color .16s ease, border-color .16s ease, background-color .16s ease;
}
.log-toggle:hover { color: var(--brand); border-color: var(--brand); }
.log-toggle:focus-visible { outline: none; box-shadow: var(--ring); }
.log-box {
  padding: 13px 15px;
  color: var(--text-2); font-size: 13px; line-height: 1.85;
  white-space: pre-wrap; word-break: break-word;
  max-height: 260px; overflow: auto;
}
.log-box.loading {
  color: var(--muted); display: flex; align-items: center; gap: 9px;
  white-space: normal;
}

/* ── 按钮 ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 13px; border-radius: 7px; cursor: pointer; font-size: 13px;
  border: 1px solid var(--brand); color: #fff;
  background: var(--brand);
  font-family: inherit; font-weight: 600; letter-spacing: 0;
  text-decoration: none;
  box-shadow: none;
  transition: background-color .16s ease, border-color .16s ease, opacity .16s ease;
}
.btn:hover { background: color-mix(in srgb, var(--brand) 88%, #000); border-color: color-mix(in srgb, var(--brand) 88%, #000); }
.btn:active { transform: none; }
.btn:focus-visible { outline: 2px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; box-shadow: none; }
.btn:focus:not(:focus-visible) { outline: none; box-shadow: none; }
.btn.ghost {
  background: var(--panel-2); color: var(--text-2);
  border-color: var(--line); box-shadow: none;
}
.btn.ghost:hover { color: var(--text); border-color: var(--brand); background: var(--panel); }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; pointer-events: none; }

/* ── 实时查询（折叠） ── */
.query {
  margin-top: 18px; padding: 16px 18px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel);
}
.query > summary {
  cursor: pointer; font-size: 13.5px; font-weight: 600;
  color: var(--text); list-style: none; user-select: none;
}
.query > summary::-webkit-details-marker { display: none; }
.query > summary::before {
  content: '▸'; display: inline-block; margin-right: 8px;
  color: var(--brand); transition: transform .18s ease;
}
.query[open] > summary::before { transform: rotate(90deg); }
.query > *:not(summary) { margin-top: 11px; }
.grid2 {
  display: grid; gap: 11px; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
}
.grid2 label { display: block; font-size: 12px; color: var(--muted); }
.grid2 input, .grid2 select {
  display: block; width: 100%; margin-top: 5px; padding: 9px 11px;
  border-radius: 7px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); font-size: 13px; font-family: inherit;
  outline: none;
  transition: border-color .16s ease, box-shadow .16s ease;
}
.grid2 input:focus, .grid2 select:focus { border-color: var(--brand); box-shadow: var(--ring); }
.grid2 input[readonly] { color: var(--muted); background: var(--panel-3); }
.grid2 .span2 { grid-column: 1 / -1; }

/* ── 空态 ── */
.empty { padding: 38px 0 30px; text-align: center; }
.empty svg { color: var(--line); margin-bottom: 10px; }
.empty p { margin: 5px 0; }
.empty-title { font-size: 14.5px; font-weight: 600; color: var(--text-2); }
.muted { color: var(--muted); font-size: 12.5px; }
.more { display: flex; justify-content: center; margin-top: 16px; }

/* ── 页脚 ── */
.foot {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 14px; flex-wrap: wrap;
  padding: 26px 2px 44px; color: var(--muted); font-size: 12px;
  border-top: 1px solid var(--line-soft);
  margin-top: 26px;
}
.foot-main { display: flex; flex-direction: column; gap: 6px; }
.foot-brand { font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.foot-brand b { color: var(--brand); }
.foot-api .visits { color: var(--muted); }
.foot-api .visits b { color: var(--text-2); font-weight: 600; }
.foot-api a { color: var(--muted); text-decoration: none; }
.foot-api a:hover { color: var(--text); }
.foot-api {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  font-size: 11.5px;
}
.foot-api a {
  color: var(--muted); text-decoration: none;
  padding: 3px 7px; border-radius: 5px;
  border: 1px solid var(--line-soft);
  transition: color .16s ease, border-color .16s ease, background-color .16s ease;
}
.foot-api a:hover { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }
.foot-api .sep { opacity: .5; }

/* ── 提示条 ── */
.msg {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted);
}
.msg.ok { color: var(--ok); border-color: rgba(53, 208, 127, .3); background: rgba(53, 208, 127, .1); }
.msg.warn { color: var(--warn); border-color: rgba(255, 176, 32, .3); background: rgba(255, 176, 32, .1); }
.msg.err { color: var(--danger); border-color: rgba(255, 107, 107, .3); background: rgba(255, 107, 107, .1); }

.spinner {
  width: 15px; height: 15px; flex: none; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--brand);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── toast ── */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  padding: 10px 15px; border-radius: 7px; font-size: 12.5px;
  background: color-mix(in srgb, var(--panel) 96%, #000);
  color: var(--text); border: 1px solid var(--line);
  box-shadow: var(--shadow); z-index: 50;
  animation: toastIn .18s ease;
}
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 10px) scale(.97); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

.notice-mask {
  position: fixed; inset: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center;
  padding: 22px; background: rgba(10, 16, 28, .5); backdrop-filter: blur(10px);
  animation: noticeFade .2s ease;
}
.notice-card {
  flex: 0 1 440px; width: auto; max-width: 100%; max-height: calc(100dvh - 44px); overflow: auto;
  padding: 24px 22px 18px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--line);
  box-shadow: var(--shadow-lg); animation: noticeRise .2s cubic-bezier(.2, 0, 0, 1);
}
.notice-kicker {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .12em; color: var(--brand);
}
.notice-kicker::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft);
}
.notice-card h2 { margin: 12px 0 8px; font-size: 22px; line-height: 1.3; color: var(--text); }
.notice-lead { margin: 0 0 14px; font-size: 14px; line-height: 1.75; color: var(--text-2); }
.notice-list { margin: 0 0 20px; padding: 0; list-style: none; display: grid; gap: 9px; }
.notice-list li { position: relative; padding-left: 17px; font-size: 13.5px; line-height: 1.7; color: var(--muted); }
.notice-list li::before {
  content: ""; position: absolute; left: 0; top: .62em;
  width: 6px; height: 6px; border-radius: 2px; background: var(--brand); opacity: .8;
}
.notice-ok { width: 100%; height: 42px; justify-content: center; font-size: 14px; border-radius: 7px; }
.notice-foot { margin: 12px 0 0; text-align: center; font-size: 11.5px; color: var(--muted); opacity: .8; }
@keyframes noticeFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes noticeRise {
  from { opacity: 0; transform: translateY(14px) scale(.97); }
  to { opacity: 1; transform: none; }
}

[hidden] { display: none !important; }

@media (max-width: 700px) {
  .topbar-inner { height: auto; padding: 11px 0; flex-wrap: wrap; gap: 10px; }
  .topbar-actions { flex-wrap: wrap; justify-content: flex-end; }
  .panel { padding: 17px; }
  .panel-head { flex-direction: column; align-items: flex-start; gap: 10px; }
}
@media (max-width: 560px) {
  .wrap { width: calc(100% - 24px); }
  .model-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .model { padding: 12px; }
  .model .name { font-size: 13px; }
  .ver-top { flex-direction: column; align-items: stretch; }
  .ver-actions { width: 100%; }
  .ver-actions .btn { flex: 1; }
  .foot { flex-direction: column; align-items: flex-start; }
  .pills { gap: 7px; padding: 16px 0 4px; }
  .pill { padding: 8px 13px; font-size: 12.5px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
