/* Smaller screens (keep last) */
@media (max-height:880px) and (min-width:861px){
  :root{--cw:66px;--ch:92px;--chip:46px}
  .avatar{width:160px}
  .dealer-row{min-height:92px}
}
/* PC with a short screen (laptops, 1280×800…): everything smaller, and the game buttons stay on screen */
@media (max-height:820px) and (min-width:861px){
  :root{--cw:53px;--ch:74px;--chip:40px}
  .seat.compact{--cw:46px;--ch:64px}
  .seat.compact .seat-hands{min-height:calc(64px + 36px)}
  .topbar{padding-top:calc(8px + var(--sa-t));padding-bottom:8px}
  .table{padding:10px}
  .felt{padding:8px 24px 0;min-height:0}
  .avatar{width:108px}
  .dealer-row{min-height:0}
  .rack{transform:scale(.85);margin-top:-10px}
  .dealer-hand{margin-top:0;margin-bottom:0}
  .dealer-hand .cards{min-height:var(--ch)}
  .dealer-hand .hand-meta{min-height:20px;margin-top:2px}
  .felt-print{display:none}
  .print-wrap .status{position:relative;bottom:auto;left:auto;transform:none;margin:4px 0 6px}
  .seat-hands{min-height:calc(var(--ch) + 28px)}
  .seat:nth-child(2){margin-top:10px}
  .hand-meta{margin-top:4px}
  .spot{width:70px;height:70px}
  .spot-label{bottom:-16px;font-size:8px}
  .spot-amount{margin-top:19px;min-height:14px}
  .table{padding:6px}
  .deck{position:sticky;bottom:0;z-index:8;min-height:0;padding:10px 0 calc(12px + var(--sa-b));
    background:linear-gradient(180deg,transparent,rgba(3,30,18,.82) 28%,rgba(3,30,18,.92))}
}
@media (max-width:860px){
  :root{--cw:58px;--ch:82px;--chip:42px}
  .seat.compact{--cw:44px;--ch:62px}
  .seat.compact .seat-hands{min-height:calc(82px + 46px)}
  .felt{padding:10px 10px 26px}
  .table{padding:8px}
  .avatar{width:112px}
  .rack{gap:2px;padding:4px 6px}
  .rack i{width:11px;height:18px}
  .bubble{max-width:calc(50vw - 80px);font-size:11px;left:auto;right:calc(100% + 4px);border-radius:14px 14px 4px 14px;top:0}
  .dealer .shoe{left:calc(100% + 4px)}
  .shoe-box{width:56px;height:46px}
  .shoe small{font-size:9px}
  .limits,.discard{display:none}
  .spot{width:64px;height:64px}
  .tray{gap:6px;padding:9px 10px}
  .btn{padding:10px 12px;font-size:13px}
  .btn kbd{display:none}
  .print-wrap .status{position:relative;bottom:auto;left:auto;transform:none;white-space:normal;margin:6px 0 4px;font-size:13px}
  .topbar{padding:calc(10px + var(--sa-t)) max(10px,var(--sa-r)) 10px max(10px,var(--sa-l));gap:8px}
  .felt,.table{min-width:0}
  .medal{width:30px;height:30px;font-size:14px}
  .brand{gap:8px}
  .brand b{font-size:11px;letter-spacing:1.4px}
  .brand small{font-size:10.5px}
  .top-nav .hide-s,.top-nav .hide-s + .sep{display:none}
  .exit-link .long{display:none}
  .exit-link .short{display:inline}
  .tlink{font-size:12px;padding:9px 5px}
  .top-nav .sep{margin:0 2px}
  .bank-pill{padding:4px 0 4px 10px;gap:7px}
  .bank-pill strong{font-size:15px}
  .purse-stack{--chip:24px;width:24px;height:22px}
  .settings-pop{width:min(290px,calc(100vw - 24px));right:-70px}
  .stage{padding:0 6px 10px}
  .seats{gap:4px}
  .seat{--cw:42px;--ch:59px;min-width:0}
  .seat.compact{--cw:34px;--ch:48px}
  .seat-hands,.seat.compact .seat-hands{min-height:calc(59px + 40px)}
  .badge{font-size:10px;padding:4px 7px}
  .badge small{font-size:9px}
  .total{font-size:11px;padding:2px 7px;min-width:30px}
  .seat:nth-child(2){margin-top:20px}
  .spot::before{font-size:22px}
  .felt::before{inset:8px}
  .statgrid,.packs{grid-template-columns:repeat(2,1fr)}
  .rules-grid{grid-template-columns:1fr}
  .felt-print .t2{display:none}
}

/* phones: the top bar must never be wider than the screen (otherwise the browser zooms the whole page out) */
@media (max-width:540px){
  .topbar{gap:6px}
  .brand > div:not(.medal){display:none}
  .top-nav{min-width:0;flex:1 1 auto;justify-content:flex-end;flex-wrap:nowrap}
  .tlink{padding:9px 4px}
  .top-nav .sep{margin:0 1px}
  #btn-account{max-width:72px}
  .bank-pill{padding-left:8px;gap:6px}
  .bank-pill strong{font-size:14px}
}
@media (max-width:380px){
  .set-txt,.chev{display:none}
  .set-ico{display:inline}
  .purse-stack{display:none}
}

/* touch screens: small round buttons get a 44 px target */
@media (pointer:coarse){
  .close{width:44px;height:44px}
  .chat-x,.rw-close{width:40px;height:40px}
  .chat-tabs .chat-tab-x{width:26px;height:26px}
  .react-toggle{width:44px;height:44px}
  .react-bar button{width:44px;height:44px}
  .seg-toggle button{min-height:36px}
  .tlink{min-height:40px}
}

/* phones with a normal height (iPhone, most Android): the whole table + the game buttons fit on screen */
@media (max-width:600px) and (max-height:900px){
  .felt-print{display:none}
  .print-wrap .status{margin:2px 0 6px}
  .avatar{width:96px}
  .dealer-row{min-height:0}
  .dealer-hand{margin-top:6px;min-height:calc(var(--ch) + 28px)}
  .seat-hands,.seat.compact .seat-hands{min-height:calc(var(--ch) + 30px)}
  .spot-amount{margin-top:16px;min-height:14px}
  .deck{gap:8px 10px;padding-top:8px;position:sticky;bottom:0;z-index:8;padding-bottom:calc(8px + var(--sa-b));
    background:linear-gradient(180deg,transparent,rgba(3,30,18,.85) 22%,rgba(3,30,18,.94))}
}
