:root {
  color-scheme: dark;
  --bg: #0a0e10;
  --bg2: #11171a;
  --bg3: #182024;
  --fg: #d3e0e8;
  --fg2: #98a8b3;
  --muted: #566369;
  --line: #1d282d;
  --accent: #5ee0d5;
  --warn: #ffc857;
  --err: #ff7a8a;
  --ok: #7dd87a;
  --link: #8fb9ff;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--fg); height: 100%; }
body {
  font: 14px/1.4 ui-monospace, "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
  gap: 0;
  min-height: 100vh;
}

button, .btn-like {
  background: var(--bg3);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 6px 12px;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button:hover, .btn-like:hover { background: #213039; border-color: var(--accent); }
button.ghost { background: transparent; }
button.warn  { color: var(--err); }
button:focus-visible, .btn-like:focus-visible { outline: 1px solid var(--accent); }

input[type="number"], input[type="text"], select {
  background: var(--bg2);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 4px 6px;
  font: inherit;
}

dialog {
  background: var(--bg2);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1em 1.5em;
}
dialog::backdrop { background: rgba(0,0,0,.6); }

.bar { padding: 8px 16px; }
.topbar { background: var(--bg2); border-bottom: 1px solid var(--line); }
.footer-controls { background: var(--bg2); border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.footer-text { margin-left: auto; color: var(--fg2); font-size: 12px; }

.panel { border-bottom: 1px solid var(--line); }

.status { display: flex; flex-direction: column; gap: 2px; }
.status .row { padding: 1px 0; }
.status .title { color: var(--accent); font-weight: 600; letter-spacing: .04em; }
.status .state.ok   { color: var(--ok); }
.status .state.warn { color: var(--warn); }
.status .state.err  { color: var(--err); }
.status .muted { color: var(--muted); }

.live-panel { padding: 16px; background: var(--bg); min-height: 110px; display: grid; place-items: center; }
.live-panel .big   { font-size: 28px; font-weight: 600; letter-spacing: .02em; }
.live-panel .ok    { color: var(--ok); }
.live-panel .warn  { color: var(--warn); }
.live-panel .muted { color: var(--muted); }
.center { text-align: center; }

.history-panel { overflow: hidden; padding: 8px 16px; }
#history {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
#history th, #history td {
  text-align: right;
  padding: 4px 8px;
  border-bottom: 1px dotted var(--line);
}
#history th { color: var(--fg2); font-weight: 600; border-bottom: 1px solid var(--line); text-align: right; }
#history td:first-child, #history th:first-child { text-align: left; color: var(--muted); }
#history tbody tr:hover { background: var(--bg3); }
.scroll-row { display: flex; justify-content: flex-end; gap: 6px; padding-top: 4px; }

.log-panel { max-height: 180px; overflow: hidden; background: var(--bg2); }
.log { padding: 6px 16px; font-size: 12px; color: var(--fg2); height: 180px; overflow: auto; }
.log div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 720px) {
  body { font-size: 12px; }
  #history th:nth-child(n+6), #history td:nth-child(n+6) { display: none; }
  .footer-controls { gap: 4px; padding: 6px 8px; }
  .footer-controls button, .footer-controls .btn-like { padding: 4px 8px; }
}
