:root {
  /* every strip is 6 frames of 1020x320, all aligned on Dexter */
  --sprite-w: 440px;
  --sprite-h: 138px;
  --teal: #0b6360;
  --ink: #0a3a3c;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  background-color: #eef3ee;
  background-image:
    linear-gradient(rgba(11, 99, 96, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(11, 99, 96, 0.06) 1px, transparent 1px);
  background-size: 32px 32px;
  color: var(--ink);
  font-family: 'IBM Plex Mono', monospace;
  overflow: hidden;
}

.lab-header { position: fixed; top: 28px; left: 32px; z-index: 6; }
.lab-hint { margin: 10px 0 0; font-size: 12.5px; color: #174648; }

.skip-link {
  position: fixed; top: 8px; left: 8px; z-index: 60;
  padding: 8px 12px; background: var(--teal); color: #fff;
  font-size: 13px; font-weight: 700; text-decoration: none;
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; outline: 3px solid #f59e0b; }

/* ---------- chase stage ---------- */
.bg-chase-stage {
  position: fixed; inset: 0; z-index: 5;
  pointer-events: none; overflow: hidden;
}
.runner-track { position: absolute; bottom: 36px; left: 0; will-change: transform; }
.runner-flip { position: relative; }
.runner-flip.is-ltr { transform: scaleX(-1); }

.sprite-runner {
  width: var(--sprite-w);
  height: var(--sprite-h);
  background-image: url('/sprites/run_6x1.webp');
  background-size: 600% 100%;
  background-repeat: no-repeat;
  pointer-events: none;
}
.bg-chase-stage.state-crash .sprite-runner { background-image: url('/sprites/crash_6x1.webp'); }
.bg-chase-stage.state-idle  .sprite-runner { background-image: url('/sprites/idle_6x1.webp'); }
.bg-chase-stage.state-sadwalk .sprite-runner { background-image: url('/sprites/sadwalk_6x1.webp'); }

/* hitbox measured from the strips: Dexter + carried tail */
.dexter-hitbox {
  position: absolute;
  left: 1.8%; bottom: 4.9%; width: 24.9%; height: 59.2%;
  background: transparent; border: none; padding: 0;
  cursor: pointer; pointer-events: auto;
}
/* idle: Dexter + tail lying beside him */
.bg-chase-stage.state-idle .dexter-hitbox { left: 1.7%; bottom: 4.6%; width: 34.6%; height: 54.5%; }
.bg-chase-stage.state-crash .dexter-hitbox { pointer-events: none; cursor: default; }
/* timed out: the dinosaur (and its tail) is the button that wakes everyone up */
.bg-chase-stage.state-sadwalk .dexter-hitbox { left: 16.5%; bottom: 1.5%; width: 83.4%; height: 96.4%; }
.dexter-hitbox:focus-visible { outline: 3px dashed #f59e0b; outline-offset: 4px; }

/* ---------- modal ---------- */
.captcha-modal-backdrop {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10, 35, 37, 0.55);
  backdrop-filter: blur(4px);
  padding: 16px;
}
.lab-modal-frame {
  width: 100%; max-width: 430px;
  background-color: var(--teal); padding: 2.5px;
  clip-path: polygon(18px 0%, calc(100% - 18px) 0%, 100% 18px, 100% calc(100% - 18px),
                     calc(100% - 18px) 100%, 18px 100%, 0% calc(100% - 18px), 0% 18px);
  filter: drop-shadow(0 24px 48px rgba(11, 46, 48, 0.35));
}
.lab-modal-inner {
  background-color: #f4f7f2;
  background-image: repeating-linear-gradient(0deg, rgba(11, 99, 96, 0.025) 0px, rgba(11, 99, 96, 0.025) 1px, transparent 1px, transparent 3px);
  padding: 26px;
  clip-path: polygon(16.5px 0%, calc(100% - 16.5px) 0%, 100% 16.5px, 100% calc(100% - 16.5px),
                     calc(100% - 16.5px) 100%, 16.5px 100%, 0% calc(100% - 16.5px), 0% 16.5px);
}
.lab-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.lab-badge-frame {
  display: inline-block; background-color: var(--teal); padding: 1.5px;
  clip-path: polygon(8px 0%, calc(100% - 8px) 0%, 100% 8px, 100% calc(100% - 8px),
                     calc(100% - 8px) 100%, 8px 100%, 0% calc(100% - 8px), 0% 8px);
}
.lab-badge-inner {
  display: inline-flex; align-items: center; gap: 8px;
  background-color: #d4ece1; color: #0b3b3d;
  font-size: 11px; font-weight: 700; padding: 4px 12px;
  clip-path: polygon(7px 0%, calc(100% - 7px) 0%, 100% 7px, 100% calc(100% - 7px),
                     calc(100% - 7px) 100%, 7px 100%, 0% calc(100% - 7px), 0% 7px);
}
.lab-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--teal); display: inline-block; }
.lab-dot.is-warn { background: #d97706; }
.lab-title {
  margin: 10px 0 4px; font-family: 'Space Grotesk', sans-serif;
  font-size: 26px; font-weight: 800; color: var(--ink); letter-spacing: -0.03em;
}
.lab-sub { margin: 0 0 18px; font-size: 12.5px; color: #174648; }
.lab-close {
  background: none; border: none; color: var(--ink);
  font-size: 20px; font-weight: 700; cursor: pointer; line-height: 1;
}
.lab-error {
  margin: 0 0 14px; padding: 8px 10px;
  border-left: 3px solid #b45309; background: #fff7e6;
  font-size: 12.5px; color: #7c2d12;
}
.lab-form { display: flex; flex-direction: column; gap: 14px; }
.lab-form[hidden] { display: none; }
.lab-label { display: block; font-size: 12.5px; font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.lab-input {
  width: 100%; background-color: #f8faf6;
  border: 2px solid var(--teal); border-radius: 5px;
  padding: 10px 12px; font-family: 'IBM Plex Mono', monospace; font-size: 13px;
  color: var(--ink); outline: none;
}
.lab-input:focus { border-color: #f59e0b; background-color: #fffdf7; }
.lab-hint { font-weight: 500; color: #5b7273; }
.lab-turnstile:empty { display: none; }
.lab-actions { display: flex; align-items: stretch; gap: 10px; margin-top: 4px; }
.lab-btn-primary {
  flex: 1; background-color: #066360; color: #fff;
  font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 16px;
  border: none; padding: 11px 20px; cursor: pointer;
  clip-path: polygon(9px 0%, calc(100% - 9px) 0%, 100% 9px, 100% calc(100% - 9px),
                     calc(100% - 9px) 100%, 9px 100%, 0% calc(100% - 9px), 0% 9px);
}
.lab-btn-primary[disabled] { opacity: 0.6; cursor: progress; }
.lab-btn-secondary-frame {
  background-color: var(--teal); padding: 2px;
  clip-path: polygon(9px 0%, calc(100% - 9px) 0%, 100% 9px, 100% calc(100% - 9px),
                     calc(100% - 9px) 100%, 9px 100%, 0% calc(100% - 9px), 0% 9px);
}
.lab-btn-secondary {
  height: 100%; background-color: #f4f7f2; color: #066360;
  font-family: 'IBM Plex Mono', monospace; font-weight: 700; font-size: 13px;
  border: none; padding: 10px 16px; cursor: pointer;
  clip-path: polygon(7.5px 0%, calc(100% - 7.5px) 0%, 100% 7.5px, 100% calc(100% - 7.5px),
                     calc(100% - 7.5px) 100%, 7.5px 100%, 0% calc(100% - 7.5px), 0% 7.5px);
}
