:root {
  /* surfaces */
  --bg: #fbfbfd;
  --surface: #ffffff;
  --surface-2: #f5f5f7;
  --hairline: #e6e6ea;
  --hairline-strong: #d2d2d7;

  /* ink */
  --text: #1d1d1f;
  --muted: #6e6e73;
  --faint: #a1a1a6;

  /* brand + accent */
  --accent: #6b5bff;
  --accent-press: #574ae6;
  --accent-soft: #ece9ff;

  /* semantic */
  --ok: #1f9d57;
  --err: #e0484d;

  /* Rudolph signature */
  --rudolph-red: #e5342b;

  /* plot (read by app.js for the canvas) */
  --plot-bg: #ffffff;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05), 0 6px 18px rgba(20,20,40,0.05);
  --shadow-md: 0 2px 6px rgba(0,0,0,0.06), 0 18px 48px rgba(20,20,40,0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "SF Pro Text", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}

main { max-width: 980px; margin: 0 auto; padding: 28px 24px 72px; }

/* ---------------- brand bar ---------------- */
.brandbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: rgba(251, 251, 253, 0.8);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--hairline);
}
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--text); }
.brand__mark { display: inline-flex; filter: drop-shadow(0 2px 6px rgba(123, 97, 255, 0.28)); }
.brand__name {
  font-family: "SF Pro Display", -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 600; font-size: 18px; letter-spacing: -0.015em;
}
.brand__by { color: var(--faint); font-size: 13px; }

/* ---------------- hero ---------------- */
.hero { text-align: center; padding: 22px 0 16px; }
.eyebrow {
  margin: 0 0 10px;
  font-size: 13px; font-weight: 600; letter-spacing: 0.04em;
  color: var(--accent); text-transform: uppercase;
}
.hero__title {
  font-family: "SF Pro Display", -apple-system, BlinkMacSystemFont, sans-serif;
  margin: 0;
  font-size: clamp(40px, 7vw, 60px);
  font-weight: 700; letter-spacing: -0.035em; line-height: 1.02;
}
.hero__lede {
  max-width: 560px; margin: 14px auto 0;
  font-size: 17px; line-height: 1.5; color: var(--muted);
}
/* the glowing red nose, inline */
.nose-dot {
  display: inline-block;
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--rudolph-red);
  box-shadow: 0 0 0 3px rgba(229, 52, 43, 0.16), 0 0 12px 2px rgba(229, 52, 43, 0.45);
  transform: translateY(1px);
}

/* ---------------- status ---------------- */
.status {
  max-width: 560px;
  margin: 0 auto 24px;
  padding: 11px 16px;
  border-radius: 12px;
  font-size: 14px;
  border: 1px solid var(--hairline);
  text-align: center;
}
.status--loading { background: var(--accent-soft); color: var(--accent-press); border-color: #dcd6ff; }
.status--ready   { background: #e9f7ee; color: #157a43; border-color: #cdebd8; }
.status--error   { background: #fdecec; color: #b3322f; border-color: #f7cfce; }

/* ---------------- panes ---------------- */
.panes { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .panes { grid-template-columns: 1fr; } }

.pane { display: flex; flex-direction: column; }

.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.stage--cam { background: var(--surface-2); }

video, .overlay, .plot { position: absolute; inset: 0; width: 100%; height: 100%; }

/* Mirror the video so it feels like a mirror */
video { transform: scaleX(-1); object-fit: cover; }
.overlay { transform: scaleX(-1); }
.plot { background: var(--plot-bg); }

/* clean placeholder shown behind the video until the camera paints */
.stage__placeholder {
  position: absolute; inset: 0; z-index: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; color: var(--faint); font-size: 14px;
}
video { z-index: 1; }
.overlay { z-index: 2; }

.pane__cap {
  display: flex; align-items: center; gap: 8px;
  margin: 12px 4px 0;
  font-size: 13px; color: var(--muted);
}
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dot--red { background: var(--rudolph-red); box-shadow: 0 0 7px 1px rgba(229,52,43,0.5); }
.dot--violet { background: var(--accent); }

/* ---------------- toolbar (above the panels) ---------------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px;
  max-width: 820px;
  margin: 0 auto 18px;
  padding: 12px 18px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
}

.ctl--accent {
  color: var(--accent);
  border-color: var(--accent);
  font-weight: 500;
}
.ctl--accent:hover { background: var(--accent-soft); }

.ctl {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--hairline-strong);
  border-radius: 980px;
  padding: 8px 16px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.ctl:hover { background: var(--surface-2); }
.ctl:active { transform: translateY(1px); }
.ctl.paused { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 4px 14px rgba(107,91,255,0.3); }

.modes {
  display: inline-flex;
  border: 1px solid var(--hairline-strong);
  border-radius: 980px;
  overflow: hidden;
  background: var(--surface);
}
.mode-btn {
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  padding: 8px 16px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.mode-btn + .mode-btn { border-left: 1px solid var(--hairline); }
.mode-btn.active { background: var(--accent); color: #fff; font-weight: 600; }

.slider, .checkbox {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  color: var(--muted);
}
.slider input[type="range"] { width: 130px; accent-color: var(--accent); }
.slider__val { color: var(--text); min-width: 38px; font-variant-numeric: tabular-nums; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--accent); }

.fps {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--faint);
}

/* ---------------- blink counter ---------------- */
.blinks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 18px;
  max-width: 820px;
  margin: 0 auto 18px;
  padding: 14px 20px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
}
.blinks__title {
  font-weight: 600;
  font-size: 14px;
  color: var(--muted);
}
.blink-stat {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  min-width: 64px;
  line-height: 1.1;
}
.blink-stat__num {
  font-family: "SF Pro Display", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--text);
}
.blink-stat__lbl {
  font-size: 12px;
  color: var(--faint);
  margin-top: 2px;
}
.blink-stat--total .blink-stat__num { color: var(--accent); }

/* ---------------- fineprint ---------------- */
.fineprint { text-align: center; color: var(--faint); font-size: 13px; margin: 28px 0 0; }
.fineprint strong { color: var(--muted); font-weight: 600; }
