/* Shared table queue, compact and collapsible inside the existing menu. */
#adminMusicSettingsSection .content-editor-form :is(label,input) { min-width: 0; }
#adminMusicSettingsSection .content-editor-form .checkline { display: flex; align-items: center; gap: 10px; }
#adminMusicSettingsSection input[type="checkbox"] { width: 22px; height: 22px; flex: 0 0 22px; }
#adminMusicSettingsSection input[type="number"], #adminMusicSettingsSection button { min-height: 44px; }
#adminMusicSettingsSection .music-request-controls { display: flex; flex-wrap: wrap; gap: 8px; }
#musicSettingsStatus { min-height: 1.4em; overflow-wrap: anywhere; }
#adminMusicLibrarySection .achievement-studio-metrics { grid-template-columns: repeat(auto-fit, minmax(min(100%, 120px), 1fr)); }
#adminMusicLibrarySection .achievement-studio-metrics article { min-width: 0; overflow-wrap: anywhere; }
#collectionTrackStudio .content-editor-form :is(label,input,textarea,select) { min-width: 0; }
#gameMenuPanel #roomMusic:not(.hidden) { display: block !important; }
#gameMenuPanel .room-music { margin: 0; padding: 0 10px; flex-shrink: 0; min-width: 0; border: 1px solid var(--border-soft); border-radius: 15px; background: rgb(6 18 13 / 60%); }
#gameMenuPanel .room-music > summary { min-height: 44px; padding: 10px 0; cursor: pointer; font-size: 14px; }
#gameMenuPanel .room-music > summary small { display: block; margin-top: 4px; font-size: 12px; overflow-wrap: anywhere; color: #b9cac1; }
#gameMenuPanel .music-panel-body { display: grid; min-width: 0; gap: 8px; padding-bottom: 10px; font: 14px/1.4 Arial, sans-serif; }
#gameMenuPanel .music-panel-body :is(p,h4) { margin: 0; }
#gameMenuPanel .music-panel-body :is(button,select,input) { min-height: 44px; min-width: 0; font-size: 14px; }
#gameMenuPanel .music-controls { display: flex; flex-wrap: wrap; gap: 8px; }
#gameMenuPanel .music-controls button { min-width: 44px; font-size: 20px; padding: 6px; }
#gameMenuPanel .music-volume-label { display: grid; gap: 3px; }
#gameMenuPanel #musicVolume { width: 100%; padding: 0; }
#gameMenuPanel .music-request-controls { display: flex; flex-wrap: wrap; gap: 8px; }
#gameMenuPanel .music-now { padding: 6px 8px; min-width: 0; overflow-wrap: anywhere; }
#gameMenuPanel .music-now span { font-size: 12px; }
#gameMenuPanel :is(#musicCatalogStatus,#musicQueueHint,#musicPlaybackStatus) { font-size: 12px; color: #b9cac1; }
#gameMenuPanel .music-queue { max-height: 150px; overflow: auto; overflow-wrap: anywhere; margin: 0; }
#gameMenuPanel .music-queue > div { display: grid; gap: 2px; font-size: 14px; }
#gameMenuPanel .music-queue small { font-size: 12px; }

/* The existing match log is reachable inside the table menu, without covering the hand by default. */
#gameMenuPanel .game-log { display: block; flex-shrink: 0; padding: 0 10px; }
#gameMenuPanel .game-log > summary { min-height: 44px; padding: 10px 0; cursor: pointer; }
#gameMenuPanel .game-log > summary strong { font-size: 14px; }
#gameMenuPanel .game-log > summary small { display: block; margin-top: 4px; font-size: 12px; color: #b9cac1; }
#gameMenuPanel .game-log .log { min-height: 0; max-height: min(240px, 45dvh); padding: 8px; font: 14px/1.45 Arial, sans-serif; overflow-wrap: anywhere; }

/* Result copy remains legible in both languages, including compact layouts. */
#matchResultOverlay :is(.match-result-kicker,.match-result-heading p,.match-result-player small,.match-result-score small,.match-result-place small,.match-result-exit-copy,.match-result-timer small) { font-size: 12px; letter-spacing: normal; }
@media (max-height: 620px) and (orientation: landscape) {
  #matchResultOverlay .match-result-document { height: calc(100dvh - 14px); min-height: 0; padding: 12px 22px 10px; gap: 6px; }
  #matchResultOverlay .match-result-heading h2 { font-size: 24px; }
  #matchResultOverlay .match-result-heading p { margin: 0; }
  #matchResultOverlay .match-result-layout { grid-template-columns: minmax(0,1fr) minmax(140px,.45fr); gap: 12px; }
  #matchResultOverlay .match-result-list { grid-row: 1; grid-column: 1; min-height: 0; max-height: 100%; overflow: auto; gap: 4px; }
  #matchResultOverlay .winner-stamp { grid-row: 1; grid-column: 2; min-width: 0; width: min(36vh,200px); max-width: 100%; justify-self: center; }
  #matchResultOverlay .match-result-row { min-height: 46px; grid-template-columns: 40px minmax(0,1fr) auto; gap: 6px; padding: 3px 8px 3px 3px; }
  #matchResultOverlay .match-result-place { width: 38px; height: 38px; }
  #matchResultOverlay .match-result-score b { font-size: 18px; }
  #matchResultOverlay .match-result-footer { min-height: 39px; }
}

/* Score ledger: readable localized columns and a touch-sized close control. */
#scoreSheetPanel .score-ledger :is(th,td) { font-size: 12px; min-height: 24px; }
#scoreSheetPanel .score-ledger thead tr:first-child th { height: 42px; }
#scoreSheetPanel .score-ledger thead tr:nth-child(2) th { top: 42px; height: 26px; font-size: 12px; }
#scoreSheetPanel .score-ledger caption { padding: 4px 0 8px; color: #381922; text-align: left; font: 700 14px/1.3 Arial,sans-serif; }
#scoreSheetPanel .score-player b { font-size: 12px; }
#scoreSheetPanel .score-ledger .score-order { font-size: 12px !important; }
#scoreSheetPanel .score-ledger sup { font-size: 12px; }
#scoreSheetPanel .score-order-column { width: 48px; }
#scoreSheetPanel .score-points-column { width: 64px; }
#closeScoreSheet { width: 44px; min-width: 44px; height: 44px; min-height: 44px; left: min(calc(50% + 400px), calc(100% - 52px)); }

/* P0 lobby flow. Game, administration and moderation keep their independent layouts. */
body.home-view-active:not(.game-session-active) { --club-font: system-ui, 'Segoe UI', sans-serif; overflow-y: auto; }
body.home-view-active:not(.game-session-active) .app { height: auto !important; min-height: 100svh; overflow: visible !important; }
body.home-view-active:not(.game-session-active) #home { height: auto; flex: 1 0 auto; overflow: visible; }
body.home-view-active:not(.game-session-active) #home .lobby-dashboard { height: auto !important; min-height: 0; align-items: stretch; }
body.home-view-active:not(.game-session-active) #home .lobby-action-card { grid-template-columns: minmax(0,1fr); grid-template-rows: auto 124px auto; height: auto; min-height: 300px; padding: 18px; overflow: hidden; }
body.home-view-active:not(.game-session-active) #home .lobby-action-card > div:nth-child(2) { grid-column: 1; grid-row: 1; position: relative; width: 100%; max-width: none; }
body.home-view-active:not(.game-session-active) #home .lobby-action-art { position: relative; grid-column: 1; grid-row: 2; min-height: 124px; width: 100%; inset: auto; overflow: hidden; }
body.home-view-active:not(.game-session-active) #home .lobby-action-card > button { grid-column: 1; grid-row: 3; min-height: 48px; font-size: 17px; }
body.home-view-active:not(.game-session-active) #home .lobby-action-card h3 { margin: 8px 0; font-size: 23px; line-height: 1.2; }
body.home-view-active:not(.game-session-active) #home .lobby-action-card p { font-size: 15px; line-height: 1.4; margin: 8px 0; }
body.home-view-active:not(.game-session-active) #home .lobby-friends-banner { display: grid; grid-template-columns: 110px minmax(0,1fr); grid-template-rows: auto auto; gap: 12px; height: auto; min-height: 130px; padding: 18px; }
body.home-view-active:not(.game-session-active) #home .lobby-friends-banner > span:nth-child(2) { width: auto; min-width: 0; }
body.home-view-active:not(.game-session-active) #home .lobby-friends-banner > b { display: block; position: static; grid-column: 1 / -1; grid-row: 2; padding: 10px; font-size: 13px; }
body.home-view-active:not(.game-session-active) #home .lobby-friends-banner strong { font-size: 20px; line-height: 1.2; }
body.home-view-active:not(.game-session-active) #home .lobby-friends-banner small { display: block; margin-top: 8px; font-size: 14px; line-height: 1.4; }
body.home-view-active:not(.game-session-active) #home .lobby-recent-section { min-height: 140px; margin-top: 16px; }
body.home-view-active:not(.game-session-active) #home .lobby-right-rail { height: auto; min-height: 0; overflow: visible; }
body.home-view-active:not(.game-session-active) .topbar .brand-emblem.shared-brand,
body.panel-view-active:not(.admin-view-active):not(.moderation-view-active) .topbar .brand-emblem.shared-brand { width: 150px !important; height: 110px !important; flex-basis: auto !important; margin: 0; object-fit: contain; }
body.home-view-active:not(.game-session-active) .topbar .brand-copy { background: none; }
body.home-view-active:not(.game-session-active) .topbar .brand-copy > strong { background: none; }
body.home-view-active:not(.game-session-active) #home .lobby-welcome h2,
body.home-view-active:not(.game-session-active) #home .lobby-action-card h3,
body.home-view-active:not(.game-session-active) #home .lobby-action-card p,
body.home-view-active:not(.game-session-active) #home .lobby-friends-banner *,
body.home-view-active:not(.game-session-active) #home .lobby-summary-card > header { font-family: system-ui, 'Segoe UI', sans-serif; }
body.home-view-active:not(.game-session-active) #home .lobby-vip-card > i { font-size: 60px; bottom: 15px; right: 15px; opacity: .22; pointer-events: none; }
body.home-view-active:not(.game-session-active) .topbar .brand-emblem.shared-brand { mix-blend-mode: normal !important; background: transparent; }
body.home-view-active:not(.game-session-active) .topbar .main-menu-toggle { display: inline-flex !important; position: absolute; bottom: 3px; right: 16px; min-height: 28px; padding: 2px 10px; font-size: 12px; }
body.home-view-active:not(.game-session-active) .topbar .tabs { padding-bottom: 20px; }
#localeSettingsSection label { display: block; margin: 12px 0; }
#localeSettingsSection select { max-width: 100%; }
#openProgressPanel { background: none; border: 0; box-shadow: none; text-align: left; padding: 0; text-transform: none; letter-spacing: 0; }
#openProgressPanel::before,#openProgressPanel::after { display: none; }
#openProgressPanel:focus-visible { outline: 2px solid #efd079; outline-offset: 3px; }
@media (min-width: 1001px) {
  body.home-view-active:not(.game-session-active) .topbar { height: 132px; min-height: 132px; flex-basis: 132px; grid-template-columns: minmax(350px,1fr) 190px minmax(350px,1fr); padding: 0 16px; }
  body.home-view-active:not(.game-session-active) #home .lobby-dashboard { grid-template-columns: minmax(180px,.65fr) minmax(480px,2fr) minmax(260px,.95fr) !important; }
  body.home-view-active:not(.game-session-active) .topbar-player-summary { grid-template-columns: 90px minmax(105px,1fr) minmax(120px, .85fr); }
  body.home-view-active:not(.game-session-active) .topbar-player-summary .profile-trigger.polished-button { width: 88px !important; min-width: 88px !important; height: 105px !important; min-height: 105px !important; }
  body.home-view-active:not(.game-session-active) .topbar-player-summary .profile-trigger-frame { width: 86px !important; height: 86px !important; flex-basis: 86px !important; }
  body.home-view-active:not(.game-session-active) .topbar-player-copy strong { font-size: 18px; }
  body.home-view-active:not(.game-session-active) .topbar-player-copy > i { max-width: 100%; }
}
@media (max-width: 1000px) {
  body.home-view-active:not(.game-session-active) #home .lobby-dashboard { grid-template-columns: minmax(0,1fr) !important; grid-template-rows: auto; padding: 12px; gap: 12px; }
  body.home-view-active:not(.game-session-active) #home .lobby-side-rail { grid-column: 1; grid-row: auto; display: block; }
  body.home-view-active:not(.game-session-active) #home .lobby-progress-list { display: flex; flex-wrap: wrap; }
  body.home-view-active:not(.game-session-active) #home .lobby-progress-list button { min-height: 44px; min-width: 140px; font-size: 15px; }
  body.home-view-active:not(.game-session-active) #home .lobby-tournament-promo { display: none; }
  body.home-view-active:not(.game-session-active) #home .lobby-command-center { grid-column: 1; grid-row: auto; padding: 16px; }
  body.home-view-active:not(.game-session-active) #home .lobby-right-rail { display: grid !important; grid-column: 1; grid-row: auto; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
  body.home-view-active:not(.game-session-active) #home .lobby-primary-actions { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
  body.home-view-active:not(.game-session-active) #home .lobby-welcome h2 { font-size: 23px; }
  body.home-view-active:not(.game-session-active) #home .lobby-welcome p { font-size: 15px; line-height: 1.4; }
  body.home-view-active:not(.game-session-active) .topbar .brand-emblem.shared-brand,
  body.panel-view-active:not(.admin-view-active):not(.moderation-view-active) .topbar .brand-emblem.shared-brand { width: 105px !important; height: 70px !important; }
  body.home-view-active:not(.game-session-active) .topbar .main-menu-toggle { position: static; min-height: 36px; }
}
@media (max-width: 540px) {
  body.home-view-active:not(.game-session-active) #home .lobby-primary-actions,
  body.home-view-active:not(.game-session-active) #home .lobby-right-rail { grid-template-columns: minmax(0,1fr); }
}

/* Table P0 safe zones. Shared dimensions keep portraits, counters and hands
   independent of the older oversized desktop frame rules in styles.css. */
#home.game-active.table-profile-open { position: relative; box-sizing: border-box; padding-right: var(--table-profile-rail); }
#home.game-active.table-profile-open .hand { gap: 0 !important; }
#home.game-active.table-profile-open .hand .card + .card { margin-left: var(--hand-overlap) !important; }
#home.game-active.table-profile-open .bid-panel { width: min(360px,calc(100% - 2 * var(--table-seat-width) - 24px)) !important; max-width: calc(100% - 2 * var(--table-seat-width) - 24px) !important; }
#home.game-active.table-profile-open #bidBox { display: block; width: 100% !important; min-width: 0 !important; }
#home.game-active.table-profile-open #bidBox .bidgrid { width: 100%; min-width: 0; grid-template-columns: repeat(5,minmax(0,1fr)) !important; gap: 3px !important; }
#home.game-active.table-profile-open #bidBox button { min-width: 0 !important; padding: 3px !important; }
#home.game-active { --table-profile-rail: clamp(200px, 24vw, 280px); }
#tablePlayerPanel { position: absolute; top: 64px; right: 8px; bottom: 64px; width: calc(var(--table-profile-rail) - 16px); box-sizing: border-box; overflow-y: auto; padding: 10px; border: 1px solid #a88c48; border-radius: 14px; background: #0c1c16; color: #f6e9c7; }
#tablePlayerPanel.hidden { display: none !important; }
#tablePlayerPanel header { display: grid; grid-template-columns: minmax(0,1fr) 44px; gap: 4px; align-items: start; }
#tablePlayerName { margin: 5px 0; font: 700 16px/1.3 Georgia,serif; overflow-wrap: anywhere; }
#tablePlayerPanel button { min-height: 44px; }
#closeTablePlayer { min-width: 44px; padding: 4px; }
#tablePlayerContent { display: grid; gap: 8px; font: 13px/1.4 Arial,sans-serif; }
#tablePlayerContent p { margin: 0; overflow-wrap: anywhere; }
#tablePlayerContent .table-profile-avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
#tablePlayerContent .table-profile-kind { color: #d5c08b; }
#tablePlayerPanel[data-motion="on"] { animation: table-profile-enter 140ms ease-out; }
@keyframes table-profile-enter { from { opacity: 0; transform: translateX(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { #tablePlayerPanel { animation: none !important; } }
#home.game-active #gamePlayers button[data-table-player] { pointer-events: auto; cursor: pointer; min-width: 0; min-height: 0; padding: 0; margin: 0; background: transparent; box-shadow: none; }
#home.game-active #gamePlayers button.seat-name { border: 0; }
#gamePlayers button[data-table-player]:focus-visible { outline: 2px solid #fff1b5; outline-offset: 2px; }
#home.game-active {
  --table-seat-width: clamp(132px, 13vw, 180px);
  --table-seat-height: clamp(124px, 24vh, 210px);
  --table-trump-height: clamp(78px, 16vh, 144px);
}
#home.game-active #gamePlayers .game-seat {
  --seat-frame-size: calc(var(--table-seat-height) - 60px);
  width: var(--table-seat-width) !important;
  height: var(--table-seat-height) !important;
  min-height: var(--table-seat-height) !important;
  border-radius: 20px !important;
}
#home.game-active #gamePlayers .seat-avatar { top: 30px !important; }
#home.game-active #gamePlayers .seat-avatar-photo { font-size: clamp(20px, 3vh, 36px); }
#home.game-active #gamePlayers .seat-metrics { left: 4px; right: 4px; top: 2px; gap: 4px; }
#home.game-active #gamePlayers .seat-metric {
  height: 26px; padding: 2px 3px; gap: 2px;
  display: flex; justify-content: space-between; align-items: center;
}
#home.game-active #gamePlayers .seat-metric small {
  flex-shrink: 0; font: 9px/1.2 Arial, sans-serif; letter-spacing: 0;
}
#home.game-active #gamePlayers .seat-metric b { font: 700 12px/1.2 Arial, sans-serif; }
#home.game-active #gamePlayers .seat-name {
  left: 4px; right: 4px; bottom: 3px; min-height: 24px;
  display: block; padding: 4px 5px; font: 700 12px/1.2 Arial, sans-serif;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#home.game-active #gamePlayers .dealer-chip { top: 32px !important; left: 2px !important; }
/* Ownership label stays outside the portrait; dealer marker uses the lower-left rail. */
#home.game-active #gamePlayers .seat-bot-badge {
  position: absolute; z-index: 8; top: 0;
  left: min(0px, calc(var(--seat-frame-size) * .16 - 36px));
  box-sizing: border-box; width: 34px; height: 18px;
  display: grid; place-items: center; padding: 0; border: 1px solid #e6c879;
  border-radius: 5px; background: #15271f; color: #ffe49b;
  font: 700 11px/1 Arial, sans-serif; letter-spacing: 0; text-transform: none;
  pointer-events: none;
}
#home.game-active #gamePlayers .game-seat:has(.seat-bot-badge) .dealer-chip {
  top: calc(30px + var(--seat-frame-size) - 20px) !important;
}
#home.game-active .hand-panel {
  left: calc(var(--table-seat-width) + 25px) !important;
  right: calc(var(--table-seat-width) + 25px) !important;
}
#home.game-active #trumpIndicator {
  right: 12px !important;
  top: 70px !important;
  width: calc(var(--table-trump-height) * .625 + 14px) !important;
  min-width: 0 !important; min-height: 0 !important;
  box-sizing: border-box; padding: 6px !important;
  border: 1px solid #e2bd6d !important; border-radius: 12px !important;
  background: linear-gradient(145deg, #3c2c17, #0c2018) !important;
  box-shadow: 0 5px 18px #0009, inset 0 0 0 2px #ffdc8220 !important;
}
#home.game-active #trumpIndicator .trump-upcard,
#home.game-active #trumpIndicator .trump-suit-mark {
  width: calc(var(--table-trump-height) * .625) !important;
  min-width: 0 !important; max-width: none !important;
  height: var(--table-trump-height) !important;
  min-height: var(--table-trump-height) !important;
  flex-basis: auto !important;
}
#home.game-active #trumpIndicator .trump-upcard { overflow: hidden; border-radius: 7px !important; }
#home.game-active #trumpIndicator .card-art { width: 100%; height: 100%; object-fit: contain; }
#home.game-active #trumpIndicator .trump-suit-mark {
  display: grid; place-items: center; box-sizing: border-box;
  border: 1px solid #b49a62 !important; border-radius: 7px !important;
  background: linear-gradient(145deg, #fff8e7, #e7d8b6) !important;
  color: #17251e; font: 700 calc(var(--table-trump-height) * .56)/1 Georgia,serif !important;
  text-shadow: 0 1px #fff9;
}
#home.game-active #trumpIndicator.red-trump .trump-suit-mark { color: #b32338; }
#home.game-active #trumpIndicator :is(.no-trump-mark,.pending-mark) { font-size: calc(var(--table-trump-height) * .3) !important; }
/* Bid balance belongs to the table, midway between the two left seats. */
#home.game-active #bidBalanceIndicator {
  --balance-height: 76px;
  left: 14px; right: auto; top: calc(69% - var(--table-seat-height) / 4 - 4px);
  width: var(--table-seat-width); min-height: var(--balance-height); height: var(--balance-height);
  transform: translateY(-50%); animation: none; padding: 8px 12px;
  grid-template-rows: 20px 36px; column-gap: 8px; border-radius: 14px;
}
#home.game-active #bidBalanceIndicator > span { font: 800 14px/20px Georgia,serif; letter-spacing: .03em; }
#home.game-active #bidBalanceIndicator > strong { font: 900 32px/36px Georgia,serif; }
#home.game-active #bidBalanceIndicator > small { font: 700 11px/15px Georgia,serif; }
#home.game-active #gameArena:not([data-player-count="4"]) #bidBalanceIndicator { top: 50%; }
@media (max-height: 600px) and (orientation: landscape) {
  #home.game-active { --table-trump-height: 78px; }
  #home.game-active #trumpIndicator { top: 62px !important; }
  #home.game-active #gameArena[data-player-count="4"] #gamePlayers .seat-right { top: calc(55% + 18px) !important; }
  #home.game-active #gameArena[data-player-count="4"] #gamePlayers .seat-left { top: calc(38% - 8px) !important; }
  #home.game-active #bidBalanceIndicator {
    --balance-height: 36px;
    top: calc(69% - var(--table-seat-height) / 4 - 8px);
    padding: 3px 5px; grid-template-columns: 1fr auto auto; grid-template-rows: 28px;
    column-gap: 4px; border-radius: 10px;
  }
  #home.game-active #bidBalanceIndicator > span { grid-column: auto; font-size: 12px; line-height: 28px; letter-spacing: 0; }
  #home.game-active #bidBalanceIndicator > strong { font-size: 25px; line-height: 28px; }
  #home.game-active #bidBalanceIndicator > small { align-self: center; padding: 0; font-size: 9px; line-height: 12px; }
}

/* Explicit scrollable emoji rows: automatic tracks used to shrink to 27px
   while square buttons stayed ~58px high and overlapped the following row. */
#home.game-active #emojiPickerPanel .emoji-picker-grid { grid-auto-rows: 60px !important; }
#home.game-active #emojiPickerPanel .emoji-picker-item {
  height: 60px !important;
  aspect-ratio: auto !important;
}

/* Trump selection belongs in the gap between the upper seats and the hand. */
#trumpChoice .trump-choice-symbol { display: none; }
#home.game-active .joker-choice-heading small,
#home.game-active .joker-mode-choice small { font: 12px/1.4 Arial,sans-serif; }
@media (max-height: 600px) and (orientation: landscape) {
  #home.game-active .joker-mode-choice button { min-height: 82px; }
}
@media (max-height: 600px) and (orientation: landscape) {
  #home.game-active #trumpChoice:not(.hidden) {
    box-sizing: border-box; display: grid; grid-template-columns: repeat(3,minmax(0,1fr));
    gap: 4px; padding: 4px; margin: 0;
    width: min(420px, calc(100vw - 2 * var(--table-seat-width) - 40px));
    top: calc(var(--table-seat-height) + 12px); transform: translateX(-50%);
    max-height: none; overflow: visible;
  }
  #home.game-active #trumpChoice > strong {
    grid-column: 1 / -1; margin: 0; font: 700 14px/16px Arial,sans-serif;
  }
  #home.game-active #trumpChoice button {
    min-width: 0; min-height: 44px; margin: 0; padding: 4px;
    font: 700 14px/1.2 Arial,sans-serif; white-space: normal;
  }
  #home.game-active.table-profile-open #trumpChoice:not(.hidden) {
    left: calc((100vw - var(--table-profile-rail)) / 2);
    width: min(420px, calc(100vw - var(--table-profile-rail) - 2 * var(--table-seat-width) - 36px));
    grid-template-columns: minmax(44px,1fr) minmax(44px,1fr) minmax(56px,1.2fr);
  }
  #home.game-active.table-profile-open #trumpChoice button {
    padding: 2px; font: 700 12px/1.2 Arial,sans-serif !important; overflow-wrap: anywhere;
  }
}
@media (max-width: 720px) and (max-height: 600px) and (orientation: landscape) {
  #home.game-active.table-profile-open #trumpChoice button:not([data-trump="none"]) .trump-choice-name {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%);
  }
  #home.game-active.table-profile-open #trumpChoice .trump-choice-symbol {
    display: block; font: 700 24px/1 Georgia,serif; color: #201a10;
  }
  #home.game-active.table-profile-open #trumpChoice :is([data-trump="H"],[data-trump="D"]) .trump-choice-symbol { color: #7f170d; }
}

/* Settings categories share one set of existing form controls, not clones. */
/* Shared, static level decoration. Independent from paid account frames. */
[data-open-progress], [data-public-progress] { --xp-color: #d9b563; }
[data-level-decoration="silver"] { --xp-color: #d6e8f1; }
[data-level-decoration="gold"] { --xp-color: #ffc965; }
[data-level-decoration="maximum"] { --xp-color: #c6a3ff; }
.player-progress { min-width: 0; width: 100%; min-height: 66px; display: grid; gap: 6px; padding: 10px; border: 1px solid var(--xp-color); border-radius: 12px; background: #101f1a; text-align: left; color: #f9edcd; }
.player-progress > strong { color: var(--xp-color); font: 700 17px/1.3 Georgia,serif; }
.player-progress > small { color: #eee6d3 !important; font: 12px/1.4 Arial,sans-serif !important; overflow-wrap: anywhere; }
.player-xp-bar { display: block; height: 7px; overflow: hidden; border-radius: 8px; background: #040a08; }
.player-xp-bar > i { display: block; height: 100%; background: var(--xp-color); }
[data-open-progress]:focus-visible, [data-public-progress]:focus-visible { outline: 2px solid #fff2be; outline-offset: 3px; }
[data-open-progress][data-level-decoration="gold"], [data-open-progress][data-level-decoration="maximum"] { box-shadow: inset 0 0 12px color-mix(in srgb,var(--xp-color) 18%,transparent); }
#topbarProfileXp { background: var(--xp-color); }
.public-player-progress { box-sizing: border-box; max-width: 100%; }
.room-player-levels { display: grid; gap: 8px; }
.room-player-levels > div { min-width: 0; overflow-wrap: anywhere; }
.room-player-levels .public-player-progress { margin-block: 4px; }
#lobbyOpenRooms .lobby-rooms-layout { grid-template-columns: minmax(0,1fr) minmax(230px,30%); height: auto; }
#lobbyOpenRooms .lobby-room-table { min-width: 0; }
#lobbyOpenRooms .lobby-room-table > header, #roomsBox .room-row {
  grid-template-columns: 64px minmax(100px,1fr) 94px 56px 52px 18px;
  gap: 6px; padding-inline: 8px; min-width: 0;
}
#lobbyOpenRooms .lobby-room-table > header { display: grid; min-height: 44px; font-size: 11px; overflow-wrap: anywhere; }
#roomsBox .room-row { min-height: 88px; }
#roomsBox .room-row > div:first-child { grid-column: auto; }
#roomsBox .room-row-code strong { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#roomsBox .room-row-players { display: flex; min-width: 0; gap: 0; padding-left: 6px; }
#roomsBox .room-row-players i { flex: 0 0 26px; width: 26px; height: 26px; margin-left: -6px; }
#roomsBox .room-row-rating, #roomsBox .room-row-free { display: grid; }
@media (max-width: 1100px) {
  #lobbyOpenRooms .lobby-rooms-layout { grid-template-columns: minmax(0,1fr); }
}
[data-level-standings="true"] .rating-podium-place { min-width: 0; }
[data-level-standings="true"] .rating-podium-place .public-player-progress > strong,
[data-level-standings="true"] .public-player-progress > small { white-space: normal; overflow-wrap: anywhere; }
[data-level-standings="true"] .rating-row, [data-level-standings="true"] .rating-list-heading { grid-template-columns: minmax(0,1fr) 50px 50px minmax(140px,180px); }
@media (max-width: 740px) {
  [data-level-standings="true"] .rating-row { grid-template-columns: minmax(0,1fr) 44px 44px; }
  [data-level-standings="true"] .rating-row > .public-player-progress { grid-column: 1 / -1; }
  [data-level-standings="true"] .rating-list-heading { grid-template-columns: minmax(0,1fr) 44px 44px; }
  [data-level-standings="true"] .rating-list-heading > span:last-child { display: none; }
}
.club-member-card > div { min-width: 0; }
.club-member-card > div > strong { overflow-wrap: anywhere; }
.club-member-card .public-player-progress { margin-block: 6px; }
.club-member-card .public-player-progress > small { white-space: normal; }
.chat-player-card > button:not(#closeCommunityChatPlayer) { position: static; min-height: 44px; padding: 10px; }
.social-profile-portrait { grid-template-rows: minmax(90px,1fr) auto auto; }
.social-profile-portrait > .public-player-progress { width: calc(100% - 12px); margin: 6px; }
.social-profile-portrait > .public-player-progress > strong { font-size: 14px; }
.chat-player-card h3, .social-profile-copy h3 { overflow-wrap: anywhere; max-width: 100%; }
.chat-player-stats { grid-template-columns: repeat(2,minmax(0,1fr)); }
#closeCommunityChatPlayer { min-width: 44px; min-height: 44px; }
@media (max-width: 700px) and (orientation: portrait) {
  #communityChat:not(.hidden) { grid-template-columns: minmax(0,1fr); min-height: 0; height: calc(100dvh - 108px); overflow-y: auto; align-content: start; padding-bottom: 90px; scroll-padding-bottom: 90px; }
  #communityChat .community-chat-channels { min-height: 0; grid-template-rows: auto auto auto; }
  #communityChat .community-chat-main { min-height: 440px; height: 60dvh; }
  #communityChatPlayer { overflow: visible; }
}
#profile .profile-overview-grid { grid-template-columns: minmax(0,1fr); }
#profile .profile-hero-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
#profile .profile-hero-metrics > div:nth-child(n) { display: grid; }
#profile .profile-title-row h2 { overflow-wrap: anywhere; }
#profile .profile-hero-panel { grid-template-columns: 110px minmax(0,1fr) minmax(150px,.55fr) !important; }
#profile .profile-hero-actions { grid-column: 1 / -1 !important; display: flex; flex-wrap: wrap; }
#profile .profile-hero-actions button { min-height: 44px; font-size: 12px; }
#profile .profile-stats-hero { grid-template-columns: minmax(0,1fr); }
#profile .profile-stats-identity { grid-template-columns: 130px minmax(0,1fr); }
#profile .profile-stats-identity > .profile-avatar-frame { width: 125px; height: 125px; }
@media (max-width: 760px) {
  #profile .profile-hero-panel { grid-template-columns: 78px minmax(0,1fr) !important; }
  #profile .profile-hero-metrics { grid-column: 1 / -1 !important; }
  #profile .profile-stats-identity { grid-template-columns: 78px minmax(0,1fr); gap: 10px; }
  #profile .profile-stats-identity > .profile-avatar-frame { width: 78px; height: 78px; }
  #profile .profile-stats-identity > div > strong { font-size: 22px; }
  #profile .profile-stat-details-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

#profileShowcase, #profileShowcaseGroups > section { min-width: 0; }
#profileShowcase .showcase-heading, #profileShowcaseDialog .showcase-heading, #profileShowcaseGroups header { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:12px; }
#profileShowcase button, #profileShowcaseDialog button { min-height:44px; min-width:44px; padding:10px 14px; white-space:normal; overflow-wrap:anywhere; }
#profileShowcase p, #profileShowcaseDialog p { color:#c9c2ab; }
.showcase-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(150px,100%),1fr)); gap:12px; }
.showcase-card { min-width:0; padding:12px; border:1px solid #78663f; border-radius:12px; background:#13251e; display:flex; flex-direction:column; align-items:flex-start; gap:8px; overflow-wrap:anywhere; }
.showcase-card strong { color:#f4d895; font-size:15px; }
.showcase-card p { margin:0; font-size:13px; }
.showcase-card small { margin-top:auto; color:#c9c2ab; font-size:12px; }
.showcase-art { display:grid; place-items:center; position:relative; width:56px; height:56px; color:#efd080; font-size:36px; }
.showcase-art img { position:absolute; inset:0; width:100%; height:100%; object-fit:contain; }
.showcase-art img[hidden] { display:none; }
#profileShowcaseDialog { box-sizing:border-box; width:min(960px,calc(100vw - 24px)); max-width:calc(100vw - 24px); max-height:calc(100dvh - 24px); overflow:auto; padding:20px; border:1px solid #bc9b55; border-radius:16px; color:#fff1ce; background:#101e19; }
#profileShowcaseDialog::backdrop { background:#000b; }
#profileShowcaseMore { margin-top:16px; }
#profileShowcaseGroups > section + section { margin-top:20px; }
#profileAwardsSection .showcase-heading, #profileRecordedRewards header { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:12px; }
#profileAwardsSection button { min-height:44px; min-width:44px; padding:10px 14px; }
#profileRecordedRewards > section + section { margin-top:20px; }
#profileAwardsSummary { grid-template-columns:repeat(2,minmax(0,1fr)); }
#profileAwardsSummary > div { min-width:0; overflow-wrap:anywhere; display:flex; flex-direction:column; gap:6px; align-items:center; }
#profileAwardsSummary small { font:14px/1.4 Arial,sans-serif !important; text-align:center; }
#profileAwardsSection .showcase-note summary { min-height:44px; padding:12px 0; box-sizing:border-box; cursor:pointer; font:14px/1.4 Arial,sans-serif; }
#profileAwardsSection .showcase-note p { font:14px/1.5 Arial,sans-serif; }
#profileAwardsNote { color:#c9c2ab; }
#profileSocialLinks { display:flex; flex-wrap:wrap; gap:10px; padding:12px 0; }
#profileSocialLinks button { min-height:44px; min-width:44px; padding:10px 14px; white-space:normal; font:14px/1.4 Arial,sans-serif !important; }

#profileAccountSection { min-width: 0; }
#settingsCategoryTabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 18px; }
#home.game-active #gameMenuPanel > button small,
#home.game-active #botTakeoverOverlay > span { font: 12px/1.35 Arial, sans-serif; }
#home.game-active #gameMenuPanel > button { flex-shrink: 0; }
#settingsCategoryTabs button { min-height: 44px; padding: 9px 14px; font: 600 14px/1.3 Arial, sans-serif !important; }
#settingsCategoryTabs button[aria-selected="true"] { background: #254d37; border-color: #e7c36f; color: #ffeab5; }
#profileAccountSection .settings-category-panel[hidden], #settingsSaveBar[hidden] { display: none !important; }
#profileAccountSection .settings-category-panel { min-width: 0; padding-bottom: 12px; }
#profileAccountSection .settings-category-panel > .box { margin-bottom: 14px; }
#profileAccountSection .settings-controls { display: grid; gap: 16px; grid-template-columns: repeat(2,minmax(0,1fr)); }
#profileAccountSection .settings-controls > h3, #profileAccountSection .settings-controls > p { grid-column: 1 / -1; }
#profileAccountSection .settings-controls label { min-width: 0; min-height: 44px; font: 15px/1.4 Arial,sans-serif !important; }
#profileAccountSection .settings-controls select { width: 100%; min-width: 0; min-height: 44px; }
#settingsSaveBar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 12px 0; }
#settingsSaveStatus, #settingsDndStatus { overflow-wrap: anywhere; }
#profile .app-view-stage:has(> [data-panel-page="account"].panel-page-active) { overflow-y: auto !important; }
#profile > .app-view-rail { overflow-y: hidden; }
#profile > .app-view-rail nav { display: flex; flex-wrap: nowrap; min-width: 0; overflow-x: auto; overflow-y: hidden; }
#profile > .app-view-rail nav button { flex: 1 0 auto; min-width: 94px; }
#profile > .app-view-rail nav button > strong { white-space: nowrap; font: 600 12px/1.3 Arial,sans-serif; }
@media (max-width: 760px) {
  #profile > .app-view-stage { padding-bottom: 90px !important; scroll-padding-bottom: 90px; }
}
@media (max-width: 700px) {
  #profileAccountSection .settings-controls { grid-template-columns: minmax(0,1fr); }
  #settingsCategoryTabs { gap: 5px; }
  #settingsCategoryTabs button { padding: 8px; font-size: 13px !important; }
}
