:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #080909;
  color: #f4f0e7;
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: auto;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #080909;
}

.scroll-room {
  height: 820vh;
  position: relative;
}

.stage {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  background: #111;
}

canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: #171512;
}

.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(3, 5, 6, 0.82), rgba(3, 5, 6, 0.16) 38%, rgba(3, 5, 6, 0.22) 70%, rgba(3, 5, 6, 0.72)),
    linear-gradient(0deg, rgba(3, 5, 6, 0.84), transparent 34%, transparent 68%, rgba(3, 5, 6, 0.46));
}

.hud {
  position: absolute;
  top: clamp(16px, 3vw, 36px);
  left: clamp(16px, 3vw, 42px);
  right: clamp(16px, 3vw, 42px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  z-index: 3;
}

.score,
.timer {
  display: flex;
  align-items: center;
  min-height: 44px;
  background: rgba(9, 12, 14, 0.72);
  border: 1px solid rgba(244, 240, 231, 0.16);
  backdrop-filter: blur(14px);
  box-shadow: 0 14px 50px rgba(0, 0, 0, 0.26);
}

.score {
  gap: 10px;
  padding: 7px 12px;
}

.timer {
  justify-content: center;
  min-width: 112px;
  padding: 7px 14px;
  font-weight: 800;
}

.team {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 28px;
  font-size: 0.82rem;
  font-weight: 900;
}

.team-blue {
  background: #2e67e8;
  color: #f5fbff;
}

.team-red {
  background: #cf2e2e;
  color: #fff8f8;
}

.score strong {
  font-size: 1rem;
  min-width: 18px;
  text-align: center;
}

.divider {
  width: 1px;
  height: 24px;
  background: rgba(244, 240, 231, 0.2);
}

.brief {
  position: absolute;
  left: clamp(18px, 5vw, 72px);
  top: clamp(72px, 11vh, 96px);
  z-index: 3;
  max-width: min(390px, calc(100vw - 36px));
}

.eyebrow {
  margin: 0 0 12px;
  color: #8cd3ff;
  font-size: clamp(0.78rem, 1.4vw, 0.9rem);
  font-weight: 900;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 10ch;
  color: #fff8eb;
  font-size: clamp(2rem, 4.2vw, 4rem);
  line-height: 0.98;
  font-weight: 950;
}

.brief p:not(.eyebrow) {
  margin: 18px 0 0;
  max-width: 23rem;
  color: rgba(244, 240, 231, 0.86);
  font-size: clamp(0.98rem, 1.32vw, 1.12rem);
  line-height: 1.48;
}

.lang-en,
.lang-vi,
.order-en,
.order-vi {
  display: block;
}

.lang-en {
  color: #f7f1e7;
}

.lang-vi {
  margin-top: 8px;
  color: rgba(244, 240, 231, 0.72);
  font-size: 0.92em;
}

.orders {
  position: absolute;
  left: clamp(18px, 5vw, 72px);
  right: clamp(18px, 5vw, 72px);
  bottom: clamp(22px, 5vh, 54px);
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-width: 860px;
}

.orders > span {
  min-height: 58px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  background: rgba(9, 12, 14, 0.76);
  border: 1px solid rgba(244, 240, 231, 0.18);
  color: #f5f0e7;
  font-weight: 800;
  backdrop-filter: blur(14px);
}

.orders > span.is-hot {
  border-color: rgba(115, 201, 255, 0.72);
  background: rgba(27, 92, 140, 0.7);
}

.scroll-cue {
  position: absolute;
  right: clamp(18px, 4vw, 54px);
  bottom: clamp(78px, 12vh, 126px);
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(320px, calc(100vw - 36px));
  padding: 12px 14px;
  background: rgba(8, 10, 12, 0.78);
  border: 1px solid rgba(244, 240, 231, 0.24);
  color: #fff8eb;
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.32);
  transition: opacity 180ms ease, transform 180ms ease;
}

.scroll-cue.is-hidden {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}

.scroll-arrow {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  background: #2e84ff;
  color: #fff;
  font-size: 1.35rem;
  font-weight: 950;
  animation: cue-bounce 1.3s ease-in-out infinite;
}

.scroll-cue strong,
.scroll-cue em,
.scroll-cue small {
  display: block;
  font-style: normal;
  line-height: 1.18;
}

.scroll-cue strong {
  font-size: 0.95rem;
  font-weight: 950;
}

.scroll-cue em {
  margin-top: 4px;
  color: rgba(244, 240, 231, 0.72);
  font-size: 0.82rem;
  font-weight: 800;
}

.scroll-cue small {
  margin-top: 8px;
  color: #8cd3ff;
  font-size: 0.74rem;
  font-weight: 900;
}

.scroll-cue small + small {
  margin-top: 2px;
  color: rgba(140, 211, 255, 0.78);
}

.order-en {
  font-size: 0.96rem;
  line-height: 1.16;
}

.order-vi {
  margin-top: 4px;
  color: rgba(244, 240, 231, 0.72);
  font-size: 0.78rem;
  line-height: 1.15;
}

.progress-rail {
  position: absolute;
  right: clamp(16px, 3vw, 42px);
  bottom: clamp(22px, 5vh, 54px);
  width: min(28vw, 260px);
  height: 8px;
  border: 1px solid rgba(244, 240, 231, 0.18);
  background: rgba(244, 240, 231, 0.1);
  z-index: 3;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #42b8ff, #f8d160);
}

.summary {
  min-height: 70vh;
  display: grid;
  align-content: center;
  gap: 18px;
  padding: clamp(32px, 8vw, 110px);
  background: #111315;
}

.summary h2 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1;
}

.summary p {
  margin: 0;
  max-width: 780px;
  color: rgba(244, 240, 231, 0.82);
  font-size: clamp(1.08rem, 2vw, 1.45rem);
  line-height: 1.5;
}

.command-line {
  width: fit-content;
  max-width: 100%;
  padding: 16px 18px;
  border-left: 4px solid #48bfff;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-weight: 900;
  font-size: clamp(1rem, 2vw, 1.2rem);
}

@media (max-width: 760px) {
  .scroll-room {
    height: 760vh;
  }

  .stage {
    min-height: 100svh;
  }

  .vignette {
    background:
      linear-gradient(180deg, rgba(3, 5, 6, 0.88), rgba(3, 5, 6, 0.5) 30%, rgba(3, 5, 6, 0.04) 48%, rgba(3, 5, 6, 0.1) 60%, rgba(3, 5, 6, 0.86)),
      linear-gradient(90deg, rgba(3, 5, 6, 0.18), transparent 24%, transparent 76%, rgba(3, 5, 6, 0.18));
  }

  .hud {
    align-items: flex-start;
  }

  .score {
    transform-origin: left top;
    transform: scale(0.86);
  }

  .timer {
    min-width: 86px;
    min-height: 38px;
    font-size: 0.9rem;
  }

  .brief {
    top: 11vh;
    max-width: min(340px, calc(100vw - 36px));
  }

  h1 {
    max-width: 12ch;
    font-size: clamp(1.72rem, 9.4vw, 2.7rem);
  }

  .brief p:not(.eyebrow) {
    max-width: 19rem;
    font-size: 0.9rem;
    line-height: 1.34;
    margin-top: 12px;
  }

  .lang-vi {
    margin-top: 6px;
  }

  .orders {
    grid-template-columns: 1fr;
    right: auto;
    width: min(84vw, 380px);
  }

  .scroll-cue {
    left: 18px;
    right: 18px;
    bottom: calc(238px + env(safe-area-inset-bottom, 0px));
    max-width: none;
    padding: 11px 12px;
  }

  .orders > span {
    min-height: 52px;
    padding: 8px 11px;
  }

  .order-en {
    font-size: 0.9rem;
  }

  .order-vi {
    font-size: 0.76rem;
  }

  .progress-rail {
    display: none;
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .vignette {
    background:
      linear-gradient(90deg, rgba(3, 5, 6, 0.82), rgba(3, 5, 6, 0.24) 32%, rgba(3, 5, 6, 0.06) 52%, rgba(3, 5, 6, 0.36)),
      linear-gradient(0deg, rgba(3, 5, 6, 0.72), transparent 34%, rgba(3, 5, 6, 0.46));
  }

  .brief {
    top: 78px;
    max-width: 300px;
  }

  h1 {
    max-width: 13ch;
    font-size: clamp(1.5rem, 5vw, 2.2rem);
  }

  .brief p:not(.eyebrow) {
    max-width: 18rem;
    font-size: 0.78rem;
    line-height: 1.3;
  }

  .orders {
    left: 16px;
    right: 16px;
    bottom: 10px;
    width: auto;
    max-width: none;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .orders > span {
    min-height: 42px;
    padding: 6px 10px;
  }

  .order-en {
    font-size: 0.82rem;
  }

  .order-vi {
    font-size: 0.68rem;
  }

  .scroll-cue {
    left: auto;
    right: 16px;
    bottom: 72px;
    max-width: min(38vw, 330px);
  }

  .progress-rail {
    display: none;
  }
}

@keyframes cue-bounce {
  0%, 100% {
    transform: translateY(-2px);
  }

  50% {
    transform: translateY(4px);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .scroll-room {
    height: 140vh;
  }

  .scroll-arrow {
    animation: none;
  }
}
