/* The game uses the visible viewport; dialogs and the home form can scroll with a keyboard open. */
:root{font-family:system-ui,-apple-system,'Segoe UI',sans-serif}
body{height:100dvh;padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);overscroll-behavior:none}
button,a,summary{touch-action:manipulation;-webkit-tap-highlight-color:transparent}
input:not([type=checkbox]){font-size:16px}
.home{overflow-y:auto;overscroll-behavior:contain}
.player>div:last-child{min-width:0}
.room,.table-shell{grid-template-columns:minmax(0,1fr)}
.room>*{min-width:0}
.player-name{max-width:100%}
.player-meta{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.table-content{overflow-wrap:anywhere}
.table-content .eyebrow{letter-spacing:.5px}
.pile-button{transition:background .12s}
.history-cards{grid-template-columns:repeat(auto-fit,minmax(44px,1fr))}
.history-cards .playing-card{max-width:none;height:clamp(40px,8dvh,66px)}
.toast{width:max-content;max-width:calc(100vw - 24px);bottom:max(16px,env(safe-area-inset-bottom))}
dialog{max-height:calc(100dvh - 24px);overscroll-behavior:contain}
.code-badge strong{user-select:text;-webkit-user-select:text}
@media(hover:none){
  .playing-card:hover:not(.selected):not(.dragging){transform:none}
  .icon-button{width:40px;height:40px}
}
@media(max-width:600px){
  .toolbar{height:48px;padding:0 12px}.brand{font-size:18px}.brand-mark{height:28px;width:26px;font-size:21px}nav{gap:4px}
  .home{padding:16px;gap:0;align-items:safe center}.entry-panel{padding:24px;max-width:420px}
  .entry-panel input{height:44px}.entry-panel .wide{min-height:44px}
  .room{padding:8px 10px;gap:6px;grid-template-rows:36px minmax(0,1fr) 48px clamp(128px,26dvh,216px) 76px}
  .room-heading{min-height:0}.room-heading>div:first-child{display:none}.room-tools{width:100%;justify-content:space-between;gap:6px}
  .code-badge{min-height:36px;padding:7px 10px}.code-badge strong{font-size:12px;letter-spacing:1.1px}
  .room-tools .text-button{font-size:12px;min-height:36px}
  .players{gap:4px}.player{padding:7px 6px;border-radius:8px;justify-content:center;min-width:0}.player-name{font-size:11px}.player-meta{font-size:10px}
  .table-shell{gap:6px}.felt{border-width:2px;border-radius:24px;padding:8px 8px 38px;gap:5px}
  .table-content{max-width:100%}.table-content h3{font-size:20px}.table-content p{font-size:12px}.table-content h3+p{margin-top:4px}
  .table-cards{gap:5px;flex-shrink:0}.table-cards .playing-card{width:clamp(40px,11vw,60px);height:clamp(54px,10dvh,86px)}
  .pile-button{bottom:5px;right:12px;min-height:30px;padding:4px 10px}
  .hand-heading{display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-rows:18px 30px;gap:0 8px;min-height:0}
  .hand-heading>div:first-child{font-size:12px}.sort-controls{grid-column:2;grid-row:1 / 3;align-self:stretch;align-items:center;gap:4px}
  .small-button{min-height:40px;padding:6px 9px;font-size:12px}
  #turnStatus{max-width:100%;font-size:11px;grid-column:1;grid-row:2;align-self:center}
  .hand{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr));gap:16px 5px;padding:10px 2px 0;align-items:stretch}
  .hand .playing-card{width:100%;max-width:none;height:100%;border-radius:6px;padding:0}
  .hand .corner{font-size:20px;top:5px;left:5px}.hand .pip{font-size:21px;right:4px;bottom:5px}
  .playing-card.selected,.playing-card.selected:active{transform:translateY(-7px);outline-width:2px}
  .hand-empty{grid-column:1 / -1;grid-row:1 / -1;text-align:center}
  .action-bar{display:flex;flex-direction:column;justify-content:space-between;align-items:stretch;gap:3px;padding-top:4px;min-height:0}
  .action-bar p{font-size:11px;line-height:14px;max-width:100%;min-height:28px;display:flex;align-items:center}
  .actions{gap:6px;justify-content:flex-end}.actions button{min-height:40px;font-size:13px;padding:8px 16px}.actions .primary{flex:1}
  dialog{width:calc(100vw - 24px);padding:20px;border-radius:16px}.dialog-heading{gap:8px}.dialog-heading h2{font-size:21px}
  .preferences{gap:10px}.checkbox{font-size:12px;gap:8px}.history-cards{gap:5px;grid-template-columns:repeat(7,minmax(0,1fr))}
}
@media(max-width:380px){
  .room{padding-left:8px;padding-right:8px}.hand{gap:14px 4px}.hand .corner{font-size:18px;left:4px}.hand .pip{font-size:17px}
  .small-button{padding-left:7px;padding-right:7px}.muted{margin-left:5px}.code-badge strong{letter-spacing:.7px}
}
@media(max-height:500px) and (min-width:601px){
  .toolbar{height:36px}.brand{font-size:16px}.brand-mark{height:24px;width:24px;font-size:18px}nav{gap:4px}.toolbar .icon-button{height:30px;width:30px}
  .room{padding:6px 12px;gap:4px;grid-template-rows:34px minmax(0,1fr) 28px 72px 38px}.room-heading{min-height:0}.room-heading h2{font-size:16px}
  .players{gap:5px}.player{padding:3px 8px}.avatar{display:none}.table-shell{gap:4px}
  .felt{flex-direction:row;padding:5px 105px 5px 12px;border-width:2px;border-radius:22px;gap:12px}
  .table-content{max-width:45%}.table-content h3{font-size:16px}.table-content p{font-size:10px}.table-cards{gap:4px}
  .table-cards .playing-card{height:48px;width:35px}.table-cards .playing-card .corner{font-size:15px;top:3px;left:4px}.table-cards .playing-card .pip{display:none}
  .pile-button{bottom:50%;transform:translateY(50%);right:10px;padding:5px 7px;gap:4px;font-size:10px}.pile-button:active:not(:disabled){transform:translateY(50%)}
  .hand{padding-top:10px}.playing-card.selected,.playing-card.selected:active{transform:translateY(-7px)}
  .hand .corner{font-size:18px;top:4px;left:5px}.hand .pip{font-size:21px;bottom:5px}.action-bar{padding-top:3px;min-height:0}
  .home{padding:8px 18px;align-items:start}.entry-panel{max-width:600px;display:grid;grid-template-columns:1fr 1fr;gap:6px 16px;padding:16px}
  .entry-panel h2{grid-column:1 / -1;margin:0 0 4px}.entry-panel label{margin:0}.entry-panel label[for=playerName]{grid-column:1;grid-row:2}
  #playerName{grid-column:1;grid-row:3}#hostButton{grid-column:1;grid-row:4}.entry-panel label[for=roomCode]{grid-column:2;grid-row:2}
  #roomCode{grid-column:2;grid-row:3}#joinButton{grid-column:2;grid-row:4}.entry-panel .or{display:none}#connectStatus{grid-column:1 / -1}
}
@media(max-height:650px) and (max-width:600px){
  .room{grid-template-rows:36px minmax(0,1fr) 44px 128px 72px;gap:4px}
  .hand-heading{grid-template-rows:18px 26px}
  .table-content h3{font-size:16px}.table-content p{font-size:11px}
  .actions button{min-height:36px;padding:6px 12px}.small-button{min-height:36px}
}
@media(max-height:560px) and (max-width:600px){
  .home{align-items:start;padding:10px 16px}.entry-panel{padding:16px 20px}.entry-panel h2{margin-bottom:8px}.entry-panel .or{margin:10px 0}
  .room{grid-template-rows:32px minmax(0,1fr) 44px 124px 72px;gap:4px}.table-content h3{font-size:16px}.table-content p{font-size:10px}
  .table-cards .playing-card{height:48px;width:35px}.table-cards .playing-card .pip{display:none}.felt{padding-bottom:31px}
  .hand .pip{display:none}.small-button{min-height:36px}.actions button{min-height:36px;padding:6px 12px}
}
