/* OVERTIME BATTLE — separate gameplay UI; single-player remains unchanged. */
#battleApp{position:absolute;inset:0;z-index:70;background:#3d305e;color:#fff6e8;overflow:hidden;font-family:ui-rounded,'Arial Rounded MT Bold',system-ui,-apple-system,sans-serif;touch-action:none}
#battleApp.hide{display:none}#battleApp button{border:2px solid #fff7e1;color:#fff9ec;background:#9075bc;border-radius:13px;padding:11px 13px;font-weight:900;box-shadow:0 4px 0 #352548;min-height:41px}#battleApp button:disabled{opacity:.48;cursor:not-allowed}
#battleApp .battle-screen.hide{display:none}#battleApp .battle-screen{position:absolute;inset:0;overflow:auto;overscroll-behavior:contain;scrollbar-width:none}#battleApp .battle-screen::-webkit-scrollbar{display:none}
#battleLobby{background:radial-gradient(ellipse at 50% -10%,#a77ccf70,transparent 55%),linear-gradient(165deg,#52416f,#3d305e 68%);padding:18px 20px 36px;text-align:center}
.battle-head{display:flex;align-items:center;justify-content:space-between;gap:9px}.battle-top-title{font-size:20px;font-weight:1000;letter-spacing:1px}.battle-kicker{font-size:10px;letter-spacing:2.5px;font-weight:900;color:#e5c7f5}
#battleApp .battle-back{flex:0 0 auto;background:#5d4a7c;padding:8px 10px;width:43px;min-height:38px}
.battle-intro{font-size:13px;color:#f4dfeb;line-height:1.55;margin:13px 0 16px}
.battle-avatars{display:grid;grid-template-columns:1fr 1fr;gap:11px;margin:12px 0}
.battle-player-box{border-radius:20px;padding:14px 10px;background:#fff5ebed;color:#493759;border:3px solid #f9d6c7;box-shadow:0 5px #302544;text-align:center}
.battle-player-box:nth-child(2){background:#fce5f1ed;border-color:#f4c0df}
.battle-player-box input{width:100%;font:900 14px ui-rounded,system-ui,-apple-system,sans-serif;border:2px solid #b09ac9;background:#fffdf6;color:#4b3860;border-radius:10px;padding:9px 6px;text-align:center;min-width:0;touch-action:auto}
.battle-portrait{width:75px;height:75px;display:block;margin:1px auto 8px;border-radius:50%;background:#e5d6fa;border:3px solid #5e486e;position:relative;overflow:hidden}
.battle-portrait.girl{background:#f8d3e7}
.battle-portrait .face{position:absolute;width:44px;height:42px;left:12px;top:25px;border-radius:48% 48% 45% 45%;background:#ffe3c6;border:2px solid #614864}
.battle-portrait .hair{position:absolute;width:52px;height:28px;left:9px;top:12px;border-radius:55% 55% 35% 32%;background:#4a384f;z-index:1}
.battle-portrait.girl .hair{background:#634259}.battle-portrait.girl .hair:before{content:'';position:absolute;right:1px;top:-12px;width:24px;height:22px;border-radius:50%;background:#634259}
.battle-portrait .eyes{position:absolute;z-index:3;top:46px;left:23px;letter-spacing:8px;font-size:16px;color:#372a48;line-height:1}
.battle-portrait .circles{position:absolute;top:49px;left:20px;right:16px;height:11px;border-radius:45%;background:linear-gradient(90deg,#a97398a8 0%,#a97398a8 42%,transparent 43%,transparent 57%,#a97398a8 58%);z-index:2}
.battle-portrait .mouth{position:absolute;left:34px;top:62px;z-index:4;color:#785363;font-size:12px}
.battle-player-box .caption{font-size:10px;display:block;margin:8px auto 0;color:#846f90;font-weight:900}
.battle-box{background:#f5e8f6;border:3px solid #e6d3fc;color:#59476b;border-radius:18px;padding:13px;margin:16px 0;text-align:left;line-height:1.65;font-size:12px;font-weight:800}
.battle-box b{color:#a55981}
.battle-modes{display:flex;gap:8px;margin:12px 0}.battle-modes button{flex:1;padding:11px 4px!important;font-size:12px}
#battleApp button.active{background:#f4b87a;color:#4d375e;border-color:#fff2ce}
#battleApp .battle-mainbtn{background:#f8b75d;color:#49345d;width:100%;font-size:16px;padding:13px 10px;margin-top:10px}
.battle-small{font-size:11px;line-height:1.5;color:#e4d4f3;margin:12px 0}
#battleOnlinePanel .battle-box{background:#f9e9f4}#battleOnlinePanel input{font:900 19px ui-rounded,system-ui;background:#fff;border:2px solid #b99fd0;border-radius:10px;text-align:center;letter-spacing:4px;padding:9px;width:100%;text-transform:uppercase;touch-action:auto}
.battle-online-row{display:flex;gap:7px}.battle-online-row button{flex:1}
#battleStatus{font-size:12px;font-weight:900;color:#fff1c1;margin:10px auto;min-height:16px;overflow-wrap:anywhere}
#battlePlay{background:#4a3969;overflow:hidden}#battleCanvas{position:absolute;inset:0;width:100%;height:100%;touch-action:none}
.battle-live-top{position:absolute;z-index:3;left:3%;right:3%;top:2.5%;pointer-events:none}
.battle-live-title{font-size:11px;text-align:center;font-weight:1000;letter-spacing:1.3px;color:#fff3cf;text-shadow:0 2px 2px #392751}
.battle-live-header{display:grid;grid-template-columns:1fr auto 1fr;gap:5px;align-items:center;margin-top:5px}
.battle-live-name{display:flex;flex-direction:column;gap:3px;min-width:0;border:2px solid #ffebf0bb;border-radius:12px;background:#f2e4f1dd;color:#443356;padding:8px 4px;backdrop-filter:blur(6px);box-shadow:0 3px 5px #30224477}
.battle-live-name.mine{border-color:#fff0b8;background:#fff4d9ee}
.battle-live-name .b-name{font-size:11px;font-weight:1000;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:center}
.battle-live-name .b-score{font-size:22px;font-weight:1000;text-align:center;font-variant-numeric:tabular-nums}
.battle-live-name .b-rate{font-size:10px;text-align:center;font-weight:900}
#battleClock{background:#4e3969;color:#fff4d5;border:2px solid #ffe8b6;border-radius:13px;min-width:67px;padding:10px 3px;text-align:center;font-weight:1000;font-size:20px;box-shadow:0 4px #32254b;font-variant-numeric:tabular-nums}
#battleClock.final{background:#d7456c;animation:BattlePulse .5s infinite alternate}
.battle-task-band{position:absolute;top:20.3%;left:5%;right:5%;z-index:3;border-radius:11px;background:#38264fc7;padding:6px 4px;color:#fff3c9;font-size:11px;text-align:center;font-weight:900;pointer-events:none;backdrop-filter:blur(5px)}
.battle-play-tip{position:absolute;bottom:19%;left:5%;right:5%;font-size:11px;color:#fff4d4;font-weight:1000;text-align:center;text-shadow:0 2px 3px #38284c;pointer-events:none;z-index:3}
.battle-live-actions{position:absolute;bottom:5%;left:5%;right:5%;z-index:5;display:flex;gap:9px}
#battleApp .battle-live-actions button{flex:1;min-width:0;padding:9px 3px;font-size:12px;background:#a88ac5cc;backdrop-filter:blur(5px)}
#battleApp .battle-live-actions #battleLeave{background:#ecd0c2;color:#563f60}
#battleApp #battleVignette{position:absolute;inset:0;pointer-events:none;z-index:2;opacity:0;background:radial-gradient(ellipse,transparent 37%,#ed2e6288);transition:opacity .3s}
#battlePlay.last-seconds #battleVignette{opacity:1;animation:BattlePulse .55s infinite alternate}
#battlePlay.last-seconds #battleCanvas{animation:BattleShake .3s infinite}
@keyframes BattlePulse{from{opacity:.55}to{opacity:1}}@keyframes BattleShake{0%,100%{transform:translate(0,0)}30%{transform:translate(1px,-1px)}70%{transform:translate(-1px,1px)}}
#battleResult{padding:25px 22px;background:radial-gradient(ellipse at top,#9b74bd,#594271 60%,#433357);text-align:center}
#battleResult h2{font-size:28px;line-height:1.15;margin:12px 0}
.battle-result-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:18px 0}.battle-result-cell{background:#fff2e6;border:3px solid #fff9ee;border-radius:15px;padding:14px 5px;color:#503d61}.battle-result-cell:last-child{background:#fbe2f1}.battle-result-cell b{font-size:24px;color:#c85c73;display:block}.battle-result-cell strong{font-size:13px}.battle-result-cell small{display:block;font-size:10px;margin-top:5px}
.battle-winner{font-size:20px;color:#ffe6a8;font-weight:1000;line-height:1.5}.battle-info{margin-top:13px;color:#eee0fa;font-size:11px}
.battle-mid{display:grid;place-items:center;min-height:160px}.battle-mid .big{font-size:52px}.battle-mid h2{margin:9px auto}
#battleApp .battle-wait{background:#fff0db;color:#553a61;border-radius:15px;padding:14px;margin:15px auto;font-weight:900;line-height:1.5}
@media(max-height:680px){#battleLobby{padding-top:13px}.battle-portrait{width:64px;height:64px}.battle-player-box{padding:7px}.battle-intro{margin:8px auto}}
@media(prefers-reduced-motion:reduce){#battlePlay.last-seconds #battleVignette,#battlePlay.last-seconds #battleCanvas,#battleClock.final{animation:none}}
/* Give each score item its own line; prevents nickname, score and accuracy collisions. */
.battle-live-name>span{display:flex;flex-direction:column;align-items:center;min-width:0;width:100%;gap:1px}
.battle-live-name .b-name{display:block;width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.battle-live-name .b-score,.battle-live-name .b-rate{display:block}
#battleCopy{width:100%;margin-top:10px;background:#eebd84!important;color:#49385d!important}

/* V2.1 -- responsive dual-character expressions and deadline warning. */
.battle-live-header{grid-template-columns:minmax(0,1fr) 65px minmax(0,1fr);gap:4px}
.battle-live-name{flex-direction:row;align-items:center;justify-content:center;gap:3px;padding:4px 3px;min-height:72px;border-radius:13px;transition:background .2s,border-color .2s,box-shadow .2s}
.battle-card-meta{display:flex;min-width:0;flex:1;flex-direction:column;align-items:center;gap:0}
.battle-avatar-mini{width:42px;height:43px;flex:0 0 42px;display:flex;align-items:center;justify-content:center;overflow:visible}
.battle-avatar-mini .battle-portrait{position:relative;flex:0 0 auto;width:75px;height:75px;transform:scale(.55);transform-origin:center center;margin:0}
.battle-live-name .b-name{font-size:9px;line-height:1.2;color:#3c2f54;max-width:100%}
.battle-live-name .b-score{font-size:17px;line-height:1.2;color:#5c456f}
.battle-live-name .b-rate{font-size:9px;color:#685374;line-height:1.2}
.battle-live-name .b-mood{display:block;font-size:9px;color:#bd5d7e;line-height:1.2;font-weight:1000;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}
.battle-live-name.battle-alarmed{border-color:#ff758d;box-shadow:0 0 14px #fa4b7788}
#battlePlayerA{background:#e5efffe8}#battlePlayerB{background:#ffe5f0ea}
#battleClock{font-size:19px;padding:9px 2px;min-width:61px}
.battle-deadline{position:absolute;top:16%;left:5%;right:5%;z-index:4;pointer-events:none}
.battle-deadline-text{font-size:10px;line-height:1.6;font-weight:1000;text-align:center;color:#fff3d3;text-shadow:1px 1px 4px #382344;letter-spacing:.5px}
.battle-deadline-track{height:10px;border-radius:99px;background:#3c2a58;border:2px solid #fff6e3ed;overflow:hidden;box-shadow:0 3px 8px #38244f80}
#battleDeadlineFill{width:100%;height:100%;background:#9fe7b7;border-radius:99px;transition:width .12s linear,background .24s ease}
.battle-task-band{top:21.5%}
/* Preserve the purple-grey black circles for BOTH players, regardless of mood. */
.battle-portrait .eyes{display:flex;gap:9px;align-items:center;top:45px;left:22px;height:12px;letter-spacing:normal;font-size:0}
.battle-portrait .eyes i{display:block;width:7px;height:4px;background:#46334f;border-radius:60% 60% 30% 30%;transition:transform .16s,height .16s,border-radius .16s}
.battle-portrait .brows{position:absolute;z-index:3;top:41px;left:22px;width:29px;height:2px;background:linear-gradient(90deg,#674c63 0 40%,transparent 40% 60%,#674c63 60%);transform:rotate(0);transition:transform .18s}
.battle-portrait .mouth{left:27px;top:58px;width:21px;height:9px;display:block;text-align:center;font-size:14px;line-height:1;color:#784b64;transition:transform .15s}
.battle-portrait .mouth:before{content:'⌢'}
.battle-portrait .sweat{position:absolute;z-index:5;top:25px;right:2px;opacity:0;font-size:14px}
.battle-portrait[data-mood="happy"] .eyes i,.battle-portrait[data-mood="combo"] .eyes i{background:transparent;border-top:2px solid #573653;height:7px;border-radius:70% 70% 0 0;transform:translateY(-2px)}
.battle-portrait[data-mood="happy"] .mouth:before{content:'ᴗ'}
.battle-portrait[data-mood="combo"] .mouth:before{content:'▽'}
.battle-portrait[data-mood="combo"]{box-shadow:0 0 0 4px #f7d17ca6}
.battle-portrait[data-mood="wrong"] .mouth:before,.battle-portrait[data-mood="worried"] .mouth:before{content:'﹏'}
.battle-portrait[data-mood="wrong"] .brows{transform:rotate(-8deg)}
.battle-portrait[data-mood="panic"] .eyes i,.battle-portrait[data-mood="worried"] .eyes i{height:8px;border-radius:50%;background:#3e3054;transform:translateY(-2px)}
.battle-portrait[data-mood="panic"] .mouth:before{content:'○'}
.battle-portrait[data-mood="panic"] .sweat{opacity:1}
.battle-portrait[data-mood="waiting"]{filter:saturate(.5);opacity:.72}
#battlePlay.warning-10 #battleVignette{opacity:.36;box-shadow:inset 0 0 24px 12px #ef355c70;background:radial-gradient(ellipse at center,transparent 46%,#db1c487a 100%)}
#battlePlay.warning-10 .battle-deadline-text{color:#ffdbb2}
#battlePlay.warning-10 #battleClock{border-color:#ffb3a4;color:#ffe0d5}
#battlePlay.last-seconds #battleVignette{opacity:.94;box-shadow:inset 0 0 36px 20px #ff174f88;background:radial-gradient(ellipse at center,transparent 37%,#e31e559c 100%);animation:BattlePulse .65s ease-in-out infinite alternate}
#battlePlay.last-seconds #battleCanvas{animation:BattleShake .3s linear infinite}
#battlePlay.last-seconds #battleClock{background:#e84664;color:white;border-color:#fff0e0;animation:BattlePulse .5s infinite alternate}
#battlePlay.last-seconds .battle-deadline-track{box-shadow:0 0 15px #ff3c6c}
#battlePlay.last-seconds .battle-live-name{border-color:#fa9eae}
#battlePlay.last-seconds .battle-deadline-text{color:#fff2e1;animation:BattlePulse .6s infinite alternate}
@media(prefers-reduced-motion:reduce){#battlePlay.last-seconds #battleVignette,#battlePlay.last-seconds #battleCanvas,#battlePlay.last-seconds #battleClock,#battlePlay.last-seconds .battle-deadline-text{animation:none!important}#battleVignette{transition:none!important}}
/* V2.2: a legible, mobile-friendly private room lobby. */
#battleOnlinePanel .battle-input-label{display:block;color:#fff3df;text-align:left;font-weight:900;font-size:12px;margin:7px 0 5px}
#battleOnlinePanel #battleOnlineNick{background:#fff9ed;color:#4b3860;letter-spacing:normal;font-size:15px;text-align:left}
#battleOnlinePanel .battle-online-row{margin:12px 0 10px}
#battleOnlinePanel #battleCodeInput{margin-bottom:6px}
#battleOnlinePanel .battle-room-banner{border:2px solid #ffe4ba;background:linear-gradient(120deg,#8a66ac,#b77caa);border-radius:17px;padding:10px 12px;margin:12px 0;color:#fff4e6;box-shadow:0 4px #32234b;text-align:center}
#battleOnlinePanel .battle-room-banner[hidden]{display:none}
#battleOnlinePanel .battle-room-banner strong{display:block;font-size:29px;letter-spacing:5px;line-height:1.4;color:#ffe5a2}
#battleOnlinePanel .battle-room-banner span{display:block;font-size:11px}
#battleApp :focus-visible{outline:3px solid #ffe59b;outline-offset:3px}

.battle-server-config{margin:15px 0 10px;text-align:left;border:1px solid #e0c1ed66;border-radius:14px;padding:11px;background:#422e58a6}
.battle-server-config summary{font-size:12px;font-weight:900;cursor:pointer;color:#f8e5f6}
.battle-server-config #battleServerUrl{font-size:12px!important;letter-spacing:0!important;text-align:left!important;margin:9px 0}
#battleApp .battle-server-config button{background:#c8a8cf;width:100%}
.battle-server-config p{font-size:10px;opacity:.8;line-height:1.4;margin:9px 0 0}
