*{box-sizing:border-box}body{margin:0;background:#061c35;color:white;font-family:Arial,Helvetica,sans-serif;min-height:100svh;display:grid;place-items:center}button{font:inherit;color:inherit;cursor:pointer;touch-action:manipulation}button:focus-visible{outline:3px solid #ffe06a;outline-offset:4px}#game{position:relative;width:min(100vw,calc(100svh * 1672 / 941));max-width:100vw;max-height:100svh;aspect-ratio:1672/941;height:auto;overflow:hidden;container-type:inline-size;isolation:isolate}.stadium{width:100%;height:100%;position:absolute;inset:0;object-fit:fill;object-position:center;user-select:none;pointer-events:none}.scoreboard{position:absolute;left:1.75%;top:1.9%;width:25.65%;height:15.4%;background:linear-gradient(120deg,#10345b,#04203e);border:2px solid #e1efff;border-radius:1cqw;padding:.5cqw 1.1cqw;font-size:1.38cqw;box-shadow:0 3px 9px #08244940}.scoreboard>div{height:33%;display:flex;align-items:center;gap:.4cqw}.scoreboard>div+div{border-top:1px solid #5baee4}.scoreline{justify-content:space-between;font-size:1.65cqw}.scoreline b:first-child{display:flex;justify-content:space-between;width:55%;border-right:2px solid #48a0da;padding-right:2.5cqw}.scoreline small{font-size:.95cqw;opacity:.7}.billboard{position:absolute;left:41.3%;top:10.9%;width:19.1%;height:14.4%;background:radial-gradient(ellipse at center,#126bd3,#12378f);display:flex;align-items:center;justify-content:center;flex-direction:column;text-align:center;transform:rotate(-.3deg);border:2px solid #2865bd;text-shadow:0 .22cqw #172452,0 -.12cqw #fff8}.billboard>span{font-size:1.25cqw;letter-spacing:.32cqw;font-weight:900;color:#d4efff}.billboard strong{font-size:2.5cqw;line-height:.99;color:#ffce3c;font-weight:1000;font-style:italic}.billboard em{font-size:1.3cqw;color:white}.controls{position:absolute;right:.9%;top:1.9%;display:flex;gap:.65cqw}.controls button{border:2px solid #d6eeff;background:#04233f;width:4.5cqw;height:4.5cqw;border-radius:50%;display:grid;place-items:center;font-weight:900;font-size:2.6cqw}.controls svg{width:58%;height:58%;fill:#f4fbff;stroke:none}.controls svg .waves{fill:none;stroke:#f4fbff;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}.controls button{box-shadow:0 .18cqw .45cqw #00162888, inset 0 1px 0 #ffffff22;background:linear-gradient(160deg,#0a3a63,#04233f);border-color:#e8f6ff}.controls button:hover{background:linear-gradient(160deg,#176090,#0a3354);filter:brightness(1.06)}.controls button:active{transform:scale(.94)}.controls #pause[data-state=play]{border-color:#ffd04c}.controls #sound[data-muted=true]{opacity:.7;border-color:#9ec8e4}#hit{position:absolute;left:1.7%;bottom:4.1%;width:12.8%;aspect-ratio:1;border:2px solid white;border-radius:50%;background:linear-gradient(130deg,#093d58,#071c36);box-shadow:0 .4cqw 1cqw #001a3655;display:grid;place-items:center;padding:0}#hit:hover{filter:brightness(1.15)}#hit:active{transform:scale(.95)}#hit>b{position:absolute;bottom:11%;font-size:1.15cqw;letter-spacing:.15cqw}.meter{position:absolute;inset:10%;border-radius:50%;background:conic-gradient(from 230deg,#00cd69 0deg 110deg,#ffe039 110deg 175deg,#ff842e 175deg 210deg,#ee322b 210deg 225deg,transparent 225deg);mask:none}.meter:before{content:'';position:absolute;inset:14%;background:#0b304a;border-radius:50%}.cricketball{position:absolute;inset:29%;display:grid;place-items:center;border:2px solid #ffb0b0;border-radius:50%;background:radial-gradient(circle at 30% 24%,#ffd0cc 0 10%,#ff4d55 22%,#d01228 55%,#7a0614 100%);box-shadow:0 0 0 .5cqw #18445e,inset -.1cqw -.08cqw .2cqw #5a000880;color:transparent;font-size:0}#needle{position:absolute;left:49%;top:0;height:50%;width:2%;background:white;transform-origin:bottom;transform:rotate(-130deg);z-index:2;border-radius:2px}.instructions{position:absolute;left:50%;top:69%;transform:translate(-50%,-50%);display:flex;align-items:center;flex-direction:column;gap:.7cqw;background:#052847eb;padding:1.4cqw 2cqw;border:1px solid #b8e8ff;border-radius:1cqw;box-shadow:0 8px 35px #0005;white-space:nowrap}.instructions>b{font-size:2cqw;color:#ffcf4c}.instructions>span{font-size:1.1cqw}.instructions small{font-size:.95cqw;color:#bad8ed}#start,.action{background:linear-gradient(#ffda52,#ffaa24);border:1px solid #ffea89;color:#153253;font-weight:900;padding:.9cqw 2cqw;border-radius:.5cqw;font-size:1.2cqw;box-shadow:0 .25cqw 0 #b16a16}#start span{margin-left:1cqw}.shotbar{position:absolute;left:37%;bottom:3%;width:30%;text-align:center;background:#062743e8;border:1px solid #8fb5d0;padding:.7cqw 1cqw;border-radius:.7cqw;font-size:1.1cqw}.shotbar small{font-size:.8cqw;letter-spacing:.14cqw;color:#c6e6f8}.track{height:.7cqw;background:#385068;border-radius:1cqw;margin:.5cqw 0;position:relative;overflow:hidden}.sweet{position:absolute;left:67.5%;width:13%;background:linear-gradient(90deg,#2fe074,#7dffb0,#2fe074);height:100%;box-shadow:0 0 .35cqw #4cea8588}#progress{position:absolute;width:3px;background:white;height:100%;left:0}#ball{display:none;position:absolute;border-radius:50%;background: radial-gradient(circle at 28% 24%,#c45a52 0 6%,transparent 22%), radial-gradient(circle at 72% 70%,#3a0508 0 18%,transparent 42%), radial-gradient(circle at 50% 45%,#b01a24 0%,#8e1018 42%,#5c0a10 78%,#2e0408 100%);border:1px solid #6a0e14;box-shadow:0 .2cqw .4cqw #000a,inset -.18cqw -.12cqw .35cqw #1a010480,inset .1cqw .08cqw .22cqw #e0706033;z-index:4;transform:translate(-50%,-50%) rotate(var(--spin,0deg)) scale(var(--squash,1),calc(2 - var(--squash,1)));overflow:hidden}#ball .shine{position:absolute;left:16%;top:14%;width:26%;height:16%;border-radius:50%;background:#ffffff28;filter:blur(1.4px);pointer-events:none}#ball .seam{position:absolute;left:36%;top:-6%;width:28%;height:112%;border-radius:50%;border-left:2px solid #f2ece4;border-right:2px solid #f2ece4;box-shadow:inset 0 0 0 1px #ffffff22;opacity:.92;pointer-events:none;transform:rotate(12deg)}#ball .stitch{position:absolute;pointer-events:none;border-radius:50%;border-left:1.5px dotted #efe8df;border-right:1.5px dotted #efe8df;opacity:.9}#ball .stitch.a{inset:4% 38%;transform:rotate(4deg)}#ball .stitch.b{inset:10% 40%;transform:rotate(20deg)}#ball-trail{display:none;position:absolute;inset:0;pointer-events:none;z-index:3}#ball-trail span{position:absolute;border-radius:50%;background:radial-gradient(circle at 35% 30%,#a82830aa,#5a0a1088);transform:translate(-50%,-50%);filter:blur(.6px)}#flash{position:absolute;left:50%;top:32%;transform:translateX(-50%);font-size:4cqw;font-weight:1000;text-align:center;white-space:nowrap;color:#ffe053;text-shadow:0 .3cqw 0 #092740,0 0 1cqw #092740;pointer-events:none}.radar{position:absolute;right:1.45%;bottom:7.8%;width:12.8%;aspect-ratio:1;background:radial-gradient(circle,#25623c,#064329);border:2px solid #e1efff;border-radius:50%;box-shadow:inset 0 0 0 .5cqw #2a695b}.radar-ring{position:absolute;inset:19%;border:1px solid #6d967e;border-radius:50%}.pitch{position:absolute;left:46%;top:35%;width:9%;height:31%;background:#dbb574;border:1px solid #edcf86}.you,.fielder,#radarball{position:absolute;width:5%;height:5%;border-radius:50%;background:white;box-shadow:0 0 0 1px #163822}.you{left:48%;top:63%;background:#ffe632}.a{left:48%;top:16%}.b{left:29%;top:30%}.c{left:68%;top:30%}.d{left:19%;top:53%}.e{left:79%;top:53%}.f{left:48%;top:80%}#radarball{background:#ef4537;display:none}dialog{color:white;border:1px solid #a3d9ff;background:#082b4e;border-radius:18px;width:min(400px,90vw);padding:30px;text-align:center;box-shadow:0 20px 100px #0008}dialog::backdrop{background:#021126a6;backdrop-filter:blur(5px)}dialog h2{color:#ffcf4c;margin-top:4px;font-size:28px}dialog p{line-height:1.5;color:#c5e0ee}dialog .action{font-size:16px;padding:13px 24px;margin:8px}dialog select{padding:10px;border-radius:6px;margin:12px;width:100%;font-size:16px}dialog label{display:block;text-align:left}.close{position:absolute;right:10px;top:7px;background:none;border:0;font-size:28px}body.swing #game{animation:impact .24s}@keyframes impact{0%{transform:translate(0,0) scale(1)}35%{transform:translate(0,3px) scale(1.01)}70%{transform:translate(-2px,1px)}100%{transform:translate(0,0) scale(1)}}@media(max-aspect-ratio:1/1){body:after{content:'Turn your phone sideways for the best stadium view';font-size:14px;color:#a9c8df;position:absolute;top:calc(50% + 32vw);text-align:center;padding:20px}#game{width:min(100vw,calc(100svh * 1672 / 941));max-height:100svh}.controls button{min-width:30px;min-height:30px}.instructions{padding:2cqw}.instructions>span,.instructions small{font-size:1.8cqw}#start{font-size:2cqw}.scoreboard{font-size:1.5cqw}}

#players{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:2;object-fit:fill;image-rendering:auto}
#view3d{position:absolute;inset:0;z-index:4;pointer-events:none}
#view3d canvas{width:100%!important;height:100%!important;display:block}
body.swing #game{animation:impact .22s ease-out}
.scoreboard,.billboard,.controls,#hit,.instructions,.shotbar,.radar{z-index:5}
#flash{z-index:6}
#ball-trail{z-index:3}
#bounce-mark{display:none;position:absolute;width:2.8%;height:1%;border:2px solid #ffe3a2;border-radius:50%;transform:translate(-50%,-50%);box-shadow:0 0 10px #f3d7a4;pointer-events:none;z-index:3}


/* Offscreen ball source; its pixels are composited among players by ground depth. */
#view3d{visibility:hidden;z-index:0}
#ball-trail{display:none!important}

/* The decorative stadium board belongs behind live play. */
.billboard{z-index:1}
.radar .fielder.a{left:24%;top:49%}.radar .fielder.b{left:73%;top:49%}

#fireworks{position:absolute;inset:0;width:100%;height:100%;z-index:6;pointer-events:none}

#game{touch-action:manipulation}#load-progress{width:min(65%,360px);height:16px;accent-color:#ffd04c}#start[hidden]{display:none}.instructions{z-index:30}

/* Splash: full overlay until Play */
body.splash .scoreboard,
body.splash .controls,
body.splash #hit,
body.splash .radar,
body.splash .shotbar{opacity:0;pointer-events:none}
#game:before{content:'';position:absolute;inset:0;background:linear-gradient(180deg,#021526cc 0%,#04233fcc 45%,#021526e6 100%);opacity:0;pointer-events:none;z-index:25;transition:opacity .35s ease}
body.splash #game:before{opacity:1;pointer-events:auto}
.instructions{z-index:40;animation:splashIn .55s ease both;gap:1cqw;min-width:min(72%,420px);white-space:normal;text-align:center}
.splash-load{display:flex;flex-direction:column;align-items:center;gap:.45cqw;width:100%}
#load-progress{width:100%;max-width:360px;height:1.1cqw;min-height:12px;border-radius:1cqw;overflow:hidden;background:#1a3f5e;border:1px solid #7eb7df}
#load-progress::-webkit-progress-bar{background:#1a3f5e;border-radius:1cqw}
#load-progress::-webkit-progress-value{background:linear-gradient(90deg,#ffd04c,#ffaa24);border-radius:1cqw;transition:width .25s ease}
#load-progress::-moz-progress-bar{background:linear-gradient(90deg,#ffd04c,#ffaa24);border-radius:1cqw}
#start{min-width:38%;letter-spacing:.12cqw;animation:playPop .4s ease both}
#splash-hint[hidden],#splash-load[hidden]{display:none}
@keyframes splashIn{from{opacity:0;transform:translate(-50%,-46%) scale(.96)}to{opacity:1;transform:translate(-50%,-50%) scale(1)}}
.billboard,
#instructions,
.instructions{display:none!important;visibility:hidden!important;pointer-events:none!important}

/* —— Home screen (outside the stadium game) —— */
body.on-home{
  display:block;height:100dvh;min-height:100dvh;height:100svh;min-height:100svh;place-items:unset;
  background:#03101f;overflow:hidden;
  font-family:"Manrope",Arial,Helvetica,sans-serif;
}
body.on-home:after{display:none!important;content:none!important}
body.on-home #game,
#game[hidden],
#home-screen[hidden]{display:none!important}
.visually-hidden{
  position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;
  overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;
}
.home-screen{
  position:relative;height:100dvh;max-height:100dvh;height:100svh;max-height:100svh;
  padding:10px 18px 14px;overflow:hidden;
  display:grid;grid-template-rows:auto minmax(0,1fr);gap:8px;
}
.home-bg{
  position:fixed;inset:0;z-index:0;pointer-events:none;
  background:
    linear-gradient(165deg,#010910f0 0%,#07407aaa 36%,#031525f6 100%),
    url('stadium-clean.png') center/cover no-repeat;
  filter:saturate(1.2) contrast(1.08);
  transform:scale(1.06);
  animation:homeBgDrift 20s ease-in-out infinite alternate;
}
.home-glow{
  position:fixed;inset:0;z-index:1;pointer-events:none;
  background:
    radial-gradient(ellipse 42% 40% at 50% 38%,#ffd04c40 0%,transparent 55%),
    radial-gradient(ellipse 55% 45% at 50% 55%,#1bb7ff30 0%,transparent 62%),
    radial-gradient(ellipse 28% 24% at 10% 16%,#3ddc7930 0%,transparent 55%),
    radial-gradient(ellipse 24% 22% at 90% 18%,#ff8a3030 0%,transparent 55%);
}
.home-sparkles{
  position:fixed;inset:0;z-index:1;pointer-events:none;opacity:.6;
  background-image:
    radial-gradient(circle at 16% 20%,#fff9 0 1.5px,transparent 2px),
    radial-gradient(circle at 78% 16%,#ffd04ccc 0 1.5px,transparent 2px),
    radial-gradient(circle at 88% 58%,#fff7 0 1px,transparent 2px),
    radial-gradient(circle at 10% 68%,#7ee7ffaa 0 1.5px,transparent 2px),
    radial-gradient(circle at 58% 10%,#fff6 0 1px,transparent 2px),
    radial-gradient(circle at 42% 78%,#ffd04c66 0 1px,transparent 2px);
  animation:sparklePulse 3.6s ease-in-out infinite;
}
.home-vignette{
  position:fixed;inset:0;z-index:1;pointer-events:none;
  background:radial-gradient(ellipse 80% 75% at 50% 45%,transparent 35%,#01080fee 100%);
}
.home-top,.home-main{position:relative;z-index:2}
.home-top{
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  max-width:1280px;width:100%;margin:0 auto;
  padding:8px 12px;
  border-radius:999px;
  background:linear-gradient(90deg,#04233fcc,#0a3d66cc);
  border:1px solid #7eb7df66;
  box-shadow:0 10px 30px #0006, inset 0 1px 0 #ffffff18;
  backdrop-filter:blur(12px);
}
.home-top-brand{
  display:flex;align-items:center;gap:8px;
  font-family:"Bebas Neue",Impact,sans-serif;letter-spacing:.1em;
  color:#ffd04c;font-size:18px;
}
.home-top-dot{
  width:10px;height:10px;border-radius:50%;
  background:radial-gradient(circle at 35% 30%,#fff,#3ddc79 45%,#0d6b32);
  box-shadow:0 0 10px #3ddc79aa;animation:sparklePulse 2s ease-in-out infinite;
}
.home-top-actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}
.home-top .top-btn{
  padding:8px 14px;font-size:12px;border-radius:999px;font-weight:800;
  background:#031f38cc;border:1px solid #7eb7df;backdrop-filter:blur(8px);
  transition:transform .15s ease, filter .15s ease;
}
.home-top .top-btn:hover{filter:brightness(1.12);transform:translateY(-1px)}
.home-top .top-btn.chip{
  background:linear-gradient(120deg,#134a78,#0a3354);
  color:#ffd04c;border-color:#ffd04c88;
}

.home-main{
  max-width:1280px;width:100%;margin:0 auto;min-height:0;
  display:grid;
  grid-template-columns:minmax(230px,.8fr) minmax(0,1.35fr) minmax(230px,.8fr);
  grid-template-areas:"stats center board";
  gap:14px 18px;align-items:stretch;
  animation:homeRise .55s ease both;
}
.home-stats{grid-area:stats}
.home-center{grid-area:center}
.home-board{grid-area:board}

.home-center{
  min-height:0;display:flex;flex-direction:column;
  align-items:center;justify-content:center;text-align:center;
  padding:2px 8px 8px;position:relative;
}
.home-logo-wrap{
  position:relative;margin:0 0 4px;
  width:min(100%,56vh,460px);aspect-ratio:1;
  display:grid;place-items:center;
  animation:logoIn .85s cubic-bezier(.2,.8,.2,1) both;
  flex:0 1 auto;
  max-height:min(46vh,420px);
}
.home-logo-wrap:before{
  content:'';position:absolute;inset:6% 8%;border-radius:50%;
  background:radial-gradient(circle,#ffd04c55 0%,#1ec8ff33 40%,transparent 68%);
  filter:blur(22px);z-index:0;animation:logoGlow 3s ease-in-out infinite;
}
.home-logo-ring{
  position:absolute;inset:4%;border-radius:50%;z-index:0;
  border:1px solid #ffd04c44;
  box-shadow:0 0 24px #ffd04c22, inset 0 0 24px #1ec8ff18;
  animation:ringPulse 4s ease-in-out infinite;
}
.home-logo-ring.delay{inset:0;animation-delay:1.2s;border-color:#5ec8ff33}
.home-logo{
  position:relative;z-index:1;width:100%;height:100%;
  object-fit:contain;pointer-events:none;user-select:none;
  filter:drop-shadow(0 22px 36px #000c);
  animation:logoFloat 4.6s ease-in-out infinite;
}
.home-tag{
  margin:2px 0 10px;color:#e8f6ff;font-size:clamp(13px,1.9vh,17px);
  max-width:34ch;line-height:1.35;font-weight:700;
  text-shadow:0 2px 12px #000a;
  padding:6px 14px;border-radius:999px;
  background:#031f3866;border:1px solid #5ec8ff44;
  flex-shrink:0;
}
.home-load{display:flex;flex-direction:column;align-items:center;gap:4px;margin-bottom:10px;width:min(100%,280px);flex-shrink:0}
.home-load #load-progress{max-width:100%;width:100%;height:10px}
.home-cta{display:flex;flex-direction:column;align-items:center;gap:8px;position:relative;z-index:5;flex-shrink:0;margin-top:4px}
.home-play{
  min-width:min(220px,70vw);
  min-height:52px;
  background:linear-gradient(#4dff8f,#18a34a);border:1px solid #b6ffd0;
  color:#062814;font-weight:900;padding:15px 40px;border-radius:999px;
  font-size:clamp(16px,2.4vh,21px);letter-spacing:.16em;text-transform:uppercase;
  box-shadow:0 6px 0 #0d6b32,0 16px 36px #0d6b3266,0 0 28px #3ddc7944;
  animation:playPop .45s ease both, playPulse 2.4s ease-in-out infinite .5s;
  cursor:pointer;
  touch-action:manipulation;
  pointer-events:auto;
}
.home-play[hidden]{display:none}
.home-guest{
  min-width:min(200px,64vw);
  min-height:40px;
  margin-top:2px;
  background:transparent;
  border:1px solid #7eb7df99;
  color:#d4ebfa;font-weight:800;padding:10px 22px;border-radius:999px;
  font-size:clamp(12px,1.8vh,14px);letter-spacing:.08em;text-transform:uppercase;
  backdrop-filter:blur(6px);
}
.home-guest:hover{border-color:#ffd04c88;color:#fff;filter:brightness(1.08)}
.home-guest[hidden]{display:none}
body.authed .home-guest{display:none!important}
.home-play:hover,#start.home-play:hover{filter:brightness(1.08);transform:translateY(-2px)}
.home-auth-hint{margin:0;font-size:12px;color:#9ec8e4}
.home-pitch-line{
  position:absolute;left:18%;right:18%;bottom:2%;height:18px;z-index:0;
  background:radial-gradient(ellipse at center,#ffd04c33 0%,transparent 70%);
  filter:blur(2px);
}
.home-glass{
  min-height:0;overflow:hidden;align-self:center;
  max-height:min(80vh,740px);
  display:flex;flex-direction:column;gap:0;
  background:
    linear-gradient(165deg,#0c4a86ee 0%,#06325cf5 42%,#021526f8 100%);
  border:1px solid #8fd0ff99;
  border-radius:22px;padding:14px 13px 12px;
  box-shadow:
    0 18px 44px #0009,
    inset 0 1px 0 #ffffff33,
    inset 0 0 0 1px #ffd04c18;
  backdrop-filter:blur(14px);
  position:relative;
}
.home-glass:before{
  content:'';position:absolute;left:14px;right:14px;top:0;height:2px;
  background:linear-gradient(90deg,transparent,#ffd04caa,#5ec8ffaa,transparent);
  opacity:.85;pointer-events:none;
}
.home-panel-head{
  display:flex;align-items:center;justify-content:space-between;gap:8px;
  margin-bottom:8px;flex-shrink:0;
  padding-bottom:6px;border-bottom:1px solid #5ec8ff33;
}
.home-stats h2,.home-board h2{
  margin:0;color:#ffd04c;font-size:17px;
  font-family:"Bebas Neue",Impact,sans-serif;letter-spacing:.14em;font-weight:400;
  text-shadow:0 2px 0 #0a2440;
}
.home-board select{
  background:#031f38;color:#fff;border:1px solid #5baee4;border-radius:999px;
  padding:5px 10px;font-size:11px;font-weight:700;
}
.home-stats-body{min-height:0;overflow:hidden;flex:1}
.home-stats-body .muted{opacity:.75;margin:0;font-size:12px}
.home-stat-grid{margin:0;gap:7px}
.home-stat-grid div{
  padding:10px 4px;border-radius:14px;
  background:linear-gradient(180deg,#0a3354ee,#031f38f0);
  border:1px solid #3d7eae;
  box-shadow:inset 0 1px 0 #ffffff14,0 6px 14px #0004;
  transition:transform .15s ease, border-color .15s ease;
}
.home-stat-grid div:hover{transform:translateY(-1px);border-color:#ffd04c66}
.home-stat-grid b{font-size:18px;text-shadow:0 0 12px #ffd04c33}
.home-stat-grid span{font-size:9px;letter-spacing:.04em;color:#9ec8e4;font-weight:700}
.home-challenge{position:static;transform:none;margin-top:8px;left:auto;top:auto}
.home-stats .avatar-row{
  margin-bottom:10px;padding:8px;border-radius:14px;
  background:#031f3888;border:1px solid #2f628a88;
}
.home-stats .avatar-img{width:46px;height:46px;border-color:#ffd04c88}
.home-stats .avatar-fallback{font-size:18px}
.home-user-line{margin:0;font-size:12px}
.home-stats .xp-bar{height:7px;margin:5px 0 2px;background:#03101f}
.home-stats .avatar-upload{margin:0}
.home-stats .avatar-upload .top-btn{padding:5px 8px;font-size:11px;border-radius:999px}
.home-tabs{
  display:flex;gap:6px;margin-bottom:10px;flex-shrink:0;
  padding:4px;border-radius:999px;background:#02152699;border:1px solid #2f628a66;
}
.home-tab{
  flex:1;border:0;background:transparent;color:#9ec8e4;
  border-radius:999px;padding:8px 8px;font-size:11px;font-weight:800;letter-spacing:.08em;text-transform:uppercase;
  transition:background .18s ease, color .18s ease, transform .15s ease;
}
.home-tab:hover{color:#fff}
.home-tab.active{
  background:linear-gradient(#ffda52,#ffaa24);color:#153253;
  box-shadow:0 4px 12px #ffaa2444;
}
.home-pane{min-height:0;flex:1;display:flex;flex-direction:column;overflow:hidden}
.home-pane[hidden]{display:none!important}
.friends-search{display:flex;gap:6px;margin-bottom:8px;flex-shrink:0}
.friends-search input{
  flex:1;min-width:0;padding:9px 12px;border-radius:999px;
  border:1px solid #4f90b8;background:#031f38;color:#fff;font:inherit;font-size:12px;
}
.friend-results{
  max-height:28%;overflow:auto;margin-bottom:8px;flex-shrink:0;
  border:1px solid #2f628a;border-radius:14px;padding:6px;background:#031f3888;
}
.friends-section{margin-top:4px;min-height:0}
.friends-section.grow{flex:1;min-height:0;display:flex;flex-direction:column}
.friends-section h3{
  margin:0 0 6px;font-size:11px;letter-spacing:.12em;text-transform:uppercase;
  color:#9ec8e4;display:flex;align-items:center;gap:8px;
}
.friend-list{overflow:auto;min-height:0;flex:1;display:flex;flex-direction:column;gap:6px}
.friend-row{
  display:grid;grid-template-columns:28px 1fr auto;gap:8px;align-items:center;
  padding:8px 9px;border-radius:14px;
  background:linear-gradient(120deg,#0a3354cc,#031f38f0);border:1px solid #2f628a;
}
.friend-meta{min-width:0}
.friend-meta strong{display:block;font-size:12px;color:#fff;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.friend-meta small{color:#9ec8e4;font-size:10px}
.friend-actions{display:flex;gap:4px;flex-wrap:wrap;justify-content:flex-end}
.fr-btn{
  border:1px solid #4f90b8;background:#0a3354;color:#e8f6ff;border-radius:999px;
  padding:5px 9px;font-size:10px;font-weight:800;
}
.fr-btn.ok{background:linear-gradient(#3ddc79,#18a34a);border-color:#8dffb0;color:#062814}
.fr-tag{font-size:10px;font-weight:800;color:#9ec8e4}
.presence.on{color:#6dff9a;font-weight:800}
.presence.off{color:#9ec8e4}
.duel-board{overflow:auto;min-height:0;flex:1;display:flex;flex-direction:column;gap:8px}
.duel-card{
  text-align:left;padding:11px 12px;border-radius:16px;
  background:linear-gradient(145deg,#0a3354dd,#031f38f2);border:1px solid #2f628a;
  box-shadow:inset 0 1px 0 #ffffff12;
}
.duel-card.tone-incoming{border-color:#ffd04c99;background:linear-gradient(160deg,#4a3212ee,#031f38)}
.duel-card.tone-outgoing{border-color:#5ec8ff99;background:linear-gradient(160deg,#0e3f68ee,#031f38)}
.duel-card.tone-win{border-color:#6dff9a99;background:linear-gradient(160deg,#0e3a22ee,#031f38)}
.duel-card.tone-loss{border-color:#ff9a9a99;background:linear-gradient(160deg,#3a1212ee,#031f38)}
.duel-top{display:flex;justify-content:space-between;gap:8px;align-items:center;margin-bottom:6px}
.duel-badge{
  font-size:10px;font-weight:900;letter-spacing:.06em;text-transform:uppercase;
  padding:4px 9px;border-radius:999px;background:#0a3354;border:1px solid #4f90b8;color:#ffd04c;
}
.duel-card.tone-win .duel-badge{border-color:#6dff9a;color:#b8ffcf}
.duel-card.tone-loss .duel-badge{border-color:#ff9a9a;color:#ffd0d0}
.duel-card.tone-incoming .duel-badge{border-color:#ffd04c;color:#ffd04c}
.duel-target{font-size:11px;color:#9ec8e4}
.duel-target b{color:#ffd04c}
.duel-card h4{margin:0 0 2px;font-size:13px;color:#fff}
.duel-card p{margin:0;font-size:11px;color:#b7d7ec;line-height:1.35}
.duel-scoreline{
  margin:0 0 6px;font-size:13px;font-weight:800;color:#fff;line-height:1.35;
  word-break:break-word;
}
.duel-result{
  display:inline-flex;align-items:center;margin:2px 0 4px;padding:5px 10px;border-radius:999px;
  font-size:12px;font-weight:900;letter-spacing:.04em;
}
.duel-result.win{background:#0e3a22;border:1px solid #6dff9a99;color:#b8ffcf}
.duel-result.loss{background:#3a1212;border:1px solid #ff9a9a99;color:#ffd0d0}
.duel-waiting{margin:2px 0 4px;font-size:11px;color:#9ec8e4;font-weight:700}
.duel-actions{margin-top:8px}
.duel-actions .fr-btn.ok{min-width:96px;font-weight:900}
#leaderboard-list{list-style:none;margin:0;padding:0;overflow:auto;flex:1;min-height:0;max-height:none}
#leaderboard-list li{
  display:grid;grid-template-columns:28px 1fr auto;gap:6px;align-items:center;
  padding:8px 6px;border-bottom:1px solid #1e4a6e88;font-size:12px;
  border-radius:10px;
}
#leaderboard-list li:hover{background:#0a335466}
#leaderboard-list .rank{color:#8ec7ea;font-weight:700}
#leaderboard-list .uname{overflow:hidden;text-overflow:ellipsis}
#leaderboard-list .pts{color:#ffd04c;font-weight:800}
#leaderboard-list .empty{display:block;opacity:.7;padding:12px 6px}

@keyframes homeBgDrift{
  from{transform:scale(1.06) translate3d(0,0,0)}
  to{transform:scale(1.1) translate3d(-1.2%,.6%,0)}
}
@keyframes homeRise{
  from{opacity:0;transform:translateY(12px)}
  to{opacity:1;transform:translateY(0)}
}
@keyframes logoIn{
  from{opacity:0;transform:translateY(22px) scale(.9)}
  to{opacity:1;transform:translateY(0) scale(1)}
}
@keyframes logoFloat{
  0%,100%{transform:translateY(0)}
  50%{transform:translateY(-8px)}
}
@keyframes logoGlow{
  0%,100%{opacity:.65;transform:scale(1)}
  50%{opacity:1;transform:scale(1.08)}
}
@keyframes ringPulse{
  0%,100%{transform:scale(1);opacity:.55}
  50%{transform:scale(1.04);opacity:.95}
}
@keyframes sparklePulse{
  0%,100%{opacity:.35}
  50%{opacity:.75}
}
@keyframes playPop{
  from{opacity:0;transform:scale(.86)}
  to{opacity:1;transform:scale(1)}
}
@keyframes playPulse{
  0%,100%{box-shadow:0 6px 0 #0d6b32,0 16px 36px #0d6b3266,0 0 22px #3ddc7940}
  50%{box-shadow:0 6px 0 #0d6b32,0 18px 40px #0d6b3280,0 0 36px #3ddc7988}
}

@media(max-width:980px){
  body.on-home,.home-screen{
    height:100dvh;max-height:100dvh;height:100svh;max-height:100svh;
    overflow:hidden;
  }
  .home-screen{padding:8px 10px 10px;gap:8px}
  .home-main{
    grid-template-columns:1fr 1fr;
    grid-template-rows:auto minmax(0,1fr);
    grid-template-areas:
      "center center"
      "stats board";
    gap:10px;
    min-height:0;
  }
  .home-center{justify-content:flex-start;padding:4px 0 0;min-height:0;overflow:visible}
  .home-logo-wrap{
    width:min(42vw,28vh,200px);
    max-height:min(28vh,200px);
  }
  .home-tag{margin:4px 0 8px;font-size:clamp(12px,1.6vh,15px);padding:5px 12px}
  .home-play{min-height:46px;padding:12px 28px;font-size:15px;letter-spacing:.12em}
  .home-glass{max-height:none;height:100%;min-height:0;padding:10px;border-radius:16px;align-self:stretch}
  .home-top{border-radius:16px;flex-shrink:0;padding:8px 12px;gap:8px}
  .home-top-brand strong{font-size:16px}
  .home-top .top-btn{padding:7px 12px;font-size:12px}
  .home-top .top-btn.chip{max-width:34vw;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .home-tabs{margin-bottom:8px;padding:3px}
  .home-tab{padding:7px 8px;font-size:11px}
  .score-num{font-size:56px}
}
@media(max-width:700px){
  body.on-home{
    overflow:hidden;
    padding:env(safe-area-inset-top,0) env(safe-area-inset-right,0) env(safe-area-inset-bottom,0) env(safe-area-inset-left,0);
  }
  .home-screen{
    height:100dvh;max-height:100dvh;height:100svh;max-height:100svh;
    padding:6px 10px calc(10px + env(safe-area-inset-bottom,0px));
    gap:8px;
    overflow:hidden;
    display:grid;
    grid-template-rows:auto minmax(0,1fr);
  }
  .home-top{
    margin:0;
    padding:8px 10px;
    gap:6px;
    z-index:4;
    border-radius:16px;
    flex-shrink:0;
  }
  .home-top-brand strong{font-size:15px}
  .home-top-dot{width:9px;height:9px}
  .home-top .top-btn{padding:7px 11px;font-size:11px;min-height:34px}
  .home-top .top-btn.chip{max-width:36vw;font-size:11px}
  .home-top .top-btn.ghost{display:none}
  .home-main{
    min-height:0;
    overflow:auto;
    -webkit-overflow-scrolling:touch;
    overscroll-behavior:contain;
    grid-template-columns:1fr;
    grid-template-rows:auto auto auto;
    grid-template-areas:
      "center"
      "stats"
      "board";
    gap:12px;
    padding-bottom:4px;
    align-content:start;
  }
  .home-center{
    grid-area:center;
    overflow:visible;
    z-index:3;
    padding:8px 4px 4px;
    justify-content:center;
  }
  .home-stats{grid-area:stats}
  .home-board{grid-area:board}
  .home-stats,.home-board{
    align-self:stretch;
    min-height:min(52vh,420px);
    height:auto;
    max-height:none;
  }
  .home-logo-wrap{
    width:min(56vw,38vh,240px);
    max-height:min(38vh,240px);
    margin:0 auto 4px;
  }
  .home-logo{
    animation:logoFloat 4.6s ease-in-out infinite;
    filter:drop-shadow(0 14px 24px #000b);
  }
  .home-logo-wrap:before{
    display:block;
    inset:8% 10%;
    filter:blur(16px);
  }
  .home-logo-ring,.home-logo-ring.delay{display:block;opacity:.75}
  .home-pitch-line{display:none}
  .home-tag{
    display:block;
    margin:4px 0 10px;
    font-size:clamp(12px,3.5vw,15px);
    padding:6px 14px;
    max-width:34ch;
  }
  .home-load{margin-bottom:8px;width:min(100%,240px)}
  .home-load #load-progress{height:8px}
  .home-cta{margin-top:2px;gap:8px;width:100%}
  .home-play{
    min-height:50px;
    min-width:min(260px,82vw);
    width:min(260px,82vw);
    padding:13px 24px;
    font-size:16px;
    letter-spacing:.14em;
    box-shadow:0 5px 0 #0d6b32,0 14px 28px #0d6b3266,0 0 24px #3ddc7944;
    animation:playPop .4s ease both, playPulse 2.4s ease-in-out infinite .5s;
  }
  .home-guest{
    min-height:42px;
    min-width:min(240px,76vw);
    width:min(240px,76vw);
    padding:10px 16px;
    font-size:13px;
  }
  .home-auth-hint{
    font-size:11px;
    line-height:1.35;
    max-width:32ch;
    color:#9ec8e4cc;
  }
  .home-glass{
    z-index:2;
    position:relative;
    padding:12px;
    border-radius:18px;
  }
  .home-panel-head{margin-bottom:8px;padding-bottom:6px}
  .home-panel-head h2,.home-stats h2,.home-board h2{font-size:15px;letter-spacing:.12em}
  .home-board select{padding:5px 10px;font-size:11px}
  .home-tabs{margin-bottom:8px;gap:4px;padding:3px}
  .home-tab{padding:8px 6px;font-size:11px;letter-spacing:.05em;min-height:36px}
  .friends-search{gap:6px;margin-bottom:8px}
  .friends-search input{padding:10px 12px;font-size:13px;border-radius:12px}
  .friends-search .top-btn{padding:10px 12px;font-size:12px;border-radius:12px}
  .friends-section h3{font-size:10px;margin:0 0 6px}
  .friend-row{
    grid-template-columns:32px minmax(0,1fr);
    gap:8px;padding:10px;border-radius:14px;
  }
  .friend-actions{grid-column:1/-1;justify-content:stretch;gap:6px}
  .friend-actions .fr-btn{flex:1;text-align:center;padding:8px 8px;font-size:11px;min-height:34px}
  .friend-meta strong{font-size:13px}
  .friend-meta small{font-size:10px}
  .duel-card{padding:10px;border-radius:14px}
  .duel-badge{font-size:10px;padding:4px 8px}
  .duel-scoreline{font-size:12px;margin:0 0 6px}
  .duel-result{font-size:11px;padding:4px 9px}
  .duel-target{font-size:11px}
  .duel-actions .fr-btn{padding:8px 12px;font-size:11px;min-height:34px}
  .home-stat-grid{gap:6px}
  .home-stat-grid div{padding:10px 4px;border-radius:12px}
  .home-stat-grid b{font-size:16px}
  .home-stat-grid span{font-size:9px}
  .home-stats .avatar-row{margin-bottom:8px;padding:8px}
  .home-stats .avatar-img{width:40px;height:40px}
  #leaderboard-list li{
    padding:10px 8px;border-radius:12px;font-size:12px;
  }
}
@media(max-width:560px){
  .home-screen{padding:4px 8px calc(8px + env(safe-area-inset-bottom,0px));gap:6px}
  .home-main{gap:10px}
  .home-logo-wrap{width:min(52vw,34vh,210px);max-height:min(34vh,210px)}
  .home-play{min-height:48px;font-size:15px}
  .home-auth-hint{font-size:10px}
  .home-stats,.home-board{min-height:min(48vh,380px)}
  .home-pitch-line{display:none}
  .pf-hero{grid-template-columns:1fr;justify-items:center;text-align:center}
  .pf-hero-copy{width:100%}
  .pf-meta{justify-content:center}
  .pf-stat-grid,.pf-stat-grid-4{grid-template-columns:repeat(2,1fr)}
  .hist-card{grid-template-columns:72px 1fr;gap:10px}
  .hist-score b{font-size:22px}
  .badge-grid{grid-template-columns:repeat(2,1fr)}
  .dialog-body,#modalcontent{padding:20px 14px 16px}
  .dialog-brand{padding:18px 14px 4px}
  .dialog-brand strong{font-size:22px}
  .sheet-title{font-size:22px}
  .score-num{font-size:48px}
  .score-hero{min-width:0;padding:10px 18px}
  .btn-row{flex-direction:column}
  .game-dialog .tabs{margin:8px 12px 4px}
  .dialog-form{padding:4px 14px 16px}
  .game-dialog .google-wrap{margin:0 14px 14px}
}

act 3-col, zoomed-out feel */
@media(orientation:landscape) and (max-height:640px){
  body.on-home,.home-screen{
    height:100dvh;max-height:100dvh;height:100svh;max-height:100svh;
    overflow:hidden;padding:3px 6px 4px;gap:3px;
    display:grid;
    grid-template-rows:auto minmax(0,1fr);
    grid-template-areas:none;
  }
  .home-top{padding:3px 6px;border-radius:10px;z-index:4;gap:4px;grid-area:auto;margin:0}
  .home-top-brand{gap:5px}
  .home-top-brand strong{font-size:11px;letter-spacing:.08em}
  .home-top-dot{width:7px;height:7px}
  .home-top .top-btn{padding:3px 7px;font-size:9px;min-height:0}
  .home-top .top-btn.chip{max-width:26vw;font-size:9px}
  .home-top .top-btn.ghost{display:none}
  .home-main{
    display:grid;
    overflow:hidden;
    grid-template-columns:minmax(0,1.15fr) minmax(96px,.5fr) minmax(0,1.15fr);
    grid-template-rows:minmax(0,1fr);
    grid-template-areas:"stats center board";
    gap:5px;
    align-items:stretch;
    min-height:0;
    padding-bottom:0;
  }
  .home-stats,.home-board{display:flex;grid-area:auto;height:100%;min-height:0}
  .home-center{
    justify-content:center;
    align-items:center;
    padding:0;
    overflow:hidden;
    z-index:3;
    min-width:0;
    grid-area:center;
  }
  .home-logo-wrap{
    width:min(18vh,88px);
    max-height:min(18vh,88px);
    margin:0 0 2px;
  }
  .home-logo{filter:drop-shadow(0 4px 8px #000a);animation:none}
  .home-logo-wrap:before,.home-logo-ring,.home-logo-ring.delay,.home-pitch-line{display:none}
  .home-tag,.home-auth-hint,.home-load small{display:none}
  .home-load{margin:0 0 2px;width:min(100%,110px)}
  .home-cta{margin:0;gap:2px;width:100%}
  .home-play{
    min-width:0;width:100%;max-width:118px;min-height:32px;padding:6px 8px;
    font-size:11px;letter-spacing:.08em;border-radius:999px;
    box-shadow:0 2px 0 #0d6b32,0 6px 12px #0d6b3266;
    animation:none;
  }
  .home-guest{
    width:100%;max-width:118px;min-height:26px;padding:4px 6px;font-size:9px;letter-spacing:.06em;
  }
  .home-glass{
    height:100%;max-height:none;min-height:0;padding:5px 6px 4px;border-radius:10px;
    z-index:2;position:relative;
  }
  .home-glass:before{left:8px;right:8px}
  .home-panel-head{margin-bottom:3px;padding-bottom:3px}
  .home-panel-head h2,.home-stats h2,.home-board h2{font-size:10px;letter-spacing:.08em}
  .home-board select{padding:2px 5px;font-size:9px}
  .home-tabs{margin-bottom:4px;padding:2px;gap:3px}
  .home-tab{padding:4px 3px;font-size:8px;letter-spacing:.03em}
  .friends-search{gap:3px;margin-bottom:4px}
  .friends-search input{font-size:10px;padding:4px 6px}
  .friends-search .top-btn{padding:4px 6px;font-size:9px;flex-shrink:0}
  .friends-section h3{font-size:8px;margin:0 0 3px;letter-spacing:.08em}
  .friend-row{
    grid-template-columns:20px minmax(0,1fr);
    gap:4px;padding:4px 5px;border-radius:8px;
  }
  .friend-actions{grid-column:1/-1;gap:3px}
  .friend-actions .fr-btn{flex:1;padding:3px 4px;font-size:8px}
  .friend-meta strong{font-size:10px}
  .friend-meta small{font-size:8px}
  .friend-list,.duel-board,#leaderboard-list{gap:4px}
  .duel-card{padding:6px;border-radius:8px}
  .duel-top{margin-bottom:3px}
  .duel-badge{font-size:8px;padding:2px 6px}
  .duel-scoreline{font-size:10px;margin:0 0 3px}
  .duel-result{font-size:9px;padding:2px 6px;margin:0}
  .duel-target{font-size:9px}
  .duel-waiting{font-size:9px}
  .home-stat-grid{gap:3px}
  .home-stat-grid div{padding:4px 1px;border-radius:6px}
  .home-stat-grid b{font-size:11px}
  .home-stat-grid span{font-size:7px}
  .home-stats .avatar-row{margin-bottom:4px;padding:4px}
  .home-stats .avatar-img{width:28px;height:28px}
  .home-user-line{font-size:10px}
  .lb-av,.lb-av-fallback{width:20px;height:20px;font-size:9px}
  #leaderboard-list li{padding:4px 3px;font-size:10px;gap:4px}
}

/* Popups on short / landscape screens — fit fully, no scroll */
@media(orientation:landscape) and (max-height:560px){
  .game-dialog,
  dialog#modal,
  dialog.app-dialog,
  .game-dialog.wide,
  dialog.app-dialog.wide,
  #profile-modal.wide{
    width:min(720px,96vw);
    max-height:min(96dvh,96svh);
    border-radius:14px;
    overflow:hidden;
  }
  .dialog-body,#modalcontent,#profile-body.dialog-body{padding:8px 12px 8px}
  .dialog-brand{padding:8px 12px 0}
  .dialog-brand strong{font-size:15px}
  .dialog-eyebrow{display:none}
  .sheet{gap:4px}
  .sheet-title{font-size:16px;margin:0}
  .sheet-sub{font-size:11px;line-height:1.25;margin:0}
  .sheet-kicker{padding:2px 8px;font-size:9px}
  .score-hero{margin:0;padding:4px 12px;min-width:90px;border-radius:10px}
  .score-num{font-size:28px}
  .score-unit{margin-top:0;font-size:9px}
  .meta-row{gap:4px}
  .meta-row span{padding:2px 6px;font-size:10px}
  .end-stats{gap:6px;max-width:100%}
  .end-stat-pair{padding:6px 4px;border-radius:12px}
  .end-stat-num{font-size:28px}
  .end-stat-label{font-size:9px;letter-spacing:.14em}
  .end-bound{padding:6px 4px;border-radius:10px}
  .end-bound b{font-size:18px}
  .end-bound span{font-size:9px;letter-spacing:.1em}
  .action{padding:7px 10px;font-size:12px;border-radius:9px;box-shadow:0 2px 0 #b16a16}
  .action.secondary{box-shadow:0 2px 0 #0d2a44}
  .action.ghost{padding:4px;font-size:11px;margin:0}
  .btn-row{flex-direction:row;gap:6px;margin-top:2px}
  .challenge-card{
    margin:0;padding:6px 8px;border-radius:10px;text-align:left;
  }
  .challenge-card strong{font-size:12px;margin:0 0 2px}
  .challenge-card p{margin:0 0 6px;font-size:10px;line-height:1.25}
  .challenge-btns .action{flex:1}
  .end-sheet{
    display:grid;
    grid-template-columns:minmax(110px,.75fr) minmax(0,1.25fr);
    grid-template-areas:
      "head head"
      "score actions";
    gap:6px 12px;
    align-items:center;
    width:100%;
  }
  .end-sheet .end-head{grid-area:head;display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:6px 10px}
  .end-sheet .end-head .sheet-sub{width:100%;text-align:center}
  .end-sheet .end-score{grid-area:score;display:flex;flex-direction:column;align-items:center;gap:4px}
  .end-sheet .end-actions{grid-area:actions;display:flex;flex-direction:column;gap:6px;width:100%;min-width:0}
  .end-sheet.compact{
    grid-template-columns:auto 1fr;
    grid-template-areas:"head head" "score actions";
  }
  dialog#modal.duel-result-modal,
  dialog#modal:has(.duel-result-sheet),
  .game-dialog:has(.duel-result-sheet){
    width:min(280px,70vw)!important;
    max-width:300px!important;
    max-height:min(78dvh,280px)!important;
    border-radius:18px!important;
  }
  dialog#modal.duel-result-modal #modalcontent,
  dialog#modal:has(.duel-result-sheet) #modalcontent{
    padding:14px 14px 12px!important;
  }
  .duel-result-sheet{gap:8px;padding:0}
  .duel-result-emoji{font-size:28px}
  .duel-result-title{font-size:26px!important}
  .duel-result-btn{max-width:220px;padding:9px 12px!important;font-size:12px!important}
  .game-dialog label{margin:3px 0;font-size:10px}
  .game-dialog input{padding:6px 8px;margin-top:2px;border-radius:8px;font-size:13px}
  .game-dialog .tabs{margin:2px 10px 0;gap:6px}
  .game-dialog .tabs button{padding:6px;font-size:11px;border-radius:8px}
  .dialog-form{padding:0 12px 8px}
  .game-dialog .google-wrap{margin:0 12px 8px;padding-top:4px}
  .form-error,.hint-mini{margin:2px 0;font-size:10px;min-height:0}
  .action.action-block{padding:7px 10px;font-size:12px;margin-top:2px}
  .google-wrap .hint-mini{display:none}
  .challenge-share-sheet{
    display:grid!important;
    grid-template-columns:1fr;
    gap:4px!important;
    width:100%;
  }
  .challenge-share-sheet .sheet-kicker{justify-self:center}
  .challenge-share-sheet .sheet-title{font-size:15px!important;margin:0}
  .challenge-share-sheet .sheet-sub{font-size:10px!important;margin:0}
  .challenge-split{
    display:grid!important;
    grid-template-columns:minmax(0,1.2fr) minmax(140px,.85fr);
    gap:8px;
    align-items:stretch;
    width:100%;
  }
  .challenge-split-left{min-height:0;display:flex;flex-direction:column}
  .challenge-split-right{
    display:flex;flex-direction:column;align-items:center;justify-content:center;
    gap:6px;padding:6px;border-radius:12px;
    background:#031f38aa;border:1px solid #4f90b866;
  }
  .challenge-share-sheet .share-badge{
    width:min(72px,28%)!important;margin:0!important;animation:none;
  }
  .challenge-friends-box{
    max-height:min(42vh,160px)!important;margin:0!important;padding:6px!important;flex:1;
  }
  .challenge-friends-head{font-size:9px;margin-bottom:4px}
  .challenge-friend-row{padding:5px 6px;gap:6px;border-radius:8px}
  .challenge-friend-row .friend-meta strong{font-size:11px}
  .challenge-friend-row .friend-meta small{font-size:9px}
  .challenge-friend-row .fr-btn{padding:4px 7px;font-size:9px}
  .challenge-split-right .action{width:100%;margin:0;padding:8px 10px;font-size:11px}
  .challenge-share-sheet .share-box{min-height:48px;margin:0;padding:6px;font-size:10px}
  .challenge-share-sheet > .action.ghost,
  .challenge-share-sheet > .btn-row{margin-top:2px}
  .pf-hero{padding:6px;gap:6px}
  .pf-handle{font-size:15px}
  .hist-list,.badge-grid{max-height:72px}
  .game-dialog .close,dialog .close{width:28px;height:28px;top:4px;right:6px;font-size:16px}
  [data-pane][hidden]{display:none!important}
  .result-pill{padding:4px 10px;font-size:11px}
}

@media(max-height:420px){
  .game-dialog,
  dialog#modal,
  dialog.app-dialog{
    max-height:98dvh;max-height:98svh;
    overflow:hidden;
  }
  .home-logo-wrap{width:min(14vh,96px);max-height:min(14vh,96px)}
  .end-sheet .end-head .sheet-sub{display:none}
  .score-num{font-size:24px}
  .challenge-card p{display:none}
}


#start,
.home-play,
.btn-play,
#again,
#again2,
#again3{
  background:linear-gradient(#3ddc79,#18a34a)!important;
  border:1px solid #8dffb0!important;
  color:#062814!important;
  box-shadow:0 4px 0 #0d6b32!important;
}
#start:active,
.home-play:active,
.btn-play:active,
#again:active,
#again2:active,
#again3:active{
  box-shadow:0 2px 0 #0d6b32!important;
}

/* WhatsApp share — brand green */
.btn-whatsapp,
#wa-share{
  background:linear-gradient(#2fe574,#25d366)!important;
  border:1px solid #7dffb0!important;
  color:#063b1f!important;
  box-shadow:0 4px 0 #128c7e!important;
}
.btn-whatsapp:hover,
#wa-share:hover{filter:brightness(1.06)}
.btn-whatsapp:active,
#wa-share:active{box-shadow:0 2px 0 #128c7e!important}

.avatar-row{display:flex;gap:12px;align-items:center;margin-bottom:12px}
.avatar-img{width:64px;height:64px;border-radius:50%;object-fit:cover;border:2px solid #7eb7df;background:#0a3354;flex-shrink:0}
.avatar-img.lg{width:88px;height:88px}
.avatar-fallback{display:grid;place-items:center;font-size:28px;font-weight:900;color:#ffd04c}
.avatar-upload{display:inline-block;margin-top:12px;cursor:pointer}
.avatar-upload[hidden]{display:none!important}
.xp-bar{height:8px;background:#1a3f5e;border-radius:99px;overflow:hidden;margin:6px 0 2px;width:100%;min-width:120px}
.xp-bar>i{display:block;height:100%;background:linear-gradient(90deg,#ffd04c,#ffaa24);width:0}
.profile-head{display:flex;gap:14px;align-items:center;text-align:left;margin-bottom:8px}
.profile-head h2{margin:0}
.level-line{margin:4px 0;font-size:13px;color:#9ec8e4}
.badge-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(132px,1fr));gap:10px;margin:4px 0 0;max-height:220px;overflow:auto;padding:2px}
.badge-chip{background:#0a3354;border:1px solid #4f90b8;border-radius:999px;padding:6px 10px;font-size:12px;display:inline-flex;gap:6px;align-items:center}
.badge-card{
  display:flex;flex-direction:column;align-items:flex-start;gap:4px;text-align:left;
  padding:12px;border-radius:14px;
  background:linear-gradient(160deg,#0e3d64,#082844);
  border:1px solid #4f90b888;box-shadow:inset 0 1px 0 #ffffff14;
}
.badge-ico{font-size:22px;line-height:1}
.badge-name{font-size:12px;font-weight:800;color:#fff;line-height:1.25}
.badge-desc{font-size:10px;color:#9ec8e4;line-height:1.35}

/* Profile popup */
#profile-modal.wide{width:min(680px,96vw)}
#profile-body.dialog-body{padding:22px 18px 20px;text-align:left}
.pf-sheet{display:flex;flex-direction:column;gap:16px}
.pf-hero{
  display:grid;grid-template-columns:auto 1fr;gap:16px;align-items:center;
  padding:16px;border-radius:18px;
  background:
    radial-gradient(ellipse 80% 90% at 0% 0%,#ffd04c22 0%,transparent 55%),
    linear-gradient(145deg,#134a78ee,#0a2f50f2);
  border:1px solid #7eb7df88;box-shadow:inset 0 1px 0 #fff2,0 10px 28px #0004;
}
.pf-avatar-ring{
  padding:4px;border-radius:50%;
  background:linear-gradient(135deg,#ffd04c,#7eb7df,#ffaa24);
  box-shadow:0 8px 20px #0006;
}
.pf-avatar-ring .avatar-img{display:block;margin:0;border:3px solid #062848}
.pf-hero-copy{min-width:0}
.pf-hero-copy .sheet-kicker{display:inline-flex;margin-bottom:8px}
.pf-handle{margin:0;font-size:26px;font-weight:1000;color:#fff;line-height:1.1;word-break:break-word}
.pf-name{margin:4px 0 10px;color:#b7d7ec;font-size:14px}
.pf-meta{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:8px}
.pf-meta span{
  font-size:12px;font-weight:700;color:#d4ebfa;
  background:#031f38aa;border:1px solid #4f90b8;border-radius:999px;padding:5px 10px;
}
.pf-meta b{color:#ffd04c}
.pf-xp{margin:0 0 4px;height:10px;background:#031f38}
.pf-xp-label{color:#9ec8e4;font-size:11px}
.pf-section{
  padding:14px;border-radius:16px;
  background:linear-gradient(180deg,#0a3354cc,#062848b8);
  border:1px solid #2f628a99;
}
.pf-section-head{
  display:flex;align-items:center;justify-content:space-between;gap:10px;
  margin-bottom:12px;padding-bottom:8px;border-bottom:1px solid #2a557888;
}
.pf-section-head h3{
  margin:0;font-size:13px;letter-spacing:.18em;text-transform:uppercase;
  color:#ffd04c;font-weight:900;
}
.pf-count{
  font-size:12px;font-weight:800;color:#9ec8e4;
  background:#031f38;border:1px solid #4f90b8;border-radius:999px;padding:4px 10px;
}
.pf-stat-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.pf-stat-grid-4{grid-template-columns:repeat(4,1fr)}
.pf-stat{
  text-align:center;padding:12px 8px;border-radius:12px;
  background:#031f38;border:1px solid #2f628a;
  box-shadow:inset 0 1px 0 #ffffff10;
}
.pf-stat b{display:block;font-size:22px;line-height:1;color:#ffd04c;font-weight:1000}
.pf-stat span{display:block;margin-top:6px;font-size:10px;letter-spacing:.04em;color:#9ec8e4;font-weight:700;text-transform:uppercase}
.pf-empty{margin:0;padding:10px 4px;color:#9ec8e4;font-size:13px;text-align:center}
.hist-list{display:flex;flex-direction:column;gap:8px;max-height:220px;overflow:auto}
.hist-card{
  display:grid;grid-template-columns:88px 1fr;gap:12px;align-items:center;
  padding:10px 12px;border-radius:14px;
  background:#031f38;border:1px solid #2f628a;
}
.hist-score{text-align:center}
.hist-score b{display:block;font-size:28px;line-height:.95;color:#ffd04c;font-weight:1000}
.hist-score span{font-size:11px;color:#9ec8e4;font-weight:700}
.hist-detail p{margin:0;font-size:13px;color:#d4ebfa}
.hist-detail b{color:#ffd04c}
.hist-target{margin-bottom:6px!important}
.hist-tags{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:6px}
.hist-tag{
  font-size:10px;font-weight:800;letter-spacing:.04em;text-transform:uppercase;
  color:#e8f6ff;background:#0a3354;border:1px solid #4f90b8;border-radius:999px;padding:3px 8px;
}
.hist-tag.soft{opacity:.85;border-color:#3a6f94}
.hist-status{
  display:inline-flex;align-items:center;justify-content:center;
  min-width:64px;padding:8px 10px;border-radius:12px;
  font-size:11px;font-weight:900;letter-spacing:.04em;text-transform:uppercase;
}
.hist-status.open{background:#1d4a6c88;border:1px solid #7eb7df;color:#cfe9fb}
.hist-status.win{background:#1d5c3688;border:1px solid #6dff9a;color:#b8ffcf}
.hist-status.loss{background:#5c1d1d88;border:1px solid #ff9a9a;color:#ffd0d0}
.hist-status.soft{background:#0a3354;border:1px solid #4f90b8;color:#d4ebfa}
.challenge-hist .hist-score{display:grid;place-items:center}
#leaderboard-list li[data-username]{cursor:pointer}
#leaderboard-list li[data-username]:hover{background:#0a335466}
.uname{display:flex;align-items:center;gap:8px;min-width:0}
.uname small{opacity:.65;font-size:11px}
.lb-av{width:24px;height:24px;border-radius:50%;object-fit:cover;flex-shrink:0;background:#0a3354}
.lb-av-fallback{display:inline-grid;place-items:center;font-size:11px;font-weight:800;color:#ffd04c;border:1px solid #4f90b8}
.app-dialog.wide{width:min(640px,96vw);max-height:min(88dvh,88svh);overflow:auto}

.top-btn{background:#04233f;border:1px solid #9fd0f3;border-radius:8px;padding:8px 12px;font-size:13px;font-weight:700}
.top-btn.ghost{opacity:.85}
.top-btn.chip{background:#0d3d66;color:#ffd04c;max-width:220px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

body.in-game{display:grid;place-items:center;overflow:hidden;min-height:100svh;height:100svh}
body.in-game .home-screen{display:none!important}

/* Stadium-themed dialogs */
.game-dialog,
dialog#modal,
dialog.app-dialog{
  border:1px solid #7eb7df;
  color:#fff;
  border-radius:22px;
  width:min(420px,94vw);
  max-width:calc(100vw - 16px);
  max-height:min(88dvh,88svh,720px);
  margin:auto;
  padding:0;
  overflow-x:hidden;
  overflow-y:auto;
  -webkit-overflow-scrolling:touch;
  overscroll-behavior:contain;
  touch-action:pan-y;
  background:
    radial-gradient(ellipse 110% 70% at 50% -8%,#2a7cc055 0%,transparent 50%),
    linear-gradient(165deg,#0b3d66 0%,#062848 45%,#031a30 100%);
  box-shadow:0 28px 80px #000c, inset 0 1px 0 #ffffff22;
  animation:dialogIn .32s ease both;
}
.game-dialog.wide,
dialog.app-dialog.wide{width:min(640px,96vw)}
.game-dialog::backdrop,
dialog#modal::backdrop,
dialog.app-dialog::backdrop{
  background:radial-gradient(circle at center,#021526cc,#010b14e6);
  backdrop-filter:blur(8px);
}
@keyframes dialogIn{
  from{opacity:0;transform:translateY(14px) scale(.96)}
  to{opacity:1;transform:translateY(0) scale(1)}
}
.game-dialog .close,
dialog .close{
  position:absolute;right:12px;top:10px;z-index:3;
  width:36px;height:36px;border:1px solid #5baee4;border-radius:50%;
  background:#04233fcc;color:#e8f6ff;font-size:22px;line-height:1;
  display:grid;place-items:center;padding:0;
}
.game-dialog .close:hover{background:#175280}
.dialog-body,#modalcontent{padding:28px 22px 22px;text-align:center}
.dialog-brand{padding:28px 22px 8px;text-align:center}
.dialog-eyebrow{
  display:block;font-size:11px;letter-spacing:.22em;text-transform:uppercase;
  color:#9ec8e4;font-weight:800;margin-bottom:6px;
}
.dialog-brand strong{
  display:block;font-size:26px;color:#ffd04c;font-style:italic;font-weight:1000;
  text-shadow:0 2px 0 #0a2440;
}
.sheet{display:flex;flex-direction:column;align-items:center;gap:10px}
.sheet-kicker{
  font-size:11px;letter-spacing:.28em;text-transform:uppercase;font-weight:900;
  color:#ffd04c;background:#ffd04c18;border:1px solid #ffd04c55;
  padding:6px 12px;border-radius:999px;
}
.sheet-title{
  margin:0;font-size:26px;line-height:1.15;color:#fff;font-weight:900;
}
.sheet-sub{margin:0;color:#b7d7ec;font-size:14px;line-height:1.45}
.sheet-sub.left{text-align:left;align-self:stretch}
.sheet-label{align-self:stretch;text-align:left;font-size:13px;color:#9ec8e4;margin-top:4px}
.score-hero{
  margin:6px 0 2px;padding:14px 28px;border-radius:18px;
  background:linear-gradient(180deg,#134a78,#0a2f50);
  border:1px solid #7eb7df88;box-shadow:inset 0 1px 0 #fff2,0 8px 24px #0005;
  display:flex;flex-direction:column;align-items:center;min-width:160px;
}
.score-num{
  font-size:68px;line-height:.9;font-weight:1000;color:#ffd04c;
  text-shadow:0 3px 0 #123a5c,0 0 24px #ffd04c44;
}
.score-unit{font-size:12px;letter-spacing:.24em;font-weight:800;color:#9ec8e4;margin-top:6px}
.meta-row{display:flex;flex-wrap:wrap;gap:8px;justify-content:center}
.meta-row span{
  font-size:12px;font-weight:700;color:#d4ebfa;
  background:#0a3354;border:1px solid #4f90b8;border-radius:999px;padding:5px 10px;
}
.end-stats{display:flex;flex-direction:column;align-items:stretch;gap:10px;width:100%;max-width:320px}
.end-stat-pair{
  display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:0;
  padding:12px 8px;border-radius:18px;
  background:linear-gradient(180deg,#134a78,#0a2f50);
  border:1px solid #7eb7df88;box-shadow:inset 0 1px 0 #fff2,0 8px 24px #0005;
}
.end-stat{display:flex;flex-direction:column;align-items:center;gap:4px;padding:4px 10px}
.end-stat-num{
  font-size:48px;line-height:.9;font-weight:1000;color:#e8f4ff;
  text-shadow:0 2px 0 #123a5c;
}
.end-stat-num.gold{
  color:#ffd04c;text-shadow:0 3px 0 #123a5c,0 0 20px #ffd04c44;
}
.end-stat-label{
  font-size:11px;letter-spacing:.2em;text-transform:uppercase;font-weight:800;color:#9ec8e4;
}
.end-stat-divider{
  width:1px;align-self:stretch;margin:6px 0;
  background:linear-gradient(180deg,transparent,#7eb7df88,transparent);
}
.end-bound-row{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.end-bound{
  display:flex;flex-direction:column;align-items:center;gap:2px;
  padding:10px 8px;border-radius:14px;
  background:#0a3354;border:1px solid #4f90b8;
}
.end-bound b{font-size:28px;line-height:1;font-weight:1000;color:#fff}
.end-bound span{font-size:11px;font-weight:800;letter-spacing:.14em;text-transform:uppercase;color:#9ec8e4}
.end-bound.six{border-color:#3ddc7988;background:linear-gradient(160deg,#0d3d2a,#0a3354)}
.end-bound.six b{color:#7dffb0}
.end-bound.four{border-color:#7eb7df88;background:linear-gradient(160deg,#123f66,#0a3354)}
.end-bound.four b{color:#9ad4ff}
.challenge-card{
  width:100%;margin-top:6px;padding:14px;border-radius:16px;text-align:center;
  background:linear-gradient(160deg,#123f66ee,#0a2744f0);
  border:1px solid #ffd04c66;
}
.challenge-card strong{display:block;color:#ffd04c;font-size:16px;margin-bottom:4px}
.challenge-card p{margin:0 0 12px;color:#c5e0ee;font-size:13px}
.end-sheet{display:flex;flex-direction:column;align-items:center;gap:10px;width:100%}
.end-sheet .end-head,.end-sheet .end-score,.end-sheet .end-actions{display:flex;flex-direction:column;align-items:center;gap:8px;width:100%}
.end-sheet .challenge-btns{width:100%}

/* Compact You Won / You Lost card */
dialog#modal.duel-result-modal,
dialog#modal:has(.duel-result-sheet),
.game-dialog:has(.duel-result-sheet){
  width:min(300px,86vw)!important;
  max-width:320px!important;
  max-height:min(70dvh,420px)!important;
  border-radius:22px!important;
  overflow:hidden!important;
}
dialog#modal.duel-result-modal .close,
dialog#modal:has(.duel-result-sheet) .close,
.game-dialog:has(.duel-result-sheet) .close{display:none!important}
dialog#modal.duel-result-modal #modalcontent,
dialog#modal:has(.duel-result-sheet) #modalcontent{
  padding:22px 18px 18px!important;
}
.duel-result-sheet{
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:12px;width:100%;text-align:center;padding:4px 0;
}
.duel-result-emoji{font-size:42px;line-height:1;filter:drop-shadow(0 6px 12px #0008)}
.duel-result-title{
  margin:0;font-size:clamp(28px,7vw,36px);font-weight:1000;letter-spacing:.02em;
  font-family:"Bebas Neue",Impact,sans-serif;
  text-shadow:0 3px 0 #123a5c,0 0 24px #ffd04c44;
}
.duel-result-sheet.win .duel-result-title{color:#7dffb0;text-shadow:0 3px 0 #0a2e18,0 0 22px #3ddc7966}
.duel-result-sheet.loss .duel-result-title{color:#ff9a9a;text-shadow:0 3px 0 #3a1212,0 0 22px #ff6b6b55}
.duel-result-btn{
  width:100%;max-width:240px;margin:4px 0 0!important;
  padding:12px 16px!important;font-size:13px!important;border-radius:14px!important;
  white-space:normal;line-height:1.25;
}
.btn-row{display:flex;gap:10px;width:100%;margin-top:4px}
.btn-row .action{flex:1;margin:0}
.action{
  background:linear-gradient(#ffda52,#ffaa24);
  border:1px solid #ffea89;color:#153253;font-weight:900;
  padding:12px 18px;border-radius:12px;font-size:14px;
  box-shadow:0 4px 0 #b16a16;cursor:pointer;text-decoration:none;
  display:inline-flex;align-items:center;justify-content:center;gap:6px;
}
.action:hover{filter:brightness(1.06)}
.action:active{transform:translateY(2px);box-shadow:0 2px 0 #b16a16}
.action.secondary{
  background:linear-gradient(#1f5f8c,#143d5c);
  border-color:#7eb7df;color:#e8f6ff;box-shadow:0 4px 0 #0d2a44;
}
.action.ghost{
  background:transparent;border:1px dashed #5baee4;color:#9ec8e4;
  box-shadow:none;margin-top:4px;width:100%;
}
.action-block{width:100%;margin:6px 0 0;display:flex}
.action[hidden],.action.ghost[hidden]{display:none!important}
.format-hint{
  margin:0 18px 4px;color:#b7d7ec;font-size:13px;line-height:1.4;text-align:center;
}
.format-hint b{color:#ffd04c}
.overs-grid{
  display:grid;grid-template-columns:1fr 1fr;gap:10px;
  padding:8px 18px 20px;width:100%;box-sizing:border-box;
}
.overs-btn{
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;
  padding:16px 10px;border-radius:16px;cursor:pointer;
  background:linear-gradient(160deg,#134a78,#0a2f50);
  border:1px solid #7eb7df88;color:#e8f6ff;
  box-shadow:inset 0 1px 0 #fff2,0 6px 16px #0005;
  transition:transform .12s ease,filter .12s ease,border-color .12s ease;
}
.overs-btn b{
  font-size:34px;line-height:1;font-weight:1000;color:#ffd04c;
  text-shadow:0 2px 0 #123a5c;
}
.overs-btn span{
  font-size:11px;letter-spacing:.18em;text-transform:uppercase;font-weight:800;color:#9ec8e4;
}
.overs-btn:hover{filter:brightness(1.08);border-color:#ffd04c88;transform:translateY(-1px)}
.overs-btn:active{transform:translateY(1px)}
.end-format-meta{
  margin:0;text-align:center;font-size:12px;font-weight:700;color:#9ec8e4;
}
.result-pill{font-weight:800;font-size:13px;padding:8px 14px;border-radius:999px}
.result-pill.win{background:#1d5c3688;border:1px solid #6dff9a;color:#b8ffcf}
.result-pill.loss{background:#5c1d1d88;border:1px solid #ff9a9a;color:#ffd0d0}
.share-box{
  width:100%;margin:4px 0;padding:12px;border-radius:12px;
  border:1px solid #4f90b8;background:#031f38;color:#e8f6ff;
  font:inherit;resize:vertical;text-align:left;
}
.challenge-share-sheet .share-badge{
  width:min(42%,160px);height:auto;margin:2px 0 8px;
  filter:drop-shadow(0 10px 18px #0008);
  animation:logoFloat 4.6s ease-in-out infinite;
}
.challenge-split{
  display:flex;flex-direction:column;gap:10px;width:100%;align-items:stretch;
}
.challenge-split-left,.challenge-split-right{min-width:0;width:100%}
.challenge-split-right{
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;
}
.challenge-friends-box{
  width:100%;text-align:left;margin:0;padding:10px;
  border-radius:14px;border:1px solid #4f90b888;background:#031f38cc;
  max-height:220px;overflow:auto;
}
.challenge-friends-head{
  font-size:11px;letter-spacing:.14em;text-transform:uppercase;font-weight:900;
  color:#ffd04c;margin-bottom:8px;
}
.challenge-friends-list{display:flex;flex-direction:column;gap:6px}
.challenge-friend-row{
  width:100%;display:grid;grid-template-columns:28px minmax(0,1fr) auto;gap:8px;align-items:center;
  padding:8px 10px;border-radius:12px;border:1px solid #2f628a;
  background:linear-gradient(120deg,#0a3354,#031f38);color:#fff;text-align:left;
}
.challenge-friend-row.mini{grid-template-columns:minmax(0,1fr) auto}
.challenge-friend-row:hover{border-color:#ffd04c88;filter:brightness(1.06)}
.challenge-friend-row .friend-meta{min-width:0}
.challenge-friend-row .friend-meta strong{display:block;font-size:13px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.challenge-friend-row .friend-meta small{font-size:11px;color:#9ec8e4}
.challenge-friend-row .fr-btn{flex-shrink:0;white-space:nowrap}
.game-dialog select,#modalcontent select{
  width:100%;padding:12px;border-radius:12px;border:1px solid #4f90b8;
  background:#031f38;color:#fff;font:inherit;margin:4px 0 8px;
}
.game-dialog .tabs{display:flex;gap:8px;margin:8px 18px 4px;padding:0}
.game-dialog .tabs button{
  flex:1;background:#0a3354;border:1px solid #4f90b8;border-radius:12px;
  padding:11px;font-weight:900;color:#fff;
}
.game-dialog .tabs button.active{
  background:linear-gradient(#ffda52,#ffaa24);color:#153253;border-color:#ffea89;
}
.dialog-form{padding:8px 22px 22px}
.game-dialog label{display:block;text-align:left;margin:10px 0;font-size:13px;color:#9ec8e4}
.game-dialog input{
  width:100%;margin-top:5px;padding:12px;border-radius:12px;
  border:1px solid #4f90b8;background:#031f38;color:#fff;font:inherit;
}
.game-dialog .google-wrap{margin:0 22px 18px;padding-top:12px;border-top:1px solid #2a5578}
.form-error{color:#ff8f8f;min-height:1.2em;margin:6px 0;font-size:13px}
.hint-mini{font-size:12px;color:#9ec8e4;margin:4px 0 8px}
.google-wrap{margin-top:16px;padding-top:12px;border-top:1px solid #2a5578}
.stat-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin:14px 0}
.stat-grid div{background:#0a3354;border-radius:12px;padding:10px 8px;text-align:center;border:1px solid #2f628a}
.stat-grid b{display:block;font-size:20px;color:#ffd04c}
.stat-grid span{font-size:11px;opacity:.85}
.end-result{color:#9fe0a8;font-weight:700}
.challenge-banner{position:fixed;left:50%;top:12px;transform:translateX(-50%);z-index:75;background:#7a1d1de8;border:1px solid #ffb4b4;border-radius:10px;padding:8px 14px;text-align:center;display:flex;flex-direction:column;gap:2px;max-width:90vw}
.challenge-banner[hidden]{display:none}


/* ==== FINAL: short landscape popups must fit with NO scroll (after base rules) ==== */
@media (orientation:landscape) and (max-height:560px){
  .game-dialog,
  dialog#modal,
  dialog.app-dialog,
  .game-dialog.wide,
  dialog.app-dialog.wide,
  #profile-modal.wide{
    width:min(760px,96vw)!important;
    max-height:min(96dvh,96svh)!important;
    overflow:hidden!important;
    border-radius:14px;
  }
  dialog#modal.duel-result-modal,
  dialog#modal:has(.duel-result-sheet),
  .game-dialog:has(.duel-result-sheet){
    width:min(260px,62vw)!important;
    max-width:280px!important;
    max-height:min(78dvh,240px)!important;
    border-radius:18px!important;
  }
  dialog#modal.duel-result-modal #modalcontent,
  dialog#modal:has(.duel-result-sheet) #modalcontent{
    padding:12px 14px 10px!important;
  }
  dialog#modal.duel-result-modal .close,
  dialog#modal:has(.duel-result-sheet) .close{display:none!important}
  .duel-result-sheet{gap:6px!important}
  .duel-result-emoji{font-size:26px!important}
  .duel-result-title{font-size:24px!important;line-height:1!important}
  .duel-result-btn{
    max-width:200px!important;width:100%!important;
    padding:8px 10px!important;font-size:11px!important;margin:0!important;
  }
  dialog#modal #modalcontent,
  .game-dialog .dialog-body,
  #profile-body.dialog-body{
    padding:6px 12px 8px!important;
  }
  .dialog-brand{padding:6px 12px 0!important}
  .dialog-brand strong{font-size:14px!important}
  .dialog-eyebrow{display:none!important}
  .format-hint{margin:0 12px 2px!important;font-size:11px!important}
  .overs-grid{gap:8px;padding:6px 12px 14px}
  .overs-btn{padding:12px 8px;border-radius:12px}
  .overs-btn b{font-size:26px}
  .overs-btn span{font-size:9px}
  .end-format-meta{font-size:10px!important}
  .sheet{gap:4px!important}
  .sheet-kicker{padding:2px 8px;font-size:9px}
  .sheet-title{font-size:15px!important;line-height:1.1}
  .sheet-sub{font-size:10px!important;line-height:1.2;margin:0!important}
  .score-hero{margin:0!important;padding:3px 10px!important;min-width:80px!important;border-radius:8px}
  .score-num{font-size:26px!important}
  .score-unit{font-size:8px!important;margin-top:0!important}
  .meta-row{gap:4px}
  .meta-row span{padding:2px 6px;font-size:9px}
  .end-stats{gap:4px!important;max-width:100%!important}
  .end-stat-pair{padding:4px 2px!important;border-radius:10px}
  .end-stat-num{font-size:24px!important}
  .end-stat-label{font-size:8px!important}
  .end-bound{padding:4px!important;border-radius:8px}
  .end-bound b{font-size:16px!important}
  .end-bound span{font-size:8px!important}
  .action{padding:6px 10px!important;font-size:11px!important;border-radius:8px;box-shadow:0 2px 0 #b16a16!important}
  .action.secondary{box-shadow:0 2px 0 #0d2a44!important}
  .action.ghost{padding:2px!important;font-size:10px!important;margin:0!important}
  .action.action-block{margin-top:2px!important;padding:6px 10px!important}
  .btn-row{gap:6px;margin-top:2px!important}
  .challenge-card{margin:0!important;padding:5px 8px!important;border-radius:8px;text-align:left}
  .challenge-card strong{font-size:11px!important;margin:0 0 2px!important}
  .challenge-card p{margin:0 0 4px!important;font-size:9px!important;line-height:1.2}
  .end-sheet{
    display:grid!important;
    grid-template-columns:minmax(100px,.7fr) minmax(0,1.3fr)!important;
    grid-template-areas:"head head" "score actions"!important;
    gap:4px 10px!important;
    align-items:center!important;
    width:100%!important;
  }
  .end-sheet .end-head{
    grid-area:head!important;
    display:flex!important;
    flex-direction:row!important;
    flex-wrap:wrap!important;
    align-items:center!important;
    justify-content:center!important;
    gap:4px 8px!important;
  }
  .end-sheet .end-head .sheet-sub{width:100%;text-align:center}
  .end-sheet .end-score{
    grid-area:score!important;
    display:flex!important;
    flex-direction:column!important;
    align-items:center!important;
    gap:3px!important;
  }
  .end-sheet .end-actions{
    grid-area:actions!important;
    display:flex!important;
    flex-direction:column!important;
    gap:4px!important;
    width:100%!important;
    min-width:0!important;
  }
  .end-sheet .challenge-btns{width:100%}
  .game-dialog .tabs{margin:2px 10px 0!important}
  .game-dialog .tabs button{padding:5px!important;font-size:10px!important}
  .dialog-form{padding:0 10px 6px!important}
  .game-dialog label{margin:2px 0!important;font-size:10px!important}
  .game-dialog input{padding:5px 7px!important;margin-top:2px!important}
  .game-dialog .google-wrap{margin:0 10px 6px!important;padding-top:4px!important}
  .google-wrap .hint-mini,.form-error{min-height:0;margin:1px 0;font-size:10px}
  .challenge-friends-box{max-height:min(38vh,140px)!important;margin:0!important;padding:5px!important}
  .challenge-share-sheet .share-badge{width:56px!important;margin:0!important}
  .challenge-split{
    display:grid!important;
    grid-template-columns:minmax(0,1.25fr) minmax(120px,.8fr)!important;
    gap:6px!important;
  }
  .challenge-split-right{padding:4px!important;gap:4px!important}
  .challenge-split-right .action{padding:6px 8px!important;font-size:10px!important}
  .challenge-friend-row{padding:4px 5px!important;gap:4px}
  .challenge-friend-row .friend-meta strong{font-size:10px}
  .challenge-friend-row .fr-btn{padding:3px 6px;font-size:8px}
  .game-dialog .close,dialog .close{width:26px;height:26px;top:4px;right:6px;font-size:15px}
  [data-pane][hidden]{display:none!important}
  .result-pill{padding:3px 8px;font-size:10px}
  .hist-list,.badge-grid{max-height:64px!important}
}
@media (max-height:400px){
  .end-sheet .end-head .sheet-sub,
  .challenge-card p{display:none!important}
  .score-num{font-size:22px!important}
}

/* Live duel leftovers (unused) */
.live-status,.live-duel-scores,.live-invite-dialog,.live-invite-timer{display:none!important}
.result-pill.draw{background:linear-gradient(#6b7280,#4b5563);color:#fff}
