:root {
  --bg: #0f1115;
  --surface: #181b22;
  --surface-2: #222631;
  --border: #2e3340;
  --text: #e8eaf0;
  --muted: #9aa1b2;
  --accent: #4f8cff;
  --accent-text: #ffffff;
  --ok: #3ccf7a;
  --bad: #ff5d5d;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
}
[hidden] { display: none !important; }

button, select, input {
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  min-height: 34px;
}
button { cursor: pointer; }
button:hover { border-color: var(--accent); }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.active { border-color: var(--accent); color: var(--accent); }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.error { color: var(--bad); min-height: 1.4em; margin: 0; }

/* ---------- login ---------- */
.login { height: 100%; display: grid; place-items: center; padding: 16px; }
.login-card {
  width: 100%; max-width: 340px; display: grid; gap: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 24px;
}
.login-card h1 { margin: 0; font-size: 20px; }
.login-card p { margin: 0; }

/* ---------- app ---------- */
.app { height: 100%; display: flex; flex-direction: column; }
.bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding: 6px 8px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.spacer { flex: 1; }
.group { display: inline-flex; align-items: center; gap: 4px; }
.zoom-label { min-width: 42px; text-align: center; font-variant-numeric: tabular-nums; color: var(--muted); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.ok { background: var(--ok); }
.dot.bad { background: var(--bad); }
.status { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }

.viewport {
  flex: 1; min-height: 0; overflow: auto; display: flex; background: #000; outline: none;
}
.viewport:focus { box-shadow: inset 0 0 0 2px var(--accent); }
.viewport.mode-click { touch-action: none; }
.viewport.mode-pan { touch-action: pan-x pan-y; }
.stage { position: relative; margin: auto; flex: none; }
.stage canvas {
  display: block; width: 100%; height: 100%; user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none; cursor: crosshair;
}
/* Penanda posisi mouse laptop (kursor asli tidak ikut terekam). */
.cursor {
  position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; pointer-events: none;
  border-radius: 50%; border: 2px solid #ff4646; background: rgba(255, 70, 70, .3);
  box-shadow: 0 0 0 1px #000;
}

.panel {
  background: var(--surface); border-top: 1px solid var(--border); padding: 10px;
  max-height: 45vh; overflow: auto; display: grid; gap: 10px;
}
.row { display: flex; gap: 6px; align-items: center; }
.row.between { justify-content: space-between; flex-wrap: wrap; }
.row input { flex: 1; min-width: 0; }
.keys { display: flex; flex-wrap: wrap; gap: 6px; }
.keys button { min-width: 48px; }

.drop {
  display: grid; gap: 4px; justify-items: center; text-align: center; cursor: pointer;
  border: 2px dashed var(--border); border-radius: 12px; padding: 18px 12px;
}
.drop.over { border-color: var(--accent); background: var(--surface-2); }

.upload-item { display: grid; gap: 4px; font-size: 13px; }
.upload-item progress { width: 100%; height: 8px; accent-color: var(--accent); }
.upload-item.done { color: var(--ok); }
.upload-item.fail { color: var(--bad); }

.file-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.file-list li {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  background: var(--surface-2); border-radius: 8px;
}
.file-list .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list .meta { color: var(--muted); font-size: 12px; white-space: nowrap; }
.file-list a { color: var(--accent); }

.toast {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 14px; max-width: calc(100% - 32px); box-shadow: 0 6px 24px rgba(0, 0, 0, .4);
}
