:root {
  --red: #ff1701;
  --off: #f4f4f4;
  --char: #161616;
  --grey: #a5a5a2;
  --line: rgba(244, 244, 244, 0.2);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--off);
  background:
    linear-gradient(rgba(22, 22, 22, 0.88), rgba(22, 22, 22, 0.96)),
    url("../images/sia.jpg") center / cover fixed;
  font-family: "Helvetica Neue", Arial, sans-serif;
}

a {
  color: inherit;
}

button {
  font: inherit;
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 92px;
  padding: 0.8rem clamp(1.25rem, 5vw, 5rem);
  border-bottom: 1px solid var(--line);
  background: rgba(22, 22, 22, 0.72);
  backdrop-filter: blur(12px);
}

.game-header img {
  display: block;
  width: 118px;
  height: 66px;
  object-fit: contain;
}

.game-header p,
.kicker,
.message-kicker,
.hud,
.tip,
footer {
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

main {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(2.5rem, 7vw, 6rem) 0 5rem;
}

.intro {
  display: grid;
  grid-template-columns: 1fr minmax(260px, 470px);
  align-items: end;
  gap: 2rem;
  margin-bottom: 2.5rem;
}

.intro .kicker {
  grid-column: 1 / -1;
  margin: 0 0 -1rem;
  color: var(--red);
}

.intro h1 {
  margin: 0;
  font-size: clamp(4rem, 10vw, 8.8rem);
  line-height: 0.77;
  letter-spacing: -0.075em;
  text-transform: uppercase;
}

.intro > p:last-child {
  max-width: 42ch;
  margin: 0;
  color: #c9c9c6;
  font-size: clamp(1rem, 2vw, 1.2rem);
}

.intro strong {
  color: var(--red);
}

.value-white,
.value-yellow,
.value-purple,
.value-red {
  font-weight: 900;
  text-transform: uppercase;
}

.value-white {
  color: var(--off);
}

.value-yellow {
  color: #ffB500;
}

.value-purple {
  color: #a92dff;
}

.value-red {
  color: var(--red);
}

.arcade {
  border: 1px solid var(--line);
  background: #0e0e0e;
  box-shadow: 14px 14px 0 var(--red);
}

.hud {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 4vw, 3.5rem);
  padding: 0.9rem 1.2rem;
  color: var(--grey);
  border-bottom: 1px solid var(--line);
}

.hud strong {
  color: var(--off);
}

.power-status {
  min-width: 9.5rem;
  padding: 0.45rem 0.65rem;
  color: var(--grey);
  border: 1px solid var(--line);
  text-align: center;
}

.power-status strong {
  margin-left: 0.3rem;
  font-size: 0.82rem;
}

.power-status.is-active {
  color: var(--char);
  background: #ffd400;
  border-color: #ffd400;
  box-shadow: 0 0 0 3px rgba(255, 212, 0, 0.18);
}

.power-status.is-active strong {
  color: var(--char);
}

.power-status.is-ending {
  color: var(--off);
  background: var(--red);
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(255, 23, 1, 0.22);
  animation: power-pulse 700ms steps(2, end) infinite;
}

.power-status.is-ending strong {
  color: var(--off);
}

@keyframes power-pulse {
  50% {
    opacity: 0.62;
  }
}

.hud button {
  margin-left: auto;
  padding: 0;
  color: var(--off);
  background: none;
  border: 0;
  font: inherit;
  letter-spacing: inherit;
  text-transform: uppercase;
  cursor: pointer;
}

.hud button:hover,
.hud button:focus-visible {
  color: var(--red);
}

.cabinet {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 13;
  overflow: hidden;
  background: #090909;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.game-message {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 2rem;
  text-align: center;
  background: rgba(9, 9, 9, 0.82);
  backdrop-filter: blur(5px);
}

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

.message-kicker {
  margin: 0 0 1rem;
  color: var(--red);
}

.game-message h2 {
  margin: 0;
  font-size: clamp(2.5rem, 8vw, 6.8rem);
  line-height: 0.82;
  letter-spacing: -0.06em;
  text-transform: uppercase;
}

.game-message > p:not(.message-kicker) {
  max-width: 44ch;
  margin: 1.25rem auto;
  color: #c9c9c6;
}

.start-button {
  padding: 1rem 1.35rem;
  color: var(--off);
  background: var(--red);
  border: 0;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
}

.start-button:hover,
.start-button:focus-visible {
  color: var(--red);
  background: var(--off);
}

.touch-controls {
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
  border-top: 1px solid var(--line);
}

.touch-controls button {
  min-height: 64px;
  color: var(--off);
  background: var(--char);
  border: 0;
  font-size: 1.6rem;
  font-weight: 900;
  touch-action: manipulation;
}

.touch-controls button:active,
.touch-controls button.is-held {
  color: var(--char);
  background: var(--red);
}

.tip {
  margin: 0;
  padding: 1rem 1.2rem;
  color: var(--grey);
  border-top: 1px solid var(--line);
}

.tip strong {
  color: var(--off);
}

.status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.newsletter-cta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(2rem, 6vw, 6rem);
  margin-top: 2.5rem;
  padding: clamp(2rem, 6vw, 5rem);
  background: var(--off);
  color: var(--char);
  box-shadow: 14px 14px 0 var(--red);
}

.newsletter-cta .message-kicker {
  color: var(--red);
}

.newsletter-cta h2 {
  margin: 0;
  font-size: clamp(2.7rem, 7vw, 6rem);
  line-height: 0.84;
  letter-spacing: -0.06em;
  text-transform: uppercase;
}

.newsletter-cta > a {
  padding: 1rem 1.25rem;
  color: var(--off);
  background: var(--red);
  border: 0;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-decoration: none;
  text-transform: uppercase;
}

.newsletter-cta > a:hover,
.newsletter-cta > a:focus-visible {
  color: var(--red);
  background: var(--char);
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem clamp(1.25rem, 5vw, 5rem);
  color: var(--grey);
  border-top: 1px solid var(--line);
}

footer a:hover,
footer a:focus-visible {
  color: var(--red);
}

@media (max-width: 700px) {
  html,
  body {
    min-height: 100%;
  }

  body {
    background: #090909;
    overscroll-behavior: none;
  }

  .game-header,
  .intro,
  footer {
    display: none;
  }

  main {
    width: 100%;
    height: 100dvh;
    margin: 0;
    padding: 0;
  }

  .arcade {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: 100%;
    height: 100dvh;
    border: 0;
    box-shadow: none;
  }

  .hud {
    min-height: 48px;
    justify-content: space-between;
    gap: 0.5rem;
    padding-inline: 0.7rem;
    font-size: 0.58rem;
    letter-spacing: 0.08em;
  }

  .hud button {
    margin-left: 0;
  }

  .power-status {
    min-width: 0;
    padding: 0.35rem 0.4rem;
  }

  .power-status strong {
    display: block;
    margin: 0.12rem 0 0;
    font-size: 0.64rem;
  }

  .touch-controls {
    display: grid;
  }

  .cabinet {
    width: 100%;
    height: 100%;
    min-height: 0;
    aspect-ratio: auto;
  }

  canvas {
    width: 100%;
    height: 100%;
  }

  .newsletter-cta {
    grid-template-columns: 1fr;
    gap: 1.25rem;
    margin: 0;
    padding: 2rem 1.25rem;
    box-shadow: none;
  }

  .newsletter-cta h2 {
    font-size: clamp(2.4rem, 14vw, 4rem);
  }

  .newsletter-cta > a {
    justify-self: start;
  }

  .tip {
    display: none;
  }

  .game-message {
    padding: 1rem;
  }

  .game-message > p:not(.message-kicker) {
    margin: 0.8rem auto;
    font-size: 0.78rem;
  }

  .start-button {
    padding: 0.8rem 1rem;
  }

}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }
}

/* Keep the completed photo visible above the next-level control. */
.game-message.level-cleared {
  inset: auto 0 0;
  padding: 16px;
  background: rgba(9, 9, 9, 0.9);
  backdrop-filter: none;
}
.game-message.level-cleared .message-kicker,
.game-message.level-cleared h2 { display: none; }
.game-message.level-cleared > p:not(.message-kicker) { margin: 0 0 12px; font-size: 0.78rem; }

.arrow-icon { display: inline-block; width: 1.1em; height: 1.1em; vertical-align: -0.18em; flex-shrink: 0; pointer-events: none; }
