/* GACHAMON V5.1.1: safe viewport + playable controls across browser/PWA.
   App artboard scales independently; short screens scroll rather than clip. */
:root{--g5-safe-top:env(safe-area-inset-top,0px);--g5-safe-bottom:env(safe-area-inset-bottom,0px)}
html{height:100%;background:#080b24;-webkit-text-size-adjust:100%}
body.g4-active{margin:0;min-height:100%;overscroll-behavior:none}
body.g4-active #g4-root{height:100dvh;overflow:hidden}
body.g4-active .g4-viewport{height:100%;padding:var(--g5-safe-top) 0 var(--g5-safe-bottom);align-items:center;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch}
body.g4-active .g4-viewport.g5-short{align-items:flex-start}
body.g4-active .g4-stage{width:var(--g5-stage-width,min(100vw,56.28dvh,540px));height:auto;min-height:0;max-height:none;flex-shrink:0;aspect-ratio:941/1672}
body.g4-active .g4-hot,body.g4-active .g4-slot,body.g4-active .g4-fullpanel button,body.g4-active .g4-dialog button{touch-action:manipulation;-webkit-tap-highlight-color:transparent;transform-origin:center;transition:transform 150ms cubic-bezier(.2,.8,.2,1),filter 150ms ease,box-shadow 150ms ease}
body.g4-active .g4-hot:active,body.g4-active .g4-hot.g4-pressed{transform:scale(.945);filter:brightness(1.16) drop-shadow(0 0 10px #ffdb78);box-shadow:0 0 23px #ffd78b77,inset 0 0 14px #ffffff33}
body.g4-active .g4-slot:active,body.g4-active .g4-fullpanel button:active,body.g4-active .g4-dialog button:active{transform:scale(.965);filter:brightness(1.17) drop-shadow(0 0 8px #9e6bff)}
body.g4-active .g4-hot:focus-visible,body.g4-active .g4-slot:focus-visible,body.g4-active .g4-fullpanel button:focus-visible{outline:3px solid #ffe497;outline-offset:2px}
body.g4-active .g4-fullpanel{padding-bottom:max(8%,calc(var(--g5-safe-bottom) + 16px));-webkit-overflow-scrolling:touch}
body.g4-active .g4-dialog-box{max-height:min(90%,calc(100dvh - var(--g5-safe-top) - var(--g5-safe-bottom) - 24px));-webkit-overflow-scrolling:touch}
/* Original Buddy and Capsule Pick: flex layout that never clips bottom CTA on short devices. */
body.g4-active.g4-legacy-play{overflow:hidden}
body.g4-active.g4-legacy-play #app{width:100%;max-width:480px;height:100dvh;min-height:0;max-height:100dvh;padding-top:var(--g5-safe-top);padding-bottom:var(--g5-safe-bottom);overflow:hidden;display:flex;flex-direction:column}
body.g4-active.g4-legacy-play .app-header{min-height:64px;height:64px;flex:0 0 64px;padding:0 12px;gap:6px;background:linear-gradient(180deg,#080a29f7,#171242d6)}
body.g4-active.g4-legacy-play .back-btn{min-width:42px!important;min-height:44px!important;width:42px!important;height:44px!important}
body.g4-active.g4-legacy-play .round-icon,body.g4-active.g4-legacy-play .point-pill{min-height:44px}
body.g4-active.g4-legacy-play .screens{min-height:0;flex:1;overflow:hidden}
body.g4-active.g4-legacy-play .screen{height:100%;min-height:0;padding-bottom:max(20px,calc(var(--g5-safe-bottom) + 12px));overscroll-behavior:contain;-webkit-overflow-scrolling:touch}
body.g4-active.g4-legacy-play .screen-buddy{display:flex;flex-direction:column;overflow-y:auto;overflow-x:hidden}
body.g4-active.g4-legacy-play .screen-arena{display:flex;flex-direction:column;overflow-y:auto;overflow-x:hidden;padding-bottom:0!important}
body.g4-active.g4-legacy-play .screen-arena .arena-top{flex-shrink:0}
body.g4-active.g4-legacy-play .screen-arena .gx-arena-field{min-height:190px;flex:1 0 190px;overflow:hidden}
body.g4-active.g4-legacy-play .screen-arena .gx-arena-controls{position:sticky;bottom:0;z-index:10;flex-shrink:0;padding-bottom:max(20px,calc(var(--g5-safe-bottom) + 6px));margin-bottom:0;background:linear-gradient(180deg,#322079,#0c1033 78%)}
body.g4-active.g4-legacy-play .screen-arena .open-btn{min-height:55px}
body.g4-active.g4-legacy-play .screen-buddy .gx-buddy-scene{flex:1 0 180px;min-height:180px}
body.g4-active.g4-legacy-play .buddy-option,body.g4-active.g4-legacy-play .qty-btn,body.g4-active.g4-legacy-play .auto-pick-btn{touch-action:manipulation;min-height:44px}
@media(max-width:390px){
 body.g4-active.g4-legacy-play .app-header{padding:0 8px;gap:5px}
 body.g4-active.g4-legacy-play .brand-mark{width:34px;height:34px}
 body.g4-active.g4-legacy-play .brand-type strong{font-size:16px;letter-spacing:-.7px}
 body.g4-active.g4-legacy-play .brand-type small{font-size:7px;letter-spacing:2px}
 body.g4-active.g4-legacy-play .header-right{gap:4px}
 body.g4-active.g4-legacy-play .point-text{display:none}
 body.g4-active.g4-legacy-play .round-icon{width:42px;height:44px}
 body.g4-active.g4-legacy-play .screen{padding-left:14px;padding-right:14px}
 body.g4-active.g4-legacy-play .gx-arena-topper{margin-left:-14px;margin-right:-14px}
 body.g4-active.g4-legacy-play .gx-arena-field{margin-left:-14px;margin-right:-14px}
 body.g4-active.g4-legacy-play .gx-arena-controls{margin-left:-14px;margin-right:-14px}
}
@media(max-height:740px){
 body.g4-active.g4-legacy-play .screen-buddy .gx-buddy-scene{flex:1 0 160px;min-height:160px}
 body.g4-active.g4-legacy-play .screen-arena .gx-arena-field{flex:1 0 205px}
 body.g4-active.g4-legacy-play .screen-buddy .section-heading{font-size:clamp(31px,8vw,40px)}
 body.g4-active.g4-legacy-play .screen-buddy .section-subtitle{font-size:12px}
}
@media (orientation:landscape) and (max-height:600px){
 body.g4-active.g4-legacy-play .screen-buddy,
 body.g4-active.g4-legacy-play .screen-arena{overflow-y:auto}
}
@media(display-mode:standalone){
 body.g4-active .g4-viewport{background:#07091f}
}

/* GACHAMON V5.2 interactive play polish: no ghost podium covering Buddy and
   game choices are full-size priced controls, not tiny 1x / 5x switches. */
body.g4-active.g4-legacy-play .gx-scene-backdrop img{display:none!important}
body.g4-active.g4-legacy-play .gx-buddy-scene{
  background:radial-gradient(ellipse at 50% 62%,#3398e34d,#5d2fa65c 40%,#150b47 78%);
  box-shadow:inset 0 0 35px #4b31b488,0 0 19px #724ddd5c}
body.g4-active.g4-legacy-play .gx-buddy-scene .buddy-character{
  filter:drop-shadow(0 14px 10px #05051e90) drop-shadow(0 0 20px #78dfff80)}
body.g4-active.g4-legacy-play .gx-buddy-scene .buddy-platform{
  bottom:2%;width:min(90%,320px);
  box-shadow:0 0 24px #41dcff99,0 0 15px #7c62ff77}
body.g4-active.g4-legacy-play .app-header .brand{
  flex:1 1 auto;min-width:0;max-width:185px;height:58px;
  background:url('/sources/ui/gachamon_wordmark.webp') center / contain no-repeat;
  filter:drop-shadow(0 0 8px #4abfff66);
}
body.g4-active.g4-legacy-play .app-header .brand-mark,
body.g4-active.g4-legacy-play .app-header .brand-type{display:none}
body.g4-active.g4-legacy-play .gx-arena-controls .controls-buttons{
  display:flex;align-items:stretch;flex-direction:column;gap:9px;margin:10px 0}
body.g4-active.g4-legacy-play .gx-arena-controls .quantity-tabs{
  display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:10px;width:100%}
body.g4-active.g4-legacy-play .gx-arena-controls .qty-btn{
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  width:100%;min-width:0;min-height:59px;gap:2px;
  font-size:15px;font-weight:900;
  border:2px solid #7ad8ff;border-radius:15px;
  color:#fff;
  background:linear-gradient(160deg,#1359b9,#172f88 75%,#0d1c5b);
  box-shadow:inset 0 2px #defcff75,0 4px #091a56,0 0 13px #0ecbff66}
body.g4-active.g4-legacy-play .gx-arena-controls .qty-btn:last-child{
  border-color:#f69aff;
  background:linear-gradient(155deg,#7c2bad,#54238a 80%,#241253);
  box-shadow:inset 0 2px #fce6ff87,0 4px #2f0c56,0 0 13px #f04aff66}
body.g4-active.g4-legacy-play .gx-arena-controls .qty-btn small{
  font-size:12px;font-weight:900;color:#ffdf71;text-shadow:0 0 6px #ffbd496b}
body.g4-active.g4-legacy-play .gx-arena-controls .qty-btn.is-active{
  border-color:#fff0ad;
  box-shadow:inset 0 2px #fff9,0 3px #a0572c,0 0 18px #ffd15b9c;
  filter:brightness(1.13)}
body.g4-active.g4-legacy-play .gx-arena-controls .auto-pick-btn{
  align-self:center;width:min(65%,260px);min-height:43px;border-radius:999px;
  border:2px solid #be8bff;color:#fff;
  background:linear-gradient(180deg,#6940ae,#2d1c7a);
  box-shadow:inset 0 2px #ffffff74,0 4px #1d124e,0 0 16px #aa5aff66}
body.g4-active.g4-legacy-play #buddy-continue{
  min-height:58px;border-radius:999px;font-size:18px;
  font-style:italic;letter-spacing:-.02em;
  background:linear-gradient(180deg,#fff4bb 0%,#ffce4c 48%,#ffa42b 100%);
  box-shadow:inset 0 3px #ffffffe0,0 6px #a9621c,0 0 20px #ffd05b99}
body.g4-active.g4-legacy-play #buddy-continue:active{
  transform:translateY(4px) scale(.98);
  box-shadow:inset 0 2px #fff8,0 1px #98501d,0 0 25px #ffda71b0}
body.g4-active.g4-legacy-play .gx-arena-controls #open-btn{
  border-radius:999px;font-size:17px;font-style:italic;letter-spacing:-.02em}
@media(max-width:380px){
 body.g4-active.g4-legacy-play .app-header .brand{max-width:155px}
 body.g4-active.g4-legacy-play .gx-arena-controls .qty-btn strong{font-size:13px}
 body.g4-active.g4-legacy-play .gx-arena-controls .qty-btn small{font-size:12px}
}

/* V5.2.1 visual QA polish: eliminate the last legacy podium image bleeding
   through transparent Buddy and Capsule Pick panels. */
body.g4-active.g4-legacy-play #app{
  background:radial-gradient(ellipse at 50% 30%,#28216b 0%,#161144 45%,#070a22 100%)!important}
body.g4-active.g4-legacy-play .screen-arena #arena-heading{
  font-size:clamp(29px,7.7vw,39px);
  line-height:.98;
  text-align:center;
  margin:2px 0 5px;
}
body.g4-active.g4-legacy-play .screen-arena #arena-heading em{
  font-size:1.12em;
  letter-spacing:-.04em;
}
