/* FRBC V36.13 — Desktop HUD stack, right side only.
   Adds layout rules for native V28 components. No changes to game engine,
   user cameras, 3D scene, mobile landscape or portrait. */
@media screen and (min-width:700px) and (min-height:456px) and (pointer:fine) and (hover:hover) {
  html.frbc-v28-demo:not(.frbc-mobile-ui):not(.frbc-mobile-horizontal):not(.frbc-mobile-vertical) {
    --frbc-v3613-top:var(--v28-menu-top,213px);
    --frbc-v3613-rail-max:calc(100dvh - var(--frbc-v3613-top) - 8px);
    --frbc-v3613-card-max:72px;
    --frbc-v3613-moves-max:180px;
  }

  /* EN remains available on the home screen; hide only in the running game.
     Account management remains accessible through player profile/menu. */
  html.frbc-v28-demo:not(.frbc-mobile-ui):not(.frbc-mobile-horizontal):not(.frbc-mobile-vertical)
  .topbar .top-actions,
  html.frbc-v28-demo:not(.frbc-mobile-ui):not(.frbc-mobile-horizontal):not(.frbc-mobile-vertical)
  .topbar #language-switch,
  html.frbc-v28-demo:not(.frbc-mobile-ui):not(.frbc-mobile-horizontal):not(.frbc-mobile-vertical)
  .topbar #hud-account {
    display:none!important;
    visibility:hidden!important;
    pointer-events:none!important;
  }

  /* Rail starts immediately below the genuine clock, not below account/EN. */
  html.frbc-v28-demo:not(.frbc-mobile-ui):not(.frbc-mobile-horizontal):not(.frbc-mobile-vertical)
  #v28-rail#v28-rail:not([hidden]) {
    position:fixed!important;inset:auto var(--v28-edge,14px) auto auto!important;
    top:var(--frbc-v3613-top)!important;
    left:auto!important;bottom:auto!important;
    width:var(--v28-right,214px)!important;
    max-width:var(--v28-right,214px)!important;
    min-width:0!important;
    max-height:var(--frbc-v3613-rail-max)!important;
    overflow-x:hidden!important;overflow-y:auto!important;
    overscroll-behavior:contain!important;
    box-sizing:border-box!important;
  }
  /* Small independent fold handle on the rail's UPPER LEFT. */
  html.frbc-v28-demo:not(.frbc-mobile-ui):not(.frbc-mobile-horizontal):not(.frbc-mobile-vertical)
  #v28-rail-handle#v28-rail-handle {
    position:fixed!important;
    top:calc(var(--frbc-v3613-top) + 5px)!important;
    right:calc(var(--v28-right,214px) + var(--v28-edge,14px) + 6px)!important;
    left:auto!important;bottom:auto!important;
    width:30px!important;height:34px!important;
    min-width:30px!important;min-height:34px!important;
    padding:0!important;
    font:700 19px/1 system-ui,sans-serif!important;
    border-radius:8px!important;
    box-sizing:border-box!important;
  }

  /* Notice "Premier lancer / Deplacements possibles" and toast sit just below
     rail. Each receives a measured top position from the tiny layout module. */
  html.frbc-v28-demo:not(.frbc-mobile-ui):not(.frbc-mobile-horizontal):not(.frbc-mobile-vertical)
  #v28-match-hint#v28-match-hint:not([hidden]),
  html.frbc-v28-demo:not(.frbc-mobile-ui):not(.frbc-mobile-horizontal):not(.frbc-mobile-vertical)
  #toast#toast.show:not([hidden]) {
    position:fixed!important;
    left:auto!important;right:var(--v28-edge,14px)!important;
    top:var(--frbc-v3613-pos,calc(var(--frbc-v3613-top) + var(--frbc-v3613-rail-max) + 6px))!important;
    bottom:auto!important;
    transform:none!important;
    width:var(--v28-right,214px)!important;
    min-width:0!important;
    max-width:var(--v28-right,214px)!important;
    max-height:var(--frbc-v3613-card-max)!important;
    overflow-x:hidden!important;overflow-y:auto!important;
    box-sizing:border-box!important;
    z-index:90!important;
  }
  html.frbc-v28-demo:not(.frbc-mobile-ui):not(.frbc-mobile-horizontal):not(.frbc-mobile-vertical)
  #v28-match-hint#v28-match-hint:not([hidden]):not(.v28-hint-collapsed) {display:flex!important;}
  html.frbc-v28-demo:not(.frbc-mobile-ui):not(.frbc-mobile-horizontal):not(.frbc-mobile-vertical)
  #v28-match-hint#v28-match-hint.v28-hint-collapsed:not([hidden]) {
    display:flex!important;
    width:38px!important;max-width:38px!important;
  }
  /* COUPS opens below the notifications, NOT beside the board/behind buttons. */
  html.frbc-v28-demo:not(.frbc-mobile-ui):not(.frbc-mobile-horizontal):not(.frbc-mobile-vertical)
  #moves-panel#moves-panel:not([hidden]),
  html.frbc-v28-demo:not(.frbc-mobile-ui):not(.frbc-mobile-horizontal):not(.frbc-mobile-vertical)
  body.direct-room #board-details#board-details[open] {
    display:block!important;
    position:fixed!important;
    top:var(--frbc-v3613-pos,calc(var(--frbc-v3613-top) + 150px))!important;
    bottom:auto!important;left:auto!important;
    right:var(--v28-edge,14px)!important;
    width:var(--v28-right,214px)!important;
    max-width:var(--v28-right,214px)!important;
    min-width:0!important;
    height:auto!important;
    min-height:0!important;
    max-height:var(--frbc-v3613-moves-max)!important;
    overflow-x:hidden!important;overflow-y:auto!important;
    overscroll-behavior:contain!important;
    box-sizing:border-box!important;
    z-index:91!important;
    transform:none!important;
  }
  html.frbc-v28-demo:not(.frbc-mobile-ui):not(.frbc-mobile-horizontal):not(.frbc-mobile-vertical)
  #moves-panel#moves-panel:not([hidden]) #moves-list {max-width:100%!important;}

  /* Real dice portal is stacked AFTER the visible notification/panel. */
  html.frbc-v28-demo:not(.frbc-mobile-ui):not(.frbc-mobile-horizontal):not(.frbc-mobile-vertical)
  body > #dice-values#dice-values.v28-desktop-dice:not(:empty):not([hidden]) {
    position:fixed!important;
    top:var(--frbc-v3613-pos,var(--v28-dice-top,calc(100dvh - 78px)))!important;
    bottom:auto!important;left:auto!important;
    right:var(--v28-edge,14px)!important;
    width:var(--v28-right,214px)!important;
    max-width:var(--v28-right,214px)!important;
    max-height:calc(100dvh - var(--frbc-v3613-pos,0px) - 6px)!important;
    box-sizing:border-box!important;
  }
  html.frbc-v28-demo:not(.frbc-mobile-ui):not(.frbc-mobile-horizontal):not(.frbc-mobile-vertical)
  :is(#v28-match-hint,#toast,#moves-panel,#board-details,#v28-rail,#dice-values)[hidden] {display:none!important;}
}
