:root {
  --purple: #7133cb;
  --purple-dark: #3a156f;
  --orange: #ff9420;
  --orange-light: #ffd44a;
  --orange-dark: #9d4300;
  --cream: #ffe990;
}

* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: #050208; font-family: Arial, Helvetica, sans-serif; touch-action: manipulation; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }

#app { width: 100vw; height: 100vh; display: grid; place-items: center; background: #050208; }
#stage {
  position: relative;
  width: min(100vw, 177.7777778vh);
  height: min(100vh, 56.25vw);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #16082f;
  user-select: none;
  -webkit-user-select: none;
}

.screen { position: absolute; inset: 0; display: none; overflow: hidden; }
.screen.active { display: block; }
.menu-bg { background: url('assets/images/menu.png') center center / cover no-repeat; }
.screen-shade { position: absolute; inset: 0; background: rgba(0,0,0,.14); }
.screen-shade.dark { background: rgba(11,8,32,.68); }

.menu-logo {
  position: absolute;
  top: 1.8%;
  left: 50%;
  transform: translateX(-50%);
  width: auto;
  height: 46.3%;
  max-width: 42%;
  object-fit: contain;
  filter: drop-shadow(0 .5vh 1.2vh rgba(0,0,0,.35));
}

.btn, .btn-3d {
  border: 0;
  cursor: pointer;
  color: #fff;
  font-weight: 900;
  text-shadow: 0 .22em .12em rgba(65,20,0,.45);
  transition: transform .07s ease, box-shadow .07s ease, filter .07s ease;
}
.btn-orange {
  background: linear-gradient(#ffd44a, #ff8120);
  border: .42vh solid #ffe990;
  box-shadow: 0 2.1vh 0 var(--orange-dark), 0 2.9vh 2.2vh rgba(0,0,0,.28);
  border-radius: 3vw;
}
.btn-orange:active, .btn-orange.pressed {
  transform: translateY(1.55vh);
  box-shadow: 0 .55vh 0 #813600, 0 1.1vh 1.2vh rgba(0,0,0,.22);
  filter: brightness(.94);
}
.btn-purple {
  background: linear-gradient(#9b63e8, #7133cb);
  border: .32vh solid #d7bdff;
  box-shadow: 0 1.45vh 0 #3a156f, 0 2vh 1.5vh rgba(0,0,0,.25);
  border-radius: 2vw;
}
.btn-purple:active, .btn-purple.pressed {
  transform: translateY(1.05vh);
  box-shadow: 0 .42vh 0 #301057, 0 .8vh .9vh rgba(0,0,0,.2);
}
.btn-play {
  position: absolute;
  left: 50%;
  top: 49.1%;
  transform: translateX(-50%);
  width: 36.5%;
  height: 20.7%;
  font-size: clamp(24px, 4.4vw, 84px);
  border-radius: 5.2vh;
}
.btn-play:active, .btn-play.pressed { transform: translate(-50%, 1.55vh); }

.music-btn {
  position: absolute;
  z-index: 15;
  right: 2.9%;
  top: 3.7%;
  width: 7.8%;
  aspect-ratio: 1;
  border: .28vh solid #cfabff;
  border-radius: 2.2vh;
  background: linear-gradient(#9a52f0, #7133cb);
  box-shadow: 0 1.7vh 0 #4d1c99, 0 2.1vh 1.2vh rgba(0,0,0,.25);
  font-size: clamp(28px, 4vw, 76px);
  line-height: 1;
}
.music-btn:active, .music-btn.pressed {
  transform: translateY(1.1vh);
  box-shadow: 0 .5vh 0 #35136d, 0 .8vh .7vh rgba(0,0,0,.2);
  filter: brightness(.9);
}

.social-bar {
  position: absolute;
  left: 9.4%;
  right: 9.4%;
  bottom: 3.7%;
  height: 13.4%;
  padding: 1.65% 1.3%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.7%;
  border-radius: 3vh;
  background: rgba(42,20,90,.86);
}
.social {
  border: 0;
  border-radius: 2.1vh;
  display: grid;
  place-items: center;
  color: white;
  text-decoration: none;
  font-weight: 800;
  font-size: clamp(14px, 2vw, 38px);
  cursor: pointer;
}
.youtube { background: #d73737; }
.facebook { background: #4367b2; }
.website { background: #5e38c9; }
.about { background: #9638b7; }
.social:active { transform: translateY(.35vh); filter: brightness(.9); }
.version { position: absolute; left: 2.5%; bottom: 8.8%; color: rgba(255,255,255,.9); font-weight: 800; font-size: clamp(10px,1.3vw,25px); }

#selectScreen h1 {
  position: absolute;
  top: 2.5%;
  width: 100%;
  margin: 0;
  color: #fff;
  text-align: center;
  font-size: clamp(22px,2.8vw,52px);
  z-index: 4;
}
.select-help {
  position: absolute;
  top: 8.6%;
  width: 100%;
  margin: 0;
  text-align: center;
  color: #e7d8ff;
  font-weight: 700;
  font-size: clamp(11px,1.35vw,25px);
  z-index: 4;
}
.btn-back {
  position: absolute;
  left: 1.8%;
  top: 3.2%;
  width: 11.2%;
  height: 8.3%;
  z-index: 10;
  font-size: clamp(12px,1.6vw,31px);
}
.character-grid {
  position: absolute;
  z-index: 5;
  left: 9.8%;
  right: 9.8%;
  top: 15.2%;
  bottom: 5.2%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 5.5% 3.1%;
}
.character-card {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: .22vh solid #8c68bf;
  border-radius: 3.8vh;
  background: rgba(42,25,72,.85);
  cursor: pointer;
  transition: border .12s ease, box-shadow .12s ease, transform .08s ease, background .12s ease;
}
.character-card:active { transform: scale(.985); }
.character-card.selected {
  border: .5vh solid #ffd631;
  background: rgba(74,43,88,.92);
  box-shadow: 0 0 2.5vh .65vh rgba(255,210,46,.8);
}
.character-card img {
  position: absolute;
  left: 5%; right: 5%; top: 3%;
  width: 90%; height: 78%;
  object-fit: contain;
}
.character-card span {
  position: absolute;
  left: 2%; right: 2%; bottom: 3%;
  text-align: center;
  color: #fff;
  font-weight: 900;
  font-size: clamp(11px,1.5vw,29px);
  text-shadow: 0 .2vh .25vh rgba(0,0,0,.6);
}

.game-screen { background: #13052b; }
#gameCanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.game-music { z-index: 20; }
.btn-jump {
  position: absolute;
  z-index: 20;
  right: 2.6%;
  bottom: 4.6%;
  width: 15.7%;
  height: 22.2%;
  border-radius: 4.2vh;
  font-size: clamp(18px,2.8vw,54px);
}

.game-over-screen { background: rgba(16,8,42,.74); z-index: 30; }
.game-over-panel {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: white;
  text-align: center;
  padding-top: 9.5%;
  background: linear-gradient(rgba(16,8,42,.66), rgba(16,8,42,.84));
}
.game-over-panel h2 { margin: 0 0 2.5%; font-size: clamp(34px,4.6vw,88px); }
.final-score { color: #ffd44a; font-size: clamp(20px,2.8vw,54px); font-weight: 900; }
.best-score { margin-top: 2.4%; font-size: clamp(16px,2.2vw,42px); font-weight: 800; }
.gameover-btn { width: 36.5%; height: 17.5%; margin-top: 4.3%; font-size: clamp(20px,3.3vw,64px); }
.gameover-btn + .gameover-btn { width: 28.1%; height: 13.4%; margin-top: 4.8%; font-size: clamp(16px,2.25vw,44px); }

.transition { pointer-events: none; position: absolute; inset: 0; z-index: 50; background: #000; opacity: 0; transition: opacity .55s ease; }
.transition.show { opacity: 1; }

.modal { display: none; position: absolute; inset: 0; z-index: 80; background: rgba(0,0,0,.83); place-items: center; }
.modal.open { display: grid; }
.modal-card { width: 55%; padding: 4%; border: .3vh solid #8a5be2; border-radius: 4vh; background: #2a145a; color: #fff; text-align: center; }
.modal-card h2 { margin: 0; font-size: clamp(25px,3.2vw,62px); }
.modal-card h3 { color: #ffd85b; font-size: clamp(16px,1.9vw,36px); }
.modal-card p { font-size: clamp(12px,1.6vw,31px); }
.modal-card .btn { width: 42%; min-height: 7vh; margin-top: 2%; font-size: clamp(13px,1.7vw,32px); }

.intro-overlay { position: absolute; inset: 0; z-index: 100; display: grid; place-items: center; pointer-events: none; opacity: 1; transition: opacity .45s ease; background: transparent; }
.intro-overlay.fade { opacity: 0; }
.intro-overlay.hidden { display: none; }
#introVideo { width: 100%; height: 100%; object-fit: contain; background: transparent; }

.loading { position: absolute; z-index: 200; inset: 0; display: grid; place-items: center; color: #fff; background: #100626; font-size: clamp(18px,2.2vw,42px); font-weight: 800; transition: opacity .25s ease; }
.loading.hidden { opacity: 0; pointer-events: none; }

.rotate-hint { display: none; }
@media (orientation: portrait) and (max-width: 900px) {
  .rotate-hint { position: fixed; z-index: 9999; inset: 0; display: grid; place-items: center; padding: 10vw; background: #16082f; color: #fff; text-align: center; font-size: 6vw; font-weight: 900; }
}
