/* Viewport sizing is defined here, after the decorative styles. */
html, body { width: 100%; height: 100%; min-height: 0; overflow: hidden; }
body { min-width: 280px; }
[hidden] { display: none !important; }

/* Home: each view gets the available screen instead of stacking below it. */
.welcome-screen.training-home { height: 100dvh; padding: 12px clamp(10px, 2vw, 28px); overflow: hidden; }
.training-home .welcome-shell { height: 100%; min-height: 0; max-height: 100%; grid-template-rows: auto auto minmax(0, 1fr) auto; gap: 10px; overflow: hidden; }
.training-home .welcome-brand { min-height: 42px; margin: 0; }
.home-tabs { display: flex; gap: 6px; }
.home-tabs button { min-height: 40px; padding: 8px 20px; border: 1px solid #d9d1bc; border-radius: 9px; background: #fffcf6; color: #31503d; font-size: 13px; font-weight: 600; }
.home-tabs [aria-selected="true"] { background: #1c4c3d; color: white; border-color: #1c4c3d; }
.training-home .welcome-layout { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); height: 100%; min-height: 0; gap: 16px; overflow: hidden; }
.training-home .welcome-story { display: flex; flex-direction: column; justify-content: center; padding: clamp(16px, 3vh, 32px); }
.training-home .welcome-story h1 { font-size: clamp(28px, 3vw, 44px); }
.training-home .welcome-start { min-height: 0; justify-content: center; padding: clamp(12px, 2vh, 24px); gap: 0; }
.training-home .welcome-start-heading h2 { margin: 5px 0; font-size: clamp(22px, 2.5vw, 30px); }
.training-home .welcome-training { margin-top: 16px; padding-top: 12px; }
.training-home .welcome-training h3 { font-size: 20px; }
.training-home .welcome-options { grid-template-columns: 1fr 1fr; gap: 12px; margin: 10px 0; }
.training-home .welcome-options label { display: grid; gap: 5px; font-size: 12px; }
.training-home .welcome-options select { width: 100%; min-width: 0; height: 38px; }
.training-home .welcome-training-help { margin: 6px 0 10px; font-size: 12px; }
.training-home .welcome-primary, .training-home .welcome-secondary { min-height: 46px; padding: 10px 14px; }
.training-home #welcome-online { margin-top: 10px; }
.training-home #welcome-resume { min-height: 36px; margin: 0 0 8px; }
.training-home .welcome-secondary-actions { margin-top: 6px; }
.training-home .welcome-secondary-actions .welcome-rules { min-height: 32px; }
.training-home .welcome-footer { padding: 0; min-height: 14px; }
.training-home .welcome-dashboard { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); height: 100%; min-height: 0; overflow: hidden; }
.training-home .welcome-dashboard-card { width: min(720px, 100%); height: 100%; min-height: 0; justify-self: center; padding: 18px; overflow: hidden; }
.training-home .welcome-dashboard-heading { min-height: 30px; font-size: 12px; }
.training-home .welcome-account-card h2 { display: block; font-size: 23px; }
.training-home .welcome-account-card > p { display: block; font-size: 13px; }
.training-home .dashboard-account-link { min-height: 40px; font-size: 13px; }
.training-home .welcome-token-summary { padding: 12px; }
.training-home .welcome-token-copy strong { font-size: 14px; }
.training-home .welcome-token-copy small { font-size: 12px; }
.training-home .welcome-loyalty-summary { display: block; }
.training-home .welcome-friends-card { display: flex; flex-direction: column; gap: 6px; }
.training-home .welcome-friends-card .welcome-dashboard-caption { display: block; font-size: 12px; }
.training-home .dashboard-friend-form { flex-shrink: 0; }
.training-home .dashboard-friend-form input { height: 40px; font-size: 13px; }
.training-home .dashboard-friend-form button { min-width: 40px; min-height: 40px; }
.training-home .dashboard-friend-help { display: block; font-size: 12px; }
.training-home .dashboard-inbox, .training-home .dashboard-friend-list { min-height: 0; max-height: none; overflow-y: auto; font-size: 12px; }
.training-home .dashboard-friend-list { flex: 1; }

/* Game: flexible felt, bounded hand, permanently reachable action buttons. */
.app-shell { height: 100dvh; min-height: 0; max-height: 100dvh; padding: 0 clamp(8px, 1.5vw, 24px) 6px; overflow: hidden; }
.topbar { flex: 0 0 52px; height: 52px; min-height: 52px; }
.topbar :is(.icon-button, .home-button, .new-game-button) { min-height: 36px; height: 36px; }
.top-actions { width: auto; min-width: 0; flex-wrap: nowrap; gap: 5px; }
.table-tools > summary { min-height: 32px; }
.topbar .messenger-toggle { position: relative; inset: auto; flex: none; min-height: 32px; padding: 5px 9px; box-shadow: none; }
.topbar .messenger-badge { position: static; }
.topbar .table-leave-button { display: inline-flex; align-items: center; justify-content: center; flex: none; gap: 4px; min-height: 36px; padding: 6px 12px; border: 1px solid #b86550; border-radius: 8px; background: #fff1eb; color: #8a3528; font: 700 12px 'DM Sans', sans-serif; cursor: pointer; white-space: nowrap; }
.topbar .table-leave-button:hover { background: #f9dfd4; border-color: #8a3528; }
.topbar .table-leave-button:focus-visible { outline: 2px solid #8a3528; outline-offset: 3px; }
.topbar .table-leave-button:disabled { opacity: .6; cursor: wait; }
.top-actions:has(#leave-online-game:not([hidden])) #new-game-button { display: none; }
/* Reserve a bottom status area while a notification is visible. */
/* Keep compact seat names outside the central fan of played cards. */
@media (max-width: 400px) and (min-height: 451px), (max-width: 760px) and (max-height: 450px) {
  .felt-table .seat { max-width: 60px; }
  .felt-table :is(.seat.seat-left-low, .seat.seat-right-low, .seat.seat-left, .seat.seat-right) { top: 62%; }
  .felt-table .seat .avatar, .felt-table .seat .seat-royal-icon { display: none; }
  .felt-table .seat-meta { min-width: 0; }
  .felt-table .seat-name-row { min-width: 0; }
  .felt-table .seat-meta strong { display: block; max-width: 60px; overflow: hidden; text-overflow: ellipsis; }
  .felt-table .seat-indicators { left: 0; max-width: 76px; }
  .felt-table :is(.seat-right, .seat-right-high, .seat-right-low) .seat-indicators { left: auto; right: 0; justify-content: flex-end; }
  #trick-zone .played-card .card { width: 42px; min-width: 42px; height: 64px; }
  #trick-zone .pos-bottom { left: calc(50% - 21px); top: calc(50% + 12px); }
  #trick-zone :is(.pos-left, .pos-left-low) { left: calc(50% - 72px); top: calc(50% - 10px); }
  #trick-zone :is(.pos-right, .pos-right-low) { left: calc(50% + 30px); top: calc(50% - 10px); }
  #trick-zone .pos-top { left: calc(50% - 21px); top: calc(50% - 58px); }
  #trick-zone .pos-left-high { left: calc(50% - 49px); top: calc(50% - 58px); }
  #trick-zone .pos-right-high { left: calc(50% + 7px); top: calc(50% - 58px); }
}
@media (max-width: 760px) and (max-height: 450px) {
  .felt-table .seat, .felt-table .seat-meta strong { max-width: 58px; }
  #trick-zone .played-card .card { width: 32px; min-width: 32px; height: 48px; }
  #trick-zone .pos-bottom { left: calc(50% - 16px); top: calc(50% + 12px); }
  #trick-zone :is(.pos-left, .pos-left-low) { left: calc(50% - 54px); top: calc(50% - 2px); }
  #trick-zone :is(.pos-right, .pos-right-low) { left: calc(50% + 22px); top: calc(50% - 2px); }
  #trick-zone .pos-top { left: calc(50% - 16px); top: calc(50% - 32px); }
  #trick-zone .pos-left-high { left: calc(50% - 35px); top: calc(50% - 32px); }
  #trick-zone .pos-right-high { left: calc(50% + 3px); top: calc(50% - 32px); }
}
body { --toast-space: 0px; }
body:has(#toast.show) { --toast-space: calc(var(--toast-height, 48px) + 8px + max(8px, env(safe-area-inset-bottom, 0px))); }
body .app-shell, body .welcome-screen.training-home { height: calc(100dvh - var(--toast-space)); max-height: calc(100dvh - var(--toast-space)); }
body .modal-backdrop { bottom: var(--toast-space); }
body .modal-backdrop > .modal-card, body #modal-backdrop > .modal-card { max-height: calc(100dvh - var(--toast-space) - 32px); }
body #game-results-backdrop > .results-dialog { max-height: calc(100dvh - var(--toast-space) - 24px); }
.toast {
  top: auto;
  bottom: max(8px, env(safe-area-inset-bottom, 0px));
  left: auto;
  right: max(12px, env(safe-area-inset-right, 0px));
  width: min(480px, calc(100vw - 24px));
  min-width: 0;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  text-align: left;
  overflow-wrap: anywhere;
  box-shadow: 0 2px 8px #1429231a;
  transform: translateY(6px);
  pointer-events: none;
  z-index: 1100;
}
.toast.show { transform: translateY(0); }
.game-layout { display: grid; grid-template-columns: minmax(160px, 200px) minmax(0, 1fr); flex: 1; min-height: 0; gap: 14px; padding-top: 6px; overflow: hidden; }
.game-layout > .sidebar { min-height: 0; overflow: hidden; }
.sidebar .legend-card, .sidebar .sidebar-footer { display: none; }
.sidebar .score-card { padding: 14px; }
.sidebar .table-note { font-size: 11px; }
.table-area { display: flex; flex-direction: column; gap: 4px; min-width: 0; min-height: 0; overflow: hidden; }
.game-layout > .table-area { grid-column: 2; }
.game-stages { flex-shrink: 0; margin: 0; min-height: 22px; }
.game-stages li { font-size: 10px; }
.game-stages li > span { width: 18px; height: 18px; }
.contract-summary { margin: 0; padding: 6px 10px; gap: 8px; }
.contract-summary-copy { gap: 1px; }
.contract-summary-copy strong { font-size: 15px; }
.contract-summary-copy small { font-size: 10px; }
.contract-summary-label { font-size: 9px; }
.called-card-marker { width: 28px; height: 38px; flex-basis: 28px; }
.called-card-marker > span { font-size: 20px; }
.table-topline { flex: 0 0 auto; flex-wrap: nowrap; min-height: 30px; margin: 0; padding: 3px 6px; gap: 6px; }
#table-message { font-size: 12px; line-height: 1.3; }
.turn-pill { flex-shrink: 0; padding: 4px 6px; font-size: 9px; }
.table-topline .turn-clock { flex: 0 0 98px; width: 98px; max-width: 98px; padding: 3px 5px; }
.turn-clock-heading b { font-size: 13px; }
.turn-clock-heading small { display: none; }
.turn-clock-heading { min-width: 0; gap: 4px; }
.felt-table { flex: 1 1 0; min-height: 140px; height: auto; max-height: none; border-radius: 100px; margin: 0; }
.player-bar { flex: 0 0 auto; min-height: 32px; margin: 0; padding: 3px 8px; }
.player-bar .avatar { width: 26px; height: 26px; flex-basis: 26px; font-size: 13px; }
.player-bar .seat-meta strong { font-size: 11px; }
.player-badge { font-size: 9px; }
.hand-area { --viewport-card-height: clamp(64px, 9dvh, 96px); flex: 0 0 auto; min-height: 0; padding: 4px 6px 0; }
.hand-heading { margin: 0 0 3px; gap: 2px 6px; font-size: 10px; }
.hand-hint { font-size: 11px; line-height: 1.25; }
.hint-button { min-height: 25px; padding: 2px 7px; font-size: 10px; }
.hand { height: calc(var(--viewport-card-height) + 12px); min-height: 0; padding: 6px 3px; }
.hand > .card, .hand.hand-grid > .card, .hand.hand-grid > .card.suit-start:not(:first-child) { height: var(--viewport-card-height); }
.hand.hand-grid { height: auto; min-height: 0; grid-template-rows: repeat(var(--hand-rows), var(--viewport-card-height)); row-gap: 3px; padding-bottom: 3px; }
.hand.hand-scrollable { overflow-x: auto; overflow-y: hidden; scrollbar-width: none; touch-action: pan-x; }
.card-reading-key { display: none; }
.action-dock { flex: 0 0 auto; min-height: 48px; margin: 0; padding: 5px; gap: 4px; }
.bid-actions { width: 100%; flex-wrap: nowrap; gap: 4px; }
.bid-button, .pass-button { flex: 1 1 0; min-width: 0; min-height: 40px; padding: 5px 3px; font-size: 10px; white-space: normal; }
.bid-button em { display: none; }
.bid-button small { margin-left: 3px; font-size: 9px; }
.dock-copy strong, .play-message-copy strong { font-size: 12px; }
.dock-copy small, .play-message-copy small { font-size: 10px; line-height: 1.3; }
.dock-copy .dock-icon { font-size: 19px; }
.call-actions { width: 100%; flex-wrap: wrap; gap: 4px; }
.call-action-intro { font-size: 10px; line-height: 1.2; }
.call-actions .call-button { flex: 1 1 0; min-width: 0; min-height: 42px; height: 42px; padding: 3px; gap: 4px; }
.call-card-preview { flex-basis: 22px; height: 34px; }
.call-card-preview > .card { width: 22px; height: 34px; }
.call-card-copy strong { font-size: 10px; line-height: 1.15; }
.call-card-copy small { display: none; }
.discard-actions { gap: 5px; flex-wrap: nowrap; }
.discard-instruction { font-size: 10px; line-height: 1.2; }
.confirm-button { min-height: 36px; padding: 6px 9px; font-size: 11px; }
.table-footer { flex: 0 0 18px; height: 18px; min-height: 0; font-size: 9px; }
.table-area:has(#score-breakdown:not([hidden])) .felt-table,
.table-area:has(#score-breakdown:not([hidden])) .hand-area { display: none; }
.score-breakdown { flex: 1 1 auto; min-height: 0; overflow: auto; }
.table-tools-panel { max-height: calc(100dvh - 60px); overflow-y: auto; }
.table-tools-panel #jump-score { width: 100%; height: auto; text-align: left; font-size: 13px; }
.table-score-dialog .sidebar { display: block; height: auto; overflow: visible; }
.table-score-dialog .sidebar > .section-label, .table-score-dialog .table-note { display: block; }
.table-score-dialog .score-card { display: block; margin-top: 12px; }
.table-score-dialog .modal-close { z-index: 2; }
.table-score-dialog h2 { padding-right: 36px; }
.felt-table .dog-pile.dog-public-discard {
  width: auto; max-width: 90%; height: auto; min-height: 0; bottom: 12px;
  padding: 4px 9px; border-radius: 12px; background: #103b33;
  color: #f5ebd0; font-size: 11px; line-height: 1.3; text-align: center;
  opacity: 1; visibility: visible;
}

.settings-modal > .modal-close { z-index: 2; }
.settings-modal .music-next-setting { display: block; margin-left: auto; }

@media (max-height: 560px) {
  .settings-modal { padding: 16px 20px; }
  .settings-modal > .modal-symbol { display: none; }
  .settings-modal > .section-label { padding-right: 40px; }
  .settings-modal h2 { margin: 4px 0 8px; font-size: 24px; }
  .settings-modal .setting-volume {
    grid-template-columns: minmax(0, 1fr) 36px minmax(80px, 1fr);
    gap: 8px;
    padding: 5px 0;
    font-size: 12px;
  }
  .settings-modal .setting-volume input { grid-column: auto; min-height: 26px; }
  .settings-modal .music-next-setting { margin-block: 0; }
  .settings-modal > .settings-shortcuts { margin-top: 8px; font-size: 11px; }
}

@media (max-width: 1000px) {
  .game-layout { grid-template-columns: minmax(0, 1fr); }
  .game-layout > .table-area { grid-column: 1; }
  .game-layout > .sidebar { display: none; }
  .training-home .welcome-layout { grid-template-columns: minmax(0, 1fr); }
  .training-home .welcome-story { display: none; }
  .training-home .welcome-start { width: min(640px, 100%); justify-self: center; }
}
@media (max-width: 760px) {
  .welcome-screen.training-home { padding: 6px 10px; }
  .training-home .welcome-shell { gap: 6px; grid-template-rows: auto auto minmax(0, 1fr); }
  .training-home .welcome-brand { min-height: 38px; }
  .training-home .welcome-brand small { display: none; }
  .training-home .welcome-footer { display: none; }
  .home-tabs button { flex: 1; min-height: 36px; padding: 5px 8px; font-size: 12px; }
  .training-home .welcome-start { border-radius: 12px; }
  .training-home .welcome-options label { font-size: 12px; }
  .training-home .welcome-options select { font-size: 13px; }
  .training-home .welcome-dashboard-card { padding: 12px; }
  .app-shell { padding: 0 6px 4px; }
  .topbar { flex-basis: 44px; height: 44px; min-height: 44px; }
  .topbar :is(.icon-button, .home-button, .new-game-button) { width: 32px; min-width: 32px; height: 32px; min-height: 32px; }
  .topbar .messenger-toggle { width: 32px; height: 32px; padding: 0; }
  .topbar .messenger-badge { position: absolute; top: 4px; right: 4px; min-width: 6px; width: 6px; height: 6px; padding: 0; border: 0; border-radius: 50%; background: #38705a; font-size: 0; }
  .messenger-button-label { display: none; }
  .table-tools > summary { min-height: 32px; padding: 0 7px; }
  .table-tools-panel { top: 44px; }
  .topbar .table-leave-button { min-height: 32px; padding: 5px 8px; font-size: 11px; }
  .table-leave-button .leave-label-detail { display: none; }
  .game-layout { gap: 0; padding-top: 3px; }
  .table-area { order: initial; flex: 1; gap: 3px; }
  .game-stages, .table-footer { display: none; }
  .contract-summary { padding: 5px 7px; }
  .contract-summary-copy strong { font-size: 13px; }
  .contract-summary-copy small { font-size: 9px; }
  .contract-summary-call { padding-left: 6px; }
  .declarer-marker { display: none; }
  .table-topline { min-height: 28px; padding: 2px 4px; }
  #table-message { font-size: 11px; }
  .table-topline .turn-clock { flex-basis: 64px; width: 64px; max-width: 64px; }
  .turn-clock-heading small { display: none; }
  .turn-pill { font-size: 8px; }
  .felt-table { min-height: 130px; border-radius: 52px; }
  .seat-top { top: 12px; }
  .seat .avatar { width: 22px; height: 22px; flex-basis: 22px; font-size: 11px; }
  .seat { gap: 4px; max-width: 105px; }
  .seat-meta strong { font-size: 10px; }
  .seat-meta span { font-size: 8px; }
  .seat-indicators { left: 20px; gap: 2px; top: calc(100% + 2px); }
  .seat-indicators span, .seat-indicators .seat-role, .seat-indicators .seat-role.declarer-role, .seat-indicators .seat-role.solo-role { font-size: 7px; padding: 2px 3px; }
  .player-bar { min-height: 28px; padding: 2px 6px; }
  .player-badge { max-width: 63%; font-size: 8px; }
  .hand-area { --viewport-card-height: clamp(60px, 8dvh, 80px); padding: 3px 3px 0; }
  .hand-heading { font-size: 9px; }
  .legal-card-count { margin-left: 4px; font-size: 8px; }
  .hand-hint { font-size: 10px; }
  .action-dock { min-height: 44px; padding: 3px; }
  .bid-button, .pass-button { flex: 1 1 0; min-height: 38px; font-size: 9px; padding: 4px 2px; }
  .call-action-intro { display: none; }
  .messenger-toggle { bottom: 8px; right: 8px; min-height: 30px; padding: 5px 9px; font-size: 11px; }
}
@media (max-width: 400px) {
  .topbar:has(#leave-online-game:not([hidden])) .brand { display: none; }
  .topbar:has(#leave-online-game:not([hidden])) .top-actions { width: 100%; justify-content: space-between; }
}
@media (max-width: 360px) {
  .app-shell .topbar { flex-basis: 76px; height: 76px; min-height: 76px; }
  .app-shell .topbar .top-actions { flex-wrap: wrap; justify-content: flex-start; align-content: center; gap: 3px; }
  .app-shell .topbar .table-leave-button { margin-left: auto; }
}
@media (max-width: 400px) and (max-height: 620px) {
  .table-area .contract-summary { min-height: 50px; padding-block: 3px; }
  .table-area .called-card-marker { height: 36px; }
  .table-area:has(.contract-summary:not([hidden])) .player-bar { display: none; }
  .table-area:has(#action-dock[data-phase="discard"]) .hand-hint { display: none; }
}
@media (max-height: 700px) {
  .training-home .welcome-training-help, .training-home .welcome-training-caption, .training-home .welcome-start-heading small { display: none; }
  .training-home .welcome-training { margin-top: 10px; padding-top: 10px; }
  .training-home .welcome-primary, .training-home .welcome-secondary { min-height: 40px; padding: 7px 10px; }
  .training-home .welcome-options { margin: 8px 0; }
  .training-home .welcome-loyalty-summary { display: none; }
  .game-stages, .table-footer { display: none; }
  .sidebar .table-note, .sidebar .trick-history { display: none; }
  .hand-area { --viewport-card-height: 64px; }
}
/* Keep the home actions accessible on compact portrait screens. */
@media (max-width: 400px) and (max-height: 620px) {
  .welcome-screen.training-home { padding: 5px 8px; }
  .training-home .welcome-shell { gap: 5px; }
  .training-home .welcome-brand { min-height: 36px; }
  .home-tabs button { min-height: 32px; padding-block: 5px; }
  .welcome-screen.training-home .welcome-start { min-width: 0; padding: 6px; justify-content: flex-start; }
  .training-home .welcome-start-heading h2 { font-size: 20px; margin-block: 3px; }
  .training-home .welcome-training { margin-top: 7px; padding-top: 7px; }
  .training-home .welcome-training h3 { font-size: 18px; margin-block: 3px; }
  .training-home .welcome-options { margin-block: 5px; }
  .training-home .welcome-options label { gap: 3px; font-size: 11px; }
  .training-home .welcome-primary, .training-home .welcome-secondary { min-height: 36px; padding: 6px 8px; }
  .welcome-screen.training-home .welcome-primary, .welcome-screen.training-home .welcome-secondary { padding-block: 4px; font-size: 13px; }
  .welcome-screen.training-home #welcome-resume { margin-bottom: 3px; }
  .welcome-screen.training-home .welcome-training h3 { font-size: 18px; margin-block: 3px; }
  .welcome-screen.training-home .welcome-secondary-actions { margin-top: 2px; gap: 2px; }
  .training-home #save-mode-note { margin-block: 4px 0; font-size: 9px; line-height: 1.3; }
}
/* Short landscape screens place the hand beside the felt. */
@media (max-height: 500px) and (min-width: 480px) {
  .welcome-screen.training-home { padding: 5px 10px; }
  .training-home .welcome-shell { grid-template-rows: auto auto minmax(0, 1fr); gap: 4px; }
  .training-home .welcome-brand { min-height: 30px; }
  .training-home .welcome-audio-controls button { min-height: 30px; height: 30px; }
  .training-home .welcome-footer, .training-home .welcome-story { display: none; }
  .home-tabs button { min-height: 30px; padding: 4px 14px; }
  .training-home .welcome-layout { grid-template-columns: minmax(0, 1fr); }
  .training-home .welcome-start { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: minmax(0, 1fr) auto; align-items: center; width: 100%; padding: 10px; gap: 6px 16px; }
  .training-home .welcome-multiplayer { grid-column: 1; }
  .training-home .welcome-training { grid-column: 2; grid-row: 1; margin: 0; padding: 0 0 0 12px; border-top: 0; border-left: 1px solid #ddd6c6; }
  .training-home .welcome-training h3 { font-size: 17px; }
  .training-home .welcome-start-heading h2 { font-size: 22px; }
  .training-home .welcome-start-heading > span { font-size: 9px; }
  .training-home .welcome-options { gap: 6px; margin: 5px 0; }
  .training-home .welcome-options select { height: 32px; padding: 0 5px; }
  .training-home .welcome-options label { gap: 2px; font-size: 10px; }
  .training-home #welcome-local { margin: 4px 0 0; font-size: 12px; }
  .training-home #welcome-local small { display: none; }
  .training-home .welcome-secondary-actions { grid-row: 2; grid-column: 1 / -1; margin: 0; }
  .training-home .welcome-secondary-actions .welcome-rules { min-height: 24px; }
  .training-home #welcome-resume { grid-column: 1 / -1; grid-row: 1; margin: 0; }
  .training-home .welcome-start:has(#welcome-resume:not([hidden])) { grid-template-rows: auto minmax(0, 1fr) auto; }
  .training-home .welcome-start:has(#welcome-resume:not([hidden])) .welcome-multiplayer,
  .training-home .welcome-start:has(#welcome-resume:not([hidden])) .welcome-training { grid-row: 2; }
  .training-home .welcome-start:has(#welcome-resume:not([hidden])) .welcome-secondary-actions { grid-row: 3; }
  .training-home .welcome-account-card > p, .training-home .welcome-friends-card .welcome-dashboard-caption, .training-home .dashboard-friend-help { display: none; }
  .training-home .welcome-dashboard-card { padding: 8px 14px; }
  .training-home .welcome-account-card h2 { font-size: 18px; margin: 3px 0; }
  .training-home .welcome-token-summary { padding: 6px; margin-top: 4px; }
  .topbar { flex-basis: 38px; height: 38px; min-height: 38px; }
  .game-layout { grid-template-columns: minmax(0, 1fr); }
  .game-layout > .table-area { grid-column: 1; }
  .game-layout > .sidebar { display: none; }
  .table-area { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr) auto; gap: 3px 10px; }
  .contract-summary { grid-column: 1; grid-row: 1; padding: 4px 6px; }
  .contract-summary-copy strong { font-size: 12px; }
  .contract-summary-copy small { font-size: 9px; }
  .contract-summary-label { font-size: 8px; }
  .declarer-marker { display: none; }
  .table-topline { grid-column: 1; grid-row: 2; }
  .felt-table { grid-column: 1; grid-row: 3; min-height: 100px; height: 100%; border-radius: 44px; }
  .player-bar { grid-column: 1; grid-row: 4; }
  .hand-area { grid-column: 2; grid-row: 1 / 4; align-self: center; --viewport-card-height: clamp(70px, 25dvh, 105px); }
  .action-dock { grid-column: 2; grid-row: 4; align-self: end; }
  .hand-heading { gap: 4px; }
  .call-actions .call-button { height: 44px; }
  .call-card-preview { display: none; }
  .seat .avatar { display: none; }
  .seat-indicators { left: 0; }
  .seat-meta strong { font-size: 10px; }
  .seat-meta span { font-size: 8px; }
  .seat-top { top: 10px; }
  .played-card .card { width: 32px; min-width: 32px; height: 48px; }
  .dog-reveal-cards .card { width: 27px; height: 41px; min-width: 27px; }
  .felt-table .dog-pile:not(.dog-revealed):not(.dog-public-discard) { height: auto; min-height: 40px; width: min(160px, 50%); padding: 4px 6px; bottom: 12px; }
  .dog-pile-heading small { display: none; }
  .felt-table .dog-pile:not(.dog-revealed) .dog-pile-heading small { display: block; margin-top: 2px; font-size: 9px; line-height: 1.2; }
  .score-breakdown { grid-column: 1; grid-row: 3; }
  .analysis-button { grid-column: 2; grid-row: 3; align-self: end; }
}
.chelem-actions { display: flex; gap: 8px; width: 100%; align-items: stretch; }
.chelem-actions > button { flex: 1; min-width: 0; white-space: normal; }
.modal-card > .modal-close { z-index: 2; }
#announcements-content { display: grid; gap: 10px; font-size: 12px; }
#announcements-content > button { text-align: left; white-space: normal; line-height: 1.5; }
.loyalty-daily { background: #f3ecd8; padding: 12px; border-radius: 10px; margin-block: 10px; font-size: 12px; }
.loyalty-daily p { line-height: 1.5; margin-bottom: 0; }
.daily-return { color: #83683a !important; }
.results-calculation { margin-block: 10px; font-size: 11px; line-height: 1.6; color: #4e6254; }
.results-calculation summary { cursor: pointer; font-weight: 600; }
#modal-backdrop > .modal-card { display: flex; flex-direction: column; width: min(760px, 100%); max-width: 760px; max-height: calc(100dvh - 32px); }
#modal-backdrop .modal-symbol { display: none; }
.rules-tabs { display: flex; gap: 5px; margin: 8px 0; flex: none; }
.rules-tabs button { flex: 1; border: 1px solid #ded7c6; border-radius: 6px; padding: 8px 4px; background: #f5f1e7; color: #385343; cursor: pointer; }
.rules-tabs [aria-pressed="true"] { background: #244b3e; color: white; }
.rules-pages { min-height: 0; overflow: auto; scrollbar-width: none; font-size: 12px; line-height: 1.6; }
.rules-pages::-webkit-scrollbar { display: none; }
.rules-pages table { width: 100%; border-collapse: collapse; font-size: 11px; }
.rules-pages th, .rules-pages td { padding: 7px 4px; border-bottom: 1px solid #e0d9c8; text-align: left; }
.rules-pages h3 { font-size: 14px; margin-bottom: 6px; }
#modal-backdrop .rules-source { font-size: 10px; line-height: 1.4; padding-top: 12px; flex: none; }
@media (max-height: 600px) { #modal-backdrop > .modal-card { padding: 16px; } #modal-backdrop h2 { font-size: 22px; margin: 0; } #modal-backdrop .section-label { display: none; } .daily-return { font-size: 10px; min-height: 24px !important; } }
