:root {
  --bg: #000000;
  --surface: #111111;
  --orange: #ff6b00;
  --amber: #ff8c00;
  --muted-orange: #d06000;
  --white: #ffffff;
  --glow: 0 0 12px rgba(255, 107, 0, 0.55), 0 0 28px rgba(255, 140, 0, 0.25);
  --text-glow: 0 0 10px rgba(255, 107, 0, 0.7);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(255, 107, 0, 0.12), transparent 55%),
    linear-gradient(180deg, #0a0a0a 0%, var(--bg) 40%);
  color: var(--white);
  font-family: "Exo", sans-serif;
  line-height: 1.5;
}

.scanlines {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 2px,
    rgba(0, 0, 0, 0.12) 2px,
    rgba(0, 0, 0, 0.12) 4px
  );
  opacity: 0.35;
}

.brand-logo {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 60;
  width: clamp(100px, 12vw, 140px);
  height: auto;
  display: block;
}

body.challenge-page .brand-logo {
  right: auto;
  left: 1.25rem;
}

body.has-leaderboard-nav .brand-logo {
  top: 4.35rem;
}

body.challenge-page.has-leaderboard-nav .brand-logo {
  top: 4.35rem;
  left: 1.25rem;
}

.leaderboard-nav-btn {
  position: fixed;
  top: 1.05rem;
  left: 1.05rem;
  z-index: 80;
  margin: 0;
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--orange);
  background: rgba(0, 0, 0, 0.82);
  color: var(--orange);
  font-family: "Exo", sans-serif;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--glow);
  display: inline-block;
}

.leaderboard-nav-btn:hover,
.leaderboard-nav-btn:focus-visible {
  background: rgba(255, 107, 0, 0.16);
  outline: none;
  transform: translateY(-1px);
}

.leaderboard-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 1.25rem;
}

.leaderboard-overlay-panel {
  width: min(960px, 100%);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.25rem 1.35rem 1.4rem;
  border: 1px solid rgba(255, 107, 0, 0.45);
  background: linear-gradient(180deg, #120a00 0%, #070707 100%);
  box-shadow: var(--glow);
  overflow: auto;
}

.leaderboard-overlay-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.leaderboard-overlay-top h1 {
  margin: 0;
  font-family: "Baloo 2", sans-serif;
  font-size: clamp(2rem, 5vw, 2.8rem);
  color: var(--white);
  letter-spacing: 0.04em;
}

.leaderboard-overlay-top .btn-secondary {
  margin-top: 0;
}

.leaderboard-overlay-tip {
  margin: 0;
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.85rem;
}

.leaderboard-overlay-tip code {
  color: var(--amber);
}

html.leaderboard-overlay-open,
html.leaderboard-overlay-open body {
  overflow: hidden;
}

main {
  flex: 1;
  min-height: 0;
  width: min(1100px, 100%);
  margin: 0 auto;
  padding: 1.25rem 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.landing-page {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  animation: fade-in 0.6s ease both;
}

.landing-hero {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  text-align: center;
}

.landing-page h1 {
  margin: 0;
  font-family: "Baloo 2", sans-serif;
  font-weight: 700;
  font-size: clamp(1.75rem, 5.5vh, 3.5rem);
  line-height: 1.05;
  letter-spacing: 0.04em;
  color: var(--white);
  text-shadow: 0 0 18px rgba(255, 107, 0, 0.35);
}

.landing-copy {
  margin: 0 auto;
  max-width: 42rem;
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: clamp(0.9rem, 2vh, 1.05rem);
  text-align: center;
}

.briefing-page .landing-hero {
  gap: 1.15rem;
}

.briefing-label {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-orange);
  font-weight: 700;
}

.briefing-copy {
  margin: 0;
  max-width: 36rem;
  color: rgba(255, 255, 255, 0.9);
  font-size: clamp(1rem, 2.2vh, 1.2rem);
  line-height: 1.45;
  font-weight: 500;
}

.briefing-player {
  margin: 0;
  color: var(--amber);
  font-family: "Baloo 2", sans-serif;
  font-size: clamp(1.05rem, 2.2vh, 1.35rem);
  letter-spacing: 0.04em;
}

.stage-copy {
  max-width: 34rem;
}

.pin-entry {
  width: min(20rem, 100%);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.pin-input {
  width: 100%;
  padding: 0.85rem 0.95rem;
  background: #000;
  border: 1px solid rgba(255, 107, 0, 0.5);
  color: var(--white);
  font-family: "Exo", sans-serif;
  font-size: 1rem;
  letter-spacing: 0.2em;
  box-shadow: inset 0 0 14px rgba(255, 107, 0, 0.12), var(--glow);
}

.pin-input:focus {
  outline: none;
  border-color: var(--amber);
  box-shadow: inset 0 0 14px rgba(255, 107, 0, 0.2), var(--glow);
}

.pin-input::placeholder {
  color: rgba(208, 96, 0, 0.7);
  letter-spacing: 0.04em;
}

.name-input {
  letter-spacing: 0.04em;
}

.name-input::placeholder {
  letter-spacing: 0.04em;
}

.btn-start,
.btn-secondary {
  font-family: "Exo", sans-serif;
  font-weight: 700;
  letter-spacing: 0.1em;
  cursor: pointer;
  border: 1px solid var(--orange);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn-start {
  margin-top: 0.25rem;
  padding: 1rem 1.75rem;
  background: linear-gradient(135deg, var(--orange), var(--amber));
  color: #000;
  box-shadow: var(--glow);
  font-size: 0.95rem;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.btn-start:hover,
.btn-start:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 0 18px rgba(255, 107, 0, 0.85), 0 0 40px rgba(255, 140, 0, 0.4);
  outline: none;
}

.btn-secondary {
  margin-top: 0.75rem;
  padding: 0.7rem 1.2rem;
  background: transparent;
  color: var(--orange);
  box-shadow: var(--glow);
}

.btn-secondary:hover,
.btn-secondary:focus-visible {
  background: rgba(255, 107, 0, 0.12);
  outline: none;
}

/* Challenge page: left content, right vertical photo strip */
body.challenge-page {
  display: flex;
  flex-direction: column;
}

.challenge-main {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 4.25rem 0.75rem 0.75rem;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  overflow: hidden;
}

.challenge-main .poster-brief-bar {
  position: relative;
  top: auto;
  flex-shrink: 0;
  margin: 0;
}

.challenge-layout {
  flex: 1;
  min-height: 0;
  width: 100%;
  position: relative;
  animation: fade-in 0.45s ease both;
}

.left-column {
  position: absolute;
  top: 0;
  left: 0.5rem;
  bottom: 0.75rem;
  width: calc(42% - 1.1rem);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-height: 0;
  justify-content: flex-start;
}

.left-panel {
  background: var(--surface);
  border: 1px solid rgba(255, 107, 0, 0.35);
  box-shadow: var(--glow);
  padding: 1.5rem;
  min-height: 0;
}

.left-panel:not(.notes-panel) {
  flex: 0 0 auto;
  padding: 1.1rem 1.35rem;
}

.left-panel:not(.notes-panel) .panel-hint {
  margin-bottom: 0.85rem;
}

.notes-panel {
  flex: 0 0 auto;
  overflow: visible;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 1.15rem 1.35rem 1.15rem;
}

.notes-text {
  margin: 0;
}

.hint-box {
  margin-top: 0.2rem;
  padding-top: 0.55rem;
  border-top: 1px solid rgba(255, 107, 0, 0.28);
  flex-shrink: 0;
}

.hint-controls {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.hint-controls[hidden] {
  display: none;
}

.hint-timer {
  margin: 0;
  margin-left: auto;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  color: var(--amber);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 3.2rem;
  text-align: right;
}

.hint-btn {
  margin-top: 0;
  padding: 0.55rem 1rem;
  font-size: 0.82rem;
}

.hint-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.hint-text {
  margin: 0;
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.92rem;
  line-height: 1.4;
  font-weight: 500;
}

.hint-text[hidden] {
  display: none;
}

.right-column {
  position: absolute;
  top: 0;
  right: 0.5rem;
  bottom: 0.5rem;
  width: calc(58% - 1.1rem);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 0;
}

.view-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  flex-shrink: 0;
}

.view-toggle-btn {
  padding: 0.65rem 0.85rem;
  border: 1px solid rgba(255, 107, 0, 0.45);
  background: #000;
  color: var(--muted-orange);
  font-family: "Exo", sans-serif;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.view-toggle-btn.is-active {
  border-color: var(--orange);
  color: var(--orange);
  box-shadow: var(--glow);
  background: rgba(255, 107, 0, 0.12);
}

.view-toggle-btn:hover,
.view-toggle-btn:focus-visible {
  color: var(--amber);
  outline: none;
}

.photo-panel {
  flex: 1;
  min-height: 0;
  width: 100%;
  border: 2px solid var(--orange);
  background: #050505;
  box-shadow: inset 0 0 18px rgba(255, 107, 0, 0.15), var(--glow);
  overflow: hidden;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: stretch;
  gap: 0.35rem;
  padding: 0.75rem;
}

.photo-panel[hidden],
.calendar-panel[hidden] {
  display: none;
}

.calendar-panel {
  flex: 1;
  min-height: 0;
  width: 100%;
  border: 2px solid var(--orange);
  background: #050505;
  box-shadow: inset 0 0 18px rgba(255, 107, 0, 0.15), var(--glow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0.85rem 1rem;
  gap: 0.65rem;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.calendar-month {
  margin: 0;
  text-align: center;
  font-family: "Baloo 2", sans-serif;
  font-weight: 700;
  font-size: clamp(1.1rem, 2.2vw, 1.5rem);
  color: var(--orange);
  letter-spacing: 0.06em;
  text-shadow: var(--text-glow);
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.35rem;
  text-align: center;
  color: var(--muted-orange);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: minmax(2.4rem, 1fr);
  gap: 0.35rem;
  flex: 1;
  min-height: 0;
}

.calendar-day {
  border: 1px solid rgba(255, 107, 0, 0.28);
  background: #0a0a0a;
  color: rgba(255, 255, 255, 0.88);
  padding: 0.35rem;
  font-size: 1rem;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.calendar-day-number {
  font-weight: 700;
  font-size: 1rem;
  line-height: 1;
}

.calendar-day.is-muted {
  color: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 107, 0, 0.12);
}

.calendar-day.has-note {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  color: var(--amber);
}

.calendar-day.has-note .calendar-day-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border: 2px solid var(--orange);
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(255, 107, 0, 0.45);
  color: var(--amber);
}

.calendar-events {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding-top: 0.35rem;
  border-top: 1px solid rgba(255, 107, 0, 0.35);
}

.calendar-event {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid rgba(255, 107, 0, 0.45);
  background: #120a00;
  color: #ffb347;
  font-size: clamp(0.95rem, 1.6vw, 1.15rem);
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
}

.calendar-event-date {
  flex-shrink: 0;
  color: var(--orange);
  font-family: "Baloo 2", sans-serif;
  font-weight: 700;
  letter-spacing: 0.04em;
  min-width: 4.5rem;
}

.calendar-event-text {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.photo-panel.is-dragover {
  background: rgba(255, 107, 0, 0.08);
  border-color: var(--amber);
}

.photo-arrow {
  align-self: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--orange);
  background: rgba(0, 0, 0, 0.75);
  color: var(--orange);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--glow);
  font-family: "Exo", sans-serif;
}

.photo-arrow:hover,
.photo-arrow:focus-visible {
  background: rgba(255, 107, 0, 0.15);
  outline: none;
}

.photo-stage {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.photo-slides {
  position: relative;
  flex: 1;
  min-height: 0;
  border: 1px solid rgba(255, 107, 0, 0.45);
  background: #000;
  overflow: hidden;
  cursor: pointer;
}

.photo-slide {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
}

.photo-slide.is-active {
  display: flex;
}

.photo-placeholder {
  color: var(--muted-orange);
  font-family: "Baloo 2", sans-serif;
  font-size: clamp(1.1rem, 2.5vw, 1.5rem);
  letter-spacing: 0.08em;
  text-align: center;
  padding: 1rem;
}

.photo-slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
}

.photo-counter {
  margin: 0;
  text-align: center;
  color: var(--amber);
  letter-spacing: 0.12em;
  font-size: 0.95rem;
}

.panel-title {
  margin: 0 0 0.5rem;
  font-family: "Baloo 2", sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  color: var(--orange);
  text-shadow: var(--text-glow);
}

.panel-hint {
  margin: 0 0 1.25rem;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.95rem;
}

.field-label {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--muted-orange);
  letter-spacing: 0.08em;
  font-size: 0.8rem;
  text-transform: uppercase;
}

.password-input {
  width: 100%;
  padding: 0.8rem 0.9rem;
  background: #000;
  border: 1px solid rgba(255, 107, 0, 0.5);
  color: var(--white);
  font-family: inherit;
  font-size: 1rem;
  box-shadow: inset 0 0 14px rgba(255, 107, 0, 0.12);
}

.password-input:focus {
  outline: none;
  border-color: var(--amber);
  box-shadow: inset 0 0 14px rgba(255, 107, 0, 0.2), var(--glow);
}

.password-input::placeholder {
  color: rgba(208, 96, 0, 0.7);
}

.feedback {
  min-height: 1.25rem;
  margin: 0.85rem 0 0;
  color: var(--amber);
  font-size: 0.9rem;
}

.pin-entry .feedback {
  margin-top: 0.35rem;
  text-align: center;
}

.feedback.error {
  color: #ff4d4d;
}

.feedback.success {
  color: #7dff9a;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Stage 2 — poster challenge */
html:has(body.poster-page),
body.poster-page {
  height: auto;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

body.poster-page {
  display: block;
}

.poster-page .poster-main,
main.poster-main {
  display: block;
  width: 100%;
  max-width: none;
  min-height: 0;
  height: auto;
  flex: none;
  margin: 0;
  padding: 0.75rem 1.25rem 2.5rem;
  overflow: visible;
}

.poster-brief-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1rem 1.25rem;
  margin: 0 0 1.25rem 0;
  background: #120a00;
  border: 2px solid var(--orange);
  box-shadow: var(--glow), 0 0 24px rgba(255, 107, 0, 0.2);
}

.poster-brief-content {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}

.poster-brief-label {
  margin: 0 0 0.25rem;
  font-family: "Baloo 2", sans-serif;
  font-weight: 700;
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--orange);
  text-shadow: var(--text-glow);
}

.poster-brief-text {
  margin: 0;
  color: #ffffff;
  font-size: clamp(0.95rem, 1.6vw, 1.15rem);
  line-height: 1.4;
  font-weight: 500;
}

.poster-brief-text strong {
  color: var(--orange);
  font-weight: 800;
  letter-spacing: 0.04em;
}

.poster-brief-text-continue {
  margin-top: 0.08rem;
}

.poster-brief-text-follow {
  margin-top: 0.7rem;
}

.poster-brief-bar .feedback {
  margin: 0;
  min-height: 0;
  flex-shrink: 0;
  font-size: 1rem;
  font-weight: 600;
}

.poster-gallery {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1.5rem;
  width: 100%;
  align-items: end;
}

.poster-card {
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  width: 100%;
  max-width: none;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.poster-card img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 68vh;
  object-fit: contain;
  object-position: center bottom;
  background: transparent;
}

.poster-card:hover,
.poster-card:focus-visible {
  outline: none;
}

.poster-card:hover img,
.poster-card:focus-visible img {
  filter: brightness(1.08);
}

/* Poster QR scanner */
.scanner-overlay[hidden] {
  display: none;
}

.scanner-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.scanner-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
}

.scanner-panel {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.scanner-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  max-height: min(70vh, 520px);
  overflow: hidden;
  border: 2px solid var(--orange);
  background: #000;
  box-shadow: var(--glow);
}

.scanner-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #050505;
}

.scanner-beam {
  position: absolute;
  left: 0;
  right: 0;
  top: -8%;
  height: 18%;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(
    to bottom,
    transparent,
    rgba(255, 107, 0, 0.15),
    rgba(255, 140, 0, 0.75),
    rgba(255, 107, 0, 0.15),
    transparent
  );
  box-shadow: 0 0 18px rgba(255, 107, 0, 0.65);
}

.scanner-frame.is-scanning .scanner-beam {
  opacity: 1;
  animation: scanner-sweep 1.8s linear forwards;
}

.scanner-corners {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.scanner-corners::before,
.scanner-corners::after,
.scanner-frame::before,
.scanner-frame::after {
  content: "";
  position: absolute;
  width: 1.4rem;
  height: 1.4rem;
  border: 3px solid var(--amber);
  z-index: 2;
  pointer-events: none;
}

.scanner-frame::before {
  top: 0.55rem;
  left: 0.55rem;
  border-right: none;
  border-bottom: none;
}

.scanner-frame::after {
  top: 0.55rem;
  right: 0.55rem;
  border-left: none;
  border-bottom: none;
}

.scanner-corners::before {
  bottom: 0.55rem;
  left: 0.55rem;
  border-right: none;
  border-top: none;
}

.scanner-corners::after {
  bottom: 0.55rem;
  right: 0.55rem;
  border-left: none;
  border-top: none;
}

.scanner-status {
  margin: 0;
  font-family: "Baloo 2", sans-serif;
  font-size: 1.2rem;
  letter-spacing: 0.08em;
  color: var(--orange);
  text-shadow: var(--text-glow);
}

.scanner-result[hidden] {
  display: none;
}

.scanner-result {
  width: 100%;
  padding: 1.1rem 1.2rem;
  border: 2px solid var(--orange);
  background: #120a00;
  box-shadow: var(--glow);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
}

.scanner-result-title {
  margin: 0;
  font-family: "Baloo 2", sans-serif;
  font-size: 1.6rem;
  letter-spacing: 0.06em;
}

.scanner-result-text {
  margin: 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 1rem;
  line-height: 1.4;
}

.scanner-result.is-correct {
  border-color: #7dff9a;
}

.scanner-result.is-correct .scanner-result-title {
  color: #7dff9a;
}

.scanner-result.is-incorrect {
  border-color: #ff4d4d;
}

.scanner-result.is-incorrect .scanner-result-title {
  color: #ff4d4d;
}

.scanner-result .btn-start {
  margin-top: 0.35rem;
}

@keyframes scanner-sweep {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(520%);
  }
}

@media (max-width: 700px) {
  .poster-gallery {
    grid-template-columns: 1fr;
  }

  .poster-brief-bar {
    margin-right: 0;
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Stage 3 — photo safety carousel */
html:has(body.photo-task-page),
body.photo-task-page {
  height: 100%;
  overflow: hidden;
}

body.photo-task-page {
  display: flex;
  flex-direction: column;
}

.photo-task-main {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0.65rem 0.75rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  overflow: hidden;
}

.photo-task-counter {
  margin: 0;
  flex-shrink: 0;
  font-family: "Baloo 2", sans-serif;
  font-size: 1.15rem;
  letter-spacing: 0.08em;
  color: var(--amber);
}

.photo-task-carousel {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.85rem;
  align-items: center;
}

.photo-task-stage {
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.photo-task-image {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: min(1100px, 96vw);
  object-fit: contain;
  background: transparent;
  border: none;
  box-shadow: none;
}

.photo-task-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  flex-shrink: 0;
  padding-bottom: 0.15rem;
}

.photo-choice {
  min-width: 10.5rem;
  padding: 0.8rem 1.2rem;
  border: 2px solid var(--orange);
  background: #000;
  color: var(--orange);
  font-family: "Exo", sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: var(--glow);
}

.photo-choice:hover,
.photo-choice:focus-visible {
  background: rgba(255, 107, 0, 0.12);
  outline: none;
}

.photo-choice-safe.is-selected {
  background: rgba(125, 255, 154, 0.16);
  border-color: #7dff9a;
  color: #7dff9a;
}

.photo-choice-unsafe.is-selected {
  background: rgba(255, 77, 77, 0.16);
  border-color: #ff4d4d;
  color: #ff4d4d;
}

.safe-strip {
  flex-shrink: 0;
  border-top: 1px solid rgba(255, 107, 0, 0.35);
  padding-top: 0.45rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.safe-strip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.safe-strip-label {
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  font-family: "Baloo 2", sans-serif;
  color: var(--orange);
  letter-spacing: 0.06em;
  font-size: 0.95rem;
}

.safe-strip-label .photo-task-counter {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  color: inherit;
}

.photo-submit-btn {
  min-width: 0;
  padding: 0.55rem 1rem;
  font-size: 0.85rem;
}

.photo-submit-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.safe-strip-track {
  display: grid;
  grid-template-columns: repeat(11, minmax(0, 1fr));
  gap: 0.35rem;
  width: 100%;
  height: 4.5rem;
  overflow: hidden;
  align-items: stretch;
}

.safe-thumb {
  width: 100%;
  height: 100%;
  min-width: 0;
  padding: 0;
  border: 1px solid rgba(255, 107, 0, 0.55);
  background: #000;
  cursor: pointer;
  overflow: hidden;
}

.safe-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.safe-thumb:hover,
.safe-thumb:focus-visible {
  border-color: var(--amber);
  outline: none;
}

.safe-strip.is-swap-mode .safe-thumb {
  border-color: var(--amber);
  box-shadow: 0 0 12px rgba(255, 140, 0, 0.55);
  animation: swap-pulse 1.1s ease-in-out infinite;
}

.safe-strip.is-swap-mode .safe-thumb:hover,
.safe-strip.is-swap-mode .safe-thumb:focus-visible {
  border-color: #7dff9a;
  box-shadow: 0 0 14px rgba(125, 255, 154, 0.55);
}

@keyframes swap-pulse {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-2px);
  }
}

.photo-popup-overlay[hidden] {
  display: none;
}

.photo-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.task-complete-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  place-items: center;
  padding: 1rem;
  box-sizing: border-box;
}

.task-complete-overlay.is-open {
  display: grid !important;
}

.task-complete-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  cursor: default;
}

.task-complete-panel {
  position: relative;
  z-index: 1;
  width: min(30rem, calc(100% - 2rem));
  padding: 1.5rem 1.5rem 1.35rem;
  border: 2px solid var(--orange);
  background: #0a0a0a;
  box-shadow: var(--glow);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.task-complete-title {
  margin: 0;
  font-family: "Baloo 2", sans-serif;
  font-size: 1.7rem;
  color: var(--orange);
  letter-spacing: 0.04em;
  text-shadow: var(--text-glow);
}

.task-complete-text {
  margin: 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.05rem;
  line-height: 1.45;
}

.task-complete-panel .btn-start {
  align-self: center;
  margin-top: 0.15rem;
}

html.task-complete-open,
html.task-complete-open body,
body.task-complete-open {
  overflow: hidden !important;
}


.photo-popup-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
}

.photo-popup-panel {
  position: relative;
  width: min(28rem, 100%);
  padding: 1.35rem 1.4rem 1.2rem;
  border: 2px solid var(--orange);
  background: #0a0a0a;
  box-shadow: var(--glow);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.photo-popup-title {
  margin: 0;
  font-family: "Baloo 2", sans-serif;
  font-size: 1.55rem;
  color: var(--orange);
  letter-spacing: 0.04em;
  text-shadow: var(--text-glow);
}

.photo-popup-text {
  margin: 0;
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.98rem;
  line-height: 1.45;
}

.photo-popup-panel .btn-start {
  align-self: center;
  min-width: 8rem;
  margin-top: 0.25rem;
}

/* Stage 4 — anagram page */
html:has(body.anagram-page),
body.anagram-page {
  height: auto;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

body.anagram-page {
  display: block;
}

.anagram-main {
  width: 100%;
  max-width: none;
  min-height: 0;
  margin: 0;
  padding: 0.75rem 1.25rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.anagram-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  width: 100%;
}

.anagram-grid-tile {
  margin: 0;
  border: 2px solid rgba(255, 107, 0, 0.5);
  box-shadow: var(--glow);
  background: #050505;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}

.anagram-grid-tile img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.anagram-answer {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  border-top: 1px solid rgba(255, 107, 0, 0.35);
  padding-top: 0.55rem;
}

.anagram-answer-row {
  display: flex;
  gap: 0.65rem;
  align-items: stretch;
  flex-wrap: wrap;
}

.anagram-input {
  flex: 1;
  min-width: 12rem;
}

.anagram-answer .btn-start {
  min-width: 8.5rem;
  padding: 0.7rem 1.1rem;
}

.anagram-answer .feedback {
  min-height: 1.25rem;
}

/* Stage 5 — phishing inbox */
html:has(body.mail-page),
body.mail-page {
  height: 100%;
  overflow: hidden;
}

body.mail-page {
  display: flex;
  flex-direction: column;
}

.mail-main {
  flex: 1;
  width: 100%;
  max-width: none;
  min-height: 0;
  margin: 0;
  padding: 0.65rem 0.75rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  overflow: hidden;
}

.mail-main .poster-brief-bar {
  position: relative;
  top: auto;
  flex-shrink: 0;
  margin: 0;
}

.mail-main .poster-brief-text b {
  font-weight: 800;
}

.mail-client {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid rgba(255, 107, 0, 0.35);
  background: rgba(18, 10, 0, 0.35);
  box-shadow: none;
  padding: 0;
  overflow: hidden;
}

.mail-client-header {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255, 107, 0, 0.35);
  padding: 0.7rem 1.1rem;
  background: rgba(18, 10, 0, 0.55);
}

.mail-client-heading {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
  flex: 1;
}

.mail-client-title {
  margin: 0;
  font-family: "Baloo 2", sans-serif;
  color: var(--orange);
  letter-spacing: 0.06em;
  font-size: 1.45rem;
}

.mail-client-tools {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.55rem;
  flex-shrink: 0;
  min-width: 10.5rem;
}

.mail-mark-btn {
  margin-top: 0;
  padding: 0.65rem 1rem;
  font-size: 0.85rem;
  visibility: hidden;
  pointer-events: none;
}

.mail-mark-btn.is-ready {
  visibility: visible;
  pointer-events: auto;
}

.mail-mark-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.mail-layout {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

.mail-list {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
  width: 100%;
  border-right: none;
  background: transparent;
}

.mail-row {
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.65rem;
  align-items: center;
  width: 100%;
  padding: 0.65rem 1.1rem 0.65rem 0.85rem;
  border: none;
  border-bottom: 1px solid rgba(255, 107, 0, 0.18);
  background: transparent;
  color: inherit;
  font-family: "Exo", sans-serif;
}

.mail-check {
  width: 1.35rem;
  height: 1.35rem;
  flex-shrink: 0;
  border: 1.5px solid rgba(255, 107, 0, 0.65);
  background: #000;
  color: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.mail-check-tick {
  font-size: 0.85rem;
  line-height: 1;
  font-weight: 700;
}

.mail-check.is-checked {
  border-color: var(--orange);
  background: rgba(255, 107, 0, 0.18);
  color: var(--orange);
  box-shadow: 0 0 10px rgba(255, 107, 0, 0.35);
}

.mail-check:hover,
.mail-check:focus-visible {
  border-color: var(--amber);
  outline: none;
}

.mail-row-open {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.85rem;
  align-items: center;
  width: 100%;
  min-width: 0;
  text-align: left;
  padding: 0.35rem 0.25rem;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-family: inherit;
}

.mail-row-open:hover,
.mail-row-open:focus-visible {
  outline: none;
}

.mail-row:hover,
.mail-row:focus-within {
  background: rgba(255, 107, 0, 0.06);
}

.mail-row.is-active,
.mail-row.is-checked {
  background: rgba(255, 107, 0, 0.1);
}

.mail-row.is-unread {
  background: #15100a;
}

.mail-row-dot {
  width: 0.55rem;
  height: 0.55rem;
  margin-top: 0.4rem;
  border-radius: 50%;
  background: transparent;
}

.mail-row.is-unread .mail-row-dot {
  background: var(--orange);
  box-shadow: 0 0 8px rgba(255, 107, 0, 0.7);
}

.mail-row-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.mail-row-top {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}

.mail-row-from {
  font-weight: 700;
  color: #fff;
}

.mail-row.is-unread .mail-row-from,
.mail-row.is-unread .mail-row-subject {
  color: #fff;
}

.mail-row-time {
  flex-shrink: 0;
  color: var(--muted-orange);
  font-size: 0.85rem;
}

.mail-row-subject {
  font-weight: 600;
  font-size: clamp(0.95rem, 1.5vw, 1.1rem);
  color: rgba(255, 255, 255, 0.92);
  white-space: normal;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.mail-row-preview {
  color: rgba(255, 255, 255, 0.55);
  font-size: clamp(0.85rem, 1.3vw, 0.98rem);
  white-space: normal;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.mail-reader,
.mail-reader-empty {
  min-height: 0;
  border: none;
  background: #0a0a0a;
}

.mail-reader {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  padding: 1.15rem 1.35rem 1.25rem;
  gap: 0.85rem;
  border-left: none;
  box-shadow: none;
}

.mail-reader[hidden] {
  display: none;
}

.mail-reader-empty {
  display: none;
}

.mail-reader-empty[hidden] {
  display: none;
}

.mail-reader-meta {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  border-bottom: 1px solid rgba(255, 107, 0, 0.28);
  padding-bottom: 0.7rem;
}

.mail-reader-from {
  margin: 0;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.92rem;
  word-break: break-word;
}

.mail-reader-subject {
  margin: 0;
  font-family: "Baloo 2", sans-serif;
  font-size: 1.3rem;
  color: var(--amber);
  letter-spacing: 0.02em;
}

.mail-reader-time {
  margin: 0;
  color: var(--muted-orange);
  font-size: 0.85rem;
}

.mail-reader-body {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.mail-reader-body p {
  margin: 0;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.5;
}

.mail-reader-body .mail-link-line {
  color: #4da3ff;
  text-decoration: underline;
  word-break: break-all;
}

.mail-reader-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 0.35rem;
}

.mail-reader-actions .btn-start {
  margin-top: 0;
  padding: 0.75rem 1.15rem;
  font-size: 0.9rem;
}

.mail-reader-actions .btn-start:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.mail-back-btn {
  border: 1px solid rgba(255, 107, 0, 0.55);
  background: #000;
  color: var(--orange);
  font-family: "Exo", sans-serif;
  font-weight: 600;
  padding: 0.45rem 0.75rem;
  cursor: pointer;
}

.mail-back-btn:hover,
.mail-back-btn:focus-visible {
  background: rgba(255, 107, 0, 0.12);
  outline: none;
}

.mail-reader-top {
  flex-shrink: 0;
}

@media (max-width: 900px) {
  .mail-layout {
    display: flex;
  }

  .mail-list {
    max-height: none;
    border-right: none;
    border-bottom: none;
  }

  .mail-reader,
  .mail-reader-empty {
    min-height: 0;
  }
}

@media (max-width: 700px) {
  .photo-task-carousel {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
  }

  .photo-task-carousel .photo-arrow {
    justify-self: center;
  }

  .anagram-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Final code / finish screen */
html:has(body.finish-page),
body.finish-page {
  height: 100%;
  overflow: hidden;
}

body.finish-page {
  display: flex;
  flex-direction: column;
}

.finish-main {
  flex: 1;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.finish-hero {
  width: min(36rem, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
  animation: fade-in 0.5s ease both;
}

.finish-hero h1 {
  margin: 0;
  font-family: "Baloo 2", sans-serif;
  font-weight: 700;
  font-size: clamp(1.85rem, 5.5vh, 3.1rem);
  line-height: 1.08;
  letter-spacing: 0.04em;
  color: var(--white);
  text-shadow: 0 0 18px rgba(255, 107, 0, 0.35);
}

.finish-copy {
  margin: 0;
  max-width: 32rem;
  color: rgba(255, 255, 255, 0.9);
  font-size: clamp(1rem, 2.2vh, 1.15rem);
  line-height: 1.45;
  font-weight: 500;
}

.finish-entry {
  width: min(20rem, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
}

.finish-input {
  text-align: center;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

#player-name.finish-input {
  letter-spacing: 0.04em;
  text-transform: none;
  text-align: left;
}

.finish-entry .feedback {
  margin: 0;
  min-height: 1.25rem;
  text-align: center;
}

.finish-entry .btn-start {
  margin-top: 0.35rem;
}

.finish-back-btn {
  margin-top: 0.15rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.finish-success h1 {
  color: #7dff9a;
  text-shadow: 0 0 18px rgba(125, 255, 154, 0.35);
}

/* Escape room timer */
.escape-timer {
  position: fixed;
  top: 0.65rem;
  right: 0.65rem;
  left: auto;
  z-index: 70;
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 0.35rem;
  padding: 0.28rem 0.5rem;
  border: 1px solid rgba(255, 107, 0, 0.45);
  background: rgba(0, 0, 0, 0.78);
  box-shadow: none;
  min-width: 0;
}

.escape-timer.is-embedded {
  position: absolute;
  top: 0.55rem;
  right: 0.65rem;
  z-index: 5;
}

body:has(.brand-logo) .escape-timer:not(.is-embedded) {
  top: 4.35rem;
}

body.challenge-page .escape-timer:not(.is-embedded) {
  top: 0.65rem;
}

.poster-brief-bar:has(.escape-timer.is-embedded),
.mail-client-header:has(.escape-timer.is-embedded) {
  padding-right: 5.25rem;
}

.mail-client-header:has(.mail-client-tools) {
  padding-right: 1.1rem;
}

.mail-client-header:has(.mail-client-tools) .mail-client-tools {
  padding-top: 0;
}

.escape-timer-label {
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-orange);
}

.escape-timer-value {
  font-family: "Baloo 2", sans-serif;
  font-size: 0.95rem;
  line-height: 1;
  letter-spacing: 0.04em;
  color: var(--amber);
}

/* Leaderboard */
html:has(body.leaderboard-page),
body.leaderboard-page {
  height: auto;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

body.leaderboard-page {
  display: block;
}

.leaderboard-main {
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 5.5rem 1.25rem 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  align-items: stretch;
}

.leaderboard-header h1 {
  margin: 0;
  font-family: "Baloo 2", sans-serif;
  font-size: clamp(2.4rem, 6vw, 3.4rem);
  color: var(--white);
  letter-spacing: 0.04em;
  text-shadow: 0 0 18px rgba(255, 107, 0, 0.35);
  text-align: center;
}

.leaderboard-copy {
  margin: 0.35rem 0 0;
  color: rgba(255, 255, 255, 0.8);
}

.leaderboard-table-wrap {
  border: 1px solid rgba(255, 107, 0, 0.4);
  background: rgba(0, 0, 0, 0.35);
  padding: 1rem;
  box-shadow: var(--glow);
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: clamp(1.05rem, 2.2vw, 1.35rem);
}

.leaderboard-table th,
.leaderboard-table td {
  text-align: left;
  padding: 0.7rem 0.55rem;
  border-bottom: 1px solid rgba(255, 107, 0, 0.22);
}

.leaderboard-table th {
  color: var(--orange);
  font-family: "Baloo 2", sans-serif;
  letter-spacing: 0.06em;
}

.leaderboard-table td:first-child,
.leaderboard-table th:first-child {
  width: 3rem;
}

.leaderboard-table td:last-child,
.leaderboard-table th:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--amber);
  font-weight: 700;
}

.leaderboard-main .btn-secondary {
  align-self: flex-start;
  text-decoration: none;
}

.finish-copy strong {
  color: var(--amber);
}


