:root {
  --bg: #0e1116;
  --panel: #171b22;
  --accent: #4da3ff;
  --accent-2: #ff4d6d;
  --text: #e8ecf2;
  --muted: #8b97a8;
}

* { box-sizing: border-box; }

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

/* Sit above WebGazer's video preview (appended to <body> at z-index 40) so
   corner calibration dots render on top of it instead of hiding behind it.
   The screens are transparent, so the preview still shows through. */
#app { position: fixed; inset: 0; z-index: 50; }

/* ---- Screens ---- */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
}
.screen.active { display: flex; }

.hidden { display: none !important; }

/* ---- Cards / text ---- */
.card {
  background: var(--panel);
  border: 1px solid #232a34;
  border-radius: 16px;
  padding: 40px;
  max-width: 460px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.45);
}

h1 { margin: 0 0 12px; font-size: 32px; }
h2 { margin: 0 0 16px; }
.lead { color: var(--text); font-size: 17px; line-height: 1.5; }
.steps { text-align: left; color: var(--muted); line-height: 1.9; list-style: none; padding: 0; margin: 20px 0; }
.steps b { color: var(--accent); }
.privacy { color: var(--muted); font-size: 13px; margin: 20px 0; }
.status { color: var(--accent-2); font-size: 14px; min-height: 20px; }

/* ---- Buttons ---- */
button {
  font: inherit;
  cursor: pointer;
  border-radius: 10px;
  padding: 12px 22px;
  border: 1px solid transparent;
  transition: transform .05s ease, background .15s ease;
}
button:active { transform: translateY(1px); }
.primary { background: var(--accent); color: #05244a; font-weight: 600; }
.primary:hover { background: #6cb4ff; }
.ghost { background: transparent; color: var(--text); border-color: #2c3542; }
.ghost:hover { background: #202632; }
.btn-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 20px; }

/* ---- Calibration ---- */
.calib-instructions {
  position: absolute; top: 24px; left: 0; right: 0;
  text-align: center; color: var(--muted); z-index: 5;
  /* Text-only banner — must not eat clicks meant for dots underneath it. */
  pointer-events: none;
}
.progress-text { color: var(--accent); font-weight: 600; }
.calib-area { position: absolute; inset: 0; }
.calib-dot {
  position: absolute;
  width: 26px; height: 26px;
  margin: -13px 0 0 -13px;
  border-radius: 50%;
  background: var(--accent-2);
  border: 3px solid #fff;
  box-shadow: 0 0 0 6px rgba(255,77,109,.25);
  cursor: pointer;
  transition: transform .1s ease;
}
.calib-dot:hover { transform: scale(1.15); }
.calib-dot .count {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
}

/* ---- Scenario ---- */
.scenario-area { position: absolute; inset: 0; background: radial-gradient(circle at center, #141a22 0%, #0b0e13 100%); }
.target {
  position: absolute;
  width: 44px; height: 44px;
  margin: -22px 0 0 -22px;
  border: 3px solid var(--accent-2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 24px rgba(255,77,109,.6);
}
.target-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent-2); }
.scenario-progress { position: absolute; bottom: 0; left: 0; right: 0; height: 5px; background: #1c222b; }
.scenario-bar { height: 100%; width: 0%; background: var(--accent); transition: width .1s linear; }

/* ---- Results ---- */
.heatmap-canvas { position: absolute; inset: 0; width: 100%; height: 100%; background: #0b0e13; }
.results-panel {
  position: relative;
  background: rgba(23,27,34,.92);
  backdrop-filter: blur(6px);
  border: 1px solid #232a34;
  border-radius: 16px;
  padding: 28px;
  max-width: 520px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.stats { display: flex; gap: 24px; justify-content: center; margin: 8px 0 4px; }
.stat span { display: block; font-size: 28px; font-weight: 700; color: var(--accent); }
.stat label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.hint { color: var(--muted); font-size: 13px; margin: 16px 0 0; }

/* ---- WebGazer video preview: keep it small, bottom-right ---- */
#webgazerVideoContainer {
  top: auto !important;
  bottom: 16px !important;
  left: auto !important;
  right: 16px !important;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
  z-index: 40 !important;
}
.camera-hint {
  position: fixed; bottom: 176px; right: 16px;
  background: rgba(0,0,0,.7); color: #fff;
  padding: 6px 10px; border-radius: 8px; font-size: 12px; z-index: 41;
}
