/* Desktop keeps the existing heading and sidebar, including their geometry. */
.history-toggle{display:none}

@media(max-width:850px){
 body{background-attachment:scroll}
 main{height:auto;min-height:100dvh;overflow:visible;gap:8px;padding:8px 8px calc(12px + env(safe-area-inset-bottom,0px));padding-left:max(8px,env(safe-area-inset-left,0px));padding-right:max(8px,env(safe-area-inset-right,0px))}
 .top{min-height:44px;flex-wrap:nowrap;gap:8px}
 .top h1{font-size:21px;line-height:28px;margin:0}
 .top>div{min-width:0}
 .top button.action{min-height:44px;padding:8px 10px;font-size:13px;flex:none}
 .playarea{grid-template-columns:minmax(0,1fr);flex:none;gap:8px}
 .leftcolumn{gap:8px;min-height:0}
 .panel{padding:10px;min-width:0}
 .panel h2{margin-bottom:8px}
 .stats{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:4px}
 .stat{padding:5px 3px;min-width:0;font-size:11px;line-height:15px;text-align:center}
 .stat>span{white-space:nowrap}
 .stat strong{font-size:16px;line-height:22px;white-space:nowrap}
 .scorepanel p{font-size:12px;margin-top:5px}
 .boardpanel{flex:none;overflow:visible;justify-content:initial}
 .rows{display:grid;gap:6px}
 .boardrow{display:grid;grid-template-columns:18px minmax(0,1fr) 32px;gap:5px;min-height:76px;padding:3px 0}
 .rowlabel{width:18px;font-size:13px}
 .cards{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:4px;width:100%;max-width:320px;min-width:0}
 .boardrow .card{width:100%;height:68px;font-size:21px;min-width:0}
 .boardrow>.muted{font-size:12px;line-height:17px;text-align:center;overflow-wrap:normal}
 .card small{display:block;width:100%;max-width:100%;font-size:10px;line-height:1.05;overflow-wrap:anywhere;text-align:center;padding:0 1px}
 .handpanel{flex:none}
 .handpanel #status{line-height:20px;min-height:40px;padding-top:0;padding-bottom:0;margin-bottom:6px}
 .hand{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:8px 7px;width:100%;max-width:520px;margin-inline:auto;overflow:visible;padding:4px 4px 7px}
 .hand .card{width:100%;min-width:0;height:80px;padding:4px 2px;font-size:24px;touch-action:manipulation}
 .hand .selected{outline-width:3px;outline-offset:1px;border-color:#697a41}
 .actions{display:flex;flex-direction:column;gap:8px;margin-top:8px}
 .actions button.action{width:100%;min-height:48px;font-size:16px;line-height:22px;padding:11px 12px;touch-action:manipulation}
 .choices{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-top:10px;scroll-margin-bottom:12px}
 button.choice{min-width:0;width:100%;min-height:48px;padding:11px 8px;font-size:15px;line-height:22px;touch-action:manipulation}
 .history{height:auto;min-height:0;overflow:hidden}
 .history>h2{display:none}
 .history-toggle{display:flex;align-items:center;justify-content:space-between;gap:10px;width:100%;min-height:44px;padding:5px 0;border:0;background:transparent;color:#303323;font:800 17px/22px Nunito,system-ui,sans-serif;text-align:left;cursor:pointer;touch-action:manipulation}
 .history-toggle::after{content:'+';font-size:24px;font-weight:650;color:#6c754c}
 .history-open .history-toggle::after{content:'−'}
 .history:not(.history-open) .log{display:none}
 .history .log{flex:none;max-height:min(50dvh,360px);overflow-y:auto;overflow-wrap:anywhere;overscroll-behavior:contain}
 .history.history-open .log{margin-top:8px}
}
@media(max-width:850px) and (hover:none){
 .hand button:hover:not(:disabled){transform:none}
}