/* Mega orb artwork: approved image scaled down without any redraw.
   One control sits immediately to the right of the name input in both modes. */
#gameScreen .word-entry>.mega-input-row,
#spinGame .word-entry>.mega-input-row{
 display:grid;grid-template-columns:minmax(0,1fr) 44px;gap:7px;
 align-items:center;min-width:0;width:100%;
}
#gameScreen .word-entry>.mega-input-row>input,
#spinGame .word-entry>.mega-input-row>input{
 width:100%;min-width:0;max-width:100%;box-sizing:border-box;
}
#gameScreen .mega-input-row>.mega-action,
#spinGame .mega-input-row>.mega-action{
 display:block;box-sizing:border-box;width:44px;height:44px;
 min-width:44px;min-height:44px;padding:0;margin:0;
 border:0;border-radius:50%;background:transparent;
 box-shadow:none;line-height:0;cursor:pointer;touch-action:manipulation;
 transition:filter .15s ease,opacity .15s ease,transform .15s ease;
}
.mega-input-row>.mega-action[hidden]{display:none!important}
.mega-input-row>.mega-action .mega-button-image{
 display:block;width:100%;height:100%;object-fit:contain;
 pointer-events:none;user-select:none;
}
.mega-input-row>.mega-action.armed{
 filter:drop-shadow(0 0 6px #d57bff) drop-shadow(0 0 4px #78edff);
}
.mega-input-row>.mega-action.used,
.mega-input-row>.mega-action.used:disabled{
 filter:grayscale(1);opacity:.8;cursor:not-allowed;
}
.mega-input-row>.mega-action:disabled:not(.used){
 opacity:.55;cursor:not-allowed;
}
.mega-input-row>.mega-action:focus-visible{
 outline:3px solid #7aceff;outline-offset:3px;
}
.mega-input-row>.mega-action:active:not(:disabled){transform:scale(.95)}
@media(max-width:430px){
 #gameScreen .word-entry>.mega-input-row,
 #spinGame .word-entry>.mega-input-row{
  grid-template-columns:minmax(0,1fr) 40px;gap:5px;
 }
 #gameScreen .mega-input-row>.mega-action,
 #spinGame .mega-input-row>.mega-action{
  width:40px;height:40px;min-width:40px;min-height:40px;
 }
}
.mega-form-dialog{max-width:min(96vw,540px);max-height:78dvh;overflow:auto;border:3px solid #a6c2d9;border-radius:14px;padding:15px;background:#172a46;color:#fff9d8;box-shadow:0 15px 75px #0d1839c7}
.mega-form-dialog::backdrop{background:#06172ba8}
.mega-choice-head{display:flex;justify-content:space-between;align-items:center;gap:15px;font:900 15px 'Courier New',monospace}
.mega-form-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:10px;margin:12px 0}
.mega-form-option{display:flex;flex-direction:column;align-items:center;gap:5px;cursor:pointer;min-height:160px;border:2px solid #81bed5;background:#27445c;color:#fff;border-radius:9px;padding:8px}
.mega-form-option img{width:100px;height:100px;object-fit:contain;image-rendering:pixelated}
.mega-form-option small{font-size:10px;text-transform:uppercase}
.mega-form-option:hover,.mega-form-option:focus-visible{border-color:#ffe58d;outline:2px solid #ab8cf6}
.rally-score-overlay.mega-charging .score-reveal-halo{background:conic-gradient(#ff6dbe,#ac7af8,#5dc8ff,#78f6d2,#bcff8a,#fff49d,#ff6dbe);filter:blur(14px);opacity:.88;animation:mega-spin 650ms linear infinite}
.rally-score-overlay.mega-charging .score-reveal-pokemon{animation:mega-flicker 130ms infinite alternate}
.rally-score-overlay.mega-transformed .score-reveal-number>span,
.rally-score-overlay.mega-transformed .score-reveal-reward{background:linear-gradient(120deg,#ff70bb,#bd7cff,#62c1ff,#69e8ce,#b6ff74,#ffe38b);background-size:300% 300%;background-clip:text;-webkit-background-clip:text;-webkit-text-fill-color:transparent;-webkit-text-stroke:1px #fff8e8;animation:mega-rainbow 1.3s linear infinite}
.rally-score-overlay.mega-transformed .score-reveal-number{filter:drop-shadow(0 4px 0 #683c86) drop-shadow(0 0 11px #90ddff)}
.rally-score-overlay.mega-transformed .score-reveal-pokemon{filter:drop-shadow(0 0 12px #d28bff);animation:mega-bloom 620ms ease-out}
@keyframes mega-spin{to{transform:rotate(360deg)}}
@keyframes mega-rainbow{to{background-position:100% 100%}}
@keyframes mega-flicker{to{opacity:.4;transform:scale(1.16)}}
@keyframes mega-bloom{0%{transform:scale(.2);opacity:0;filter:brightness(4)}65%{transform:scale(1.33);opacity:1}100%{transform:scale(1)}}
@media(prefers-reduced-motion:reduce){.mega-action.armed,.rally-score-overlay.mega-charging .score-reveal-pokemon,.rally-score-overlay.mega-charging .score-reveal-halo,.rally-score-overlay.mega-transformed .score-reveal-pokemon{animation:none!important}}

/* Do not signal a Mega until the score reveal animation is complete. */
.mega-reveal-name{background:linear-gradient(115deg,#fa7ac8,#b58bff,#6dd7ff,#8df4ca,#dcf77d,#f5db8a);background-clip:text;-webkit-background-clip:text;-webkit-text-fill-color:transparent;font-weight:900}
.history-item.mega-history-result .history-points{background:linear-gradient(110deg,#ff78bc,#aa8dff,#6cd1f7,#83ebb4,#ffe48d);background-clip:text;-webkit-background-clip:text;-webkit-text-fill-color:transparent;font-weight:900}


