/* D-pad on the left, about 35% of the bar. Action cluster keeps the rest.
   In-store CSS is untouched. */
html, body {
  touch-action: none;
  overscroll-behavior: none;
}
#controls {
  display: block;
  position: relative;
  height: calc(208px + env(safe-area-inset-bottom));
  padding: 0;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
#controls .move {
  position: absolute;
  left: calc(12px + env(safe-area-inset-left));
  top: 50%;
  transform: translateY(-50%);
  width: 172px;
  height: 172px;
  display: grid;
  grid-template-columns: 52px 52px 52px;
  grid-template-rows: 52px 52px 52px;
  gap: 8px;
  touch-action: none;
}
#controls .dpad-up { grid-column: 2; grid-row: 1; }
#controls .dpad-left { grid-column: 1; grid-row: 2; }
#controls .dpad-right { grid-column: 3; grid-row: 2; }
#controls .dpad-down { grid-column: 2; grid-row: 3; }
#controls .move-btn {
  width: 52px;
  height: 52px;
  min-width: 52px;
  min-height: 52px;
  padding: 0;
  color: #fff6e0;
  display: grid;
  place-items: center;
}
#controls .move-btn svg {
  width: 22px;
  height: 22px;
  display: block;
  overflow: visible;
  transform: none;
  pointer-events: none;
}
#controls .move-btn svg path {
  fill: #fff6e0;
  stroke: none;
}
#controls .move-btn.held,
#controls .move-btn:active {
  color: #fff6e0;
}
#controls .move-btn.held svg path,
#controls .move-btn:active svg path {
  fill: #fff6e0;
}
#controls .acts {
  position: absolute;
  right: calc(12px + env(safe-area-inset-right));
  top: 50%;
  transform: translateY(-50%);
  width: 136px;
  height: 172px;
  display: grid;
  grid-template-columns: 64px 64px;
  grid-template-rows: 1fr 1fr;
  gap: 8px;
}
#controls .acts .ctrl {
  width: 64px;
  height: 100%;
  min-width: 60px;
  min-height: 60px;
  font-size: 13px;
  padding: 0 2px;
}
#controls .ctrl {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.movelist {
  list-style: none;
  margin: 8px 0 12px;
  padding: 10px 12px;
  text-align: left;
  border-radius: 14px;
  background: rgba(10, 6, 12, 0.72);
  border: 2px solid rgba(255, 210, 58, 0.45);
}
.movelist li { margin: 4px 0; font-size: 14px; font-weight: 800; line-height: 1.35; }
#controls .ctrl.held,
#controls .ctrl:active {
  transform: translateY(2px) scale(0.97);
  filter: brightness(1.4);
  box-shadow: 0 1px 0 #5a3010, 0 0 14px rgba(255, 210, 58, 0.55);
}
@media (orientation: landscape) {
  #controls { height: calc(188px + env(safe-area-inset-bottom)); }
}
.move-pad {
  position: relative;
  min-height: 148px;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  pointer-events: auto;
  background: transparent;
  border: 0;
}
.joy-base {
  position: relative;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background: rgba(18, 14, 16, 0.55);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.16), 0 8px 18px rgba(0, 0, 0, 0.28);
  touch-action: none;
}
.joy-arrow {
  position: absolute;
  width: 0;
  height: 0;
  border-style: solid;
  opacity: 0.85;
}
.joy-arrow.up {
  top: 10px;
  left: 50%;
  margin-left: -5px;
  border-width: 0 5px 8px 5px;
  border-color: transparent transparent rgba(255, 255, 255, 0.78) transparent;
}
.joy-arrow.down {
  bottom: 10px;
  left: 50%;
  margin-left: -5px;
  border-width: 8px 5px 0 5px;
  border-color: rgba(255, 255, 255, 0.78) transparent transparent transparent;
}
.joy-arrow.left {
  left: 10px;
  top: 50%;
  margin-top: -5px;
  border-width: 5px 8px 5px 0;
  border-color: transparent rgba(255, 255, 255, 0.78) transparent transparent;
}
.joy-arrow.right {
  right: 10px;
  top: 50%;
  margin-top: -5px;
  border-width: 5px 0 5px 8px;
  border-color: transparent transparent transparent rgba(255, 255, 255, 0.78);
}
.joy-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 54px;
  height: 54px;
  margin: -27px 0 0 -27px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 42%, #e6c27a 0%, #c4923a 28%, #8a5a22 62%, #5c3a16 100%);
  box-shadow: inset 0 0 0 3px rgba(90, 52, 18, 0.85), 0 2px 4px rgba(0, 0, 0, 0.35);
  touch-action: none;
}
.attack-arc { position: relative; min-height: 156px; touch-action: none; }
.pad-btn {
  position: absolute;
  width: 86px;
  height: 86px;
  border-radius: 50%;
  border: 3px solid #ffe08a;
  background: radial-gradient(circle at 50% 30%, #5a3424, #140c10 72%);
  color: #fff6e0;
  font-family: "Lilita One", Impact, sans-serif;
  font-size: 15px;
  letter-spacing: 0.04em;
  touch-action: none;
  pointer-events: auto;
  box-shadow: 0 4px 0 #5a3010;
}
.pad-btn.punch { right: 4px; bottom: 4px; }
.pad-btn.kick { right: 78px; bottom: 58px; }
.pad-btn.super {
  right: 4px;
  bottom: 96px;
  width: 74px;
  height: 74px;
  opacity: 0.38;
  border-color: #8a7040;
  pointer-events: none;
}
.pad-btn.super.ready {
  opacity: 1;
  pointer-events: auto;
  border-color: #fff1a8;
  background: radial-gradient(circle at 50% 30%, #ffb000, #c2410c 68%);
  color: #2a0c08;
}
.pad-btn.held, .pad-btn.flash { filter: brightness(1.45); transform: translateY(3px); box-shadow: 0 1px 0 #5a3010; }

#online-prova-bar {
  position: absolute;
  z-index: 40;
  top: 0;
  left: 0;
  right: 0;
  margin: 0;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
  background: #ffd23a;
  color: #1a0902;
  text-align: center;
  font-weight: 900;
  font-size: 15px;
}
#online-prova-bar[hidden] { display: none !important; }
body.online-test #overlay { padding-top: calc(48px + env(safe-area-inset-top)); }
#overlay.show-end {
  display: block;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-top: calc(16px + env(safe-area-inset-top));
}
body.online-test #overlay.show-end {
  padding-top: calc(72px + env(safe-area-inset-top));
}
#screen-end { margin: 0 auto; }
.ladder { list-style: none; padding: 0; margin: 8px 0 0; text-align: left; }
.ladder li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255, 246, 224, 0.15);
  font-weight: 800;
  font-size: 14px;
}
#overlay.show-end { align-items: flex-start; }
#screen-end h1 { font-size: clamp(32px, 9vw, 52px); }
#screen-end .share-card {
  width: min(100%, 440px);
  max-height: none;
  height: auto;
  object-fit: contain;
  object-position: center top;
  display: block;
  background: #140810;
}
.share-card {
  width: min(100%, 440px);
  margin: 8px auto;
  border-radius: 12px;
  border: 2px solid #ffd23a;
}
form.stack { text-align: left; }
form.stack label { display: block; font-weight: 800; margin: 8px 0 4px; }
form.stack input {
  width: 100%;
  min-height: 48px;
  border-radius: 12px;
  border: 2px solid #ffd23a;
  background: #1a1218;
  color: #fff6e0;
  padding: 0 12px;
  font-size: 16px;
}
.upgrade-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(100%, 420px);
  margin: 12px auto 0;
}
.upgrade-card {
  min-height: 96px;
  width: 100%;
  border-radius: 16px;
  border: 3px solid #ffe56a;
  background: linear-gradient(160deg, #3a140c 0%, #1a0c12 55%, #0e1a22 100%);
  color: #fff6e0;
  padding: 14px 16px;
  text-align: left;
  box-shadow: 0 8px 0 #5a2010;
  touch-action: manipulation;
}
.upgrade-card b {
  display: block;
  font-family: Bangers, Impact, sans-serif;
  font-size: 28px;
  letter-spacing: 0.04em;
  color: #ffe56a;
}
.upgrade-card span {
  display: block;
  margin-top: 4px;
  font-size: 16px;
  line-height: 1.3;
}
.upgrade-card:active {
  transform: translateY(4px);
  box-shadow: 0 4px 0 #5a2010;
}
.item-panel { text-align: center; }
.item-panel h1 {
  font-size: clamp(40px, 12vw, 64px);
  line-height: 0.9;
  color: #ffe56a;
  text-shadow: 0 4px 0 #8a2208, 0 0 18px #ff6a1a;
}
.item-stage {
  position: relative;
  width: min(100%, 320px);
  height: 300px;
  margin: 8px auto 0;
}
#overlay:has(#screen-upgrade:not([hidden])),
#overlay:has(#screen-item:not([hidden])) {
  align-items: center;
  background: rgba(7, 4, 12, 0.94);
}
.item-stage img {
  position: relative;
  z-index: 1;
  width: 260px;
  height: 260px;
  object-fit: contain;
  filter: drop-shadow(0 0 18px #ff7a18);
  animation: item-float 1.4s ease-in-out infinite;
}
.item-pedestal {
  position: absolute;
  left: 50%;
  bottom: 8px;
  width: 210px;
  height: 28px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse at center, #ffe56a 0%, #ff6a1a 42%, rgba(255, 40, 0, 0) 72%);
  box-shadow: 0 0 24px #ff5a18;
}
.item-name {
  font-family: Bangers, Impact, sans-serif;
  font-size: clamp(26px, 7vw, 36px);
  letter-spacing: 0.03em;
  color: #fff6e0;
  margin: 8px 0 0;
}
.item-hp {
  font-family: Bangers, Impact, sans-serif;
  font-size: clamp(36px, 10vw, 52px);
  color: #7CFF8A;
  margin: 0;
  text-shadow: 0 3px 0 #145018;
}
@keyframes item-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

