:root {
  color-scheme: dark;
  --ink: #07090d;
  --panel: #0c1119;
  --white: #f6f8fb;
  --muted: #97a2b3;
  --cyan: #1ec8ff;
  --blue: #155cff;
  --amber: #ffb347;
  --line: rgba(255, 255, 255, 0.16);
  --safe-top: max(24px, env(safe-area-inset-top));
  --safe-bottom: max(24px, env(safe-area-inset-bottom));
}

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  height: 100%;
  background: var(--ink);
}

body {
  width: 100%;
  height: 100%;
  max-width: 100%;
  min-width: 300px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  overflow: hidden;
  color: var(--white);
  background: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

[hidden] {
  display: none !important;
}

.topbar {
  position: fixed;
  z-index: 20;
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--safe-top) 4vw 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 9, 13, 0.58);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--white);
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 26px;
  place-items: center;
  color: #061019;
  background: var(--cyan);
  clip-path: polygon(16% 0, 100% 0, 84% 100%, 0 100%);
  font-size: 0.68rem;
}

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.65rem;
  font-weight: 700;
}

.status-light {
  width: 7px;
  height: 7px;
  background: #5cf0a5;
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(92, 240, 165, 0.7);
}

#story,
.scene {
  position: absolute;
  inset: 0;
}

.scene {
  z-index: 1;
  display: flex;
  align-items: center;
  padding: 108px 8vw 112px;
  overflow: hidden;
  visibility: hidden;
  opacity: 0;
  transform: scale(1.025);
  transition:
    opacity 520ms ease,
    transform 800ms cubic-bezier(0.2, 0.72, 0.2, 1),
    visibility 0s linear 800ms;
}

.scene.is-active {
  z-index: 2;
  visibility: visible;
  opacity: 1;
  transform: scale(1);
  transition-delay: 0s;
}

.scene-copy {
  position: relative;
  z-index: 5;
  width: min(780px, 64vw);
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 22px;
  color: #b8c2d1;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.72rem;
  font-weight: 800;
}

.eyebrow span {
  padding: 5px 8px;
  color: #061019;
  background: var(--cyan);
  clip-path: polygon(12% 0, 100% 0, 88% 100%, 0 100%);
}

.eyebrow-warm span {
  background: var(--amber);
}

h1,
h2,
p {
  letter-spacing: 0;
}

h1,
h2 {
  margin: 0;
  font-size: 5.7rem;
  line-height: 0.93;
  font-weight: 830;
}

h1 strong,
h2 strong {
  color: var(--cyan);
  font-weight: inherit;
}

.lead {
  max-width: 610px;
  margin: 30px 0 0;
  color: #b8c2d1;
  font-size: 1.08rem;
  line-height: 1.7;
}

.primary-action {
  display: inline-flex;
  min-height: 54px;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 34px;
  padding: 0 22px;
  border: 1px solid var(--cyan);
  border-radius: 4px;
  color: #041018;
  background: var(--cyan);
  box-shadow: 0 12px 44px rgba(30, 200, 255, 0.2);
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 850;
  text-transform: uppercase;
  transition: transform 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.primary-action svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.primary-action:hover {
  transform: translateY(-2px);
  background: #71dcff;
  box-shadow: 0 16px 52px rgba(30, 200, 255, 0.3);
}

.primary-action:active {
  transform: translateY(0);
}

.primary-action:focus-visible,
.restart:focus-visible,
.brand:focus-visible {
  outline: 3px solid var(--white);
  outline-offset: 4px;
}

.primary-action-warm {
  border-color: var(--amber);
  background: var(--amber);
  box-shadow: 0 12px 44px rgba(255, 179, 71, 0.18);
}

.primary-action-warm:hover {
  background: #ffc875;
  box-shadow: 0 16px 52px rgba(255, 179, 71, 0.26);
}

.scene-intro {
  background:
    linear-gradient(90deg, rgba(7, 9, 13, 0.98) 0%, rgba(7, 9, 13, 0.86) 46%, rgba(7, 9, 13, 0.2) 100%),
    linear-gradient(140deg, #07111d 0%, #07090d 56%, #141018 100%);
}

.technical-grid {
  position: absolute;
  inset: 0;
  opacity: 0.28;
  background-image:
    linear-gradient(rgba(30, 200, 255, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30, 200, 255, 0.12) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(90deg, transparent 10%, black 62%, transparent 100%);
}

.road {
  position: absolute;
  right: -2vw;
  bottom: -22vh;
  width: 61vw;
  height: 94vh;
  background: linear-gradient(180deg, rgba(21, 92, 255, 0.04), rgba(21, 92, 255, 0.42));
  clip-path: polygon(48% 0, 52% 0, 100% 100%, 0 100%);
  opacity: 0.56;
}

.road::before,
.road::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, transparent, var(--cyan));
  box-shadow: 0 0 22px rgba(30, 200, 255, 0.6);
}

.road::before {
  left: 34%;
  transform: rotate(13deg);
}

.road::after {
  right: 34%;
  transform: rotate(-13deg);
}

.road span {
  position: absolute;
  left: 50%;
  width: 3px;
  height: 13%;
  background: rgba(255, 255, 255, 0.72);
  transform: translateX(-50%);
  animation: lane 2.2s linear infinite;
}

.road span:nth-child(2) {
  animation-delay: -0.74s;
}

.road span:nth-child(3) {
  animation-delay: -1.48s;
}

@keyframes lane {
  from {
    top: 12%;
    opacity: 0;
    transform: translateX(-50%) scaleY(0.2);
  }
  30% {
    opacity: 1;
  }
  to {
    top: 93%;
    opacity: 0;
    transform: translateX(-50%) scaleY(2.8);
  }
}

.destination {
  position: absolute;
  right: 8vw;
  top: 50%;
  z-index: 3;
  width: 244px;
  padding: 24px 0;
  border-top: 1px solid rgba(30, 200, 255, 0.6);
  border-bottom: 1px solid rgba(30, 200, 255, 0.22);
  transform: translateY(-50%);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.destination span,
.destination small {
  display: block;
  color: var(--muted);
  font-size: 0.62rem;
}

.destination strong {
  display: block;
  margin: 8px 0 22px;
  color: var(--cyan);
  font-size: 1.1rem;
}

.scene-clue {
  background:
    linear-gradient(90deg, #07090d 0%, #0a1018 52%, #07111d 100%);
}

.scene-clue-one::before,
.scene-clue-two::before {
  content: "";
  position: absolute;
  inset: 0 0 0 56%;
  border-left: 1px solid rgba(30, 200, 255, 0.18);
  background:
    repeating-linear-gradient(90deg, transparent 0 84px, rgba(30, 200, 255, 0.07) 85px 86px);
}

.clue-number {
  position: absolute;
  right: 5vw;
  bottom: -14vh;
  color: rgba(30, 200, 255, 0.045);
  font-size: 44rem;
  line-height: 1;
  font-weight: 900;
}

.scan-lines {
  position: absolute;
  top: 17%;
  right: 6vw;
  width: 34vw;
  height: 60%;
  border-top: 1px solid rgba(30, 200, 255, 0.34);
  border-bottom: 1px solid rgba(30, 200, 255, 0.16);
  background: repeating-linear-gradient(0deg, transparent 0 14px, rgba(30, 200, 255, 0.06) 15px 16px);
  transform: skewX(-8deg);
}

.equalizer {
  position: absolute;
  right: 7vw;
  bottom: 25%;
  z-index: 3;
  display: flex;
  height: 270px;
  align-items: center;
  gap: 14px;
}

.equalizer i {
  width: 8px;
  height: 42%;
  background: linear-gradient(180deg, var(--amber), var(--cyan));
  box-shadow: 0 0 18px rgba(30, 200, 255, 0.22);
  animation: equalize 1.2s ease-in-out infinite alternate;
}

.equalizer i:nth-child(2n) {
  animation-delay: -0.6s;
}

.equalizer i:nth-child(3n) {
  animation-delay: -0.3s;
}

.equalizer i:nth-child(4n) {
  animation-delay: -0.9s;
}

@keyframes equalize {
  from { height: 18%; }
  to { height: 95%; }
}

.scene-reveal {
  padding-top: 106px;
}

.reveal-image,
.reveal-shade {
  position: absolute;
  inset: 0;
}

.reveal-image {
  background-image: url("/assets/pantalla-regalo.png");
  background-position: center;
  background-size: cover;
  transform: scale(1.04);
  transition: transform 6s cubic-bezier(0.15, 0.6, 0.2, 1);
}

.scene-reveal.is-active .reveal-image {
  transform: scale(1);
}

.reveal-shade {
  background:
    linear-gradient(90deg, rgba(5, 7, 11, 0.96) 0%, rgba(5, 7, 11, 0.89) 34%, rgba(5, 7, 11, 0.38) 62%, rgba(5, 7, 11, 0.08) 100%),
    linear-gradient(0deg, rgba(5, 7, 11, 0.88) 0%, transparent 38%);
}

.reveal-copy {
  width: min(700px, 50vw);
}

.reveal-copy h2 {
  font-size: 4.8rem;
}

.reveal-answer {
  max-width: 610px;
  margin: 28px 0 0;
  color: #d6dce5;
  font-size: 1.25rem;
  line-height: 1.55;
}

.reveal-answer strong {
  color: var(--amber);
}

.feature-line {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  margin: 28px 0 0;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  list-style: none;
}

.feature-line li {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #d7dde6;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
}

.feature-line svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--cyan);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.final-message {
  max-width: 600px;
  margin: 25px 0 0;
  color: #f4f6f9;
  font-size: 1rem;
  line-height: 1.55;
}

.final-message[hidden] {
  display: none;
}

.final-message strong {
  color: var(--amber);
}

.restart {
  display: block;
  margin: 18px 0 0;
  padding: 4px 0;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.34);
  color: #c0c7d1;
  background: transparent;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.journey-progress {
  position: fixed;
  z-index: 20;
  right: 4vw;
  bottom: var(--safe-bottom);
  display: flex;
  align-items: center;
  gap: 15px;
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.62rem;
}

.progress-label b {
  color: var(--white);
}

.progress-track {
  display: flex;
  gap: 6px;
}

.progress-track i {
  width: 28px;
  height: 3px;
  background: rgba(255, 255, 255, 0.18);
  transition: background-color 300ms ease, box-shadow 300ms ease;
}

.progress-track i.is-passed {
  background: var(--cyan);
  box-shadow: 0 0 12px rgba(30, 200, 255, 0.55);
}

.key-hint {
  position: fixed;
  z-index: 20;
  left: 4vw;
  bottom: var(--safe-bottom);
  margin: 0;
  color: #687383;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.6rem;
  text-transform: uppercase;
}

kbd {
  padding: 2px 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  color: #bbc4d0;
  font: inherit;
}

#confetti {
  position: fixed;
  z-index: 50;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

@media (max-width: 980px) {
  h1,
  h2 {
    font-size: 4.3rem;
  }

  .destination {
    display: none;
  }

  .scene-copy {
    width: min(720px, 78vw);
  }

  .reveal-copy {
    width: min(650px, 66vw);
  }

  .reveal-copy h2 {
    font-size: 4rem;
  }

  .equalizer {
    right: -2vw;
    opacity: 0.5;
  }
}

@media (max-width: 700px) {
  .topbar {
    padding-right: 20px;
    padding-left: 20px;
  }

  .brand {
    font-size: 0.62rem;
  }

  .status {
    font-size: 0;
  }

  .status-light {
    width: 8px;
    height: 8px;
  }

  .scene {
    align-items: flex-start;
    padding: 136px 24px 112px;
  }

  .scene-copy,
  .reveal-copy {
    width: 100%;
  }

  .eyebrow {
    margin-bottom: 18px;
    font-size: 0.65rem;
  }

  h1,
  h2,
  .reveal-copy h2 {
    font-size: 3.2rem;
    line-height: 0.97;
  }

  .lead {
    max-width: 88%;
    margin-top: 24px;
    font-size: 0.98rem;
    line-height: 1.6;
  }

  .primary-action {
    min-height: 52px;
    margin-top: 28px;
    padding: 0 18px;
    font-size: 0.76rem;
  }

  .scene-intro {
    background:
      linear-gradient(180deg, rgba(7, 9, 13, 0.96) 0%, rgba(7, 9, 13, 0.74) 55%, rgba(7, 9, 13, 0.4) 100%),
      linear-gradient(140deg, #07111d 0%, #07090d 56%, #141018 100%);
  }

  .technical-grid {
    background-size: 42px 42px;
  }

  .road {
    right: -35vw;
    width: 126vw;
    opacity: 0.4;
  }

  .clue-number {
    right: -8vw;
    bottom: 5vh;
    font-size: 22rem;
  }

  .scan-lines {
    right: -35vw;
    width: 90vw;
    opacity: 0.55;
  }

  .equalizer {
    right: -18vw;
    bottom: 15%;
    gap: 9px;
    opacity: 0.28;
  }

  .reveal-image {
    background-position: 68% center;
  }

  .reveal-shade {
    background:
      linear-gradient(180deg, rgba(5, 7, 11, 0.98) 0%, rgba(5, 7, 11, 0.88) 48%, rgba(5, 7, 11, 0.38) 74%, rgba(5, 7, 11, 0.76) 100%);
  }

  .reveal-copy h2 {
    max-width: 420px;
  }

  .reveal-answer {
    max-width: 92%;
    margin-top: 22px;
    font-size: 1.05rem;
  }

  .feature-line {
    gap: 16px;
    margin-top: 20px;
    padding: 14px 0;
  }

  .feature-line li {
    font-size: 0.65rem;
  }

  .feature-line svg {
    width: 16px;
    height: 16px;
  }

  .final-message {
    margin-top: 18px;
    font-size: 0.9rem;
  }

  .journey-progress {
    right: 20px;
  }

  .progress-track i {
    width: 20px;
  }

  .key-hint {
    display: none;
  }
}

@media (max-width: 420px), (max-height: 740px) {
  .scene {
    padding-top: 112px;
  }

  h1,
  h2,
  .reveal-copy h2 {
    font-size: 2.65rem;
  }

  .lead {
    font-size: 0.9rem;
  }

  .reveal-answer {
    font-size: 0.95rem;
  }

  .primary-action {
    min-height: 48px;
    margin-top: 22px;
  }

  .feature-line {
    gap: 12px;
  }
}

@media (max-width: 360px), (max-height: 620px) {
  .topbar {
    padding-top: max(14px, env(safe-area-inset-top));
    padding-bottom: 14px;
  }

  .brand {
    gap: 8px;
    font-size: 0.54rem;
  }

  .brand-mark {
    width: 30px;
    height: 24px;
  }

  .scene {
    padding: 94px 16px 68px;
  }

  .eyebrow {
    gap: 8px;
    margin-bottom: 10px;
    font-size: 0.56rem;
  }

  h1,
  h2,
  .reveal-copy h2 {
    font-size: 2.15rem;
  }

  .lead {
    margin-top: 14px;
    font-size: 0.8rem;
    line-height: 1.45;
  }

  .primary-action {
    min-height: 44px;
    margin-top: 14px;
    font-size: 0.66rem;
  }

  .reveal-answer {
    margin-top: 12px;
    font-size: 0.84rem;
    line-height: 1.4;
  }

  .feature-line {
    gap: 10px;
    margin-top: 12px;
    padding: 10px 0;
  }

  .feature-line li {
    gap: 5px;
    font-size: 0.55rem;
  }

  .feature-line svg {
    width: 14px;
    height: 14px;
  }

  .final-message {
    max-width: 270px;
    margin-top: 12px;
    font-size: 0.76rem;
    line-height: 1.4;
  }

  .restart {
    margin-top: 10px;
    font-size: 0.62rem;
  }

  .journey-progress {
    right: 16px;
    bottom: max(14px, env(safe-area-inset-bottom));
  }

  .progress-track i {
    width: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
