/* Celular / tablet: controles na tela, aviso de girar, ajustes de tamanho */

html, body { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
/* na luta, a tela inteira é "controle": nada de zoom, rolagem, seleção de texto ou lupa */
body.fighting, body.fighting #game { touch-action: none; }
body.touch-ui, body.touch-ui * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

.only-touch { display: none; }
body.touch-ui .only-touch { display: inline; }
body.touch-ui .no-touch { display: none; }
body.touch-ui .hint,
body.touch-ui #help { display: none; }

/* ---- botão voltar (toque e mouse) */
.back-btn {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
  padding: 8px 16px;
  font: 400 18px/1 var(--display);
  letter-spacing: 2px;
  color: var(--cream);
  background: rgba(26, 15, 10, .8);
  border: 2px solid rgba(244, 234, 210, .6);
  transform: skewX(-10deg);
  cursor: pointer;
}
.back-btn:active { background: var(--gold); color: var(--ink); }

/* ---- controles de toque (só aparecem lutando, sem menu aberto) */
#touch { display: none; position: fixed; inset: 0; pointer-events: none; touch-action: none; user-select: none; -webkit-user-select: none; }
body.touch-ui.fighting:not(.paused) #touch { display: block; }

.stick-zone {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 45%;
  height: 72%;
  pointer-events: auto;
}
.stick-base {
  position: fixed;
  left: 18%;
  top: 72%;
  width: 124px;
  height: 124px;
  margin: -62px 0 0 -62px;
  border-radius: 50%;
  border: 3px solid rgba(244, 234, 210, .35);
  background: rgba(0, 0, 0, .18);
  opacity: .45;
  transition: opacity .1s;
}
.stick-base.on { opacity: 1; }
.stick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 56px;
  height: 56px;
  margin: -28px 0 0 -28px;
  border-radius: 50%;
  background: rgba(244, 234, 210, .85);
  box-shadow: 0 3px 0 rgba(0, 0, 0, .35);
}

.touch-btns {
  position: absolute;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  width: 250px;
  height: 200px;
  pointer-events: none;
}
.tb {
  position: absolute;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  border: 3px solid rgba(244, 234, 210, .75);
  color: #fff;
  font: 400 13px/1 var(--display);
  letter-spacing: 1px;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, .6);
  pointer-events: auto;
  touch-action: none;
  opacity: .85;
  transition: transform .05s;
}
.tb.down { transform: scale(.9); opacity: 1; filter: brightness(1.3); }
/* arco estilo controle: fraco / médio / forte e o especial grande embaixo */
.tb-l { left: 0; top: 40px; background: rgba(58, 160, 255, .55); }
.tb-m { left: 86px; top: 0; background: rgba(255, 196, 40, .55); }
.tb-h { left: 172px; top: 40px; background: rgba(255, 75, 58, .6); }
.tb-s {
  left: 58px;
  top: 104px;
  width: 132px;
  height: 64px;
  border-radius: 34px;
  font-size: 17px;
  background: linear-gradient(180deg, rgba(255, 210, 63, .85), rgba(224, 112, 28, .85));
  color: var(--ink);
  text-shadow: none;
}
.touch-pause {
  position: absolute;
  top: 88px;
  left: 50%;
  width: 46px;
  height: 36px;
  margin-left: -23px;
  border-radius: 8px;
  border: 2px solid rgba(244, 234, 210, .6);
  background: rgba(0, 0, 0, .45);
  color: var(--cream);
  font: 900 16px/1 sans-serif;
  pointer-events: auto;
}

/* ---- aviso de girar */
#rotate { display: none; }
@media (orientation: portrait) and (pointer: coarse) {
  #rotate {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #140a06;
    color: var(--cream);
    text-align: center;
  }
  #rotate .phone { font-size: 72px; line-height: 1; animation: girar 1.6s ease-in-out infinite; color: var(--gold); }
  #rotate b { font: 400 30px/1 var(--display); letter-spacing: 3px; color: var(--gold); }
  #rotate span { font-size: 14px; opacity: .8; }
  @keyframes girar { 0%, 30% { transform: rotate(0); } 60%, 100% { transform: rotate(90deg); } }
}

/* ---- telas baixas (celular deitado): tudo mais compacto */
@media (max-height: 500px) {
  #hud { top: 8px; gap: 10px; }
  .bar { height: 16px; border-width: 2px; }
  .name { font-size: 15px; }
  #timer { font-size: 28px; min-width: 50px; padding: 2px 4px 4px; }
  .pips i { width: 10px; height: 10px; }
  .combo { font-size: 20px; margin-top: 4px; }
  #banner { font-size: 64px; }
  .touch-pause { top: 58px; }

  .panel { padding: 14px 22px; }
  .panel-title { font-size: 30px; margin-bottom: 6px; }
  .menu-list li { font-size: 21px; margin: 2px 0; padding: 4px 14px 4px 10px; }
  .panel.wide { max-height: 92vh; overflow: auto; }
  .controls { font-size: 12px; }
  .controls td { padding: 3px 8px; }
  .panel-sub { font-size: 12px; margin-top: 4px; }

  .logo { font-size: 84px; }
  .select-title { font-size: 26px; margin-top: 8px; }
  .select-info { top: 54px; width: 30vw; padding: 8px 12px; }
  .select-info .big-name { font-size: 28px; }
  .select-info .bio { display: none; }
  .stat { margin: 1px 0; font-size: 11px; }
  .select-info .state { font-size: 16px; margin-top: 4px; }
  .cards { bottom: 14px; gap: 10px; }
  .card { width: 70px; height: 86px; }
  .card b { font-size: 36px; }
  .card span { font-size: 10px; }
  .stage-cards { bottom: 16px; gap: 12px; }
  .stage-card { width: 150px; }
  .stage-art { height: 56px; }
  .stage-card b { font-size: 18px; }
  .back-btn { font-size: 14px; padding: 6px 12px; }
}
