* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #000;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  font-family: system-ui, "Segoe UI", Roboto, Arial, sans-serif;
  color: #fff;
}

#game { position: fixed; inset: 0; display: block; }

/* ---------- Controles de toque ---------- */
#controls { display: none; }
body.touch.playing #controls { display: block; }

#stickZone {
  position: fixed; left: 0; bottom: 0;
  width: 36vw; height: 62vh;
}
#stick {
  position: absolute; left: 4vh; bottom: 5vh;
  width: 38vh; height: 17vh;
  border-radius: 9vh;
  background: rgba(255, 255, 255, .16);
  border: 2px solid rgba(255, 255, 255, .45);
}
#stick .arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  font-size: 5vh; color: rgba(255, 255, 255, .6);
}
#stick .arrow.left { left: 3vh; }
#stick .arrow.right { right: 3vh; }
#knob {
  position: absolute; left: 50%; top: 50%;
  width: 14vh; height: 14vh; margin: -7vh 0 0 -7vh;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff, #c9d3e6);
  box-shadow: 0 .6vh 1.5vh rgba(0, 0, 0, .45);
}

.btn {
  position: fixed;
  width: 17vh; height: 17vh;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .6);
  background: rgba(20, 40, 90, .55);
  color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 0; font-family: inherit;
  touch-action: none;
}
.btn b { font-size: 5vh; line-height: 1; }
.btn small { font-size: 2.1vh; font-weight: 700; letter-spacing: .05em; margin-top: .4vh; }
.btn.on { background: rgba(255, 210, 63, .75); color: #10204a; }
#btnJump { right: 4vh; bottom: 5vh; width: 21vh; height: 21vh; background: rgba(200, 40, 40, .6); }
#btnJump b { font-size: 6vh; }
#btnDuck { right: 28vh; bottom: 4vh; }
#btnElev { right: 9vh; bottom: 29vh; background: rgba(40, 120, 70, .6); }
body.no-elev #btnElev { display: none; }

/* ---------- Botões do topo ---------- */
#topBtns {
  position: fixed; top: .6vh; right: 1vh;
  display: none; gap: 1vh;
}
body.playing #topBtns { display: flex; }
#topBtns button {
  width: 7vh; height: 7vh; min-width: 30px; min-height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .5);
  background: rgba(255, 255, 255, .12);
  color: #fff; font-size: 2.8vh; font-weight: 700; padding: 0;
}
#topBtns button.off { opacity: .45; text-decoration: line-through; }

/* ---------- Overlays ---------- */
.overlay {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, rgba(11, 21, 48, .78), rgba(0, 0, 0, .92));
  z-index: 10;
}
.overlay.hidden { display: none; }

.panel {
  text-align: center;
  max-width: 92vw;
  max-height: 96vh;
  overflow: auto;
  padding: 2vh 3vw;
}
.brand { display: flex; align-items: center; justify-content: center; gap: 2.5vh; }
.brand img { height: clamp(40px, 13vh, 100px); filter: drop-shadow(0 1vh 1.5vh rgba(0, 0, 0, .5)); }
.studio { margin: 2vh 0 0; font-size: clamp(10px, 2.4vh, 14px); font-weight: 700; letter-spacing: .4em; color: #5fb3c7; }
.panel h1 {
  margin: 0;
  font-size: clamp(28px, 9vh, 64px);
  letter-spacing: .06em;
  color: #ffd23f;
  text-shadow: 0 .6vh 0 #c0392b, 0 1.2vh 2vh rgba(0, 0, 0, .6);
}
.panel .sub { margin: 1vh 0 2vh; font-size: clamp(14px, 4vh, 24px); font-weight: 700; }
.panel .sub span { color: #ffd23f; }
#menuMsg { font-size: clamp(14px, 4vh, 22px); margin: 1vh 0 1.5vh; min-height: 1em; }

.modes { display: flex; justify-content: center; gap: 2vw; margin-bottom: 1.6vh; }
.mode {
  display: flex; align-items: center; gap: 1.2vh;
  padding: .8vh 2.4vh .8vh 1vh;
  border-radius: 2vh;
  border: 2px solid rgba(255, 255, 255, .25);
  background: rgba(255, 255, 255, .06);
  color: #fff; font-family: inherit; cursor: pointer; text-align: left;
}
.mode canvas { height: clamp(44px, 14vh, 90px); width: auto; }
.mode b { display: block; font-size: clamp(14px, 4.4vh, 24px); letter-spacing: .04em; }
.mode small { display: block; font-size: clamp(10px, 2.6vh, 14px); opacity: .8; }
.mode.sel { border-color: #ffd23f; background: rgba(255, 210, 63, .16); box-shadow: 0 0 2vh rgba(255, 210, 63, .25); }
.mode.sel b { color: #ffd23f; }

.scenes { display: flex; justify-content: center; flex-wrap: wrap; gap: 1vh; margin-bottom: 2vh; }
.scn {
  display: flex; align-items: center; gap: .8vh;
  padding: .6vh 1.6vh;
  border-radius: 99px;
  border: 1px solid rgba(255, 255, 255, .3);
  background: rgba(255, 255, 255, .08);
  color: #fff; font-family: inherit; font-size: clamp(10px, 2.6vh, 14px); font-weight: 700; cursor: pointer;
}
.scn b { color: #5fb3c7; }
.scn.sel { background: #5fb3c7; color: #0b1530; border-color: #5fb3c7; }
.scn.sel b { color: #0b1530; }
.scn:disabled { opacity: .4; cursor: default; }
#menuMsg b { color: #ffd23f; }
#btnPlay {
  font-family: inherit;
  font-weight: 800;
  font-size: clamp(18px, 6vh, 34px);
  padding: 1.6vh 7vh;
  border-radius: 99px;
  border: none;
  background: linear-gradient(#ffdf6b, #f0b400);
  color: #3a1d00;
  box-shadow: 0 .8vh 0 #a66f00, 0 1.5vh 3vh rgba(0, 0, 0, .5);
  cursor: pointer;
}
#btnPlay:active { transform: translateY(.5vh); box-shadow: 0 .3vh 0 #a66f00; }
.help { margin-top: 2.5vh; font-size: clamp(11px, 3vh, 16px); opacity: .9; line-height: 1.4; }
.help p { margin: .6vh 0; }
.help .keys { color: #9fd3ff; }
.touch-only { display: none; }
body.touch .touch-only { display: block; }
body.touch .desk-only { display: none; }

#rotate { display: none; flex-direction: column; z-index: 20; background: #0b1530; }
#rotate p { font-size: 20px; font-weight: 700; }
#rotate .phone {
  width: 60px; height: 100px;
  border: 4px solid #fff; border-radius: 10px;
  animation: spin 1.8s ease-in-out infinite;
}
@keyframes spin { 0%, 20% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }
@media (orientation: portrait) {
  body.touch #rotate { display: flex; }
}
