:root {
  color-scheme: dark;
  font-family: Inter, "Hiragino Sans", "Yu Gothic UI", "Yu Gothic", Meiryo, sans-serif;
  background: #111317;
  color: #f7f4eb;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}

body {
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 16% 10%, rgba(251, 194, 75, 0.2), transparent 26rem),
    linear-gradient(135deg, #111317, #202226 42%, #111317);
}

.game-shell {
  position: relative;
  width: min(100vw, 520px);
  height: 100dvh;
  min-height: 0;
  max-height: 980px;
  overflow: hidden;
  background: #181b20;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 28px 80px rgba(0, 0, 0, 0.45);
}

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

.hud {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: 12px;
  right: 56px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  pointer-events: none;
}

.hud > div {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(17, 19, 23, 0.72);
  backdrop-filter: blur(14px);
}

.label {
  display: block;
  color: rgba(247, 244, 235, 0.68);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
}

.hud strong {
  display: block;
  margin-top: 3px;
  font-size: clamp(18px, 5vw, 28px);
  line-height: 1;
  white-space: nowrap;
}

.sound-button {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: 12px;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  color: #f7f4eb;
  background: rgba(17, 19, 23, 0.76);
  font-size: 18px;
  font-weight: 900;
  backdrop-filter: blur(14px);
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 16px;
  padding: 24px;
  text-align: center;
  background: linear-gradient(180deg, rgba(17, 19, 23, 0.4), rgba(17, 19, 23, 0.78));
}

.overlay.hidden {
  display: none;
}

.logo-mark {
  width: fit-content;
  padding: 6px 10px;
  border: 2px solid #111317;
  border-radius: 8px;
  color: #111317;
  background: #f4c542;
  font-size: 14px;
  font-weight: 900;
}

h1 {
  margin: 0;
  color: #fff9dd;
  font-size: clamp(48px, 15vw, 74px);
  line-height: 0.92;
  letter-spacing: 0;
  text-shadow: 0 5px 0 #111317, 0 18px 42px rgba(0, 0, 0, 0.45);
}

.overlay p {
  max-width: 21rem;
  margin: 0;
  color: rgba(247, 244, 235, 0.86);
  font-size: 15px;
  line-height: 1.65;
}

.overlay button {
  min-width: 180px;
  min-height: 52px;
  border: 0;
  border-radius: 8px;
  color: #111317;
  background: #f4c542;
  box-shadow: 0 7px 0 #987327, 0 18px 34px rgba(0, 0, 0, 0.3);
  font-size: 18px;
  font-weight: 900;
}

.overlay button:active {
  transform: translateY(4px);
  box-shadow: 0 3px 0 #987327, 0 12px 22px rgba(0, 0, 0, 0.24);
}

.toast {
  position: absolute;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 8px 12px;
  border-radius: 8px;
  color: #111317;
  background: #f7f4eb;
  font-weight: 900;
  opacity: 0;
  transform: translate(-50%, 14px);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (min-width: 760px) {
  .game-shell {
    height: min(100dvh, 920px);
    margin: 20px 0;
    border-radius: 8px;
  }
}
