:root {
  --bg: #0f1117;
  --card: #171a24;
  --border: rgba(255,255,255,0.09);
  --text: #eef0f6;
  --muted: #9aa0b4;
  --accent: #ffd166;
  --ok: #4ade80;
  --warn: #facc15;
  --bad: #f87171;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
}
.wrap { max-width: 1100px; margin: 0 auto; padding: 24px 16px 60px; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 10px; }
h3 { font-size: 14px; margin: 14px 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.hint { color: var(--muted); }
.muted { color: var(--muted); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; margin: 16px 0; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
}
.cards .card { margin-bottom: 0; }
label { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; color: var(--muted); font-size: 13px; }
select, input[type=number], input[type=text] {
  background: #0c0e15; color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 10px; font: inherit; font-size: 14px;
}
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 10px 0; }
button {
  background: var(--accent); color: #2b1d0e;
  border: 0; border-radius: 9px; padding: 8px 14px;
  font: inherit; font-weight: 600; cursor: pointer;
}
button.secondary { background: rgba(255,255,255,0.1); color: var(--text); }
button.danger { background: var(--bad); color: #fff; }
button.small { padding: 4px 9px; font-size: 12px; }
button:disabled { opacity: 0.4; cursor: default; }
a.btn {
  display: inline-block;
  background: var(--accent); color: #2b1d0e;
  border-radius: 9px; padding: 8px 14px;
  font-weight: 600; text-decoration: none; line-height: 1.2;
}
a.btn.secondary { background: rgba(255,255,255,0.1); color: var(--text); }
a.btn:hover, button:not(:disabled):hover { filter: brightness(1.08); }

/* ---------- Toasts ---------- */
.toasts {
  position: fixed; right: 16px; bottom: 16px;
  display: flex; flex-direction: column; gap: 8px;
  width: min(380px, calc(100vw - 32px));
  z-index: 1000;
}
.toast {
  background: #1f2330; color: var(--text);
  border: 1px solid var(--border); border-left: 4px solid var(--muted);
  border-radius: 10px; padding: 10px 12px;
  font-size: 14px; line-height: 1.4;
  box-shadow: 0 10px 30px rgba(0,0,0,0.45);
  animation: toast-in 0.18s ease-out;
  cursor: default;
}
.toast.success { border-left-color: var(--ok); }
.toast.warn { border-left-color: var(--warn); }
.toast.error { border-left-color: var(--bad); }
.toast.info { border-left-color: #7dd3fc; }
.toast .actions { display: flex; gap: 8px; margin-top: 8px; justify-content: flex-end; }
.toast.out { opacity: 0; transform: translateY(6px); transition: all 0.18s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
video { width: 100%; aspect-ratio: 16/9; background: #05060a; border-radius: 10px; margin-top: 10px; }
video.pixel { image-rendering: pixelated; }
.status { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--bad); display: inline-block; }
.dot.on { background: var(--ok); }
.dot.wait { background: var(--warn); }
.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: 6px 0; border-bottom: 1px solid var(--border); }
.state.connected { color: var(--ok); }
.state.failed, .state.disconnected { color: var(--bad); }
.log {
  background: #0c0e15; border-radius: 10px; padding: 10px;
  font-size: 12px; max-height: 240px; overflow: auto; white-space: pre-wrap; margin: 0;
}
code { background: rgba(255,255,255,0.08); padding: 1px 5px; border-radius: 4px; font-size: 13px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; }
td img { width: 36px; height: 36px; object-fit: contain; image-rendering: pixelated; vertical-align: middle; }
tr.dead td { color: var(--muted); }
tr.ignored td { opacity: 0.5; text-decoration: line-through; }
.pill { padding: 1px 8px; border-radius: 999px; font-size: 12px; background: rgba(255,255,255,0.1); }
.pill.ok { background: rgba(74,222,128,0.2); color: #bbf7d0; }
.pill.bad { background: rgba(248,113,113,0.25); color: #fecaca; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }
.links a { display: block; padding: 10px 0; border-bottom: 1px solid var(--border); color: var(--accent); text-decoration: none; }
input.order { width: 60px; }
.rules { display: flex; flex-direction: column; gap: 18px; }
.rule-section h3 { margin: 0 0 6px; color: var(--text); text-transform: none; letter-spacing: 0; font-size: 16px; font-weight: 700; }
.rule-intro { margin: 0 0 8px; color: var(--muted); font-size: 14px; }
.rules ol { margin: 0; padding-left: 26px; display: flex; flex-direction: column; gap: 10px; }
.rules ol > li { padding-left: 4px; line-height: 1.5; }
.rules ol > li::marker { color: var(--accent); font-weight: 700; }
.rule-text { font-size: 15px; }
.rule-items { margin: 6px 0 0; padding-left: 18px; color: var(--text); font-size: 14px; }
.rule-items li { margin: 2px 0; }
.rule-auto { margin-top: 4px; font-size: 12px; padding-left: 10px; border-left: 2px solid var(--border); color: var(--muted); }
.rule-auto.auto { border-left-color: var(--ok); }
.small { font-size: 12px; }
details summary { cursor: pointer; margin: 6px 0; }
.toast.violation { border-left-color: var(--bad); background: #2a1215; }
.toast.violation .msg b { display: block; color: var(--bad); font-size: 16px; margin-bottom: 2px; }
.toast.violation .msg b { color: var(--bad); font-size: 16px; }
