/* Brede browser: variant en kaarten links, vierkante tafel ernaast, score rechts.
   Start direct na de compacte desktopindeling zodat er geen oud tussenformaat
   overblijft tussen 1151 en 1499 pixels. */
@media (min-width: 1151px) {
  body.game-active .app-shell {
    --ultrawide-table-size: calc(var(--app-visible-height, 100dvh) - 262px);
    width: 100vw !important;
    height: var(--app-visible-height, 100dvh) !important;
    max-width: none !important;
    max-height: var(--app-visible-height, 100dvh) !important;
    margin: 0 !important;
    padding: 6px !important;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) clamp(300px, 17vw, 350px) !important;
    grid-template-rows: 88px 140px minmax(250px, 1fr) 96px 48px !important;
    grid-template-areas:
      "top top top"
      "variant table score"
      "hand table score"
      "chat chat score"
      "events events score" !important;
    gap: 6px !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }

  body.game-active .app-shell:has(.roem-board:not([hidden])) {
    --ultrawide-table-size: calc(var(--app-visible-height, 100dvh) - 294px);
    grid-template-rows: 88px 140px minmax(250px, 1fr) 96px 80px !important;
  }

  body.game-active .top-bar {
    grid-area: top !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: 88px !important;
    padding: 8px 12px !important;
    overflow: hidden !important;
  }

  body.game-active .variant-banner {
    grid-area: variant !important;
    align-self: stretch !important;
    justify-self: center !important;
    width: min(100%, var(--ultrawide-table-size)) !important;
    height: 140px !important;
    min-width: 0 !important;
    min-height: 140px !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 13px 16px !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 86px !important;
    align-items: center !important;
    gap: 12px !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }

  body.game-active .variant-banner-content {
    min-width: 0 !important;
    align-self: center !important;
  }

  body.game-active .variant-banner-content > span {
    font-size: 11px !important;
    letter-spacing: .08em !important;
  }

  body.game-active .variant-banner-content > strong {
    display: block !important;
    margin-top: 3px !important;
    font-size: clamp(20px, 1.45vw, 27px) !important;
    line-height: 1.02 !important;
  }

  body.game-active .variant-banner-content > p {
    margin: 6px 0 0 !important;
    max-width: 32ch !important;
    font-size: 12px !important;
    line-height: 1.16 !important;
  }

  body.game-active .variant-city-mark {
    width: 86px !important;
    height: 86px !important;
    min-width: 86px !important;
    display: grid !important;
    place-items: center !important;
    font-size: 22px !important;
  }

  body.game-active .table {
    grid-area: table !important;
    place-self: center !important;
    width: min(100%, var(--ultrawide-table-size)) !important;
    height: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: 100% !important;
    max-height: 100% !important;
    aspect-ratio: 1 / 1 !important;
    border-radius: 13px !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }

  body.game-active .deal-animation-layer {
    --deal-card-w: clamp(42px, calc(var(--ultrawide-table-size) * .105), 56px) !important;
  }

  body.game-active .played-card {
    width: clamp(48px, calc(var(--ultrawide-table-size) * .115), 60px) !important;
  }

  body.game-active .played-card .mini-card {
    width: clamp(48px, calc(var(--ultrawide-table-size) * .115), 60px) !important;
    height: auto !important;
    aspect-ratio: .69 !important;
  }

  body.game-active .played-card .mini-card .corner { top: 6px !important; left: 6px !important; font-size: clamp(11px, calc(var(--ultrawide-table-size) * .026), 13px) !important; }
  body.game-active .played-card .mini-card .corner > span:last-child,
  body.game-active .played-card .mini-card .rank-center { display: none !important; }
  body.game-active .played-card .mini-card .suit { inset: 0 !important; padding-top: 14% !important; display: grid !important; place-items: center !important; font-size: clamp(24px, calc(var(--ultrawide-table-size) * .058), 30px) !important; }
  body.game-active .played-card > span { font-size: 11px !important; }

  body.game-active .hand-panel {
    grid-area: hand !important;
    align-self: stretch !important;
    justify-self: center !important;
    width: min(100%, var(--ultrawide-table-size)) !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: none !important;
    padding: 10px !important;
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr) !important;
    gap: 8px !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }

  body.game-active .hand-heading {
    min-width: 0 !important;
    min-height: 32px !important;
    margin: 0 !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: start !important;
    gap: 4px !important;
  }

  body.game-active .your-player-label .avatar {
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
    font-size: 14px !important;
  }

  body.game-active .hand-heading h2 { font-size: 18px !important; }
  body.game-active .hand-heading p { font-size: 11px !important; line-height: 1.12 !important; text-align: left !important; }

  body.game-active #playerHand.hand {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    grid-template-rows: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    place-items: center !important;
    overflow: hidden !important;
  }

  body.game-active #playerHand .card {
    width: auto !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: 76px !important;
    max-height: 108px !important;
    aspect-ratio: .69 !important;
    border-radius: 8px !important;
  }

  body.game-active #playerHand .card .corner > span:last-child { display: none !important; }

  body.game-active .score-board {
    grid-area: score !important;
    place-self: stretch !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: none !important;
    padding: 10px !important;
    display: grid !important;
    grid-template-columns: 1fr !important;
    grid-template-rows: repeat(3, minmax(54px, auto)) minmax(0, 1fr) !important;
    gap: 8px !important;
    overflow: hidden !important;
  }

  body.game-active .score-board > .score-card { min-height: 54px !important; padding: 9px 10px !important; }
  body.game-active .score-board > .score-actions { display: grid !important; grid-template-columns: 1fr !important; align-content: start !important; gap: 8px !important; }

  body.game-active .table-chat {
    grid-area: chat !important;
    place-self: stretch !important;
    width: 100% !important;
    height: 96px !important;
    min-width: 0 !important;
    min-height: 96px !important;
    padding: 7px !important;
    overflow: hidden !important;
  }

  body.game-active .table-chat-header { min-width: 190px !important; }
  body.game-active .table-chat-header strong { font-size: 11px !important; }
  body.game-active .table-chat-header small { font-size: 9px !important; }

  body.game-active .table-chat-log {
    min-height: 0 !important;
    height: 100% !important;
    overflow-y: auto !important;
  }

  body.game-active .table-chat-log .chat-line.compact {
    max-height: none !important;
  }

  body.game-active .table-chat-log .chat-line.compact span {
    display: block !important;
    overflow: visible !important;
    white-space: normal !important;
  }

  body.game-active .game-events {
    grid-area: events !important;
    place-self: stretch !important;
    width: 100% !important;
    height: 48px !important;
    min-width: 0 !important;
    min-height: 48px !important;
    padding: 5px !important;
    overflow: hidden !important;
  }

  body.game-active .game-events .message {
    height: 100% !important;
    min-height: 0 !important;
    padding: 5px 9px !important;
    display: flex !important;
    align-items: center !important;
    font-size: 12px !important;
    overflow: hidden !important;
  }

  body.game-active .app-shell:has(.roem-board:not([hidden])) .game-events {
    height: 80px !important;
    min-height: 80px !important;
    padding: 7px !important;
    display: flex !important;
    align-items: stretch !important;
    gap: 8px !important;
  }

  body.game-active .game-events:has(.roem-board:not([hidden])) .message {
    flex: 0 1 38% !important;
    min-width: 180px !important;
  }

  body.game-active .game-events .roem-board:not([hidden]) {
    position: static !important;
    inset: auto !important;
    transform: none !important;
    flex: 1 1 420px !important;
    width: auto !important;
    max-width: 620px !important;
    min-width: 280px !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 7px 11px !important;
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) !important;
    grid-template-rows: auto auto !important;
    align-content: center !important;
    column-gap: 9px !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    text-align: left !important;
  }

  body.game-active .game-events .roem-board:not([hidden]) > span {
    grid-column: 1 !important;
    grid-row: 1 !important;
    align-self: center !important;
    font-size: 11px !important;
    line-height: 1 !important;
  }

  body.game-active .game-events .roem-board:not([hidden]) > strong {
    grid-column: 2 !important;
    grid-row: 1 !important;
    min-width: 0 !important;
    margin: 0 !important;
    font-size: 16px !important;
    line-height: 1.05 !important;
    white-space: nowrap !important;
  }

  body.game-active .game-events .roem-board:not([hidden]) > p {
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
    margin: 4px 0 0 !important;
    font-size: 11px !important;
    line-height: 1.2 !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
  }

  body.game-active .bid-panel { display: none !important; }
  body.game-active .bid-popup-dialog { width: min(430px, 32vw) !important; }
}

/* In het overgangsgebied krijgt het speelgedeelte voorrang boven de zijbalk. */
@media (min-width: 1151px) and (max-width: 1499px) {
  body.game-active .app-shell {
    grid-template-columns: repeat(2, minmax(0, 1fr)) 250px !important;
  }

  body.game-active .variant-banner {
    height: 126px !important;
    min-height: 126px !important;
    padding: 11px 13px !important;
    grid-template-columns: minmax(0, 1fr) 66px !important;
    gap: 8px !important;
  }

  body.game-active .variant-banner-content > strong {
    font-size: clamp(18px, 1.65vw, 23px) !important;
  }

  body.game-active .variant-banner-content > p {
    font-size: 10px !important;
  }

  body.game-active .variant-city-mark {
    width: 66px !important;
    height: 66px !important;
    min-width: 66px !important;
    font-size: 18px !important;
  }
}
