/* Phones in landscape: the whole game on one screen, thumbs on the sides (load after responsive.css) */
/* the chat's dimmed backdrop only exists for landscape phones */
.chat-scrim{display:none}
/* One rule for every landscape phone: the height is what's short, never the width.
   Tablets and computers are never this short (their big screens zoom by steps, js/display.js). */
@media (orientation:landscape) and (max-height:500px){
  :root{
    --lh:calc(100dvh * var(--vz,1));                 /* the visible height (the address bar comes and goes) */
    --ch:clamp(42px,13dvh,56px);--cw:calc(var(--ch) * .72);
    --chip:clamp(38px,11.5dvh,46px);
    --bar:44px;                                       /* top bar height */
  }

  /* ---------- top bar: one thin line ---------- */
  .topbar{min-height:var(--bar);padding:var(--sa-t) max(10px,var(--sa-r)) 0 max(10px,var(--sa-l));gap:10px}
  .medal{width:28px;height:28px;font-size:13px}
  .brand b{font-size:11px;letter-spacing:1.6px}
  .brand small{font-size:10.5px;margin-top:0}
  .tlink{min-height:44px;padding:0 7px;font-size:12.5px}
  .bank-pill{min-height:44px;padding:2px 0 2px 10px}
  .bank-pill strong{font-size:15px}
  .purse-stack{--chip:22px;width:22px;height:20px}
  .settings-pop{max-height:calc(var(--lh) - var(--bar) - 12px);overflow:auto}

  /* ---------- blackjack table: chips | felt | game buttons ---------- */
  .stage{padding:0 max(6px,var(--sa-r)) 4px max(6px,var(--sa-l))}
  .table{padding:5px;border-radius:18px}
  .felt{
    height:calc(var(--lh) - var(--bar) - var(--sa-t) - 14px);min-height:0;
    display:grid;grid-template-columns:calc(var(--chip) + 18px) minmax(0,1fr) 128px;
    grid-template-rows:auto auto auto minmax(0,1fr);column-gap:10px;align-items:start;
    padding:6px 8px 6px;border-radius:16px;
  }
  .felt::before{inset:5px;border-radius:12px}
  .felt > .dealer-row,.felt > .dealer-hand,.felt > .print-wrap,.felt > .seats{grid-column:2}
  .dealer-row{grid-row:1;min-height:0}
  .dealer-hand{grid-row:2;margin-top:0;min-height:calc(var(--ch) + 8px)}
  .dealer-hand::before{top:-4px}
  /* the dealer's total next to his cards, the status line top right (no height taken from the seats) */
  .dealer-hand .hand-meta{position:absolute;left:calc(50% + var(--cw) * 1.4 + 12px);top:calc(var(--ch) / 2 - 12px);margin:0;min-height:0}
  .print-wrap{grid-row:1;width:auto;max-width:34%;justify-self:end;align-self:start;z-index:3}
  .felt-print{display:none}
  .print-wrap .status{position:relative;bottom:auto;left:auto;transform:none;margin:0;font-size:11.5px;line-height:1.3;padding:4px 10px;white-space:normal;text-align:center}
  .seats{grid-row:3 / 5;align-self:end;gap:6px}
  .seat-hands,.seat.compact .seat-hands{min-height:calc(var(--ch) + 14px);flex-wrap:nowrap;gap:4px 6px}
  .seat:nth-child(2){margin-top:0}
  .seat{--cw:calc(var(--ch) * .72)}
  .seat.compact{--ch:clamp(38px,11dvh,48px)}
  .spot{width:clamp(44px,12dvh,50px);height:clamp(44px,12dvh,50px)}
  .spot-label{bottom:-13px;font-size:7.5px}
  .spot-amount{margin-top:12px;min-height:0;font-size:11px}
  .avatar{width:clamp(52px,15dvh,70px);margin-top:0}
  .rack{transform:scale(.7);margin-top:-12px}
  .dealer .shoe{transform:scale(.8);transform-origin:0 100%}
  .bubble{font-size:11px;max-width:min(240px,30vw)}

  /* the deck's parts become cells of the felt grid */
  .deck{display:contents}
  .tray{grid-column:1;grid-row:1 / -1;align-self:center;flex-direction:column;align-items:center;gap:5px;padding:7px 6px;border-radius:14px;max-height:100%;overflow:auto;scrollbar-width:none}
  .tray .chip{--chip:clamp(38px,11.5dvh,46px)}
  .tray .chip:hover:not(:disabled){transform:translateX(5px) rotate(-8deg)}
  #deck-bet{grid-column:3;grid-row:1 / 3;align-self:end;margin-bottom:6px}
  #deck-deal{grid-column:3;grid-row:3 / 5;align-self:start}
  #deck-play,#deck-ins,#deck-broke,#deck-wait,#deck-mp{grid-column:3;grid-row:1 / -1;align-self:center}
  .felt .actions{flex-direction:column;flex-wrap:nowrap;align-items:stretch;gap:6px}
  .felt .actions .btn{min-height:48px;padding:6px 8px;font-size:13.5px;width:100%}
  .felt .actions .btn.big{min-height:56px;font-size:15px}
  #deck-bet .btn{min-height:44px}
  #deck-wait{align-self:center;text-align:center;font-size:12px}
  .mp-info{font-size:11px;text-align:center}
  /* shared blackjack tables: the timer and the reactions stay out of the way */
  .react-toggle{bottom:calc(8px + var(--sa-b))}

  /* ---------- the « Choisissez votre jeu » screen and the lobbies: compact title ---------- */
  .menu{padding:0 max(14px,var(--sa-r)) 16px max(14px,var(--sa-l))}
  .menu-hero{padding:4px 0 0}
  .menu-hero .suits{display:none}
  .menu-hero h1{font-size:clamp(24px,8dvh,34px);letter-spacing:4px;margin:2px 0}
  .menu-hero p{font-size:10px;letter-spacing:3px}
  .menu-hero::before{height:160px}
  .games-back{top:4px;min-height:44px;padding:6px 14px}
  #menu-account{margin-top:8px}
  .acc-banner{padding:8px 12px;gap:8px}
  .acc-banner span{font-size:12px}
  .games-list{grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;max-width:none;margin-top:10px}
  .gart{aspect-ratio:auto;height:clamp(60px,19dvh,120px)}
  .gbody{padding:8px 14px 10px;gap:5px}
  .gname{font-size:18px}
  .gsub{font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .gmeta,.glive,.bj-arc{display:none}
  .gcta{min-height:44px}
  .games-foot,.menu-foot{margin-top:14px}
  .menu-tabs{margin-top:8px;gap:16px;justify-content:safe center;overflow-x:auto;scrollbar-width:none}
  .menu-tabs button{min-height:44px;white-space:nowrap;flex:none;font-size:12px;letter-spacing:2px}
  /* table cards: side by side, no long descriptions */
  .msec{margin:16px 0 10px}
  .tcard{padding:12px;gap:10px}
  .tcard.wide{flex-direction:row;align-items:center}
  .tcard.wide .mini-table,.tcard.wide .rl-mini{width:min(300px,38vw)}
  .vip-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}
  .tdesc{display:none}
  .tinfo{margin:8px 0 10px;gap:5px 12px;font-size:12px}
  .tbody .btn{min-height:44px}

  /* ---------- roulette table: chips | wheel + layout | buttons ---------- */
  .rl-stage{
    height:calc(var(--lh) - var(--bar) - var(--sa-t));padding:2px max(6px,var(--sa-r)) 4px max(6px,var(--sa-l));
    display:grid;grid-template-columns:calc(var(--chip) + 18px) minmax(0,1fr) 120px;
    grid-template-rows:auto auto minmax(0,1fr) auto;grid-template-areas:"top top top" "tray seats actions" "tray board actions" "tray info actions";
    gap:4px 8px;
  }
  .rl-top{grid-area:top;margin:0;gap:10px}
  .rl-top .games-back{min-height:44px;padding:4px 12px}
  .rl-title b{font-size:13px;letter-spacing:2px;display:inline}
  .rl-title span{display:none}
  .rm-seats{grid-area:seats;margin:0;gap:4px}
  .rm-seat{min-height:0;flex-direction:row;justify-content:center;gap:6px;padding:3px 6px}
  .rm-seat .pav{width:28px}
  .rm-seat.free{flex-direction:row}
  .rm-chair{width:22px;height:22px;font-size:11px}
  .rm-inv{min-height:32px;padding:2px 8px}
  .rl-board{grid-area:board;min-height:0;padding:6px;gap:8px;border-radius:14px;grid-template-columns:minmax(110px,24%) minmax(0,1fr);align-items:stretch}
  .rl-side{padding:6px;gap:4px;flex-direction:column;justify-content:center;align-items:center;min-height:0}
  .rl-croupier{margin:0;flex-direction:column;align-items:center;gap:2px}
  .rl-dealer{width:clamp(44px,13dvh,64px)}
  .rl-bubble{position:static;max-width:100%;font-size:10.5px;padding:4px 8px;text-align:center}
  .rl-wheel{width:auto;height:clamp(80px,30dvh,150px);max-width:100%;aspect-ratio:1}
  .rl-wheel .wheel{width:100%;height:100%}
  .rl-main{min-height:0;gap:6px;justify-content:center}
  .rl-felt{padding:4px;max-width:none;flex:none}
  .rl-svg{max-height:calc(var(--lh) - var(--bar) - 150px);width:auto;max-width:100%;margin:0 auto}
  .rl-history{padding:4px 8px;gap:4px 8px;order:0}
  .rl-history small{font-size:9px}
  .rl-last{max-height:22px;overflow:hidden;min-width:0}
  .rl-stats{display:none}
  .rl-controls{display:contents}
  .rl-info{grid-area:info;flex-direction:row;align-items:baseline;gap:10px;min-width:0;flex:none}
  .rl-staked{white-space:nowrap;font-size:11px}
  .rl-staked b{font-size:15px}
  .rl-msg{min-width:0;flex:1;font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .rl-tray{grid-area:tray;align-self:center;flex-direction:column;align-items:center;gap:5px;padding:7px 6px;border-radius:14px;width:auto;max-height:100%;overflow:auto;scrollbar-width:none}
  .rl-tray .chip{--chip:clamp(38px,11.5dvh,46px)}
  .rl-tray .chip.sel{transform:translateX(6px)}
  .rl-actions{grid-area:actions;align-self:center;flex-direction:column;flex-wrap:nowrap;align-items:stretch;gap:6px;width:auto}
  .rl-actions .btn,.rl-actions .btn.ghost{min-height:44px;padding:6px 8px;font-size:12.5px;width:100%;flex:none}
  .rl-actions .rl-spin{min-height:56px;min-width:0;font-size:15px}
  .rl-stage.spinning .rl-side{flex-direction:column}
  .rl-stage.spinning .rl-wheel{width:auto}

  /* ---------- chat: a window over the left of the table, the game buttons stay in sight ---------- */
  .chat{left:max(8px,var(--sa-l)) !important;right:auto !important;top:calc(var(--bar) + var(--sa-t) + 4px) !important;bottom:max(6px,var(--sa-b)) !important;
    width:min(66vw,560px);height:auto;border-radius:14px;opacity:1;background:rgba(16,9,7,.95);z-index:72}
  .chat-head{cursor:default}
  .chat-form input{font-size:16px}
  .chat-scrim{display:block;position:fixed;inset:0;z-index:71;background:rgba(0,0,0,.42);-webkit-tap-highlight-color:transparent}
  .chat-scrim[hidden]{display:none}
  .chat-fab{top:auto;bottom:calc(8px + var(--sa-b));right:calc(8px + var(--sa-r));left:auto;width:44px;height:44px;font-size:19px}   /* bottom right: the chips column (Max bet) stays free */
  /* …and the button columns keep that corner free for it (only when the bubble is there: signed in) */
  body:has(.chat-fab:not([hidden])) :is(#deck-play,#deck-ins,#deck-broke,#deck-wait,#deck-mp,.rl-actions){padding-bottom:50px}
  body:has(.chat-fab:not([hidden])) .rl-actions{gap:4px}
  body:has(.chat-fab:not([hidden])) .rl-actions .btn.ghost{min-height:40px}

  /* ---------- dialogs: never taller than the screen, the × always in sight ---------- */
  .modal{padding:max(6px,var(--sa-t)) max(10px,var(--sa-r)) max(6px,var(--sa-b)) max(10px,var(--sa-l))}
  .panel{max-height:calc(var(--lh) - 12px - var(--sa-t) - var(--sa-b));padding:14px 18px 16px;width:min(820px,100%)}
  .panel.narrow{width:min(620px,100%)}
  .panel > .close{position:sticky;top:0;float:right;margin:-4px -6px 4px 10px;z-index:5;background:rgba(14,8,6,.92)}
  .panel h2{font-size:19px;letter-spacing:2px}
  .panel .sub{margin-bottom:10px}
  .inv-list{max-height:none}
  .inv-search{font-size:16px}

  /* the update banner and the toasts stay clear of the game buttons (right column) */
  .update-banner{left:max(10px,var(--sa-l));right:auto;transform:none;bottom:calc(8px + var(--sa-b));max-width:60vw}
  .toast{top:calc(var(--bar) + var(--sa-t) + 4px)}
}

/* touch screens, every orientation: no zoom when typing (16 px minimum in the fields), 44 px targets everywhere */
@media (pointer:coarse){
  .btn{min-height:44px}
  .link-btn{padding-block:14px;margin-block:-14px}
  .av-pick{min-height:44px}
  .chat-x{width:44px;height:44px}           /* text links: a taller target, same place */
  #btn-account{min-width:44px;justify-content:center}
  .tray .chip,.rl-tray .chip{--chip:44px}
  .menu-tabs button{min-height:44px}
  .tlink{min-height:44px}
  .bank-pill{min-height:44px}
  .rl-actions .btn{min-height:44px}
  .mp-seat .btn,.sp-sit,.sp-invite,.rm-inv{min-height:40px}
  .afield input,.aform input,.inv-search,.chat-form input{font-size:16px}
  .chat-tabs button{min-height:44px}
  .chat-form .btn{min-width:44px;min-height:44px}
  .chat-msg b.chat-who{padding:14px 8px;margin:-14px -8px}      /* a bigger target, same place on screen */
  .games-back{min-height:44px}
}

/* « Tourne ton téléphone » (js/display.js rotateHint): like a toast, under the top bar, never over the game buttons */
.rotate-hint{
  position:fixed;left:50%;top:calc(66px + var(--sa-t));z-index:89;width:min(360px,calc(100vw - 24px));
  display:flex;flex-wrap:wrap;align-items:center;gap:8px 10px;padding:11px 12px;border-radius:12px;font-size:13px;line-height:1.4;
  background:linear-gradient(180deg,#2a1a0f,#140b07);border:1px solid var(--gold-dim);box-shadow:0 14px 34px rgba(0,0,0,.6);
  opacity:0;transform:translate(-50%,-12px);transition:opacity .3s,transform .3s;
}
.rotate-hint[hidden]{display:none}
.rotate-hint.on{opacity:1;transform:translate(-50%,0)}
.rh-ico{font-size:20px}
.rh-txt{flex:1;min-width:0}
.rh-btns{display:flex;gap:8px;width:100%;justify-content:flex-end}
.rotate-hint .btn{min-height:44px;padding:8px 12px;font-size:12.5px}
@media (prefers-reduced-motion:reduce){.rotate-hint{transition:none}}
