html,
body {
  margin: 0;
  padding: 0;
  background: #ff9270;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Crect width='24' height='24' fill='none'/%3E%3Crect x='5' y='4' width='4' height='4' fill='%236b4636'/%3E%3Crect x='15' y='4' width='4' height='4' fill='%236b4636'/%3E%3Crect x='3' y='6' width='8' height='8' fill='%236b4636'/%3E%3Crect x='13' y='6' width='8' height='8' fill='%236b4636'/%3E%3Crect x='5' y='8' width='4' height='4' fill='%23ff7a93'/%3E%3Crect x='15' y='8' width='4' height='4' fill='%23ff7a93'/%3E%3Crect x='5' y='12' width='14' height='4' fill='%236b4636'/%3E%3Crect x='7' y='12' width='10' height='4' fill='%23ff7a93'/%3E%3Crect x='7' y='16' width='10' height='4' fill='%236b4636'/%3E%3Crect x='9' y='16' width='6' height='4' fill='%23ff7a93'/%3E%3Crect x='9' y='20' width='6' height='2' fill='%236b4636'/%3E%3Crect x='11' y='20' width='2' height='2' fill='%23ff7a93'/%3E%3C/svg%3E") 12 12, auto;
}

* {
  image-rendering: pixelated;
}

button,
a,
select,
input,
label,
[onclick],
[onClick] {
  cursor: inherit !important;
}

.arcade-cabinet {
  position: fixed;
  inset: 0;
  z-index: 58;
  pointer-events: none;
  font-family: Silkscreen, monospace;
}

.crt-power-off {
  position: fixed;
  inset: 0;
  z-index: 121;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at center, rgba(255, 248, 240, 0.08) 0%, transparent 28%),
    #050308;
  cursor: inherit;
}

.crt-power-off::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(520px, 72vw);
  height: 3px;
  transform: translate(-50%, -50%);
  background: rgba(255, 248, 240, 0.35);
  box-shadow:
    0 0 10px rgba(255, 248, 240, 0.5),
    0 0 26px rgba(255, 93, 115, 0.35);
  animation: blink 1.2s steps(1) infinite;
}

.crt-power-prompt {
  position: relative;
  margin-top: 72px;
  font-family: "Press Start 2P", monospace;
  font-size: 12px;
  line-height: 1.6;
  color: #ffe08a;
  text-align: center;
  text-shadow:
    0 0 10px rgba(255, 224, 138, 0.7),
    3px 3px 0 #6b4636;
  animation: blink 1s steps(1) infinite;
}

.crt-power-on {
  position: fixed;
  inset: 0;
  z-index: 120;
  pointer-events: none;
  background: #050308;
  animation: crtOverlayBoot 1.45s steps(1) forwards;
}

/* The screen dying — a CRT collapsing to a line, then a dot, then nothing. */
.crt-power-down {
  position: fixed;
  inset: 0;
  z-index: 210;
  pointer-events: all;
  background-color: rgba(5, 3, 8, 0);
  animation: crtDownBg 1.75s ease-in forwards;
}

.crt-power-down::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: #fff8f0;
  box-shadow:
    0 0 16px #fff8f0,
    0 0 42px rgba(255, 93, 115, 0.85),
    0 0 80px rgba(155, 217, 242, 0.5);
  animation: crtCollapse 1.75s cubic-bezier(0.6, 0, 0.2, 1) forwards;
}

@keyframes crtDownBg {
  0% { background-color: rgba(5, 3, 8, 0); }
  22% { background-color: rgba(5, 3, 8, 1); }
  100% { background-color: rgba(5, 3, 8, 1); }
}

@keyframes crtCollapse {
  0% { width: min(86vw, 680px); height: 62vh; opacity: 0; }
  9% { width: min(86vw, 680px); height: 62vh; opacity: 0.95; }
  34% { width: min(86vw, 680px); height: 4px; opacity: 1; }
  70% { width: 7px; height: 4px; opacity: 1; }
  86% { width: 4px; height: 4px; opacity: 0.95; }
  100% { width: 0; height: 0; opacity: 0; }
}

/* Credits — the game is over, and it stays over. */
.credits-screen {
  position: fixed;
  inset: 0;
  z-index: 205;
  background:
    radial-gradient(ellipse at center, rgba(255, 93, 115, 0.06) 0%, transparent 60%),
    #050308;
  display: flex;
  align-items: stretch;
  justify-content: center;
  overflow: hidden;
  cursor: default;
}

.credits-scroll {
  position: relative;
  width: min(560px, 92vw);
  height: 100vh;
  overflow: hidden;
}

.credits-inner {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 82vh;
  padding-bottom: 60vh;
  will-change: transform;
}

.credits-scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.22) 0px,
    rgba(0, 0, 0, 0.22) 1px,
    transparent 1px,
    transparent 3px
  );
}

/* Pixel-arcade scrollbar for the secret letter */
#konami-scroll {
  scrollbar-width: thin;
  scrollbar-color: #ff5d73 #160a12;
}

#konami-scroll::-webkit-scrollbar {
  width: 12px;
}

#konami-scroll::-webkit-scrollbar-track {
  background: #160a12;
  border-left: 2px solid #1e0d24;
}

#konami-scroll::-webkit-scrollbar-thumb {
  background: #ff5d73;
  border: 2px solid #0b0810;
  box-shadow:
    inset 2px 2px 0 #ff9fb0,
    inset -2px -2px 0 #b83a52;
}

#konami-scroll::-webkit-scrollbar-thumb:hover {
  background: #ff7a93;
}

#konami-scroll::-webkit-scrollbar-thumb:active {
  background: #ff9fb0;
}

/* The resting place — where every visit lands once the game is over. */
.rested-screen {
  position: fixed;
  inset: 0;
  z-index: 205;
  background:
    radial-gradient(ellipse at center, rgba(255, 93, 115, 0.05) 0%, transparent 62%),
    #050308;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 36px;
  padding: 24px;
  box-sizing: border-box;
  overflow: hidden;
  cursor: default;
  animation: restFadeIn 1.8s ease forwards;
}

.rested-heart {
  width: 25px;
  height: 25px;
  transform: scale(2.3);
  transform-origin: center;
  animation: restPulse 3.6s ease-in-out infinite;
}

.rested-clocks {
  display: flex;
  gap: min(56px, 14vw);
  align-items: flex-start;
}

.rested-clock {
  text-align: center;
}

.rested-clock-label {
  font-family: Silkscreen, monospace;
  font-size: 10px;
  letter-spacing: 2px;
  color: #9bd9f2;
  opacity: 0.75;
  margin-bottom: 9px;
}

.rested-clock-time {
  font-family: "Press Start 2P", monospace;
  font-size: 17px;
  color: #ffe08a;
  text-shadow: 0 0 10px rgba(255, 224, 138, 0.32);
}

.rested-line {
  font-family: Silkscreen, monospace;
  font-size: 13px;
  letter-spacing: 2px;
  color: #6a5a72;
  text-align: center;
}

@keyframes restFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes restPulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.crt-power-on::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 4px;
  transform: translate(-50%, -50%);
  background: #fff8f0;
  box-shadow:
    0 0 12px #fff8f0,
    0 0 28px rgba(255, 93, 115, 0.85),
    0 0 52px rgba(155, 217, 242, 0.45);
  animation: crtLineBoot 1.2s ease-out forwards;
}

.crt-power-on::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.18) 0 2px, transparent 2px 5px),
    radial-gradient(ellipse at center, rgba(255, 248, 240, 0.3) 0%, rgba(255, 93, 115, 0.12) 34%, transparent 68%);
  animation: crtFlashBoot 1.45s ease-out forwards;
}

.pixel-screen-mask {
  position: absolute;
  background: linear-gradient(135deg, #21162a 0%, #120b1a 55%, #0b0810 100%);
  border-color: #6b4636;
  border-style: solid;
  box-shadow:
    inset 0 0 0 2px rgba(255, 224, 138, 0.08),
    inset 0 0 24px rgba(0, 0, 0, 0.68);
  z-index: 0;
}

.pixel-screen-mask.top {
  left: 0;
  right: 0;
  top: 0;
  height: 74px;
  border-width: 0 0 4px;
}

.pixel-screen-mask.bottom {
  left: 0;
  right: 0;
  bottom: 0;
  height: 52px;
  border-width: 4px 0 0;
}

.pixel-screen-mask.left {
  left: 0;
  top: 74px;
  bottom: 52px;
  width: 54px;
  border-width: 0 4px 0 0;
}

.pixel-screen-mask.right {
  right: 0;
  top: 74px;
  bottom: 52px;
  width: 54px;
  border-width: 0 0 0 4px;
}

.pixel-screen-mask::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.16;
  background: repeating-linear-gradient(0deg, transparent 0 7px, rgba(255, 255, 255, 0.08) 7px 8px);
}

.pixel-screen-mask::after {
  content: none;
}

.pixel-screen-frame {
  position: absolute;
  inset: 74px 54px 52px;
  border: 8px solid #241531;
  box-shadow:
    inset 0 0 0 4px #6b4636,
    inset 0 0 0 8px #120b1a,
    inset 0 0 28px rgba(255, 224, 138, 0.16),
    0 0 0 4px #6b4636,
    0 0 0 8px #160d20,
    0 0 24px rgba(255, 93, 115, 0.25);
  z-index: 1;
}

.pixel-screen-frame::before,
.pixel-screen-frame::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  background: #7c5a72;
  border: 3px solid #120b1a;
  box-shadow:
    inset 2px 2px 0 #a07a90,
    inset -2px -2px 0 #3a2738,
    0 0 8px rgba(255, 224, 138, 0.22);
}

.pixel-screen-frame::before {
  left: 12px;
  top: 12px;
}

.pixel-screen-frame::after {
  right: 12px;
  top: 12px;
}

.pixel-screen-screw {
  position: absolute;
  bottom: 12px;
  width: 12px;
  height: 12px;
  background: #7c5a72;
  border: 3px solid #120b1a;
  box-shadow:
    inset 2px 2px 0 #a07a90,
    inset -2px -2px 0 #3a2738,
    0 0 8px rgba(255, 224, 138, 0.22);
}

.pixel-screen-screw.left {
  left: 12px;
}

.pixel-screen-screw.right {
  right: 12px;
}

.pixel-screen-led {
  position: absolute;
  right: 38px;
  bottom: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: #7be0a0;
  letter-spacing: 1px;
  text-shadow: 0 0 8px rgba(123, 224, 160, 0.72);
}

.pixel-screen-led::before {
  content: "";
  width: 8px;
  height: 8px;
  background: #7be0a0;
  box-shadow: 0 0 8px rgba(123, 224, 160, 0.9);
  animation: blink 1.5s steps(1) infinite;
}

.arcade-marquee {
  position: absolute;
  left: 50%;
  top: 10px;
  transform: translateX(-50%);
  width: min(620px, calc(100vw - 28px));
  box-sizing: border-box;
  background: #241531;
  border: 4px solid #6b4636;
  box-shadow:
    inset 3px 3px 0 #3a2348,
    inset -3px -3px 0 #160d20,
    5px 5px 0 rgba(20, 10, 28, 0.45),
    0 0 18px rgba(255, 93, 115, 0.35);
  padding: 10px 14px;
  text-align: center;
  z-index: 2;
}

.arcade-marquee-title {
  font-family: "Press Start 2P", monospace;
  font-size: 15px;
  line-height: 1.4;
  color: #ff5d73;
  letter-spacing: 1px;
  text-shadow:
    0 0 10px rgba(255, 93, 115, 0.75),
    3px 3px 0 #6b1f2e;
}

.arcade-marquee-sub {
  margin-top: 5px;
  font-size: 11px;
  color: #9bd9f2;
  letter-spacing: 2px;
}

.arcade-side-label {
  position: absolute;
  top: 50%;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: translateY(-50%);
  background: #120b1a;
  border: 3px solid #4a2d52;
  box-shadow:
    inset 2px 2px 0 #33203e,
    3px 3px 0 rgba(20, 10, 28, 0.42);
  padding: 10px 6px;
  font-size: 12px;
  color: #ffe08a;
  letter-spacing: 2px;
  text-shadow: 0 0 8px rgba(255, 224, 138, 0.72);
  z-index: 2;
}

.arcade-side-label.left {
  left: 10px;
}

.arcade-side-label.right {
  right: 10px;
}

.arcade-control-deck {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  width: min(560px, calc(100vw - 30px));
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: #2a1c2c;
  border: 4px solid #6b4636;
  box-shadow:
    inset 3px 3px 0 #3a2738,
    inset -3px -3px 0 #160d20,
    5px 5px 0 rgba(20, 10, 28, 0.42);
  padding: 10px 14px;
  z-index: 2;
}

.arcade-coin-slot {
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: #9bd9f2;
  font-size: 10px;
  letter-spacing: 1px;
}

.arcade-coin-slot::before {
  content: "";
  display: block;
  width: 66px;
  height: 12px;
  background: #0b0810;
  border: 3px solid #7c5a72;
  box-shadow:
    inset 2px 2px 0 #000,
    0 0 8px rgba(155, 217, 242, 0.28);
}

.arcade-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
}

.arcade-button-light {
  width: 22px;
  height: 22px;
  border: 3px solid #6b4636;
  box-shadow:
    inset 3px 3px 0 rgba(255, 255, 255, 0.35),
    inset -3px -3px 0 rgba(0, 0, 0, 0.18),
    3px 3px 0 rgba(20, 10, 28, 0.5);
}

.arcade-button-light.red {
  background: #ff5d73;
}

.arcade-button-light.blue {
  background: #9bd9f2;
}

.arcade-button-light.yellow {
  background: #ffe08a;
}

.arcade-start-label {
  font-family: "Press Start 2P", monospace;
  font-size: 9px;
  line-height: 1.4;
  color: #ff9fb0;
  text-align: right;
}

@media (max-width: 760px) {
  .arcade-side-label {
    display: none;
  }

  .arcade-marquee {
    top: 7px;
    padding: 8px 10px;
  }

  .arcade-marquee-title {
    font-size: 11px;
  }

  .arcade-marquee-sub {
    font-size: 9px;
  }

  .arcade-control-deck {
    bottom: 7px;
    padding: 8px 10px;
  }

  .pixel-screen-frame {
    inset: 62px 12px 48px;
    border-width: 5px;
    box-shadow:
      inset 0 0 0 3px #6b4636,
      inset 0 0 0 6px #120b1a,
      0 0 0 3px #6b4636,
      0 0 0 6px #160d20;
  }

  .pixel-screen-mask.top {
    height: 62px;
  }

  .pixel-screen-mask.bottom {
    height: 48px;
  }

  .pixel-screen-mask.left {
    top: 62px;
    bottom: 48px;
    width: 12px;
  }

  .pixel-screen-mask.right {
    top: 62px;
    bottom: 48px;
    width: 12px;
  }

  .pixel-screen-frame::before,
  .pixel-screen-frame::after,
  .pixel-screen-screw,
  .pixel-screen-led {
    display: none;
  }

  .arcade-start-label {
    display: none;
  }
}

@keyframes bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-9px);
  }
}

@keyframes hop {
  0%,
  100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-26px);
  }
  50% {
    transform: translateY(0);
  }
  55% {
    transform: translateY(-5px);
  }
  62% {
    transform: translateY(0);
  }
}

@keyframes tremble {
  0%,
  100% {
    transform: translate(0, 0) rotate(0);
  }
  20% {
    transform: translate(-3px, 1px) rotate(-2.5deg);
  }
  40% {
    transform: translate(3px, -1px) rotate(2.5deg);
  }
  60% {
    transform: translate(-2px, 1px) rotate(-1.5deg);
  }
  80% {
    transform: translate(2px, 0) rotate(1.5deg);
  }
}

@keyframes drip {
  0% {
    transform: translateY(0);
    opacity: 0;
  }
  15% {
    opacity: 1;
  }
  100% {
    transform: translateY(34px);
    opacity: 0;
  }
}

@keyframes floatUp {
  0% {
    transform: translateY(12px) scale(0.85);
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  100% {
    transform: translateY(-150px) scale(0.5);
    opacity: 0;
  }
}

@keyframes fall {
  0% {
    transform: translateY(-30px) rotate(0);
  }
  100% {
    transform: translateY(108vh) rotate(540deg);
  }
}

@keyframes floatBg {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-12px);
  }
}

@keyframes glowPulse {
  0%,
  100% {
    box-shadow:
      inset 3px 3px 0 #ffb09c,
      inset -3px -3px 0 #d8472f,
      5px 5px 0 #6b4636,
      0 0 0 0 rgba(255, 93, 115, 0.5);
  }
  50% {
    box-shadow:
      inset 3px 3px 0 #ffb09c,
      inset -3px -3px 0 #d8472f,
      5px 5px 0 #6b4636,
      0 0 0 10px rgba(255, 93, 115, 0);
  }
}

@keyframes blink {
  0%,
  48% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0.25;
  }
}

@keyframes twinkle {
  0%,
  100% {
    opacity: 1;
  }
  45% {
    opacity: 0.12;
  }
}

@keyframes rainFall {
  0%   { transform: translateY(-30px) rotate(10deg); }
  100% { transform: translateY(110vh) rotate(10deg); }
}
@keyframes snowFall {
  0%   { transform: translateY(-20px) translateX(0px); opacity: 0.9; }
  33%  { transform: translateY(33vh) translateX(12px); }
  66%  { transform: translateY(66vh) translateX(-8px); }
  100% { transform: translateY(110vh) translateX(4px); opacity: 0.3; }
}
@keyframes cloudFloat {
  0%   { transform: translateX(-320px); opacity: 0; }
  8%   { opacity: 0.55; }
  92%  { opacity: 0.55; }
  100% { transform: translateX(110vw); opacity: 0; }
}
@keyframes lightningFlash {
  0%, 88%, 91%, 95%, 97%, 100% { opacity: 0; }
  89%, 93%, 96% { opacity: 0.18; }
}

@keyframes planeCruise {
  0% {
    transform: translateX(-140px);
    opacity: 0;
  }
  8%,
  88% {
    opacity: 0.9;
  }
  100% {
    transform: translateX(calc(100vw + 140px));
    opacity: 0;
  }
}

@keyframes neonFlicker {
  0%,
  100% {
    opacity: 1;
  }
  48% {
    opacity: 0.82;
  }
  50% {
    opacity: 0.35;
  }
  52% {
    opacity: 1;
  }
  76% {
    opacity: 0.68;
  }
  78% {
    opacity: 1;
  }
}

@keyframes crtOverlayBoot {
  0%,
  72% {
    opacity: 1;
  }
  86% {
    opacity: 0.38;
  }
  100% {
    opacity: 0;
    visibility: hidden;
  }
}

@keyframes crtLineBoot {
  0% {
    width: 0;
    height: 3px;
    opacity: 0;
  }
  18% {
    width: 64vw;
    height: 3px;
    opacity: 1;
  }
  38% {
    width: 78vw;
    height: 3px;
    opacity: 0.8;
  }
  56% {
    width: 86vw;
    height: 22vh;
    opacity: 0.65;
  }
  74% {
    width: 100vw;
    height: 100vh;
    opacity: 0.28;
  }
  100% {
    width: 100vw;
    height: 100vh;
    opacity: 0;
  }
}

@keyframes crtFlashBoot {
  0%,
  28% {
    opacity: 0;
  }
  36% {
    opacity: 0.42;
  }
  44% {
    opacity: 0.08;
  }
  58% {
    opacity: 0.24;
  }
  100% {
    opacity: 0;
  }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes achievementPop {
  0% {
    transform: translate(-50%, -16px) scale(0.88);
    opacity: 0;
  }
  12% {
    transform: translate(-50%, 0) scale(1);
    opacity: 1;
  }
  82% {
    transform: translate(-50%, 0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -10px) scale(0.96);
    opacity: 0;
  }
}

/* ============================================================
   Mobile friendliness
   ============================================================ */

/* Never let the page scroll sideways. */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

/* Snappy, native-feeling taps: no grey flash, no 300ms delay,
   no double-tap-to-zoom on the game controls, no text-selection
   flicker when tapping buttons rapidly. */
* {
  -webkit-tap-highlight-color: transparent;
}

button,
a,
select,
input,
[onclick],
[onClick] {
  touch-action: manipulation;
}

button,
[onclick],
[onClick] {
  -webkit-user-select: none;
  user-select: none;
}

/* Form fields must be >=16px or iOS Safari zooms the whole page on
   focus. Overrides the 15px inline styles on the date form. */
input,
select,
textarea {
  font-size: 16px !important;
}

@media (max-width: 760px) {
  /* Give the game content room to clear the fixed marquee (top) and
     control deck (bottom) so tall screens (the win/date form) aren't
     hidden behind the cabinet chrome. */
  .game-content {
    padding-top: 68px !important;
    padding-bottom: 64px !important;
  }
}

@media (max-width: 480px) {
  /* Resting screen: keep both clocks on one comfortable row. */
  .rested-clocks {
    gap: 20px;
  }

  .rested-clock-time {
    font-size: 14px;
  }

  .rested-clock-label {
    font-size: 9px;
    letter-spacing: 1px;
  }

  .rested-line {
    font-size: 11px;
  }

  .rested-screen {
    gap: 28px;
  }
}
