:root {
  --bg: #0f1115;
  --surface: #171a21;
  --surface-2: #1f232c;
  --border: #2a2f3a;
  --text: #eef0f4;
  --text-dim: #97a0b3;
  --accent: #4f8cff;
  --accent-2: #6fd0ff;
  --danger: #ff5c68;
  --success: #33d17a;
  --pointer: #ff4757;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

#app {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 16px 48px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 4px 22px;
  color: var(--text-dim);
  font-size: 14px;
  letter-spacing: 0.02em;
}

.topbar .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(79, 140, 255, 0.15);
}

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

h1 {
  font-size: 22px;
  margin: 0 0 6px;
}

.subtitle, .hint {
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 20px;
}

.hint { margin: 14px 0 18px; }

.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  padding: 12px 18px;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease;
}
.btn:hover { background: #262b36; }
.btn:active { transform: scale(0.98); }

.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  color: #06121f;
}

.btn.danger {
  background: transparent;
  border-color: rgba(255, 92, 104, 0.4);
  color: var(--danger);
}

.video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

.video-wrap video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
}

#viewer-pointer-layer {
  position: absolute;
  inset: 0;
  cursor: crosshair;
  touch-action: none;
  z-index: 2;
}

#monitor-pointer-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.pointer-arrow {
  position: absolute;
  width: 28px;
  height: 28px;
  margin-left: -2px;
  margin-top: -2px;
  z-index: 3;
  pointer-events: none;
  color: var(--pointer);
  transition: left 0.05s linear, top 0.05s linear, opacity 0.2s ease;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.pointer-arrow svg { width: 100%; height: 100%; }
.pointer-arrow svg path { fill: currentColor; }

.pointer-arrow .pointer-name {
  position: absolute;
  left: 26px;
  top: -2px;
  white-space: nowrap;
  background: currentColor;
  color: #06121f;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.pointer-arrow.pulse::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid currentColor;
  animation: pulse 0.6s ease-out;
}

@keyframes pulse {
  0% { transform: scale(0.4); opacity: 1; }
  100% { transform: scale(2.6); opacity: 0; }
}

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 11px 12px;
  border-radius: 10px;
  font-size: 15px;
  margin-bottom: 10px;
}

.link-label {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.monitor-label {
  color: #ffb84f;
}

.viewer-list {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.viewer-list:empty { margin: 0; }

.viewer-list li {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px 5px 8px;
  font-size: 13px;
}

.viewer-list .swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.link-box {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.link-box input {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
}

.status {
  color: var(--text-dim);
  font-size: 14px;
  margin: 0 0 16px;
}

.error {
  color: var(--danger);
  font-size: 14px;
  margin-top: 14px;
}

.overlay-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 4;
}

@media (max-width: 480px) {
  .card { padding: 18px; }
  .link-box { flex-direction: column; }
}
