* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 10px;
  overflow: hidden;
  background:
    radial-gradient(circle at top, rgba(255, 207, 92, 0.14), transparent 28%),
    linear-gradient(180deg, #120b1f 0%, #1d1230 48%, #09060f 100%);
  font-family: "Courier New", Courier, monospace;
}

.app {
  text-align: center;
  width: min(92vw, 760px);
  padding: 14px 14px 10px;
  border: 4px solid #ffcf5c;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(0, 0, 0, 0.18)),
    #140f23;
  box-shadow:
    0 0 0 6px #3a2359,
    0 26px 60px rgba(0, 0, 0, 0.45);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

#gameCanvas {
  display: block;
  width: min(100%, calc(100vh - 150px));
  height: min(calc(100vh - 150px), 100%);
  margin: 0 auto;
  background: #0a0f18;
  border-radius: 10px;
  border: 4px solid #ffcf5c;
  box-shadow:
    0 18px 42px rgba(0, 0, 0, 0.45),
    0 0 0 3px #2b1c43,
    inset 0 0 0 2px rgba(255, 255, 255, 0.03);
  image-rendering: pixelated;
}

.hint {
  color: #ffe7a8;
  font-size: 11px;
  line-height: 1.35;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: left;
}

.sound-toggle {
  flex: 0 0 auto;
  padding: 6px 10px;
  border: 2px solid #57e3ff;
  border-radius: 999px;
  background: linear-gradient(180deg, #281a3d, #171024);
  color: #f4fbff;
  font: inherit;
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    transform 120ms ease,
    box-shadow 120ms ease,
    border-color 120ms ease;
}

.sound-toggle:hover,
.sound-toggle:focus-visible {
  outline: none;
  transform: translateY(-1px);
  border-color: #ffcf5c;
  box-shadow: 0 0 0 3px rgba(87, 227, 255, 0.16);
}

.sound-toggle[aria-pressed="true"] {
  border-color: #ff6f91;
  color: #ffd7e1;
}

.app > .hint:last-of-type {
  margin-top: 8px;
  text-align: center;
}

@media (max-height: 760px) {
  body {
    padding: 6px;
  }

  .app {
    padding: 10px 10px 8px;
  }

  #gameCanvas {
    width: min(100%, calc(100vh - 120px));
    height: min(calc(100vh - 120px), 100%);
  }

  .app > .hint:last-of-type {
    display: none;
  }
}

@media (max-width: 640px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .hint {
    text-align: center;
  }
}
