:root {
  --bg: #0d1117;
  --panel: #151b24;
  --line: #232c3a;
  --txt: #e6ebf2;
  --dim: #8e9aad;
  --ok: #34d399;
  --warn: #f59e0b;
  --accent: #3b82f6;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--txt);
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 13px; overflow: hidden;
}
.app { display: flex; height: 100vh; }

.side {
  width: 286px; flex: none; border-right: 1px solid var(--line);
  background: var(--panel); padding: 14px; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.logo {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; letter-spacing: .5px;
}
.brand-t { font-size: 14px; font-weight: 600; }
.brand-s { font-size: 11px; color: var(--dim); margin-top: 2px; }

.block { margin-bottom: 16px; }
.lbl { display: block; color: var(--dim); font-size: 11px; margin-bottom: 6px; letter-spacing: .4px; }
select, input {
  width: 100%; background: #0b0f15; color: var(--txt);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 10px; font-size: 13px; outline: none;
}
input:focus, select:focus { border-color: #35507d; }
button {
  background: #1e2734; color: var(--txt); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 12px; font-size: 12.5px; cursor: pointer;
  white-space: nowrap;
}
button:hover { background: #263244; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { filter: brightness(1.1); }
row { display: flex; }
.row { display: flex; gap: 8px; margin-top: 8px; align-items: center; }
.row.small input { width: 62px; }
.row.small span { color: var(--dim); font-size: 11px; }
.code-lbl { color: var(--dim); font-size: 11px; flex: none; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 8px; }

.state { display: flex; align-items: center; gap: 7px; margin-top: 10px; font-size: 12px; color: var(--dim); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #4b5563; flex: none; }
.dot.on { background: var(--ok); box-shadow: 0 0 8px rgba(52, 211, 153, .7); }
.dot.wait { background: var(--warn); }

.logs {
  height: 150px; overflow-y: auto; background: #0b0f15;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px;
  font-family: ui-monospace, Consolas, monospace; font-size: 11.5px;
  color: var(--dim); line-height: 1.65; white-space: pre-wrap; word-break: break-all;
}
.logs .err { color: #f87171; }
.logs .ok { color: #6ee7b7; }

.stage {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 18px; min-width: 0; background:
    radial-gradient(1200px 600px at 50% 0%, #16202e 0%, var(--bg) 70%);
}
.screen-wrap { position: relative; max-height: 100%; }
canvas {
  display: block; max-height: calc(100vh - 40px); max-width: 100%;
  border-radius: 14px; background: #000;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .55);
  touch-action: none;
}
.hud {
  position: absolute; left: 10px; top: 10px;
  background: rgba(8, 12, 18, .72); border: 1px solid var(--line);
  border-radius: 8px; padding: 4px 9px; font-size: 11px; color: var(--dim);
  pointer-events: none;
}

@media (max-width: 860px) {
  .app { flex-direction: column; }
  .side { width: 100%; height: 42vh; border-right: none; border-bottom: 1px solid var(--line); }
  canvas { max-height: 52vh; }
}
