* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #0f1117; --surface: #1a1d27; --surface2: #242836;
  --border: #2e3347; --text: #e1e4ed; --muted: #8b8fa3;
  --primary: #5b8af5; --primary-hover: #4a79e4;
  --success: #34d399; --danger: #f87171; --warning: #fbbf24;
  --radius: 10px;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.6;
  max-width: 1000px; margin: 0 auto; padding: 20px;
}
header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid var(--border);
}
header h1 { font-size: 20px; font-weight: 600; }
.badge {
  padding: 4px 14px; border-radius: 20px; font-size: 13px; font-weight: 500;
}
.badge.on { background: rgba(52,211,153,.15); color: var(--success); }
.badge.off { background: rgba(139,143,163,.15); color: var(--muted); }
section {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 18px;
}
section h2 {
  font-size: 14px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .5px; margin-bottom: 14px;
}
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 10px; }
.row:last-child { margin-bottom: 0; }
button {
  padding: 8px 18px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface2); color: var(--text); font-size: 14px;
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
button:disabled { opacity: .4; cursor: not-allowed; }
button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
button.primary:hover:not(:disabled) { background: var(--primary-hover); }
button.danger { border-color: var(--danger); color: var(--danger); }
button.danger:hover:not(:disabled) { background: rgba(248,113,113,.1); }
button.mini { padding: 4px 12px; font-size: 13px; }
button.busy { position: relative; color: transparent !important; pointer-events: none; }
button.busy::after {
  content: ""; position: absolute; top: 50%; left: 50%;
  width: 16px; height: 16px; margin: -8px 0 0 -8px;
  border: 2px solid var(--muted); border-top-color: var(--primary);
  border-radius: 50%; animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
label { font-size: 14px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
select {
  padding: 6px 12px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); font-size: 14px;
}
.mono { font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace; font-size: 13px; }
.muted { color: var(--muted); font-size: 13px; }
.device-info { font-family: monospace; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.kv > div {
  background: var(--surface2); padding: 10px 14px; border-radius: 8px;
  display: flex; justify-content: space-between; align-items: center;
}
.kv b { font-weight: 500; color: var(--muted); font-size: 13px; }
.kv .bad { border: 1px solid var(--danger); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-weight: 500; padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 13px; }
td { padding: 10px; border-bottom: 1px solid var(--border); }
tr:hover td { background: rgba(91,138,245,.04); }
td .mini { margin-right: 4px; }
.progress-wrap { margin-top: 14px; }
.progress {
  height: 8px; background: var(--surface2); border-radius: 4px; overflow: hidden;
  margin-bottom: 6px;
}
.progress > div {
  height: 100%; background: linear-gradient(90deg, var(--primary), #818cf8);
  border-radius: 4px; transition: width .2s; width: 0;
}
.log {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px; max-height: 280px; overflow-y: auto;
  font-family: "SF Mono", "Fira Code", monospace; font-size: 13px; line-height: 1.8;
}
.log .line { color: var(--muted); }
.log .OK { color: var(--success); }
.log .ERR { color: var(--danger); }
.log .WARN { color: var(--warning); }
.log .EVENT { color: var(--primary); }
.local-item {
  display: flex; align-items: center; gap: 12px; padding: 8px 0;
  border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.local-item:last-child { border-bottom: none; }
.local-item a { color: var(--primary); text-decoration: none; }
.local-item a:hover { text-decoration: underline; }
.local-item audio { height: 34px; }
.hidden { display: none !important; }
.warn-banner {
  background: rgba(251,191,36,.1); border: 1px solid var(--warning);
  color: var(--warning); padding: 12px 16px; border-radius: 8px;
  margin-bottom: 18px; font-size: 14px;
}
