:root {
  --ink: #0b0b14;
  --yellow: #ffd400;
  --hot: #ff2e63;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  background: var(--ink);
  color: #fff;
  font-family: var(--font);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

#video, #canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
}
#video {
  object-fit: cover;
  transform: scaleX(-1); /* selfie view */
  background: var(--ink);
}
#canvas { pointer-events: none; }

.screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
  text-align: center;
  background: radial-gradient(ellipse at 50% 30%, #2a1b4d 0%, var(--ink) 70%);
  overflow: hidden;
}
#screenOver { background: rgba(11, 11, 20, 0.82); }

h1, h2 {
  margin: 0;
  font-weight: 900;
  font-style: italic;
  letter-spacing: 0.02em;
  line-height: 0.95;
  color: var(--yellow);
  text-shadow: 0 4px 0 var(--hot), 0 0 24px rgba(255, 46, 99, 0.55);
}
h1 { font-size: clamp(48px, 16vmin, 96px); }
h2 { font-size: clamp(36px, 11vmin, 64px); }

.pose { width: min(46vmin, 220px); height: auto; flex: 0 1 auto; filter: drop-shadow(0 6px 0 rgba(0, 0, 0, 0.35)); }

.how {
  margin: 0;
  font-size: clamp(17px, 4.6vmin, 24px);
  font-weight: 700;
  line-height: 1.3;
  text-shadow: 0 2px 0 var(--ink);
}

.big {
  font: inherit;
  font-size: clamp(20px, 5.5vmin, 28px);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink);
  background: var(--yellow);
  border: 4px solid var(--ink);
  border-radius: 14px;
  padding: 16px 34px;
  box-shadow: 0 6px 0 var(--hot);
  cursor: pointer;
  touch-action: manipulation;
}
.big:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 2px 0 var(--hot); }
.big:disabled { background: #6b6b7a; box-shadow: 0 6px 0 #34343f; color: #1d1d27; cursor: default; text-transform: none; letter-spacing: 0; }

.error {
  margin: 0;
  max-width: 28em;
  padding: 10px 14px;
  font-weight: 700;
  background: var(--hot);
  border: 3px solid var(--ink);
  border-radius: 10px;
}

.stats {
  display: flex;
  gap: 12px;
  margin: 0;
  flex-wrap: wrap;
  justify-content: center;
}
.stats div {
  min-width: 96px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.1);
  border: 3px solid var(--yellow);
  border-radius: 12px;
}
.stats dt { font-size: 14px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; }
.stats dd { margin: 4px 0 0; font-size: 40px; font-weight: 900; color: var(--yellow); }

/* Text over the live camera needs a backing and an outline */
.banner {
  position: fixed;
  z-index: 5;
  left: 50%;
  bottom: 14%;
  transform: translateX(-50%);
  padding: 14px 24px;
  max-width: 92vw;
  white-space: nowrap;
  font-size: clamp(20px, 6vmin, 32px);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--yellow);
  background: rgba(11, 11, 20, 0.82);
  border: 3px solid var(--yellow);
  border-radius: 12px;
  animation: pulse 1s ease-in-out infinite;
  pointer-events: none;
}
@keyframes pulse { 50% { transform: translateX(-50%) scale(1.06); } }

.count {
  position: fixed;
  z-index: 5;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: min(48vmin, 280px);
  font-weight: 900;
  font-style: italic;
  color: var(--yellow);
  -webkit-text-stroke: 6px var(--ink);
  paint-order: stroke fill;
  text-shadow: 0 8px 0 var(--hot);
  pointer-events: none;
}

#debugBtn {
  position: fixed;
  z-index: 20;
  right: 10px;
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 8px 12px;
  color: #fff;
  background: rgba(11, 11, 20, 0.7);
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  touch-action: manipulation;
}
#debugBtn[aria-pressed="true"] { color: var(--ink); background: var(--yellow); border-color: var(--ink); }

/* Short landscape screens: tighten the start screen */
@media (max-height: 480px) {
  .screen { gap: 8px; padding: 12px; }
  h1 { font-size: 40px; }
  h1 br { display: none; }
  .pose { width: 90px; }
  .how { font-size: 15px; }
  .big { padding: 10px 24px; }
  .stats dd { font-size: 28px; }
}
