:root {
  --bg: #0f1115;
  --panel: #181b22;
  --line: #2a2f3a;
  --fg: #e6e8ee;
  --muted: #9aa3b2;
  --accent: #4c8dff;
  --danger: #ff5c66;
  --ok: #46d19e;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.45 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- auth / admin shared ---- */
body.center { display: grid; place-items: center; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px;
  width: min(92vw, 400px);
}
.wrap { width: min(94vw, 900px); margin: 24px auto; }
.wrap .card { width: auto; margin-bottom: 20px; }
h1 { margin: 0 0 18px; font-size: 22px; }
h2 { margin: 0 0 12px; font-size: 18px; }
label { display: block; margin: 0 0 14px; color: var(--muted); font-size: 13px; }
input, button, select { font: inherit; }
[hidden] { display: none !important; }
/* Style every text-like field the same, regardless of (or missing) type. */
input:not([type=checkbox]):not([type=radio]):not([type=file]):not([hidden]) {
  display: block; width: 100%; margin-top: 6px;
  background: #0d0f14; border: 1px solid var(--line); border-radius: 8px;
  color: var(--fg); padding: 10px 12px; -webkit-appearance: none; appearance: none;
}
input::placeholder { color: #5b6472; }
input:not([type=checkbox]):not([type=radio]):not([type=file]):not([hidden]):focus {
  outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent;
}
button {
  cursor: pointer; border: 0; border-radius: 8px;
  background: var(--accent); color: #fff; padding: 10px 16px; font-weight: 600;
}
button:hover { filter: brightness(1.08); }
button.link { background: none; color: var(--accent); padding: 6px 8px; font-weight: 500; }
button.link.danger { color: var(--danger); }
.inline { display: inline; }
.hint { color: var(--muted); font-size: 13px; margin: -6px 0 16px; }
.error { color: var(--danger); margin: 0 0 14px; }
.notice { color: var(--ok); margin: 0 0 14px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--panel);
}
.topbar .brand { font-weight: 700; }
.topbar nav { display: flex; align-items: center; gap: 16px; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row input { width: auto; flex: 1 1 180px; margin-top: 0; }
.chk { display: inline-flex; align-items: center; gap: 6px; margin: 0; color: var(--fg); white-space: nowrap; }
.chk input { width: auto; margin: 0; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { color: var(--muted); font-weight: 600; }
.actions { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.actions input { width: 140px; flex: none; margin: 0; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px;
        word-break: break-all; max-width: 520px; }

/* ---- remote browser ---- */
body.app { overflow: hidden; }
#app { display: flex; flex-direction: column; height: 100vh; }
.chrome {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.chrome button {
  background: #232833; color: var(--fg); font-weight: 600;
  padding: 6px 12px; min-width: 34px; white-space: nowrap; flex: none;
}
.chrome button:hover { background: #2c333f; }
#upload { display: inline-flex; align-items: center; gap: 4px; }
#navform { flex: 1; }
#addr {
  width: 100%; margin: 0;
  background: #0d0f14; border: 1px solid var(--line); border-radius: 999px;
  color: var(--fg); padding: 8px 16px;
}
.chrome .status { color: var(--muted); font-size: 12px; white-space: nowrap; }
.chrome-link { background: none; color: var(--muted); font-weight: 500; padding: 6px 8px; }
.chrome-link:hover { color: var(--fg); text-decoration: none; }

#stage { position: relative; flex: 1; background: #000; overflow: hidden; }
#screen {
  position: absolute; inset: 0; margin: auto;
  max-width: 100%; max-height: 100%; display: block;
  image-rendering: auto; background: #fff;
}
#screen:focus { outline: none; }
.overlay {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(10,12,16,.82); color: var(--fg); text-align: center; padding: 24px;
}
.overlay.hidden { display: none; }
#overlay-msg { max-width: 460px; font-size: 15px; line-height: 1.6; }
