:root {
  color-scheme: dark;
  --bg: #12140f;
  --bg-raise: #1b1e16;
  --line: #32362a;
  --ink: #f3ecda;
  --muted: #a39b84;
  --amber: #e2a122;
  --amber-ink: #2a2108;
  --ok: #8fbf6a;
  --bad: #d4654a;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  font-family: "Segoe UI", "Avenir Next", "Trebuchet MS", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(226, 161, 34, 0.08), transparent 50%),
    var(--bg);
  color: var(--ink);
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button, .linkish {
  cursor: pointer;
}

a { color: var(--amber); }

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card, .panel, .topbar, .device, .table-wrap {
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.login-card {
  width: min(420px, 100%);
  padding: 32px;
  box-shadow: var(--shadow);
}

.mark {
  font-family: Palatino, "Iowan Old Style", Georgia, serif;
  font-size: 32px;
  letter-spacing: -0.04em;
  margin: 0;
}

.mark span { color: var(--amber); }

.lede {
  color: var(--muted);
  margin: 8px 0 24px;
  line-height: 1.45;
}

label {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
}

input, select, textarea {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #12140f;
}

textarea {
  min-height: 120px;
  resize: vertical;
  font-family: "Cascadia Code", "Source Code Pro", ui-monospace, monospace;
  font-size: 13px;
}

button.primary, button.ghost, button.danger {
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
}

button.primary { background: var(--amber); color: var(--amber-ink); font-weight: 650; }
button.ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }
button.danger { background: transparent; color: var(--bad); border: 1px solid var(--bad); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 14px 18px;
  margin-bottom: 16px;
}

.nav { display: flex; gap: 8px; flex-wrap: wrap; }

.nav button[aria-current="page"] {
  background: var(--amber);
  color: var(--amber-ink);
  border-color: transparent;
}

.who { color: var(--muted); font-size: 14px; }

.grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
}

.panel { padding: 16px; }

.device {
  width: 100%;
  text-align: left;
  padding: 12px;
  margin-bottom: 8px;
  background: transparent;
  color: inherit;
  border: 1px solid transparent;
  border-radius: 12px;
}

.device.selected, .device:hover { border-color: var(--line); background: #23281c; }

.device strong { display: block; }

.meta { color: var(--muted); font-size: 13px; margin-top: 4px; }

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  background: var(--muted);
}

.dot.on { background: var(--ok); }
.dot.off { background: var(--bad); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }

pre.output {
  background: #0d0f0b;
  border-radius: 12px;
  padding: 12px;
  min-height: 140px;
  overflow: auto;
  white-space: pre-wrap;
  font-family: "Cascadia Code", "Source Code Pro", ui-monospace, monospace;
  font-size: 13px;
}

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > * { margin: 0; }
.split { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.error { color: var(--bad); min-height: 1.2em; }
.banner {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 18px;
  color: var(--muted);
}

.viewer {
  position: fixed;
  inset: 24px;
  background: #10130d;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.viewer canvas {
  width: 100%;
  height: auto;
  background: #000;
  border-radius: 12px;
  cursor: crosshair;
}

@media (max-width: 800px) {
  .grid { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; }
}
