/* Keep settings readable and bounded; panels expose every option without a long dialog. */
.toast{z-index:10000!important;bottom:var(--toast-bottom,96px)!important;width:max-content;max-width:min(560px,calc(100vw - 24px));box-sizing:border-box;font-size:14px;line-height:1.45;white-space:normal;overflow-wrap:anywhere;text-align:center;unicode-bidi:plaintext;pointer-events:none;}
#modal:has(.settings-tabs){width:min(600px,calc(100vw - 24px));max-height:calc(100dvh - 24px);box-sizing:border-box;padding:24px;overflow:visible;}
.settings-tabs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;margin:16px 0;}
.settings-tabs button{min-width:0;min-height:44px;border:1px solid #87abc76b;border-radius:10px;background:#163957;color:#d8eaf4;font:inherit;padding:8px;overflow-wrap:anywhere;}
.settings-tabs button[aria-selected=true]{border-color:#edc76b;background:#35536a;color:#ffe4a1;}
.settings-tabs button:focus-visible{outline:2px solid #ffe4a1;outline-offset:2px;}
.settings-panel[hidden]{display:none!important;}
.settings-panel p{font-size:15px;line-height:1.5;overflow-wrap:anywhere;}
#modal .settings-panel .setting{margin:8px 0;padding:8px 0;min-height:44px;}
#modal .settings-panel input[type=range]{min-height:36px;padding:0;margin:0 0 6px;width:100%;}
#modal .settings-panel .volume-label{font-size:15px;margin:0;gap:12px;}
.settings-panel .audio-previews{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:10px;}
.settings-panel .audio-previews button{min-height:44px;white-space:normal;}
.settings-panel .voice-note{display:block;line-height:1.4;margin-top:8px;}
#modal:has(.settings-tabs)>.dialog-actions{margin:16px 0 0;}
@media(max-width:600px){#modal:has(.settings-tabs){padding:18px;}#modal .settings-panel .language-setting{margin-bottom:12px;}.settings-tabs{margin:12px 0;}.settings-panel .audio-previews button{padding:8px;font-size:14px;}}

/* Phone-only board clearance. Desktop sizing remains in fit-match.css. */
@media(max-width:600px){
  body.in-arena #app{padding:8px max(4px,env(safe-area-inset-right,0px)) max(12px,env(safe-area-inset-bottom,0px)) max(4px,env(safe-area-inset-left,0px));}
  body.in-arena header,body.in-arena footer,body.in-arena .bottom-dock{display:none!important;}
  body.in-arena main.match{padding-top:0;}
  body.in-arena .back-row{margin:0 6px 6px;min-height:44px;gap:8px;}
  body.in-arena .back-row>.text-button{min-height:44px;}
  body.in-arena .back-row small{font-size:10px;letter-spacing:1px;text-align:end;}
  body.in-arena .match-layout{display:flex;flex-direction:column;gap:12px;min-width:0;}
  body.in-arena .board-column{width:100%;min-width:0;max-width:none;margin:0;}
  body.in-arena .board-frame{width:100%;box-sizing:border-box;padding:3px;margin:6px 0;border-radius:12px;}
  body.in-arena .board-grid{width:100%;}
  body.in-arena .square{padding:1px;touch-action:manipulation;}
  body.in-arena .file,body.in-arena .rank{font-size:9px;line-height:1.1;}
  body.in-arena .player-card{padding:7px 9px;min-height:52px;gap:8px;}
  body.in-arena .player-card .avatar{width:36px;height:36px;flex:0 0 36px;}
  body.in-arena .player-card b{font-size:14px;}
  body.in-arena .player-card small{font-size:11px;}
  body.in-arena .player-card>div:nth-child(2){min-width:0;flex:1;}
  body.in-arena .player-card .player-clock{font-size:21px;min-width:72px;}
  body.in-arena .untimed-card{font-size:13px;white-space:nowrap;}
  body.in-arena .board-presentation-note{display:none;}
  body.in-arena .board-hint{font-size:12px;min-height:0;margin-top:6px;padding:8px;}
  body.in-arena .match-panel{width:100%;min-width:0;padding:12px;box-sizing:border-box;}
  body.in-arena .match-records,body.in-arena .match-left{min-width:0;}
  body.in-arena .record-tabs{display:flex;gap:6px;flex-wrap:wrap;}
  body.in-arena .record-tabs button{min-height:44px;}
  body.in-arena .match-options>summary{min-height:44px;}
  body.in-arena .match-options .text-button{min-height:44px;}
}
