* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: #10131a;
  color: #e8eaf0;
  min-height: 100vh;
}
.hidden { display: none !important; }

#app { display: flex; justify-content: center; padding: 24px 16px 48px; }
.step { width: 100%; max-width: 760px; }

h1 { font-size: 1.5rem; text-align: center; margin: 8px 0 20px; }
h2 { font-size: 1.2rem; margin-top: 0; }

.card {
  background: #1a1f2b;
  border: 1px solid #2a3040;
  border-radius: 12px;
  padding: 24px 28px;
  line-height: 1.55;
}
.card.wide { max-width: 760px; }

button {
  font: inherit;
  padding: 10px 22px;
  border-radius: 8px;
  border: 1px solid #3a4050;
  cursor: pointer;
  background: #2a3040;
  color: #e8eaf0;
  margin-top: 12px;
}
button.primary {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
  font-weight: 600;
}
button.primary:hover:not(:disabled) { background: #1d4ed8; }
button:disabled { opacity: 0.45; cursor: not-allowed; }

input[type="text"] {
  font: inherit;
  width: 100%;
  padding: 10px 14px;
  margin-top: 4px;
  border-radius: 8px;
  border: 1px solid #3a4050;
  background: #10131a;
  color: #e8eaf0;
}
.check { display: flex; gap: 10px; align-items: flex-start; margin: 18px 0 6px; cursor: pointer; }
.check input { margin-top: 4px; transform: scale(1.3); }

.muted { color: #9aa3b5; font-size: 0.92rem; }
.error { color: #f87171; }
.banner {
  background: #7c2d12; color: #ffedd5; padding: 10px 16px; text-align: center; font-size: 0.95rem;
}

.cam-wrap { position: relative; width: 480px; max-width: 100%; margin: 12px auto; }
#cam { width: 100%; border-radius: 10px; display: block; transform: scaleX(-1); }
#cam-overlay {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none; transform: scaleX(-1);
}

.checklist { list-style: none; padding: 0; margin: 12px 0; }
.checklist li { padding: 4px 0 4px 30px; position: relative; color: #9aa3b5; }
.checklist li::before {
  content: "✗"; position: absolute; left: 6px; color: #f87171; font-weight: 700;
}
.checklist li.ok { color: #d1fae5; }
.checklist li.ok::before { content: "✓"; color: #34d399; }

#calib-area { position: fixed; inset: 0; background: #10131a; z-index: 50; }
.calib-dot {
  position: absolute; width: 34px; height: 34px; border-radius: 50%;
  background: #ef4444; border: 3px solid #fecaca;
  transform: translate(-50%, -50%);
  cursor: pointer; z-index: 51;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff; user-select: none;
}
.calib-dot.done { background: #22c55e; border-color: #bbf7d0; pointer-events: none; }
#calib-progress {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%);
  color: #9aa3b5; z-index: 52; background: #1a1f2b; padding: 6px 14px; border-radius: 8px;
}

#player-wrap { position: fixed; inset: 0; background: #000; z-index: 60; display: flex; align-items: center; justify-content: center; }
#player { max-width: 100vw; max-height: 100vh; width: 100%; }
#slide { max-width: 92vw; max-height: 92vh; display: block; }
#fixation {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: #000; color: #e8eaf0; font-size: 3rem; font-weight: 300;
}
#interlude {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: #000; color: #9aa3b5; font-size: 1.4rem;
}

/* Доп. калибровка/замер точности: смотрим на точку */
#gaze-stage { position: fixed; inset: 0; background: #10131a; z-index: 55; }
#stage-text {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  color: #9aa3b5; background: #1a1f2b; padding: 8px 18px; border-radius: 8px; z-index: 57;
}
#stage-dot {
  position: fixed; width: 30px; height: 30px; border-radius: 50%;
  background: #38bdf8; border: 3px solid #bae6fd;
  transform: translate(-50%, -50%) scale(1);
  transition: left 0.55s ease, top 0.55s ease;
  z-index: 56;
}
#stage-dot.pulse { animation: dotpulse 1s ease-in-out infinite; }
@keyframes dotpulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(0.55); }
}

/* Наша сглаженная точка взгляда (вместо дёрганой встроенной) */
#smooth-dot {
  position: fixed; width: 22px; height: 22px; border-radius: 50%;
  background: #ef4444cc; border: 2px solid #fecaca;
  transform: translate(-50%, -50%);
  pointer-events: none; z-index: 90; display: none;
}

.accuracy { font-size: 1.05rem; }
.accuracy b.good { color: #34d399; }
.accuracy b.mid { color: #fbbf24; }
.accuracy b.bad { color: #f87171; }

/* Камера остаётся отрисовываемой во время показа (display:none может
   замораживать кадры для детектора) — уводим в угол размером 2x2px. */
#cam.live-offscreen {
  position: fixed !important; right: 0 !important; bottom: 0 !important;
  width: 2px !important; height: 2px !important; opacity: 0.01 !important;
  pointer-events: none !important; z-index: 1 !important; transform: none !important;
}

#finish-summary ul { list-style: none; padding: 0; }
#finish-summary li { padding: 4px 0 4px 30px; position: relative; }
#finish-summary li::before { content: "✓"; position: absolute; left: 6px; color: #34d399; font-weight: 700; }
.session-id { font-family: Consolas, monospace; font-size: 0.85rem; color: #9aa3b5; word-break: break-all; }

/* Результаты участника после теста */
#my-results h3 { margin: 20px 0 10px; font-size: 1.05rem; }
.myres-row {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center;
  padding: 8px 0; border-bottom: 1px solid #2a3040;
}
.myres-row:last-child { border-bottom: none; }
.myres-thumb { width: 64px; border-radius: 6px; background: #0c0f16; }
.myres-label { font-size: 0.95rem; }
.myres-emo { font-weight: 700; white-space: nowrap; }
.myres-note { color: #9aa3b5; font-size: 0.85rem; }
.myres-bar { height: 6px; background: #232937; border-radius: 3px; overflow: hidden; margin-top: 5px; max-width: 260px; }
.myres-bar > div { height: 100%; border-radius: 3px; }
