:root {
  --bg: #f6f7f9; --panel: #ffffff; --text: #1c2430; --muted: #627084;
  --line: #e1e5eb; --accent: #0b6bcb; --accent-ink: #ffffff;
  --warn: #b45309; --bad: #b42318; --good: #157f3d;
  --radius: 10px; --gutter: 16px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1419; --panel: #171e26; --text: #e6ebf2; --muted: #93a1b4;
    --line: #26303b; --accent: #5aa9ff; --accent-ink: #06182b;
    --warn: #f0b04a; --bad: #ff8a80; --good: #5fd08b;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1419; --panel: #171e26; --text: #e6ebf2; --muted: #93a1b4;
  --line: #26303b; --accent: #5aa9ff; --accent-ink: #06182b;
  --warn: #f0b04a; --bad: #ff8a80; --good: #5fd08b;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", "Noto Sans TC", "PingFang TC", sans-serif;
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px;
  padding: 8px var(--gutter); background: var(--panel); border-bottom: 1px solid var(--line);
}
.top h1 { font-size: 17px; margin: 0; }
.spacer { flex: 1; }
.icon-btn, select, input, button.btn {
  font: inherit; color: var(--text); background: var(--panel);
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px;
}
.icon-btn { cursor: pointer; min-width: 38px; min-height: 36px; }
button.btn { cursor: pointer; background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.layout { display: grid; grid-template-columns: 210px 1fr; min-height: calc(100vh - 53px); }
nav {
  border-right: 1px solid var(--line); background: var(--panel); padding: 8px;
  position: sticky; top: 53px; align-self: start; max-height: calc(100vh - 53px); overflow: auto;
}
nav h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 12px 8px 4px; }
nav a {
  display: block; padding: 7px 10px; border-radius: 8px; color: var(--text); text-decoration: none;
}
nav a:hover { background: var(--bg); }
nav a[aria-current="page"] { background: var(--accent); color: var(--accent-ink); }
main { padding: var(--gutter); min-width: 0; max-width: 1100px; }
.params { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 14px; }
.params[hidden] { display: none; }
.params label { display: grid; gap: 3px; font-size: 12px; color: var(--muted); }
#status { color: var(--muted); min-height: 1.5em; margin-bottom: 8px; }
#status.error { color: var(--bad); }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 14px; min-width: 0;
}
.card h3 { margin: 0 0 8px; font-size: 14px; color: var(--muted); font-weight: 600; }
.hero { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.hero .temp { font-size: 52px; font-weight: 600; line-height: 1; }
.hero img { width: 64px; height: 64px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: 13px; }
.chip.warn { color: var(--warn); border-color: var(--warn); }
.chip.bad { color: var(--bad); border-color: var(--bad); }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td.wrap { white-space: normal; min-width: 14em; }
th { color: var(--muted); font-weight: 600; font-size: 12px; position: sticky; top: 0; background: var(--panel); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }
.muted { color: var(--muted); }
p.text { margin: 4px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.player img { width: 100%; max-width: 640px; border-radius: var(--radius); background: var(--bg); display: block; }
.player .controls { display: flex; gap: 10px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.player input[type=range] { flex: 1; min-width: 140px; padding: 0; }
.photos { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.photos figure { margin: 0; }
.photos img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; background: var(--bg); }
.photos figcaption { font-size: 13px; margin-top: 4px; }
.bars { display: grid; gap: 4px; }
.bar { display: grid; grid-template-columns: 8em 1fr 4.5em; gap: 8px; align-items: center; font-size: 13px; }
.bar > i { display: block; height: 10px; border-radius: 5px; background: var(--accent); min-width: 2px; }
.bar > span:last-child { text-align: right; font-variant-numeric: tabular-nums; }
details { margin-top: 6px; }
summary { cursor: pointer; color: var(--muted); }
pre { overflow: auto; background: var(--bg); padding: 10px; border-radius: 8px; font-size: 12px; }
#menu { display: none; }
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  #menu { display: inline-block; }
  nav {
    position: fixed; inset: 53px 0 0 0; z-index: 4; max-height: none; display: none;
    border-right: 0;
  }
  nav.open { display: block; }
  .hero .temp { font-size: 44px; }
  .bar { grid-template-columns: 6em 1fr 4em; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
