body.game-page {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  touch-action: manipulation;
}

body.game-page header.site-header {
  padding: 10px 20px;
  flex-shrink: 0;
}

body.game-page header.site-header a {
  font-size: 1.1rem;
}

body.game-page main.wide {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 12px 20px;
}

body.game-page .page-meta {
  flex-shrink: 0;
}

body.game-page .page-meta h1 {
  font-size: 1.2rem;
  margin: 0 0 2px;
}

body.game-page .page-meta .subtitle {
  font-size: 0.8rem;
  margin: 0;
}

body.game-page footer {
  display: none;
}

.game-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
}

.game-wrap:fullscreen {
  background: #062338;
}

#game {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  background: #062338;
  border-radius: 6px;
  border: 1px solid #334155;
  touch-action: manipulation;
  cursor: crosshair;
}

.hud-buttons {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  gap: 10px;
  z-index: 5;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(15, 23, 42, 0.55);
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.icon-btn:hover {
  background: rgba(15, 23, 42, 0.8);
}

.tower-bar {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  align-items: center;
  background: rgba(15, 23, 42, 0.6);
  padding: 8px;
  border-radius: 14px;
  z-index: 5;
  backdrop-filter: blur(2px);
}

.tower-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  width: 66px;
  padding: 6px 4px;
  border-radius: 10px;
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.tower-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  transform: translateY(-2px);
}

.tower-btn.selected {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.25);
}

.tower-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.tower-icon {
  font-size: 1.3rem;
  line-height: 1.1;
}

.tower-name {
  font-size: 0.62rem;
  font-weight: 700;
}

.tower-cost {
  font-size: 0.62rem;
  color: #facc15;
  font-weight: 700;
}

.wave-btn {
  padding: 10px 16px;
  border-radius: 10px;
  border: none;
  background: #34d399;
  color: #062338;
  font-weight: 800;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  margin-left: 6px;
}

.wave-btn:hover {
  background: #6ee7b7;
  transform: translateY(-2px);
}

.wave-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.55);
  border-radius: 8px;
  cursor: pointer;
}

.overlay-content {
  text-align: center;
  color: #fff;
  padding: 16px;
}

.overlay-content h2 {
  margin: 0 0 8px;
}

.overlay-content p {
  margin: 4px 0;
}

.best-score {
  color: #facc15;
  font-weight: 700;
}

#pause-overlay {
  cursor: default;
}

.pause-buttons {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  justify-content: center;
}

.pause-btn {
  padding: 10px 24px;
  border-radius: 8px;
  border: none;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease;
}

.pause-btn:hover {
  transform: translateY(-2px);
}

.pause-btn.resume {
  background: #38bdf8;
  color: #0f172a;
}

.pause-btn.resume:hover {
  background: #7dd3fc;
}

.pause-btn.exit {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.pause-btn.exit:hover {
  background: rgba(255, 255, 255, 0.22);
}

.hidden {
  display: none !important;
}

.rotate-hint {
  display: none;
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.65);
  color: #fff;
  font-size: 0.75rem;
  padding: 6px 14px;
  border-radius: 999px;
  z-index: 4;
  white-space: nowrap;
}

@media (max-width: 640px) {
  body.game-page header.site-header {
    padding: 8px 14px;
  }

  body.game-page header.site-header a {
    font-size: 0.95rem;
  }

  body.game-page main.wide {
    padding: 8px 10px;
  }

  body.game-page .page-meta h1 {
    font-size: 1rem;
  }

  body.game-page .page-meta .subtitle {
    font-size: 0.7rem;
  }

  .icon-btn {
    width: 34px;
    height: 34px;
    font-size: 1rem;
  }

  .hud-buttons {
    top: 8px;
    right: 8px;
    gap: 6px;
  }

  .tower-bar {
    gap: 5px;
    padding: 6px;
    bottom: 8px;
  }

  .tower-btn {
    width: 52px;
    padding: 4px 2px;
  }

  .tower-icon {
    font-size: 1.05rem;
  }

  .tower-name {
    display: none;
  }

  .wave-btn {
    padding: 8px 12px;
    font-size: 0.75rem;
  }

  .pause-buttons {
    flex-wrap: wrap;
  }

  .pause-btn {
    padding: 10px 18px;
    font-size: 0.9rem;
  }
}

@media (max-width: 640px) and (orientation: portrait) {
  .rotate-hint {
    display: block;
  }
}
