/* Shared fit-and-finish for every standalone cartridge. */
.arcade-pause-toggle, .arcade-effects-toggle {
  position: absolute;
  bottom: 10px;
  z-index: 20;
  padding: 8px;
  min-height: 44px;
  font: 8px/1.3 "Press Start 2P", monospace;
  background: #080c21;
  color: #d7e8ff;
  border: 1px solid #8593b0;
}
.arcade-pause-toggle { left: 10px; }
.arcade-effects-toggle { left: 100px; }
.arcade-pause-screen {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  background: rgba(4, 4, 16, .94);
  color: white;
  font: 16px "Press Start 2P", monospace;
}
.arcade-pause-screen[hidden], .arcade-pause-toggle[hidden] { display: none; }

html {
  background: #040410;
}

body {
  overscroll-behavior: none;
}

#game-canvas {
  touch-action: none;
}

#start-screen,
#game-over {
  padding: 28px;
  text-align: center;
}

#start-screen > *,
#game-over > * {
  max-width: 100%;
}

.subtitle {
  width: min(94%, 720px);
  line-height: 1.65;
  text-wrap: balance;
}

.controls-info {
  width: min(94%, 720px);
  text-wrap: balance;
}

button {
  min-width: 44px;
  min-height: 44px;
}

button:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 4px;
}

.arcade-sound-toggle {
  position: absolute;
  z-index: 20;
  right: 10px;
  bottom: 10px;
  min-width: 112px;
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid currentColor;
  border-radius: 2px;
  background: rgba(5, 5, 20, 0.86);
  color: #b8c4d8;
  box-shadow: none;
  font: 8px/1.3 "Press Start 2P", monospace;
  opacity: 0.78;
  cursor: pointer;
}

.arcade-sound-toggle:hover,
.arcade-sound-toggle:focus-visible {
  color: #fff;
  opacity: 1;
}

.arcade-difficulty-badge {
  position: absolute;
  z-index: 19;
  left: 10px;
  bottom: 10px;
  min-height: 22px;
  padding: 6px 8px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(5, 5, 20, 0.8);
  color: #b8c4d8;
  font: 8px/1.3 "Press Start 2P", monospace;
  pointer-events: none;
}

.arcade-difficulty-toast {
  position: absolute;
  z-index: 22;
  top: 74px;
  left: 50%;
  width: max-content;
  max-width: 86%;
  padding: 10px 14px;
  transform: translateX(-50%);
  border: 1px solid #ffcc33;
  background: rgba(5, 5, 20, 0.94);
  color: #ffcc33;
  font: 10px/1.4 "Press Start 2P", monospace;
  text-align: center;
  pointer-events: none;
  animation: arcade-difficulty-rise 1.5s ease both;
}

@keyframes arcade-difficulty-rise {
  0% { opacity: 0; transform: translate(-50%, 8px) scale(0.96); }
  12%, 78% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -6px) scale(0.98); }
}

#game-wrapper[data-difficulty="4"] .arcade-difficulty-badge,
#game-wrapper[data-difficulty="5"] .arcade-difficulty-badge {
  border-color: rgba(255, 70, 100, 0.7);
  color: #ff6b81;
}

.arcade-hook-card {
  display: grid;
  gap: 5px;
  width: min(620px, 88%);
  margin: 10px auto;
  padding: 9px 12px;
  border: 1px solid color-mix(in srgb, currentColor 45%, transparent);
  background: rgba(5, 5, 20, 0.72);
  line-height: 1.45;
  text-align: center;
}

.arcade-hook-label {
  color: #ffd700;
  font-size: clamp(8px, 1.35vw, 11px);
  letter-spacing: 0.08em;
}

.arcade-hook-copy,
.arcade-hook-progress,
.arcade-replay-line {
  font-size: clamp(7px, 1.15vw, 9px);
}

.arcade-hook-copy { color: rgba(255, 255, 255, 0.84); }
.arcade-hook-progress,
.arcade-replay-line { color: #00ffcc; }

.arcade-replay-line {
  margin: 4px 0 10px;
  text-align: center;
}

.arcade-hook-toast {
  position: absolute;
  z-index: 15;
  top: 58px;
  left: 50%;
  width: max-content;
  max-width: 88%;
  padding: 9px 14px;
  transform: translateX(-50%);
  border: 1px solid #ffd700;
  background: rgba(5, 5, 20, 0.92);
  color: #ffd700;
  font-size: clamp(8px, 1.35vw, 11px);
  line-height: 1.4;
  text-align: center;
  pointer-events: none;
  animation: arcade-hook-pop 1.6s ease both;
}

@keyframes arcade-hook-pop {
  0% { opacity: 0; transform: translate(-50%, -8px) scale(0.96); }
  12%, 78% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -4px) scale(0.98); }
}

@media (max-width: 560px) {
  body {
    padding: 4px;
  }

  #game-wrapper {
    max-width: calc(100vw - 8px);
  }

  #game-canvas {
    width: 100%;
    height: auto;
  }

  #start-screen,
  #game-over {
    padding: 18px;
  }

  .title-text,
  #start-screen h1 {
    font-size: clamp(18px, 6vw, 28px);
    line-height: 1.35;
  }

  .subtitle,
  .controls-info {
    margin-bottom: 14px;
  }

  .arcade-hook-card {
    gap: 3px;
    width: 92%;
    margin: 6px auto;
    padding: 6px 8px;
  }

  .arcade-sound-toggle {
    right: 6px;
    bottom: 6px;
    min-width: 98px;
    min-height: 32px;
    padding: 6px 7px;
    font-size: 7px;
  }

  .arcade-difficulty-badge {
    left: 6px;
    bottom: 6px;
    padding: 5px 6px;
    font-size: 7px;
  }
}

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

  .arcade-hook-toast { animation: none; }
  .arcade-difficulty-toast { animation: none; }
}
