body {
  margin: 0;
  font-family: system-ui, sans-serif;
  line-height: 1.6;
  color: #1a1a1a;
  overflow: hidden;
  background: #0c0f14;
}

header {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 10;
  padding: 0.5rem 1rem;
}

main {
  position: relative;
  width: 100vw;
  height: 100vh;
}

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

#game-canvas {
  position: absolute;
  display: block;
  background: #bcd6ee;
}

.screen[hidden] {
  display: none;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.5rem;
  background: rgba(20, 20, 25, 0.82);
  color: #f4f4f4;
  text-align: center;
  overflow-y: auto;
}

.screen img {
  max-width: min(90vw, 420px);
  max-height: 40vh;
  border-radius: 0.5rem;
}

.screen .title-image {
  width: auto;
  max-width: min(92vw, 640px);
  height: auto;
  max-height: 10vh;
  border-radius: 0;
}

.screen fieldset {
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 0.5rem;
  margin: 0;
  padding: 0.5rem 0.75rem;
}

#character-preview {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 0.5rem;
}

.swatch-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.swatch-button,
.swatch-color {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.4rem;
  border: 2px solid rgba(255, 255, 255, 0.4);
  cursor: pointer;
  font-size: 0.7rem;
  color: #fff;
  background: #444;
}

.swatch-button[aria-pressed="true"],
.swatch-color[aria-pressed="true"] {
  border-color: #ffd23f;
  box-shadow: 0 0 0 2px #ffd23f;
}

.best-times {
  font-size: 0.9rem;
  color: #d8d8d8;
}

.best-times p {
  margin: 0.15rem 0;
}

#pause-screen button {
  font-size: 1rem;
  padding: 0.5rem 1.5rem;
  border-radius: 0.4rem;
  border: none;
  background: #ffd23f;
  color: #1a1a1a;
  cursor: pointer;
}

.hardcore-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#start-button {
  font-size: 1.1rem;
  padding: 0.6rem 1.5rem;
  border-radius: 0.4rem;
  border: none;
  background: #ffd23f;
  color: #1a1a1a;
  cursor: pointer;
}

.hud[hidden] {
  display: none;
}

.hud {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  display: flex;
  gap: 1rem;
  padding: 0.4rem 0.8rem;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border-radius: 0.4rem;
  font-size: 1rem;
  z-index: 5;
}

.mute-button {
  position: absolute;
  bottom: 0.75rem;
  right: 0.75rem;
  z-index: 6;
  width: 2.75rem;
  height: 2.75rem;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}

.mute-button[aria-pressed="true"] {
  background: rgba(0, 0, 0, 0.75);
  color: #ffd23f;
}

.credits-viewport {
  width: min(90vw, 480px);
  height: 45vh;
  overflow: hidden;
  position: relative;
}

.credits-roll {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  animation: credits-scroll 16s linear forwards;
}

@keyframes credits-scroll {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(-100%);
  }
}
