:root {
  --bg-deep: #1a0a1f;
  --bg-mid: #2d1538;
  --accent: #ff6b9d;
  --accent-dim: #c44a7a;
  --gold: #ffd93d;
  --text: #f8e8f0;
  --muted: #9a7a9a;
  --panel: rgba(20, 8, 28, 0.92);
  --border: #5c3d6e;
  --pixel-scale: 3;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(ellipse 120% 80% at 50% 0%, var(--bg-mid) 0%, var(--bg-deep) 55%);
  color: var(--text);
  font-family: "Press Start 2P", system-ui, sans-serif;
  font-size: 10px;
  line-height: 1.6;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#app {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.screen {
  display: none;
  width: 100%;
  max-width: 720px;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.screen--active {
  display: flex;
}

.panel {
  background: var(--panel);
  border: 4px solid var(--border);
  box-shadow:
    0 0 0 2px #0a050c,
    8px 8px 0 rgba(0, 0, 0, 0.35);
  padding: 28px 24px;
  max-width: 480px;
  width: 100%;
  text-align: center;
}

.panel__eyebrow {
  color: var(--gold);
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 16px;
}

.panel__title {
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 24px;
  color: var(--accent);
  text-shadow: 2px 2px 0 #4a1030;
}

.panel__title--big {
  font-size: 18px;
  margin-bottom: 20px;
}

.password-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: stretch;
}

.input-pixel {
  font-family: inherit;
  font-size: 10px;
  padding: 14px 16px;
  background: #120818;
  border: 3px solid var(--border);
  color: var(--text);
  outline: none;
}

.input-pixel:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 107, 157, 0.35);
}

.btn-pixel {
  font-family: inherit;
  font-size: 9px;
  padding: 14px 20px;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-dim) 100%);
  border: 3px solid #fff2;
  color: #1a0510;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.btn-pixel:hover {
  filter: brightness(1.08);
}

.btn-pixel:active {
  transform: translate(2px, 2px);
}

.password-error {
  color: #ff8a8a;
  font-size: 8px;
  margin: 8px 0 0;
}

.password-error[hidden] {
  display: none;
}

.password-form.shake {
  animation: shake 0.45s ease;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20%,
  60% {
    transform: translateX(-6px);
  }
  40%,
  80% {
    transform: translateX(6px);
  }
}

.game-hud {
  width: 100%;
  max-width: calc(320px * var(--pixel-scale) + 8px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 8px;
  color: var(--gold);
}

.game-hud__hint {
  color: var(--muted);
  font-size: 7px;
}

.game-wrap {
  border: 4px solid var(--border);
  box-shadow:
    0 0 0 2px #0a050c,
    12px 12px 0 rgba(0, 0, 0, 0.4);
  background: #0d0612;
  line-height: 0;
}

#game-canvas {
  width: calc(320px * var(--pixel-scale));
  height: calc(180px * var(--pixel-scale));
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: block;
}

.controls-hint {
  font-size: 7px;
  color: var(--muted);
  max-width: calc(320px * var(--pixel-scale) + 8px);
  text-align: center;
  margin: 0;
}

.controls-hint kbd {
  display: inline-block;
  padding: 2px 6px;
  margin: 0 2px;
  background: #2a1a32;
  border: 2px solid var(--border);
  font-family: inherit;
  font-size: 7px;
}

.screen--win {
  position: relative;
  max-width: 560px;
}

.screen--win .panel {
  position: relative;
  z-index: 2;
}

.panel__message {
  font-size: 9px;
  line-height: 1.8;
  color: var(--text);
  margin: 0 0 20px;
}

.panel__signoff {
  font-size: 8px;
  color: var(--accent);
  margin: 0;
}

.confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 520px) {
  :root {
    --pixel-scale: 2;
  }

  .panel__title--big {
    font-size: 14px;
  }
}
