:root {
  color-scheme: dark;
  --bg: #0f1216;
  --panel: #181d24;
  --line: #2a323d;
  --text: #e6e9ee;
  --muted: #98a2b3;
  --accent: #3b82f6;
  --ok: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
h1 { font-size: 15px; margin: 0 auto 0 0; font-weight: 600; }
h2 { font-size: 16px; margin: 0 0 12px; }
.pill {
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.pill[data-tone="ok"] { color: var(--ok); border-color: var(--ok); }
.pill[data-tone="warn"] { color: var(--warn); border-color: var(--warn); }
.pill[data-tone="bad"] { color: var(--bad); border-color: var(--bad); }
main { padding: 16px; }
button {
  font: inherit;
  color: #fff;
  background: var(--accent);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
}
button.ghost, .buttons button { background: transparent; border-color: var(--line); color: var(--text); }
button:hover:not(:disabled) { filter: brightness(1.15); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button:focus-visible, input:focus-visible, canvas:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#login {
  max-width: 360px;
  margin: 10vh auto 0;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: grid;
  gap: 10px;
}
#login input {
  font: inherit;
  padding: 8px 10px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.error { color: var(--bad); margin: 0; min-height: 1.4em; }

#remote { display: flex; gap: 16px; justify-content: center; align-items: flex-start; flex-wrap: wrap; }
#stage {
  position: relative;
  height: calc(100vh - 90px);
  min-height: 360px;
  aspect-ratio: 9 / 16;
  background: #000;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
#screen { width: 100%; height: 100%; display: block; object-fit: contain; touch-action: none; cursor: pointer; }
#overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
  background: rgba(8, 10, 13, 0.82);
}
#overlay p { margin: 0; color: var(--muted); max-width: 26ch; }
aside { width: 220px; display: grid; gap: 12px; }
.buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; padding: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
dt { color: var(--muted); }
dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.hints { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12px; }
@media (max-width: 640px) {
  #stage { height: auto; width: 100%; }
  aside { width: 100%; }
}
