:root{
  --bg:#051a0a;
  --bg2:#0d3314;
  --panel:rgba(5,35,17,.94);
  --panel2:rgba(8,52,25,.94);
  --lime:#7dff49;
  --green:#24db68;
  --green-dark:#0c6f31;
  --yellow:#ffe04c;
  --red:#ff405b;
  --cyan:#7dffd6;
  --text:#f7fff9;
  --muted:#acd0b6;
}
*{box-sizing:border-box}
html,body{margin:0;width:100%;height:100%;height:100dvh;background:radial-gradient(circle at center,#0a3614,#05170a 72%);color:var(--text);font-family:Inter,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;overflow:hidden;overscroll-behavior:none}
body{min-width:0;min-height:0}
button,a{font:inherit}button{cursor:pointer}
#app,.screen{width:100%;height:100%;height:100dvh;min-width:0;min-height:0;overflow:hidden}.screen{display:none}.screen.active{display:flex}

.preload-screen{position:fixed;inset:0;display:none;align-items:center;justify-content:center;padding:20px;z-index:999;background:radial-gradient(circle at center,#125625,#04140a 72%)}
.preload-screen.active{display:flex}
.preload-card{width:min(420px,94vw);padding:24px 20px;border-radius:24px;border:1px solid rgba(142,255,174,.26);background:linear-gradient(180deg,rgba(6,53,24,.96),rgba(2,28,12,.985));box-shadow:0 20px 70px #001908cc,0 0 48px rgba(54,255,111,.12),inset 0 0 0 1px rgba(255,255,255,.035);text-align:center}
.preload-card h2{margin:8px 0 12px;font-size:clamp(28px,5vw,42px);line-height:.95}
.preload-card p{margin:0 auto 10px;color:#daf4e2;max-width:34ch}
.preload-bar{height:14px;border-radius:999px;overflow:hidden;background:#0f4822;border:1px solid #2e844c;box-shadow:inset 0 1px 0 rgba(255,255,255,.05);margin:14px 0 10px}
.preload-bar i{display:block;height:100%;width:0;background:linear-gradient(90deg,#1fe06a,#d9ff3f,#ffe04c);transition:width .18s ease}
#preloadPct{display:block;font-size:20px;color:var(--yellow)}
.preload-tip{font-size:12px;color:#a8cfb5;margin-top:10px}

.menu-screen{position:relative;align-items:center;justify-content:center;background:linear-gradient(rgba(2,34,12,.18),rgba(1,24,8,.32)),url('../img/stadium.webp') center/cover no-repeat;padding:clamp(6px,1.7vh,16px);overflow:hidden}
.menu-shade{position:absolute;inset:0;background:radial-gradient(circle at center,rgba(8,92,34,.16),rgba(1,25,9,.86) 74%),linear-gradient(135deg,rgba(9,100,40,.18),rgba(0,25,8,.40))}
.menu-panel{position:relative;z-index:1;width:min(1280px,97vw);max-height:calc(100dvh - 12px);padding:clamp(10px,2vh,22px) clamp(12px,2vw,26px);border:1px solid rgba(142,255,174,.26);border-radius:24px;background:linear-gradient(180deg,rgba(6,53,24,.91),rgba(2,28,12,.97));box-shadow:0 20px 70px #001908cc,0 0 48px rgba(54,255,111,.12),inset 0 0 0 1px rgba(255,255,255,.035);backdrop-filter:blur(12px);text-align:center;display:flex;flex-direction:column;justify-content:center;overflow:hidden}
.brand{font-weight:950;font-size:clamp(9px,1.5vh,13px);letter-spacing:.25em;color:var(--lime)}
h1{margin:clamp(1px,.6vh,4px) 0 2px;font-size:clamp(28px,min(5vw,7vh),68px);line-height:.92;letter-spacing:-.04em;text-shadow:0 4px 0 #05200e,0 0 30px rgba(117,255,73,.24)}
.subtitle{margin:clamp(4px,.8vh,8px) 0 clamp(6px,1.2vh,12px);color:#fff;font-size:clamp(11px,1.7vh,16px);font-weight:850}
.rules-strip{display:flex;gap:6px;justify-content:center;flex-wrap:wrap;margin-bottom:clamp(7px,1.5vh,14px)}
.rules-strip span{padding:clamp(4px,.8vh,7px) 10px;border-radius:999px;background:#0b4722;border:1px solid #2e844c;color:#dcffe7;font-size:clamp(9px,1.25vh,12px);font-weight:850;box-shadow:inset 0 1px 0 rgba(255,255,255,.05)}
.duration-row{display:flex;align-items:center;justify-content:center;gap:10px;margin:0 0 clamp(6px,1.1vh,10px);min-height:0}.duration-row>span{font-size:clamp(9px,1.2vh,11px);font-weight:950;color:#bdecc9;letter-spacing:.08em;white-space:nowrap}.duration-picker{display:flex;gap:5px;flex-wrap:wrap;justify-content:center}.duration-btn{border:1px solid #347c4c;border-radius:999px;padding:clamp(4px,.7vh,6px) clamp(7px,.8vw,11px);background:#0b4722;color:#dfffea;font-size:clamp(8px,1.1vh,10px);font-weight:900;line-height:1}.duration-btn:hover{background:#12602e}.duration-btn.selected{background:linear-gradient(180deg,#f3ff69,#a9ed20);color:#102008;border-color:#f5ff9d;box-shadow:0 0 12px rgba(205,255,66,.25)}
.opponent-row{display:flex;align-items:center;justify-content:center;gap:9px;margin:clamp(5px,.9vh,8px) 0 0;min-height:0}.opponent-row>span{font-size:clamp(9px,1.2vh,11px);font-weight:950;color:#bdecc9;letter-spacing:.08em;white-space:nowrap}.opponent-row select{appearance:none;-webkit-appearance:none;min-width:min(260px,42vw);max-width:360px;border:1px solid #3b8654;border-radius:999px;padding:clamp(5px,.8vh,7px) 34px clamp(5px,.8vh,7px) 13px;background:linear-gradient(180deg,#0d5428,#08391b);color:#f1fff5;font-size:clamp(9px,1.2vh,11px);font-weight:900;outline:none;background-image:linear-gradient(45deg,transparent 50%,#bdf7cd 50%),linear-gradient(135deg,#bdf7cd 50%,transparent 50%),linear-gradient(180deg,#0d5428,#08391b);background-position:calc(100% - 16px) 50%,calc(100% - 11px) 50%,0 0;background-size:5px 5px,5px 5px,100% 100%;background-repeat:no-repeat}.opponent-row select:disabled{opacity:.55;cursor:not-allowed}.opponent-row select:focus{border-color:#bdfb75;box-shadow:0 0 0 3px rgba(164,255,81,.12)}
.menu-panel h2{margin:1px 0 clamp(5px,1vh,10px);font-size:clamp(14px,2.1vh,20px)}
.team-grid{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:clamp(6px,1vw,11px);min-height:0}
.team-card{position:relative;overflow:hidden;border:2px solid transparent;border-radius:clamp(12px,1.6vw,19px);background:linear-gradient(180deg,#0d4b24,#082f17);color:#fff;transition:.16s ease;box-shadow:inset 0 0 0 1px rgba(255,255,255,.08),0 8px 18px rgba(0,18,6,.25);min-width:0;padding:0}
.team-card:hover{transform:translateY(-2px);border-color:#9affb077}.team-card.selected{border-color:var(--yellow);box-shadow:0 0 0 3px #ffe04c2a,0 10px 28px #001d0aa8}
.team-card img{width:100%;height:clamp(88px,16vh,148px);object-fit:contain;display:block;background:radial-gradient(circle at 50% 60%,#237544 0,#0e4d27 48%,#062e16 100%)}
.team-card .tc-body{padding:clamp(5px,.8vh,8px) 8px clamp(6px,1vh,10px)}
.team-card h3{margin:0 0 3px;font-size:clamp(11px,1.55vh,15px);line-height:1.05}
.team-card p{margin:0;color:#bad9c2;font-size:clamp(8px,1.08vh,10px);line-height:1.2}
.team-card .trait{display:block;margin-top:clamp(3px,.6vh,6px);color:var(--yellow);font-size:clamp(8px,1.05vh,10px);font-weight:950;line-height:1.1}
.menu-actions{display:flex;align-items:center;justify-content:center;gap:12px;margin-top:clamp(7px,1.5vh,15px)}
.primary,.secondary{border:0;border-radius:13px;padding:clamp(9px,1.5vh,13px) 20px;font-weight:1000;letter-spacing:.045em;font-size:clamp(11px,1.6vh,15px)}
.primary{background:linear-gradient(180deg,#f4ff69,#a9ed20);color:#102008;box-shadow:0 5px 0 #558707}.primary:disabled{filter:grayscale(1);opacity:.55;cursor:not-allowed;box-shadow:none}.secondary{background:#144a28;color:#fff;border:1px solid #3a8652}.ghost-link{color:#ddffe7;text-decoration:none;font-size:clamp(10px,1.4vh,14px);font-weight:850}
.tip{margin:clamp(6px,1.2vh,11px) auto 0;max-width:860px;color:#a6c9b0;font-size:clamp(8px,1.22vh,11px);line-height:1.3}

.game-screen{align-items:center;justify-content:center;background:radial-gradient(circle at center,#0b4822,#03140a 72%)}
.game-shell{width:100vw;height:100vh;height:100dvh;min-height:0;display:grid;grid-template-rows:auto auto minmax(0,1fr) auto;gap:clamp(3px,.75vh,7px);padding:clamp(3px,.75vh,7px);background:linear-gradient(180deg,#0b3e1e,#03170a);overflow:hidden}
.hud{display:grid;grid-template-columns:minmax(120px,180px) 1fr minmax(120px,180px);align-items:center;gap:clamp(4px,.8vw,10px);min-height:0;height:clamp(44px,7vh,58px)}
.hud-block,.score-block,.hud-buttons{background:linear-gradient(180deg,#0c4b24,#073517);border:1px solid #277344;border-radius:15px;box-shadow:inset 0 0 0 1px #ffffff08,0 5px 16px #00180766}
.timer-block{height:100%;padding:4px 13px;display:flex;align-items:center;justify-content:space-between}.hud-label{font-size:10px;font-weight:900;color:#a9cfb5}.timer-block strong{font-size:clamp(20px,3.2vh,27px);color:var(--yellow)}
.score-block{justify-self:center;height:100%;display:flex;align-items:center;gap:clamp(5px,1vw,14px);padding:3px 15px;min-width:min(620px,52vw);max-width:680px}
.team-score{display:flex;align-items:center;gap:7px;flex:1;justify-content:flex-end;font-weight:900;min-width:0}.team-score.cpu{justify-content:flex-start}.team-score img{width:clamp(28px,5vh,39px);height:clamp(28px,5vh,39px);border-radius:50%;object-fit:cover;background:#0a3519;border:2px solid #aaffbb44}.team-score span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:clamp(10px,1.55vh,14px)}.team-score strong{font-size:clamp(23px,3.7vh,31px);color:#fff}.score-sep{font-size:clamp(19px,3vh,26px);color:#82af8f}
.hud-buttons{justify-self:end;height:100%;display:flex;align-items:center;gap:4px;padding:4px}.hud-buttons button{width:clamp(30px,4.6vh,40px);height:calc(100% - 2px);max-height:40px;border:0;border-radius:10px;background:#14622f;color:#fff;font-size:clamp(15px,2.6vh,20px);font-weight:900}.hud-buttons button:hover{background:#1b7f3d}
.turn-bar{min-height:0;height:clamp(39px,6vh,48px);display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:10px;padding:3px 10px;background:linear-gradient(180deg,#08391b,#062b15);border:1px solid #236d3e;border-radius:13px}
.turn-bar>div:first-child{display:flex;flex-direction:column}.turn-bar strong{font-size:clamp(11px,1.7vh,14px);color:var(--lime)}.turn-bar #statusText{color:#a7c9b1;font-size:clamp(8px,1.3vh,11px)}
.moves{display:flex;align-items:center;gap:8px;font-size:10px;font-weight:900;color:#9cc3a8}.move-dots{display:flex;gap:5px}.move-dot{width:clamp(13px,2.1vh,17px);height:clamp(13px,2.1vh,17px);border-radius:50%;background:#174829;border:2px solid #36784b}.move-dot.on{background:var(--yellow);border-color:#fff4a0;box-shadow:0 0 12px #ffe04c77}
.power{justify-self:end;display:flex;align-items:center;gap:7px;font-size:9px;color:#9cc3a8;font-weight:900}.power-track{width:clamp(75px,10vw,130px);height:9px;border-radius:999px;background:#174829;overflow:hidden}.power-track i{display:block;height:100%;width:0;background:linear-gradient(90deg,#24e16c,#ffe237,#ff405b);transition:width .05s linear}.power b{width:34px;text-align:right;color:#fff}
.canvas-wrap{position:relative;min-height:0;min-width:0;border-radius:16px;overflow:hidden;background:#061c0d;display:grid;place-items:center;box-shadow:0 0 0 1px #2b7445,0 12px 42px #00170788}#pitch{display:block;max-width:100%;max-height:100%;touch-action:none;user-select:none;-webkit-user-select:none}
.event-banner{position:absolute;left:50%;top:16%;transform:translate(-50%,-50%) scale(.75);max-width:84%;padding:clamp(10px,1.8vh,15px) clamp(14px,2vw,24px);border-radius:16px;background:linear-gradient(180deg,#f5ff78,#a9e92d);color:#152109;border:4px solid #fff;box-shadow:0 7px 0 #507d08,0 15px 50px #000b;font-weight:1000;font-size:clamp(18px,3vw,46px);text-align:center;opacity:0;pointer-events:none;z-index:8;text-transform:uppercase}.event-banner.show{animation:bannerPop 1.9s ease both}.event-banner.foul{background:linear-gradient(180deg,#ff7888,#e00d31);color:#fff;box-shadow:0 7px 0 #700014,0 15px 50px #000b}.event-banner.info{background:linear-gradient(180deg,#72ef9b,#15914a);color:#fff;box-shadow:0 7px 0 #075729,0 15px 50px #000b}.event-banner.card-yellow{background:linear-gradient(180deg,#fff56b,#ffc400);color:#2e2400;box-shadow:0 7px 0 #9c7400,0 15px 50px #000b}.event-banner.card-red{background:linear-gradient(180deg,#ff6677,#d90021);color:#fff;box-shadow:0 7px 0 #720011,0 15px 50px #000b}@keyframes bannerPop{0%{opacity:0;transform:translate(-50%,-50%) scale(.55) rotate(-2deg)}10%,75%{opacity:1;transform:translate(-50%,-50%) scale(1) rotate(0)}100%{opacity:0;transform:translate(-50%,-50%) scale(1.06)}}
.modal-overlay,.rotate-overlay{position:absolute;inset:0;display:none;align-items:center;justify-content:center;background:#011507e6;z-index:12}.modal-overlay.show,.rotate-overlay.show{display:flex}.rotate-overlay{z-index:11;background:linear-gradient(180deg,rgba(2,17,8,.82),rgba(2,17,8,.94))}.rotate-card,.modal-card{width:min(480px,90%);max-height:90%;overflow:hidden;padding:clamp(16px,3vh,28px);border-radius:22px;background:linear-gradient(180deg,#0b4b24,#052d15);border:1px solid #42865a;text-align:center;box-shadow:0 30px 90px #001607}
.rotate-card h2,.modal-card h2{font-size:clamp(24px,4vh,30px);margin:0 0 8px}
.rotate-card p,.modal-card p{color:#b6d4be}
.rotate-card button,.modal-card button{margin:5px}.modal-actions{display:flex;justify-content:center;gap:8px;flex-wrap:wrap}.ball-reset-card{width:min(540px,92%)}
.phone-emoji{font-size:42px;line-height:1;margin-bottom:8px}
.end-score{display:flex;justify-content:center;gap:18px;align-items:center;font-size:clamp(42px,8vh,62px);font-weight:1000;margin:10px}.end-score b{font-size:34px;color:#7ba489}
.game-footer{min-height:clamp(16px,2.4vh,24px);display:flex;align-items:center;justify-content:space-between;gap:12px;padding:0 6px;color:#82a88d;font-size:clamp(8px,1.3vh,11px);overflow:hidden;white-space:nowrap}.game-footer span:first-child{color:#c7e4cf;font-weight:700;overflow:hidden;text-overflow:ellipsis}.footer-credits{display:flex;align-items:center;gap:7px;min-width:0;justify-content:flex-end}.footer-credits a{color:#9de4b2;text-decoration:none;font-weight:700}.footer-credits a:hover{text-decoration:underline}.footer-credits b{color:#5fa977;font-weight:900}

@media(max-width:1180px){.team-grid{grid-template-columns:repeat(3,minmax(0,1fr));}}
@media(max-width:1000px){
  .menu-panel{width:98vw}.team-card img{height:clamp(82px,17vh,132px)}
  .hud{grid-template-columns:120px 1fr 132px}.score-block{min-width:0;width:100%}.team-score span{display:none}
  .turn-bar{grid-template-columns:1fr auto}.power{grid-column:1/-1;justify-self:stretch;display:none}.game-footer{min-height:14px;font-size:7px;gap:6px}.footer-credits{gap:4px}.game-shell{grid-template-rows:auto auto minmax(0,1fr) auto}
}
@media(max-width:680px){
  .menu-screen{padding:4px}.menu-panel{width:calc(100vw - 8px);max-height:calc(100dvh - 8px);padding:8px;border-radius:16px}
  h1{font-size:clamp(24px,7vw,34px)}.subtitle{margin:3px 0 5px}.rules-strip{margin-bottom:4px;gap:3px}.rules-strip span{padding:3px 6px;font-size:8px}.duration-row{gap:5px;margin-bottom:4px}.duration-row>span{font-size:7px}.duration-picker{gap:3px}.duration-btn{padding:3px 6px;font-size:7px}.menu-panel h2{margin:0 0 5px;font-size:13px}.opponent-row{margin-top:4px;gap:5px}.opponent-row>span{font-size:7px}.opponent-row select{min-width:150px;max-width:58vw;padding:4px 25px 4px 9px;font-size:7.5px;background-position:calc(100% - 12px) 50%,calc(100% - 8px) 50%,0 0;background-size:4px 4px,4px 4px,100% 100%}
  .team-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:4px}.team-card{border-radius:10px}.team-card img{height:clamp(50px,9.2vh,74px)}.team-card .tc-body{padding:4px}.team-card h3{font-size:9px}.team-card p,.team-card .trait{display:none}
  .menu-actions{margin-top:5px;gap:8px}.primary,.secondary{padding:7px 11px;font-size:10px;border-radius:9px}.ghost-link{font-size:9px}.tip{margin-top:5px;font-size:7.5px;line-height:1.15}
  .game-shell{padding:3px;gap:3px}.hud{height:38px;grid-template-columns:78px 1fr 82px;gap:3px}.timer-block{padding:2px 5px}.hud-label{display:none}.timer-block strong{font-size:16px}.score-block{gap:3px;padding:2px 4px}.team-score img{width:24px;height:24px}.team-score strong{font-size:18px}.score-sep{font-size:16px}.hud-buttons{gap:1px;padding:2px}.hud-buttons button{width:24px;height:30px;font-size:13px;border-radius:7px}.hud-buttons #fullBtn{display:none}
  .turn-bar{height:34px;padding:2px 5px;gap:4px}.turn-bar strong{font-size:10px}.turn-bar #statusText{font-size:7.5px}.moves{gap:4px;font-size:8px}.move-dots{gap:3px}.move-dot{width:12px;height:12px}.power{display:none}.canvas-wrap{border-radius:8px}.game-footer{min-height:13px;font-size:6.3px;gap:4px;padding:0 3px}.footer-credits{gap:3px}
  .rotate-card{width:min(92vw,360px);padding:18px 14px}.phone-emoji{font-size:34px}.rotate-card p{font-size:13px}
}
@media(max-height:620px) and (min-width:681px){
  .menu-panel{padding:6px 15px}.brand{font-size:9px}h1{font-size:32px}.subtitle{margin:2px 0 4px;font-size:10px}.rules-strip{margin-bottom:4px}.rules-strip span{padding:3px 7px;font-size:8px}.duration-row{margin-bottom:4px}.duration-row>span{font-size:8px}.duration-btn{padding:3px 7px;font-size:8px}.menu-panel h2{font-size:12px;margin:0 0 4px}.opponent-row{margin-top:3px}.opponent-row>span{font-size:8px}.opponent-row select{padding:4px 28px 4px 10px;font-size:8px}.team-card img{height:84px}.team-card .tc-body{padding:4px 6px 5px}.team-card h3{font-size:11px}.team-card p{font-size:8px}.team-card .trait{font-size:8px;margin-top:3px}.menu-actions{margin-top:6px}.primary,.secondary{padding:7px 13px;font-size:10px}.tip{font-size:8px;margin-top:5px}
  .hud{height:40px}.turn-bar{height:34px}.game-footer{min-height:14px;font-size:7px;gap:6px}.footer-credits{gap:4px}.game-shell{grid-template-rows:auto auto minmax(0,1fr) auto}
}
