:root {
  --bg: #0e0e10; --card: rgba(18,18,24,.72); --fg: #f4f4f6; --muted: #a6a6b2; --line: rgba(255,255,255,.1);
  --track: rgba(255,255,255,.14); --accent: #f4f4f6; --accent-fg: #14141a; --red: #ff4a3d; --sel: rgba(255,255,255,.14); --seg: rgba(255,255,255,.06);
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #0e0e10; --card: rgba(18,18,24,.72); --fg: #f4f4f6; --muted: #a6a6b2; --line: rgba(255,255,255,.1);
    --track: rgba(255,255,255,.14); --accent: #f4f4f6; --accent-fg: #14141a; --red: #ff4a3d; --sel: rgba(255,255,255,.14); --seg: rgba(255,255,255,.06);
    color-scheme: dark;
  }
}
[hidden] { display: none !important; }
:root[data-theme="dark"] {
    --bg: #0e0e10; --card: rgba(20,20,24,.72); --fg: #f2f2f4; --muted: #a5a5b0; --line: rgba(255,255,255,.1);
    --track: #26262c; --accent: #f2f2f4; --accent-fg: #0e0e10; --red: #ff4a3d; --sel: #3a3a42; --seg: rgba(255,255,255,.06);
    color-scheme: dark;
  }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: transparent; color: var(--fg);
  font-family: Montserrat, system-ui, -apple-system, "PingFang SC", "Noto Sans SC", sans-serif; }
/* 地狱猫车库图作底层背景，压渐变保证文字可读（挂在 html 上，不会被 body 底色盖住） */
html {
  background:
    linear-gradient(180deg, rgba(6,6,10,.6) 0%, rgba(6,6,10,.82) 100%),
    url('./assets/cover.webp') center / cover no-repeat, #0e0e10;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; }
.top { display: flex; justify-content: space-between; align-items: center; padding: 14px 24px; border-bottom: 1px solid rgba(255,255,255,.08); height: 56px; }
.brand { font-weight: 700; letter-spacing: .3em; font-size: 15px; display: flex; align-items: center; gap: 10px; }
.brand #status { letter-spacing: 0; font-weight: 500; color: var(--muted); font-size: 13px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; }
.dot.on { background: #22c55e; } .dot.warn { background: #f59e0b; }
#srcStatus { color: var(--muted); font-size: 13px; }

.layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(340px, 1fr); gap: 24px; padding: 20px 24px; height: calc(100% - 56px); }
.dash { display: flex; flex-direction: column; min-height: 0; }
#gauge { flex: 1; width: 100%; min-height: 0; touch-action: none;
  border-radius: 24px;
  background: radial-gradient(circle at 50% 45%, rgba(10,10,16,.55) 0%, rgba(10,10,16,.25) 55%, transparent 75%); }
.manual, .pedals { display: flex; gap: 12px; justify-content: center; align-items: center; padding-top: 12px; }
.hint { color: var(--muted); font-size: 13px; }
.gearbtn { width: 84px; height: 64px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); font-size: 30px; }
.pedal { flex: 1; height: 76px; border-radius: 16px; font-size: 18px; font-weight: 600; background: var(--card); border: 1px solid var(--line); user-select: none; touch-action: none; }
.pedal.gas.active, .pedal.brake.active { background: var(--accent); color: var(--accent-fg); }
.pedal.auto { flex: .8; font-size: 15px; color: var(--muted); }

.panel { overflow-y: auto; min-height: 0; padding-bottom: 12px; display: flex; flex-direction: column; gap: 14px; }
.packs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pack { text-align: left; padding: 10px 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); min-height: 64px; }
.pack b { display: block; font-size: 14px; font-weight: 600; }
.pack small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 3px; line-height: 1.3; }
.pack.sel { border-color: var(--fg); box-shadow: inset 0 0 0 1px var(--fg); }
.group-title { grid-column: 1 / -1; font-size: 12px; color: var(--muted); margin: 4px 2px 0; letter-spacing: .1em; }

.rows { display: flex; flex-direction: column; gap: 8px; }
.row { display: grid; grid-template-columns: 84px 1fr; align-items: center; gap: 10px; }
.row[hidden] { display: none; }
.row label { color: var(--muted); font-size: 13px; }
.seg { display: flex; background: var(--seg); border-radius: 10px; padding: 3px; }
.seg button { flex: 1; height: 38px; border-radius: 8px; background: transparent; font-size: 14px; color: var(--muted); }
.seg button.sel { background: var(--sel); color: var(--fg); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.12); }
select, input[type=text] { height: 42px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--fg); padding: 0 10px; font: inherit; font-size: 14px; width: 100%; }
input[type=range] { width: 100%; accent-color: var(--fg); height: 32px; }

.start { height: 58px; border-radius: 14px; background: var(--accent); color: var(--accent-fg); font-size: 17px; font-weight: 600; margin-top: 4px; box-shadow: 0 4px 20px rgba(0,0,0,.35); }
.start.on { background: var(--red); color: #fff; box-shadow: 0 4px 24px rgba(255,74,61,.4); }
.note { color: var(--muted); font-size: 12px; margin: 0; line-height: 1.5; }

@media (max-width: 820px) {
  html, body { overflow: auto; }
  .layout { grid-template-columns: 1fr; height: auto; padding: 16px; }
  #gauge { height: 360px; flex: none; }
  .packs { grid-template-columns: repeat(2, 1fr); }
}

.top-right { display: flex; align-items: center; gap: 14px; }
.iconbtn { height: 36px; padding: 0 14px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); font-size: 13px; }

.tune { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 10; padding: 24px; }
.tune-card { background: var(--card); color: var(--fg); border-radius: 18px; width: min(860px, 100%); max-height: 100%; display: flex; flex-direction: column; border: 1px solid var(--line); }
.tune-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.tune-head h2 { margin: 0; font-size: 17px; }
.ghost { height: 38px; padding: 0 14px; border-radius: 10px; background: var(--seg); font-size: 14px; margin-left: 8px; }
.ghost.x { width: 38px; padding: 0; font-size: 20px; }
.tune-body { overflow-y: auto; padding: 4px 20px 16px; }
.tune-foot { padding: 12px 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.tsec { padding: 14px 0; border-bottom: 1px solid var(--line); }
.tsec h3 { margin: 0 0 4px; font-size: 15px; }
.thelp { margin: 0 0 8px; color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.trow { display: grid; grid-template-columns: 1fr minmax(220px, 300px); gap: 16px; align-items: center; padding: 10px 0; }
.trow.wide { grid-template-columns: 1fr minmax(260px, 400px); }
.tlabel b { display: block; font-size: 14px; font-weight: 600; }
.tlabel small { display: block; color: var(--muted); font-size: 12px; line-height: 1.45; margin-top: 3px; }
.tctl { display: flex; align-items: center; gap: 10px; justify-content: flex-end; }
.tctl input[type=range] { flex: 1; }
.tval { min-width: 78px; text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; color: var(--muted); }
.ttoggle { width: 72px; height: 38px; border-radius: 10px; background: var(--seg); color: var(--muted); font-weight: 600; }
.ttoggle.on { background: var(--accent); color: var(--accent-fg); }
.tctl .seg { flex: 1; }
.tdiag { color: var(--muted); font-size: 11.5px; margin: 14px 0 0; }
@media (max-width: 820px) {
  .tune { padding: 0; }
  .tune-card { border-radius: 0; height: 100%; }
  .trow, .trow.wide { grid-template-columns: 1fr; gap: 8px; }
  .tctl { justify-content: stretch; }
}

/* 玻璃拟态：卡片轻微毛玻璃透出背景 */
.pack, .gearbtn, .pedal, .iconbtn, .tune-card { backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
