.game {
  position: relative;
  width: 100%;
  max-width: 820px;
  border-radius: 1rem 1rem 0 0;
  overflow: clip;
}

.game__start-screen {
  position: absolute;
  inset: 0;
  background: url("../img/9_intro_outro_screens/start/startscreen_1.png") no-repeat center / cover;
  z-index: 10;
}

.game__ui {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(92%, 780px);
  z-index: 20;
}

.game__sound-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.game__volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 180px;
  height: 4px;
  background: linear-gradient(to right, #f5c518 var(--fill, 100%), rgba(255, 255, 255, 0.8) var(--fill, 100%));
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.game__btn--mute {
  font-size: 1.2rem;
  width: 34px;
  height: 34px;
  padding: 0;
  border: none;
  background: transparent;
  color: #f5c518;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.game__btn--mute:hover {
  opacity: 0.8;
}

.game__btn--menu {
  font-family: "Zabars", Arial, sans-serif;
  font-size: 1.4rem;
  letter-spacing: 3px;
  padding: 4px 8px 2px 14px;
  background: #f5c518;
  border: 2px solid #c8960c;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 2px 3px 0 #8b6000;
}

.game__volume-slider::-moz-range-track {
  background: rgba(255, 255, 255, 0.8);
  border-radius: 2px;
  height: 4px;
}

.game__volume-slider::-moz-range-progress {
  background: #f5c518;
  border-radius: 2px;
  height: 4px;
}

.game__volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #f5c518;
  cursor: pointer;
}

.game__volume-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #f5c518;
  cursor: pointer;
  border: none;
}

.game__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.game__btn--menu:hover {
  background: #ffd740;
}

.game__btn--fullscreen {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.6));
}

.game__btn--fullscreen:hover {
  color: #f5c518;
}

/* =====================
   Game Wrapper
   ===================== */

.game-wrap {
  position: relative;
  width: calc(100% - 4rem);
  max-width: 820px;
}

/* =====================
   Fullscreen Mode
   ===================== */

.game-container:fullscreen,
.game-container:-webkit-full-screen,
.game-container:-moz-full-screen,
.game-container:-ms-fullscreen {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: none;
  background: #000;
  border-radius: 0;
  overflow: visible;
}

.game-container:fullscreen canvas,
.game-container:-webkit-full-screen canvas,
.game-container:-moz-full-screen canvas,
.game-container:-ms-fullscreen canvas {
  width: 100vw;
  height: 100vh;
  max-width: calc(100vh * 720 / 480);
  max-height: calc(100vw * 480 / 720);
  aspect-ratio: 720 / 480;
  border: none;
  border-radius: 0;
}

.game-container:fullscreen .menu-popup,
.game-container:-webkit-full-screen .menu-popup,
.game-container:-moz-full-screen .menu-popup,
.game-container:-ms-fullscreen .menu-popup {
  border-radius: 0;
}

/* =====================
   Touch Controls
   ===================== */

.game__touch-controls {
  display: none;
  position: absolute;
  bottom: 12px;
  left: 0;
  right: 0;
  padding: 0 12px;
  justify-content: space-between;
  z-index: 20;
  pointer-events: none;
}

.game__touch-group {
  display: flex;
  gap: 10px;
  pointer-events: none;
}

.game__touch-btn {
  pointer-events: auto;
  width: 52px;
  height: 52px;
  background: rgba(245, 197, 24, 0.75);
  border: 2px solid rgba(185, 70, 27, 0.9);
  border-radius: 50%;
  font-size: 1.4rem;
  color: #fff;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

.game__touch-btn:active {
  background: rgba(245, 197, 24, 1);
}

@media (pointer: coarse) {
  .game__touch-controls--active {
    display: flex;
  }
}

@media (pointer: coarse) and (max-width: 670px) and (orientation: portrait) {
  .game__touch-controls {
    display: none !important;
  }
}

/* ======================
   End Screen
   ====================== */

.game__end-screen {
  position: absolute;
  bottom: 14%;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 16px;
  z-index: 30;
  pointer-events: none;
}

.game__end-screen[hidden] {
  display: none;
}

.game__end-btn {
  pointer-events: auto;
  padding: 12px 28px;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  letter-spacing: 0.03em;
  transition:
    transform 0.1s,
    opacity 0.1s;
}

.game__end-btn:hover {
  transform: scale(1.05);
}

.game__end-btn--primary {
  background: #f5c518;
  color: #1a0a00;
}

.game__end-btn--secondary {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.5);
}
