:root {
  --bg: #101216;
  --panel: #1a1d24;
  --line: #2c313c;
  --text: #e8eaee;
  --muted: #8d95a3;
  --accent: #3b82f6;
  --bad: #f87171;
  --ok: #34d399;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}
[hidden] { display: none !important; }
main { height: 100%; display: flex; flex-direction: column; }
main.center { align-items: center; justify-content: center; padding: 16px; }
h1 { font-size: 20px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.pad { padding: 0 16px; }
.grow { flex: 1; }

.card {
  width: 100%;
  max-width: 360px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
input {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  min-width: 0;
}
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
button {
  font: inherit;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  white-space: nowrap;
  touch-action: manipulation;
}
button:active { background: var(--line); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.on { border-color: var(--accent); color: #fff; background: #1e3a6b; }
button:disabled { opacity: .5; }
.msg { min-height: 20px; margin: 0; color: var(--bad); font-size: 14px; }

.bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  padding-top: calc(8px + env(safe-area-inset-top));
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.list { padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.machine {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  text-align: left;
  font-size: 17px;
}
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.ok { background: var(--ok); }
.machine .sub { color: var(--muted); font-size: 13px; }

#stage {
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: #000;
  position: relative;
  -webkit-overflow-scrolling: touch;
}
#wrap { position: relative; width: 100%; line-height: 0; }
#screen {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
#cursor {
  position: absolute;
  width: 14px;
  height: 14px;
  margin: -2px 0 0 -2px;
  pointer-events: none;
  background: #fff;
  clip-path: polygon(0 0, 0 100%, 30% 72%, 52% 100%, 68% 92%, 48% 64%, 86% 64%);
  filter: drop-shadow(0 0 1px #000) drop-shadow(0 0 1px #000);
}
#stage-msg { position: absolute; left: 0; right: 0; top: 40%; text-align: center; padding: 0 16px; margin: 0; }
.row {
  display: flex;
  gap: 6px;
  padding: 6px 8px;
  background: var(--panel);
  border-top: 1px solid var(--line);
  align-items: center;
}
.row.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
footer.row { padding-bottom: calc(6px + env(safe-area-inset-bottom)); }
#textrow input { flex: 1; }
.sep { width: 1px; align-self: stretch; background: var(--line); flex: none; margin: 0 2px; }
