/*
 * FRBC V36.7 — Mobile landscape command shell — audited against V28 + V35.3.2.
 * CSS only: no additional menu, no gameplay, account, camera or 3D changes.
 * Target: ACTIVE mobile landscape game, not portrait, desktop or home.
 * Match compact landscape VIEWPORTS even in browser phone simulators using a fine pointer.
 * The V28 game-active class is required; portrait, full-size desktop and PC mode remain excluded.
 * V36.6 incorrectly required pointer:coarse + frbc-mobile-horizontal, which are absent in some simulators.
 * Native hidden/collapsed states and gameplay logic remain authoritative.
 */
@media screen and (orientation:landscape) and (max-width:1100px) and (max-height:600px) {
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.frbc-mobile-vertical):not(.mobile-intro) {
    --v36-edge: max(6px, env(safe-area-inset-left));
    --v36-right-edge: max(6px, env(safe-area-inset-right));
    --v36-left-width: clamp(118px, 15.5vw, 150px);
    --v36-right-width: clamp(120px, 15vw, 144px);
    --v36-top: max(52px, calc(env(safe-area-inset-top) + 47px));
    --v36-alert-reserve: 120px;
    --v36-ui: rgba(8, 31, 51, .95);
    --v36-ui-top: rgba(21, 64, 92, .96);
    --v36-border: rgba(157, 204, 232, .65);
    --v36-ink: #eaf6ff;
    --v36-tile: rgba(111, 170, 211, .18);
    --v28-right: var(--v36-right-width);
  }
  /* When a live player notice joins the two game alerts, reserve its own row. */
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):has(.frbc-player-notice:not([hidden])) {
    --v36-alert-reserve: 175px;
  }
  /* Restore the REAL game dock. The old V28 stylesheet explicitly hid it. */
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.mobile-intro):not(.frbc-v28-dock-closed):not(.frbc-dock-closed):not(.mobile-decor-expanded):not(.frbc-camera-editing)
  #game-dock#game-dock:not([hidden]) {
    position:fixed!important;
    inset:var(--v36-top) auto auto var(--v36-edge)!important;
    left:var(--v36-edge)!important;right:auto!important;
    top:var(--v36-top)!important;bottom:auto!important;
    transform:none!important;
    display:flex!important;flex-flow:column nowrap!important;
    align-items:stretch!important;justify-content:flex-start!important;
    width:var(--v36-left-width)!important;min-width:0!important;
    max-width:var(--v36-left-width)!important;
    height:auto!important;min-height:0!important;
    max-height:max(110px,calc(100dvh - var(--v36-top) - var(--v36-alert-reserve)))!important;
    overflow-x:hidden!important;overflow-y:auto!important;
    overscroll-behavior:contain!important;-webkit-overflow-scrolling:touch;
    scrollbar-width:thin;
    margin:0!important;padding:7px 6px!important;gap:6px!important;
    border:1px solid var(--v36-border)!important;border-radius:11px!important;
    box-sizing:border-box!important;background:linear-gradient(150deg,var(--v36-ui-top),var(--v36-ui))!important;
    color:var(--v36-ink)!important;box-shadow:0 10px 27px #0009!important;
    backdrop-filter:blur(7px);z-index:86!important;pointer-events:auto!important;
  }
  /* Undo the V35.2 human-room max-height:none override, which cuts off controls. */
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  #game-dock#game-dock:has(#frbc-multiplayer-actions:not([hidden])) {
    max-height:max(110px,calc(100dvh - var(--v36-top) - var(--v36-alert-reserve)))!important;
    bottom:auto!important;overflow-y:auto!important;
  }
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):is(.frbc-v28-dock-closed,.frbc-dock-closed)
  #game-dock#game-dock {display:none!important;}
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  #game-dock#game-dock[hidden]{display:none!important;}
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  #game-dock#game-dock :is(#frbc-v298-game-state,.turn-info,.dice-values,.dock-actions,.dock-secondary,.frbc-multiplayer-actions,.coach-strip) {
    position:relative!important;flex:0 0 auto!important;
    box-sizing:border-box!important;width:100%!important;min-width:0!important;max-width:100%!important;
    grid-area:auto!important;margin:0!important;
  }
  /* A single compact turn heading; preserve original text and dice. */
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  #game-dock#game-dock #frbc-v298-game-state{display:none!important;}
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  #game-dock#game-dock .turn-info {display:block!important;padding:2px 0 7px!important;border-bottom:1px solid #a9d3ee47!important;text-align:center!important;}
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  #game-dock#game-dock #turn-kicker{display:block!important;font:800 9px/1.2 system-ui,sans-serif!important;color:#a8d4f0!important;letter-spacing:.02em!important;}
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  #game-dock#game-dock #turn-title{font:800 12px/1.25 system-ui,sans-serif!important;white-space:normal!important;overflow-wrap:anywhere!important;margin:3px 0!important;}
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  #game-dock#game-dock #turn-help{display:-webkit-box!important;-webkit-line-clamp:2!important;-webkit-box-orient:vertical!important;overflow:hidden!important;margin:0!important;font:500 10px/1.2 system-ui,sans-serif!important;}
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  #game-dock#game-dock .dice-values{display:flex!important;flex-wrap:wrap!important;justify-content:center!important;align-items:center!important;gap:5px!important;min-height:31px!important;padding:0!important;}
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  #game-dock#game-dock .dock-actions{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;align-items:stretch!important;gap:5px!important;padding:0!important;}
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  #game-dock#game-dock .dock-actions .primary:not([hidden]){grid-column:1/-1!important;background:linear-gradient(120deg,#e3f3ff,#9bcde9)!important;color:#0a2c45!important;border-color:#f4faff!important;}
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  #game-dock#game-dock .dock-secondary{display:flex!important;flex-direction:column!important;align-items:stretch!important;gap:5px!important;padding:6px 0 0!important;border-top:1px solid #a9d3ee47!important;}
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  #game-dock#game-dock #cube-button{
    flex-flow:row wrap!important;align-items:center!important;align-content:center!important;
    gap:3px 5px!important;word-break:normal!important;overflow-wrap:normal!important;
    font-size:9px!important;line-height:1.2!important;
  }
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  #game-dock#game-dock #cube-button > span{white-space:normal!important;overflow-wrap:normal!important;font-size:9px!important;}
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  #game-dock#game-dock .dock-secondary > span:not(#frbc-v28-dock-controls){font:10px/1.25 system-ui,sans-serif!important;white-space:normal!important;text-align:center!important;}
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  #game-dock#game-dock .frbc-multiplayer-actions:not([hidden]){display:flex!important;flex-flow:column nowrap!important;gap:5px!important;align-items:stretch!important;max-height:none!important;overflow:visible!important;padding:0!important;}
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  #game-dock#game-dock :is(.dock-actions,.dock-secondary,.frbc-multiplayer-actions,.coach-strip) button:not([hidden]) {
    display:flex!important;align-items:center!important;justify-content:center!important;gap:3px!important;
    width:100%!important;min-width:0!important;max-width:100%!important;
    height:auto!important;min-height:44px!important;max-height:none!important;
    padding:6px 4px!important;margin:0!important;box-sizing:border-box!important;
    border:1px solid var(--v36-border)!important;border-radius:8px!important;
    background:var(--v36-tile)!important;color:var(--v36-ink)!important;
    font:700 10px/1.2 system-ui,sans-serif!important;white-space:normal!important;overflow-wrap:anywhere!important;
    touch-action:manipulation;
  }
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  #game-dock#game-dock .dock-actions .primary:not([hidden]){background:linear-gradient(120deg,#e3f3ff,#9bcde9)!important;color:#0a2c45!important;border-color:#f4faff!important;}
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  #game-dock#game-dock .frbc-multiplayer-actions:not([hidden]) > button{flex:0 0 auto!important;min-width:0!important;min-height:44px!important;white-space:normal!important;}
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  #game-dock#game-dock #frbc-v28-dock-controls{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:5px!important;width:100%!important;box-sizing:border-box!important;}
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  #game-dock#game-dock #frbc-v28-dock-controls button{width:100%!important;min-height:44px!important;min-width:0!important;max-height:none!important;display:grid!important;place-items:center!important;padding:7px!important;box-sizing:border-box!important;}
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  #game-dock#game-dock [hidden]{display:none!important;}
  /* Keep the native fold handle tappable while the dock scrolls independently. */
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  #v28-dock-handle#v28-dock-handle{
    display:grid!important;place-items:center!important;position:fixed!important;
    left:calc(var(--v36-edge) + var(--v36-left-width) + 3px)!important;right:auto!important;
    top:var(--v36-top)!important;bottom:auto!important;
    width:44px!important;min-width:44px!important;height:44px!important;min-height:44px!important;
    padding:0!important;border:1px solid var(--v36-border)!important;border-radius:9px!important;
    background:var(--v36-ui)!important;color:#fff!important;font:800 18px system-ui!important;
    z-index:88!important;touch-action:manipulation;
  }
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):is(.frbc-v28-dock-closed,.frbc-dock-closed)
  #v28-dock-handle#v28-dock-handle{left:var(--v36-edge)!important;}
  /* Original V28 icon rail. Refit six rows, two columns. All 12 icons remain. */
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.mobile-intro)
  #v28-rail#v28-rail{
    position:fixed!important;right:var(--v36-right-edge)!important;left:auto!important;
    top:var(--v36-top)!important;bottom:auto!important;
    width:var(--v36-right-width)!important;min-width:0!important;max-width:var(--v36-right-width)!important;
    height:auto!important;max-height:calc(100dvh - var(--v36-top) - max(7px,env(safe-area-inset-bottom)))!important;
    overflow-y:auto!important;overflow-x:hidden!important;overscroll-behavior:contain!important;
    display:block!important;padding:6px!important;box-sizing:border-box!important;
    border:1px solid var(--v36-border)!important;border-radius:11px!important;
    background:linear-gradient(150deg,var(--v36-ui-top),var(--v36-ui))!important;
    box-shadow:0 10px 27px #0009!important;z-index:86!important;
  }
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal).frbc-v28-rail-closed
  #v28-rail#v28-rail{display:none!important;}
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  #v28-rail .v28-grid{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:4px!important;}
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  #v28-rail#v28-rail .v28-grid > .v28-tile{
    grid-column:auto!important;grid-row:auto!important;
    display:flex!important;flex-direction:column!important;align-items:center!important;justify-content:center!important;
    gap:2px!important;box-sizing:border-box!important;min-width:0!important;width:100%!important;
    height:44px!important;min-height:44px!important;max-height:none!important;padding:3px!important;
    border:1px solid var(--v36-border)!important;border-radius:7px!important;
    background:var(--v36-tile)!important;color:var(--v36-ink)!important;
    touch-action:manipulation;
  }
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  #v28-rail#v28-rail .v28-grid .v28-tile svg{width:18px!important;height:18px!important;flex:0 0 18px!important;}
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  #v28-rail#v28-rail .v28-grid .v28-tile .v28-tile-label{display:block!important;font:700 8px/1.15 system-ui,sans-serif!important;letter-spacing:0!important;text-align:center!important;white-space:normal!important;}
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  #v28-rail-handle#v28-rail-handle{
    display:grid!important;place-items:center!important;position:fixed!important;
    right:calc(var(--v36-right-edge) + var(--v36-right-width) + 3px)!important;left:auto!important;top:var(--v36-top)!important;bottom:auto!important;
    width:44px!important;min-width:44px!important;height:44px!important;min-height:44px!important;
    padding:0!important;border:1px solid var(--v36-border)!important;border-radius:8px!important;
    background:var(--v36-ui)!important;color:#fff!important;z-index:88!important;touch-action:manipulation;
  }
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal).frbc-v28-rail-closed
  #v28-rail-handle#v28-rail-handle{
    right:var(--v36-right-edge)!important;
  }
  /* Notifications under LEFT dock: three non-overlapping slots, no deck-wide overlays. */
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  #v28-match-hint#v28-match-hint:not([hidden]){
    position:fixed!important;inset:auto auto 8px var(--v36-edge)!important;
    left:var(--v36-edge)!important;right:auto!important;top:auto!important;bottom:max(8px,env(safe-area-inset-bottom))!important;
    display:flex!important;width:var(--v36-left-width)!important;min-width:0!important;max-width:var(--v36-left-width)!important;
    min-height:44px!important;max-height:61px!important;padding:5px!important;gap:4px!important;
    overflow-y:auto!important;box-sizing:border-box!important;z-index:87!important;
    font-size:10px!important;line-height:1.2!important;pointer-events:auto!important;
  }
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  #v28-match-hint.v28-hint-collapsed{min-height:44px!important;width:44px!important;}
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  #toast#toast:not([hidden]){
    position:fixed!important;inset:auto auto auto var(--v36-edge)!important;
    left:var(--v36-edge)!important;right:auto!important;top:auto!important;
    bottom:max(73px,calc(env(safe-area-inset-bottom) + 73px))!important;
    width:var(--v36-left-width)!important;max-width:var(--v36-left-width)!important;max-height:40px!important;
    box-sizing:border-box!important;overflow-y:auto!important;padding:4px 6px!important;
    border:1px solid var(--v36-border)!important;border-radius:8px!important;
    background:var(--v36-ui)!important;color:#fff!important;font:10px/1.2 system-ui!important;
    z-index:87!important;pointer-events:none!important;
  }
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  .frbc-notification-root{
    position:fixed!important;top:auto!important;bottom:max(120px,calc(env(safe-area-inset-bottom) + 120px))!important;
    left:var(--v36-edge)!important;right:auto!important;
    box-sizing:border-box!important;width:var(--v36-left-width)!important;max-width:var(--v36-left-width)!important;
    max-height:54px!important;overflow-y:auto!important;z-index:3100!important;
  }
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  .frbc-notification-root .frbc-player-notice{max-width:100%!important;box-sizing:border-box!important;}
  /* [hidden] must beat the older notification display:grid!important rule. */
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  .frbc-notification-root .frbc-player-notice[hidden]{display:none!important;}
  /* Chat native element stays in document.body. Force real modal above old dock styles. */
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  #frbc-chat-modal#frbc-chat-modal:not([hidden]):not(.is-collapsed){
    position:fixed!important;inset:0!important;
    left:0!important;right:0!important;top:0!important;bottom:0!important;
    width:100dvw!important;max-width:none!important;height:100dvh!important;max-height:none!important;
    display:grid!important;place-items:center!important;
    padding:max(8px,env(safe-area-inset-top)) max(8px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left))!important;
    box-sizing:border-box!important;overflow:auto!important;
    background:#031828bf!important;backdrop-filter:blur(6px)!important;
    transform:none!important;z-index:30000!important;pointer-events:auto!important;
  }
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  #frbc-chat-modal#frbc-chat-modal.is-collapsed{display:none!important;}
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  #frbc-chat-modal#frbc-chat-modal[hidden]{display:none!important;}
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  #frbc-chat-modal:not([hidden]):not(.is-collapsed) .frbc-chat-card{
    width:min(470px,calc(100dvw - 22px))!important;min-width:0!important;max-width:100%!important;
    height:min(335px,calc(100dvh - 20px))!important;min-height:0!important;max-height:calc(100dvh - 20px)!important;
    display:flex!important;flex-direction:column!important;margin:auto!important;padding:10px 12px!important;
    box-sizing:border-box!important;overflow:hidden!important;
    border:1px solid #9ac9e8!important;border-radius:13px!important;
    background:linear-gradient(135deg,#174362,#081e32)!important;box-shadow:0 15px 50px #000b!important;
  }
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  #frbc-chat-modal:not([hidden]) .frbc-chat-card header{position:static!important;display:flex!important;align-items:center!important;justify-content:space-between!important;flex:0 0 auto!important;min-height:44px!important;}
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  #frbc-chat-modal:not([hidden]) #frbc-chat-close{display:grid!important;place-items:center!important;min-width:44px!important;min-height:44px!important;width:44px!important;height:44px!important;touch-action:manipulation;}
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  #frbc-chat-modal:not([hidden]) #frbc-chat-thread{flex:1 1 auto!important;min-height:20px!important;overflow-y:auto!important;}
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  #frbc-chat-modal:not([hidden]) #frbc-chat-text{max-height:52px!important;min-height:36px!important;}
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  #frbc-chat-modal:not([hidden]) .frbc-chat-actions button{min-height:38px!important;}
  /* Moves and sessions use true panels with native close controls and scrolling. */
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  #moves-panel#moves-panel:not([hidden]),
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  #v28-sessions-panel#v28-sessions-panel:not([hidden]) {
    position:fixed!important;left:50%!important;right:auto!important;top:50%!important;bottom:auto!important;
    transform:translate(-50%,-50%)!important;
    box-sizing:border-box!important;width:min(430px,calc(100dvw - var(--v36-left-width) - var(--v36-right-width) - 26px))!important;
    max-width:calc(100dvw - 24px)!important;max-height:calc(100dvh - 18px)!important;min-width:210px!important;
    padding:10px!important;overflow-y:auto!important;z-index:250!important;
    border:1px solid var(--v36-border)!important;border-radius:11px!important;
    background:#102f4c!important;box-shadow:0 9px 34px #000b!important;
  }
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  #moves-panel:not([hidden]) #moves-list{max-height:calc(100dvh - 132px)!important;overflow:auto!important;}
  /* Existing [hidden] and modal close events remain authoritative. */
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  :is(#v28-rail,#v28-match-hint,#moves-panel,#v28-sessions-panel,#frbc-chat-modal,#game-dock#game-dock)[hidden]{display:none!important;}
}
@media screen and (orientation:landscape) and (max-width:710px) and (max-height:420px){
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal){
    --v36-left-width:113px;--v36-right-width:120px;
    --v36-top:max(50px,calc(env(safe-area-inset-top) + 45px));
  }
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  #v28-rail .v28-grid{gap:3px!important;}
}

/* V36.7 compact-landscape refinement: the opening roll action must span the entire narrow
   left column, including 667x375. Do not change portrait / desktop / lobby. */
@media screen and (orientation:landscape) and (max-width:1100px) and (max-height:600px) {
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.frbc-mobile-vertical):not(.mobile-intro)
  #game-dock#game-dock .dock-actions #roll-button:not([hidden]),
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.frbc-mobile-vertical):not(.mobile-intro)
  #game-dock#game-dock .dock-actions #confirm-button:not([hidden]) {
    grid-column: 1 / -1 !important;
    grid-row: auto !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    min-height: 44px !important;
    flex: none !important;
    white-space: normal !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
    font-size: 10px !important;
    line-height: 1.15 !important;
  }
}

/* V36.7 : hidden-state safety, within the compact landscape scope. */
@media screen and (orientation:landscape) and (max-width:1100px) and (max-height:600px) {
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  #game-dock#game-dock [hidden] { display:none!important; }
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  :is(#v28-rail,#v28-match-hint,#toast,#frbc-chat-modal,#moves-panel,#v28-sessions-panel)[hidden] { display:none!important; }
}


/* ================================================================
   FRBC V36.8 — Compact landscape GAME HUD polish only.
   Corrections: right-side score/account/clock/rail collision;
   left-side side-stat/alert stacking, without touching gameplay.
   This media query MUST NOT run on full-size desktop or portrait.
   ================================================================ */
@media screen and (orientation:landscape) and (max-width:1100px) and (max-height:600px) {
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.mobile-intro) {
    --v36-right-rail-top:max(78px,calc(env(safe-area-inset-top) + 74px));
    --v36-alert-width:calc(var(--v36-left-width) + 34px);
  }

  /* Upper-right match score: compact and separate from the icon rail. */
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.mobile-intro)
  .topbar .match-score#scoreboard {
    position:fixed!important;
    top:max(3px,env(safe-area-inset-top))!important;
    right:var(--v36-right-edge)!important;
    left:auto!important;
    width:clamp(142px,21vw,192px)!important;
    min-width:0!important;
    max-width:clamp(142px,21vw,192px)!important;
    max-height:45px!important;
    box-sizing:border-box!important;
    overflow:hidden!important;
    margin:0!important;
    transform:none!important;
    z-index:83!important;
  }
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.mobile-intro)
  .topbar .match-score .round-progress {display:none!important;}
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.mobile-intro)
  .topbar .match-score .player {min-width:0!important;font-size:9px!important;}
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.mobile-intro)
  .topbar .match-score .player span {min-width:0!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;}
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.mobile-intro)
  .topbar .match-score .score-readout small {font-size:8px!important;letter-spacing:0!important;}

  /* Move existing account/language/credit actions LEFT of the score and rail.
     Keep all live buttons and click handlers, no display:none. */
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.mobile-intro)
  .topbar .top-actions {
    position:fixed!important;
    top:max(5px,env(safe-area-inset-top))!important;
    right:calc(var(--v36-right-edge) + var(--v36-right-width) + 64px)!important;
    left:auto!important;
    width:clamp(205px,35vw,246px)!important;
    min-width:0!important;
    max-width:clamp(205px,35vw,246px)!important;
    min-height:0!important;
    max-height:42px!important;
    margin:0!important;
    display:flex!important;
    flex-flow:row nowrap!important;
    align-items:center!important;
    justify-content:flex-end!important;
    gap:4px!important;
    box-sizing:border-box!important;
    z-index:83!important;
  }
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.mobile-intro)
  .topbar .top-actions #language-switch {
    order:0!important;flex:0 0 47px!important;
    box-sizing:border-box!important;min-width:0!important;max-width:47px!important;
    min-height:35px!important;height:35px!important;padding:3px!important;
    white-space:nowrap!important;font-size:10px!important;
  }
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.mobile-intro)
  .topbar .top-actions #hud-account {
    order:1!important;flex:1 1 75px!important;min-width:0!important;
    width:auto!important;max-width:none!important;
    min-height:35px!important;height:35px!important;
    padding:3px 5px!important;font-size:10px!important;
    overflow:hidden!important;
  }
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.mobile-intro)
  .topbar .top-actions #hud-account span {
    min-width:0!important;overflow:hidden!important;text-overflow:ellipsis!important;
    white-space:nowrap!important;font-size:10px!important;
  }
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.mobile-intro)
  .topbar .top-actions #hud-wallet {
    order:2!important;flex:0 1 95px!important;min-width:66px!important;
    width:auto!important;max-width:95px!important;
    min-height:35px!important;height:35px!important;
    padding:3px 5px!important;margin:0!important;
    font-size:10px!important;
  }
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.mobile-intro)
  .topbar .top-actions #hud-wallet small {display:none!important;}
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.mobile-intro)
  .topbar .top-actions #hud-wallet b {font-size:10px!important;white-space:nowrap!important;}
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.mobile-intro)
  .topbar .top-actions #hud-wallet-reward[hidden] {display:none!important;}

  /* Clock remains available above the RIGHT rail rather than on top of it. */
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.mobile-intro)
  #v28-clock-indicator#v28-clock-indicator:not([hidden]),
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.mobile-intro)
  #frbc-clock-display#frbc-clock-display:not([hidden]) {
    position:fixed!important;
    top:max(48px,calc(env(safe-area-inset-top) + 44px))!important;
    right:var(--v36-right-edge)!important;left:auto!important;
    width:var(--v36-right-width)!important;max-width:var(--v36-right-width)!important;
    min-height:0!important;max-height:27px!important;
    overflow:hidden!important;white-space:nowrap!important;text-overflow:ellipsis!important;
    padding:3px 4px!important;margin:0!important;
    box-sizing:border-box!important;font-size:10px!important;line-height:1.25!important;
    z-index:85!important;
  }
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.mobile-intro)
  #v28-rail#v28-rail:not([hidden]) {
    top:var(--v36-right-rail-top)!important;
    max-height:calc(100dvh - var(--v36-right-rail-top) - max(5px,env(safe-area-inset-bottom)))!important;
  }
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.mobile-intro)
  #v28-rail-handle#v28-rail-handle {
    top:var(--v36-right-rail-top)!important;
    width:38px!important;min-width:38px!important;height:44px!important;
  }
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.mobile-intro)
  #v28-dock-handle#v28-dock-handle {
    width:38px!important;min-width:38px!important;height:44px!important;
  }
  /* Let the rail scroll a few pixels on very short screens; never remove buttons. */
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.mobile-intro)
  #v28-rail#v28-rail .v28-grid > .v28-tile {min-height:44px!important;}

  /* Old standalone side stats visually sit BEHIND notifications.
     Match points remain in the scoreboard; no gameplay counter is changed. */
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.mobile-intro)
  body #side-stats#side-stats {display:none!important;}

  /* Reserve distinct vertical slots for game dock, multiplayer notifications,
     transient toast and the foldable opening hint. */
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.mobile-intro):has(.frbc-player-notice:not([hidden])) {
    --v36-alert-reserve:177px;
  }
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.mobile-intro)
  #v28-match-hint#v28-match-hint:not([hidden]) {
    left:var(--v36-edge)!important;right:auto!important;
    bottom:max(6px,env(safe-area-inset-bottom))!important;
    width:var(--v36-alert-width)!important;max-width:var(--v36-alert-width)!important;
    min-height:44px!important;max-height:56px!important;
    overflow-x:hidden!important;overflow-y:auto!important;
    padding:5px 4px!important;gap:3px!important;
    z-index:87!important;
  }
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.mobile-intro)
  #v28-match-hint #v28-hint-text {
    min-width:0!important;flex:1!important;
    overflow-wrap:break-word!important;word-break:normal!important;
    font-size:10px!important;line-height:1.15!important;
  }
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.mobile-intro)
  #v28-match-hint #v28-hint-fold {
    flex:0 0 26px!important;min-width:26px!important;
    min-height:36px!important;height:36px!important;
    display:grid!important;place-items:center!important;
  }
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.mobile-intro)
  #toast#toast.show:not([hidden]) {
    bottom:max(68px,calc(env(safe-area-inset-bottom) + 68px))!important;
    width:var(--v36-alert-width)!important;max-width:var(--v36-alert-width)!important;
    max-height:40px!important;
  }
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.mobile-intro)
  .frbc-notification-root:has(.frbc-player-notice:not([hidden])) {
    bottom:max(115px,calc(env(safe-area-inset-bottom) + 115px))!important;
    width:var(--v36-alert-width)!important;max-width:var(--v36-alert-width)!important;
    max-height:54px!important;
  }
  /* Explicitly honour hidden states even when older UI styles use !important. */
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.mobile-intro)
  :is(#v28-rail,#v28-match-hint,#v28-clock-indicator,#frbc-clock-display,#toast)[hidden] {display:none!important;}
}

@media screen and (orientation:landscape) and (max-width:1100px) and (max-height:600px) {
  /* Never render a decorative empty toast when no native toast is active. */
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.mobile-intro)
  #toast#toast:not(.show) { display:none!important; }
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.mobile-intro)
  #toast#toast.show:not([hidden]) { display:block!important;opacity:1!important; }
  /* V28 folded match hint must remain folded after the width expansion. */
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.mobile-intro)
  #v28-match-hint#v28-match-hint.v28-hint-collapsed:not([hidden]) {
    width:44px!important;min-width:44px!important;max-width:44px!important;
    padding:4px!important;justify-content:center!important;
  }
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.mobile-intro)
  #v28-match-hint.v28-hint-collapsed #v28-hint-text {display:none!important;}
}


/* ============================================================================
   FRBC V36.9 — FLUID UI / MOBILE LANDSCAPE FINISH
   Progressive sizing instead of scaling the whole game. This remains a CSS-only
   override on the existing V28 menu. Does not alter portrait, computer, scene,
   cameras, game rules, network, or the main/home/shop dialogs.
   ============================================================================ */
@media screen and (orientation:landscape) and (max-width:1100px) and (max-height:600px) {
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.mobile-intro) {
    --v36-edge:max(5px,env(safe-area-inset-left));
    --v36-right-edge:max(5px,env(safe-area-inset-right));
    --v36-left-width:clamp(113px,calc(11.5vw + 24px),155px);
    --v36-right-width:clamp(119px,calc(10vw + 37px),155px);
    --v36-top:max(49px,calc(env(safe-area-inset-top) + clamp(46px,10.5dvh,57px)));
    --v36-right-rail-top:max(77px,calc(env(safe-area-inset-top) + clamp(74px,19dvh,89px)));
    --v36-alert-width:clamp(142px,calc(var(--v36-left-width) + 14px),181px);
    --v36-alert-reserve:77px;
    --v28-right:var(--v36-right-width);
  }
  /* Open toasts and member notices reserve their own vertical space, so the
     scrolling command column never covers the native notification slots. */
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.mobile-intro):has(#toast.show:not([hidden])) {
    --v36-alert-reserve:125px;
  }
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.mobile-intro):has(.frbc-player-notice:not([hidden])) {
    --v36-alert-reserve:179px;
  }
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.mobile-intro):not(.frbc-v28-dock-closed):not(.frbc-dock-closed):not(.mobile-decor-expanded):not(.frbc-camera-editing)
  #game-dock#game-dock:not([hidden]),
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.mobile-intro)
  #game-dock#game-dock:has(#frbc-multiplayer-actions:not([hidden])) {
    max-height:max(94px,calc(100dvh - var(--v36-top) - var(--v36-alert-reserve)))!important;
    overscroll-behavior-y:contain!important;
  }
  /* Do not enlarge child controls to fit: keep usable 44px touch targets and
     preserve vertical scrolling for PAUSE, abandon, roll and cube. */
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.mobile-intro)
  #game-dock#game-dock :is(.dock-actions,.dock-secondary,.frbc-multiplayer-actions,.coach-strip) button:not([hidden]) {
    min-height:44px!important;line-height:1.2!important;
  }
  /* The compact first-turn label remains readable at 667px without eating
     the entire available board width. */
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.mobile-intro)
  #game-dock#game-dock #turn-title {
    font-size:clamp(11px,1.4vw,13px)!important;
  }
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.mobile-intro)
  #v28-rail#v28-rail:not([hidden]) {
    max-height:max(108px,calc(100dvh - var(--v36-right-rail-top) - max(5px,env(safe-area-inset-bottom))))!important;
    overscroll-behavior-y:contain!important;
  }
  /* A collapsed rail must stay collapsed. */
  html.frbc-v28-demo.frbc-v28-rail-closed:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal)
  #v28-rail#v28-rail {display:none!important;}
  /* The opening hint is one small, legible card below the dock, never a giant
     white banner. All text remains in the native component. */
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.mobile-intro)
  #v28-match-hint#v28-match-hint:not([hidden]):not(.v28-hint-collapsed){
    bottom:max(6px,env(safe-area-inset-bottom))!important;
    width:var(--v36-alert-width)!important;max-width:var(--v36-alert-width)!important;
    min-height:44px!important;max-height:53px!important;
  }
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.mobile-intro)
  #v28-match-hint #v28-hint-text {font-size:clamp(9px,1.12vw,11px)!important;}
  /* Keep top-right information clear of the native six-row rail. */
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.mobile-intro)
  #v28-clock-indicator#v28-clock-indicator:not([hidden]){
    top:max(47px,calc(env(safe-area-inset-top) + 46px))!important;
    max-height:23px!important;
  }
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.mobile-intro)
  #v28-rail-handle#v28-rail-handle{
    top:var(--v36-right-rail-top)!important;
    min-width:38px!important;min-height:44px!important;
  }
  /* No invisible layer may capture touches from a closed menu. */
  html.frbc-v28-demo:not(.frbc-mobile-vertical):not(.frbc-pc-horizontal):not(.mobile-intro)
  :is(#game-dock,#v28-rail,#v28-match-hint,#toast,#frbc-chat-modal)[hidden] {display:none!important;}
}
