:root {
  --bg: #0b0c10;
  --panel: #15171c;
  --text: #e6e6e6;
  --muted: #9aa0a6;
  --primary: #22c55e;
  --danger: #ef4444;
  --accent: #3b82f6;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #1f232b;
  position: sticky;
  top: 0;
  background: rgba(11, 12, 16, 0.9);
  backdrop-filter: blur(8px);
  z-index: 2001;
}
.app-header:fullscreen, :fullscreen .app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
}
.app-header .actions { display: flex; gap: 8px; flex-wrap: wrap; }

button {
  background: #23262f;
  color: var(--text);
  border: 1px solid #2b303a;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
}
button:hover { border-color: #3a4150; }
button.primary { background: var(--primary); color: #07110a; border-color: var(--primary); }
button.danger { background: var(--danger); color: #180507; border-color: var(--danger); }

.app-main {
  max-width: 900px;
  margin: 24px auto;
  padding: 0 16px;
  display: grid;
  gap: 16px;
}

.panel {
  background: var(--panel);
  border: 1px solid #1f232b;
  border-radius: 12px;
  padding: 16px;
}

/* 顶部更多下拉菜单 */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute;
  right: 0;
  top: 110%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #14161b;
  border: 1px solid #262a33;
  border-radius: 10px;
  padding: 10px;
  min-width: 140px;
  z-index: 2500;
}
.dropdown-menu.hidden { display: none; }
.dropdown-menu button { text-align: left; }

h3 { margin: 0 0 8px; font-weight: 600; }
.status { color: var(--muted); line-height: 1.6; }
.results { white-space: pre-wrap; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }

/* 覆盖层用于放置校准/测试点 */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 1000;
}
.overlay.hidden { display: none; }

.heat-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.gaze-layer {
  position: fixed;
  left: 0; top: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 500; /* 低于测试/校准覆盖层（1000），不遮挡UI */
  mix-blend-mode: screen; /* 只做提亮混合，不会压暗底层 */
}

.cal-dot {
  position: absolute;
  width: 22px; height: 22px;
  margin: -11px 0 0 -11px; /* center by (x,y) */
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 4px rgba(59,130,246,0.25);
  cursor: pointer;
  transition: transform 0.1s ease;
}
.cal-dot:hover { transform: scale(1.08); }

.test-dot {
  position: absolute;
  width: 18px; height: 18px;
  margin: -9px 0 0 -9px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid #02240f;
  box-shadow: 0 0 0 4px rgba(34,197,94,0.25);
}

.legend {
  position: fixed;
  left: 16px;
  bottom: 16px;
  background: rgba(21,23,28,0.9);
  border: 1px solid #262a33;
  color: var(--muted);
  padding: 10px 12px;
  border-radius: 8px;
  z-index: 1100;
  font-size: 13px;
}

.replay-dot {
  position: absolute;
  width: 10px; height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: #f59e0b;
  border: 2px solid #1f1202;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.3);
}

.replay-target {
  position: absolute;
  width: 12px; height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid #02240f;
  opacity: 0.7;
}

/* 实时追踪软光圈（避免抖动，浅色大范围） */
.gaze-blob {
  position: fixed;
  left: 0; top: 0;
  width: 120px; height: 120px;
  margin: 0;
  transform: translate(-50%, -50%);
  pointer-events: none;
  border-radius: 50%;
  z-index: 1200;
  background: radial-gradient(circle,
    rgba(255,255,255,0.22) 0%,
    rgba(255,255,255,0.16) 40%,
    rgba(255,255,255,0.08) 70%,
    rgba(255,255,255,0.00) 100%);
  mix-blend-mode: screen;
}



