/* Room for the arena, without shrinking the two players' input targets. */
/* Only the keypads consume gestures; menus and the rest of the page can still scroll/zoom. */
.keypad,.key{touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}
.key{-webkit-tap-highlight-color:transparent}
.key.touch-held{transform:translateY(4px);box-shadow:inset 0 2px 0 #fff,0 1px 0 #9aa9bd;filter:brightness(.94)}
.topbar,.game{max-width:1660px}
.brand h1{line-height:1.08;font-size:clamp(1.5rem,3vw,3rem)}
.brand h1 span{line-height:1.1}
.brand:after{content:'МАТЕМАТИЧЕСКАЯ ДУЭЛЬ';display:block;margin-top:10px;font-size:clamp(.5rem,.7vw,.72rem);letter-spacing:.18em;color:#ffe5a0;font-weight:900}
.game{grid-template-columns:minmax(210px,.76fr) minmax(440px,1.75fr) minmax(210px,.76fr);gap:14px}
.panel{padding:12px;min-height:550px}
.arena{min-height:550px}
.timer{position:absolute;top:8px;width:88px;height:88px;border-width:7px;font-size:1.5rem}
.message{margin-top:auto}
.timer small{font-size:.55rem}
.field{top:120px;bottom:70px}
.rope-zone{height:218px;top:54%}
.tugger,.hand-overlay{height:260px;top:-25px;width:42%}
.tugger.left,.hand-overlay.left{left:5%}
.tugger.right,.hand-overlay.right{right:5%}
.tugger.right,.hand-overlay.right{top:-17px}
.round-status{position:absolute;top:100px;font-size:.77rem;font-weight:900;color:#153361}
.track:before,.track:after{position:absolute;top:-4px;bottom:-4px;width:4px;border-radius:3px;content:'';background:#168cff;left:10%}
.track:after{left:auto;right:10%;background:#ff334f}
.finish-label{position:absolute;bottom:39px;font-size:.65rem;font-weight:900;color:#123969;background:#fff5d8df;border-radius:8px;padding:3px 6px;z-index:2}
.finish-label.blue{left:5%}.finish-label.red{right:5%;color:#ad1025}
.countdown{position:absolute;inset:0;display:grid;place-content:center;text-align:center;background:#10244d45;backdrop-filter:blur(2px);z-index:8;color:white;font-weight:900;text-shadow:0 4px 0 #10244d;border-radius:26px}
.countdown[hidden]{display:none}
.countdown strong{font-size:clamp(4rem,10vw,7rem);line-height:1.1}
.countdown span{font-size:.9rem}
.panel-heading{display:flex;justify-content:space-between;gap:6px;align-items:center;font-size:.75rem;font-weight:900;margin:0 2px 9px}
.streak{border-radius:20px;padding:3px 7px;background:#fff2;white-space:nowrap}
.bot-status{display:none;padding:14px;background:#7e122b;color:#fff;border-radius:16px;font-weight:700;line-height:1.5;text-align:center;margin:auto 0}
.bot-mode .panel.red .keypad{display:none}.bot-mode .bot-status{display:block}
.bot-status:before{content:'';display:block;width:32px;height:32px;margin:0 auto 12px;border:4px solid #fff4;border-top-color:#fff;border-radius:50%;animation:thinking 1.4s linear infinite}
@keyframes thinking{to{transform:rotate(360deg)}}
.play-settings{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:12px 0;text-align:left}
.setting-field{display:flex;flex-direction:column;gap:5px;color:#18345d;font-weight:900;font-size:.83rem}
.setting-field select{width:100%;min-height:40px;border:2px solid #a8bed4;border-radius:11px;background:white;color:#10244d;padding:7px 9px;font:inherit;cursor:pointer}
.setting-field small{font-size:.7rem;line-height:1.3;font-weight:400;min-height:1.3em}
.setting-field[hidden]{display:none}
.modal{width:min(960px,100%)}
.modal h2{font-size:2.2rem}
.modal-actions{position:sticky;bottom:-24px;margin:8px -10px -10px;padding:12px 10px 18px;background:linear-gradient(#ffe7a700,#ffe7a7 18%);z-index:2}
.modal-actions .start{font-size:1.15rem;padding:12px 28px}
.overlay.hidden{visibility:hidden}
@media(min-width:750px){.play-settings{grid-template-columns:repeat(4,minmax(0,1fr))}#botLevelField{grid-column:1/-1;display:grid;grid-template-columns:140px 1fr 1.3fr;align-items:center}#botLevelField[hidden]{display:none}}
.modal .character-card{height:102px}.modal .character-card img{height:80px}
.modal .character-card span{font-size:.72rem}
.result-stats .stat-card{text-align:left;line-height:1.45}
.result-stats .stat-card span{line-height:1.5}
.error-review{margin:10px 0;text-align:left;color:#10244d;font-size:.85rem;border:2px solid #e4bf81;border-radius:12px;padding:10px}
.error-review summary{cursor:pointer;font-weight:900}
.error-review ul{max-height:150px;overflow:auto;padding-left:22px;line-height:1.7;margin:8px 0 0}
.error-review[hidden],.result-stats[hidden]{display:none}
.result-menu{border:0;background:transparent;color:#18345d;text-decoration:underline;cursor:pointer;font:inherit;font-weight:700;padding:12px 20px}
.result-menu[hidden]{display:none}
.between-rounds .character-select,.between-rounds .play-settings,.between-rounds .match-settings,.between-rounds .keys-help{display:none}
button:focus-visible,select:focus-visible,summary:focus-visible{outline:3px solid #184c92;outline-offset:3px}
@media(max-width:1100px){
  .game{grid-template-columns:repeat(2,minmax(0,1fr))}.arena{grid-column:1/-1;grid-row:1;min-height:390px}
  .panel{min-height:410px}.field{top:106px;bottom:55px}.message{padding:8px 12px;font-size:1rem}
  .rope-zone{height:185px}.tugger,.hand-overlay{height:230px;top:-26px}.tugger.right,.hand-overlay.right{top:-18px}
  .pose.rabbit{transform:translateY(var(--pose-y,0%)) scale(1.08)}
  .tugger.rabbit,.hand-overlay.rabbit{height:190px;top:-10px}.tugger.rabbit.right,.hand-overlay.rabbit.right{top:-2px}
  .round-status{top:89px}.timer{width:78px;height:78px}.brand:after{margin-top:7px}
}
@media(max-width:650px){
  .game{gap:8px}.arena{min-height:330px}.panel{padding:7px;min-height:392px}
  .field{top:93px;bottom:45px}.timer{width:65px;height:65px;font-size:1.1rem}.round-status{top:76px;font-size:.63rem}
  .rope-zone{height:137px}.tugger,.hand-overlay{height:162px;top:-15px;width:42%}.tugger.right,.hand-overlay.right{top:-7px}
  .tugger.rabbit,.hand-overlay.rabbit{height:150px;top:-15px}.tugger.rabbit.right,.hand-overlay.rabbit.right{top:-7px}.pose.rabbit{transform:translateY(var(--pose-y,0%)) scale(1.1)}
  .modal-actions{bottom:-12px;margin-bottom:-6px;padding-bottom:12px}
  .message{font-size:.77rem;padding:6px 9px}.finish-label{bottom:30px;font-size:.51rem;padding:2px 4px}
  .panel-heading{font-size:.6rem;gap:2px;margin-bottom:6px}.streak{padding:2px 4px}
  .play-settings{gap:8px;margin:8px 0}.setting-field{font-size:.72rem}.setting-field select{min-height:38px;padding:6px;font-size:.75rem}.setting-field small{font-size:.62rem}
  .modal .character-card{height:79px}.modal .character-card img{height:57px}.modal .character-card span{font-size:.6rem}
  .brand:after{font-size:.48rem;margin-top:6px}.modal h2{font-size:1.7rem}.bot-status{font-size:.76rem;padding:10px}
}
@media(max-width:380px){.panel-heading{flex-direction:column;align-items:flex-start}.arena{min-height:330px}.modal .character-card{height:70px}.modal .character-card img{height:48px}}
@media(max-height:550px) and (min-width:700px){
  .game{grid-template-columns:minmax(160px,.7fr) minmax(280px,1.5fr) minmax(160px,.7fr)}
  .arena{grid-column:auto;grid-row:auto;min-height:0;height:calc(100svh - 95px)}.panel{min-height:0;height:calc(100svh - 95px);padding:6px}
  .field{top:88px;bottom:43px}.timer{width:60px;height:60px;font-size:1rem}.round-status{top:71px;font-size:.65rem}
  .rope-zone{height:135px}.tugger,.hand-overlay{height:154px;top:-14px}.tugger.right,.hand-overlay.right{top:-6px}
  .pose.rabbit{transform:translateY(var(--pose-y,0%)) scale(1.02)}.tugger.rabbit,.hand-overlay.rabbit{height:138px;top:-14px}.tugger.rabbit.right,.hand-overlay.rabbit.right{top:-6px}
  .panel-heading{font-size:.6rem;margin-bottom:4px}.question{min-height:45px}.answer{height:36px}.brand:after{display:none}
  .message{font-size:.72rem;padding:5px 8px}.finish-label{font-size:.52rem;bottom:28px}
}
@media(prefers-reduced-motion:reduce){.bot-status:before{animation:none}}
