:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --line: #e3e6ea;
  --text: #1c1f23;
  --muted: #6b7280;
  --accent: #185fa5;
  --accent-weak: #e6f1fb;
  --ok: #0f6e56;
  --warn: #854f0b;
  --err: #a32d2d;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
}

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12px; }
.spacer { flex: 1; }

.bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  height: 52px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 500; font-size: 15px; }
.tag {
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 8px;
}

main { max-width: 1120px; margin: 0 auto; padding: 28px 20px 60px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}

.login { max-width: 340px; margin: 60px auto; }
.login h1 { font-size: 16px; font-weight: 500; margin: 0 0 18px; }
.login label { display: block; margin-bottom: 14px; font-size: 13px; color: var(--muted); }
.login input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  color: var(--text);
  background: #fff;
}
.login input:focus { outline: 2px solid var(--accent-weak); border-color: var(--accent); }
.login .btn { width: 100%; }

.btn {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn:hover { border-color: #c9ced5; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #124a80; }
.btn.ghost { background: transparent; }

.err { color: var(--err); font-size: 13px; min-height: 20px; margin: 10px 0 0; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.device {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: border-color .15s, box-shadow .15s;
}
.device:hover { border-color: #b9c2cc; box-shadow: 0 2px 10px rgba(20, 30, 45, .06); }

.thumb {
  aspect-ratio: 16 / 10;
  background: #14171b;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.thumb .ph { color: #7c848f; font-size: 12px; }

.device .meta { padding: 12px 14px; display: flex; align-items: center; gap: 8px; }
.device .meta .name { font-weight: 500; }
.device .meta .sub { color: var(--muted); font-size: 12px; margin-left: auto; }

.pill {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.pill.on { background: #e1f5ee; color: var(--ok); }
.pill.off { background: #f1f2f4; color: var(--muted); }
.pill.wait { background: #faeeda; color: var(--warn); }

/* ---- 观看页 ---- */
body.viewer { height: 100vh; display: flex; flex-direction: column; overflow: hidden; background: #0f1114; }

.vbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  height: 48px;
  background: #16191d;
  border-bottom: 1px solid #23272d;
  color: #e6e8ea;
  flex: 0 0 auto;
}
.vbar .btn { background: transparent; border-color: #2c3138; color: #c9ced5; }
.vbar .btn:hover { border-color: #444b54; }
.vbar .muted { color: #8d949c; }

.stage {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.stage canvas { max-width: 100%; max-height: 100%; display: block; }
.stage.actual { overflow: auto; align-items: flex-start; justify-content: flex-start; }
.stage.actual canvas { max-width: none; max-height: none; }

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8d949c;
  font-size: 13px;
  background: rgba(15, 17, 20, .55);
  pointer-events: none;
}
