:root {
  color-scheme: dark;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: #151917;
  color: #f7f3e8;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 10%, rgba(244, 190, 80, 0.18), transparent 28rem),
    linear-gradient(145deg, #18211d 0%, #0d1110 50%, #21231e 100%);
}

button {
  min-width: 9rem;
  border: 0;
  border-radius: 8px;
  padding: 0.9rem 1.15rem;
  color: #151917;
  background: #ffd15c;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}

button:hover {
  background: #ffe08b;
}

input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 0.8rem 0.9rem;
  color: #fff7d6;
  background: rgba(255, 255, 255, 0.08);
  font: inherit;
  font-weight: 800;
  outline: none;
}

input:focus {
  border-color: #ffd15c;
  box-shadow: 0 0 0 3px rgba(255, 209, 92, 0.18);
}

.app-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: clamp(0.75rem, 2vw, 1.5rem);
}

.game-frame {
  position: relative;
  width: min(100vw - 1.5rem, 1180px);
  aspect-ratio: 3 / 2;
  max-height: calc(100vh - 1.5rem);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: #29372e;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.45);
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.hud {
  position: absolute;
  inset: 1rem 1rem auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
  pointer-events: none;
}

.hud > div {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 0.6rem 0.7rem;
  background: rgba(12, 16, 14, 0.68);
  backdrop-filter: blur(10px);
}

.label {
  display: block;
  margin-bottom: 0.15rem;
  color: #bcc8bb;
  font-size: clamp(0.68rem, 1.4vw, 0.78rem);
  font-weight: 700;
  text-transform: uppercase;
}

.hud strong {
  display: block;
  overflow: hidden;
  color: #fff7d6;
  font-size: clamp(0.92rem, 2vw, 1.25rem);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.screen-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  background:
    linear-gradient(180deg, rgba(13, 17, 16, 0.32), rgba(13, 17, 16, 0.76)),
    rgba(0, 0, 0, 0.16);
}

.screen-overlay.hidden {
  display: none;
}

.panel {
  width: min(93vw, 620px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: clamp(1rem, 4vw, 2rem);
  background: rgba(19, 23, 20, 0.82);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(12px);
}

.eyebrow {
  margin: 0 0 0.65rem;
  color: #ffd15c;
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 0.85rem;
  font-size: clamp(1.8rem, 5vw, 3.6rem);
  line-height: 1;
}

.panel p {
  max-width: 58ch;
  color: #dce5d9;
  line-height: 1.55;
}

.menu-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.4rem;
}

.name-field {
  display: grid;
  gap: 0.35rem;
  margin-top: 1.1rem;
  color: #aeb9ac;
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.score-list {
  display: grid;
  gap: 0.8rem;
  margin: 1.5rem 0 0;
}

.score-list > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 0.8rem;
}

dt {
  color: #aeb9ac;
  font-weight: 700;
}

dd {
  margin: 0;
  color: #fff7d6;
  font-weight: 800;
  text-align: right;
}

.highscore-board {
  margin-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 0.9rem;
}

.highscore-board h2 {
  margin: 0 0 0.65rem;
  color: #ffd15c;
  font-size: 0.92rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

#highscoreList {
  display: grid;
  gap: 0.35rem;
  max-height: 10.5rem;
  margin: 0;
  overflow: auto;
  padding-left: 1.45rem;
}

#highscoreList li {
  color: #f7f3e8;
  line-height: 1.35;
}

.score-entry {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}

.score-entry span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-entry strong {
  color: #fff7d6;
  white-space: nowrap;
}

@media (max-width: 720px) {
  body {
    overflow: auto;
  }

  .app-shell {
    align-items: start;
  }

  .game-frame {
    width: calc(100vw - 1rem);
    aspect-ratio: 9 / 14;
    max-height: none;
  }

  .hud {
    inset: 0.55rem 0.55rem auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
  }

  .hud > div {
    padding: 0.48rem 0.55rem;
  }

  .score-list > div {
    display: block;
  }

  dd {
    margin-top: 0.25rem;
    text-align: left;
  }

  #highscoreList {
    max-height: 8rem;
  }
}
