*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(
    180deg,
    #dfe7f3 0%,
    #cbd5e1 45%,
    #a8a29e 60%,
    #8d7c6b 100%
  );
  color: #f8fafc;
  font-family:
    "Inter",
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
}

.pixel {
  font-family: "Press Start 2P", "VT323", "Courier New", monospace;
  letter-spacing: 1px;
}

@font-face {
  font-family: "Press Start 2P";
  src: url("/public/assets/fonts/PressStart2P-Regular.ttf") format("truetype");
  font-display: swap;
}

.frame {
  position: relative;
  width: 100vw;
  max-width: 440px;
  height: min(100vh, calc(100vw * 16 / 9));
  max-height: 100vh;
  border: 2px solid #1e293b;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.3);
  display: flex;
  justify-content: center;
  align-items: center;
}

canvas {
  width: 100%;
  height: auto;
  aspect-ratio: 9 / 16;
  max-height: 100%;
  image-rendering: pixelated;
  background: linear-gradient(
    180deg,
    #dfe7f3 0%,
    #cbd5e1 40%,
    #a8a29e 40%,
    #8d7c6b 100%
  );
  display: block;
}

.player-sprite {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  transform: translate(-9999px, -9999px);
  pointer-events: none;
  image-rendering: pixelated;
  filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.2));
}

.overlay {
  position: absolute;
  inset: 0;
  background: url("../dash/dash-portrait.png") center/cover no-repeat;
  color: #f8fafc;
  display: grid;
  place-items: start center;
  text-align: center;
  padding-top: 15%;
}

.overlay h1 {
  margin: 8px 0 4px;
}

.overlay p {
  margin: 4px 0;
}

.overlay__score {
  font-weight: 700;
}

.overlay__title {
  font-family: "Press Start 2P", "VT323", "Courier New", monospace;
  font-size: 22px;
  color: #facc15;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
  margin-top: 8px;
}

.overlay__home {
  margin-top: 14px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid rgba(248, 250, 252, 0.6);
  color: #f8fafc;
  text-decoration: none;
  font-size: 12px;
  font-family: "Press Start 2P", "VT323", "Courier New", monospace;
  background: rgba(15, 23, 42, 0.35);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.25);
}

.overlay__home:hover {
  background: rgba(15, 23, 42, 0.55);
}

.hud {
  position: absolute;
  top: 20%;
  left: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  color: #facc15;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
  visibility: hidden;
}

.hud__label,
.hud__score {
  background: rgba(0, 0, 0, 0.35);
  padding: 6px 10px;
  border-radius: 8px;
  font-family: "Press Start 2P", "VT323", "Courier New", monospace;
}

.hud__label {
  color: #fde68a;
  text-shadow:
    0 0 6px rgba(250, 204, 21, 0.7),
    0 2px 4px rgba(0, 0, 0, 0.9);
}

.gameover {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.55);
}

.gameover__card {
  background: rgba(15, 23, 42, 0.9);
  border: 2px solid #facc15;
  border-radius: 12px;
  padding: 16px 20px;
  text-align: center;
  color: #facc15;
  font-family: "Press Start 2P", "VT323", "Courier New", monospace;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

.gameover__title {
  margin: 0 0 8px;
  font-size: 18px;
}

.gameover__score {
  margin: 0 0 14px;
  font-size: 16px;
}

.gameover__player {
  margin: 0 0 10px;
  font-size: 14px;
}

.gameover__btn {
  background: #facc15;
  color: #0f172a;
  border: none;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: "Press Start 2P", "VT323", "Courier New", monospace;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}

.gameover__btn:active {
  transform: translateY(1px);
}

.gameover__btn--ghost {
  display: inline-block;
  margin-top: 8px;
  background: transparent;
  color: #facc15;
  border: 2px solid #facc15;
  text-decoration: none;
}

.countdown {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.6);
  grid-template-rows: 1fr auto 1fr;
  padding: 24px;
  transform: translateY(20%);
}

.countdown__text {
  font-family: "Press Start 2P", "VT323", "Courier New", monospace;
  font-size: 42px;
  color: #facc15;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.countdown__hint {
  margin: 0;
  padding: 6px 12px;
  text-align: center;
  font-family: "Press Start 2P", "VT323", "Courier New", monospace;
  font-size: 12px;
  color: #f8fafc;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 8px;
}

.character-select {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.65);
  padding: 20px;
}

.character-select__card {
  background: rgba(15, 23, 42, 0.9);
  border: 2px solid #facc15;
  border-radius: 14px;
  padding: 18px 16px;
  text-align: center;
  color: #facc15;
  font-family: "Press Start 2P", "VT323", "Courier New", monospace;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  max-width: 360px;
  width: 100%;
}

.character-select__title {
  margin: 0 0 14px;
  font-size: 16px;
}

.character-select__options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.character-select__option {
  border: 2px solid #facc15;
  border-radius: 10px;
  background: rgba(2, 6, 23, 0.7);
  color: #facc15;
  padding: 10px;
  cursor: pointer;
  display: grid;
  place-items: center;
  gap: 8px;
  font-family: "Press Start 2P", "VT323", "Courier New", monospace;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.character-select__option img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  image-rendering: pixelated;
}

.character-select__option:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.35);
}
