:root {
  --bg: #111318; --card: #1b1e25; --line: #2a2f39; --text: #e8eaf0; --muted: #8b93a3;
  --accent: #ffb547; --ok: #3ccf91; --bad: #ff5b5b;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.4 system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: rgba(17,19,24,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.title { font-weight: 700; font-size: 17px; }
.status { font-size: 13px; padding: 3px 10px; border-radius: 99px; background: #2a2f39; color: var(--muted); }
.status.on { background: rgba(60,207,145,.15); color: var(--ok); }
.status.busy { background: rgba(255,181,71,.15); color: var(--accent); }
main { max-width: 560px; margin: 0 auto; padding: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 12px; }
.card.warn { border-color: var(--bad); color: #ffc9c9; }
.row { display: flex; gap: 10px; margin: 8px 0; align-items: flex-end; }
.grow { flex: 1; }
.hidden { display: none !important; }
button {
  font: inherit; color: var(--text); background: #262a33; border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 12px; cursor: pointer; touch-action: manipulation;
}
button:active { transform: scale(.98); }
button:disabled { opacity: .45; }
button.primary { background: var(--accent); color: #1a1205; border-color: transparent; font-weight: 600; }
button.danger { color: var(--bad); }
button.power.on { color: var(--ok); }
button.power.off { color: var(--muted); }
label { display: block; font-size: 13px; color: var(--muted); }
label.check { display: flex; gap: 8px; align-items: center; margin: 10px 0; }
select, input[type=number] {
  width: 100%; margin-top: 4px; font: inherit; color: var(--text); background: #262a33;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px;
}
label.check input[type=number] { width: 80px; margin: 0; }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; overflow-x: auto; }
.tabs button { flex: 1; padding: 10px 6px; white-space: nowrap; }
.tabs button.active { background: var(--accent); color: #1a1205; border-color: transparent; font-weight: 600; }
.slider { display: grid; grid-template-columns: 44px 1fr 56px; align-items: center; gap: 10px; margin: 14px 0; }
.slider span { color: var(--muted); font-size: 13px; }
.slider output { text-align: right; font-variant-numeric: tabular-nums; }
.slider.big input { height: 44px; }
input[type=range] { width: 100%; height: 32px; accent-color: var(--accent); }
input[type=range].hue {
  -webkit-appearance: none; appearance: none; height: 14px; border-radius: 7px;
  background: linear-gradient(90deg, red, #ff0, lime, cyan, blue, #f0f, red);
}
input[type=range].hue::-webkit-slider-thumb {
  -webkit-appearance: none; width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 3px solid #0006;
}
.preview { height: 56px; border-radius: 12px; border: 1px solid var(--line); margin-bottom: 4px; transition: background .15s; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips button { padding: 7px 12px; font-size: 13px; }
.fxgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.fxgrid button { padding: 12px 4px; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fxgrid button.active { background: var(--accent); color: #1a1205; border-color: transparent; }
.hint { color: var(--muted); font-size: 12px; margin-top: 8px; }
summary { cursor: pointer; font-weight: 600; }
.node { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.node .name { flex: 1; }
.node small { color: var(--muted); display: block; }
.node button { padding: 7px 10px; font-size: 13px; }
pre#log {
  max-height: 320px; overflow: auto; white-space: pre-wrap; word-break: break-all; font-size: 11px;
  background: #0c0d11; border-radius: 8px; padding: 8px; color: #b9c0cf;
}
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: #000d; color: #fff; padding: 10px 16px; border-radius: 10px; max-width: 90vw; z-index: 20; font-size: 14px;
}
