/* gcp:css/fit.css — one-screen scale. Loaded last so it wins over breakpoint px. */

.seat-backs, .seat-backs .n { display: none !important; }

#app.table-view {
  overflow: hidden;
  height: var(--app-vh, 100dvh);
  max-height: var(--app-vh, 100dvh);
}

#app.table-view .table-stage {
  min-height: 0;
  overflow: hidden;
}

#app.table-view .stage-board {
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#app.table-view .felt {
  flex: 1 1 0;
  min-height: 0;
  container-type: size;
}

#app.table-view .hand-dock,
#app.table-view .toolbar,
#app.table-view .bk-toolbar,
#app.table-view .status-bar,
#app.table-view .info-bar,
#app.table-view .bk-names-row,
#app.table-view .sg-coach,
#app.table-view .gk-coach,
#app.table-view .bl-bunts-live {
  flex-shrink: 0;
}

/* Chrome uses --ui-scale; cards keep --table-scale */
#app.table-view .toolbar,
#app.table-view .bk-toolbar {
  padding: calc(5px * var(--ui-scale)) calc(8px * var(--ui-scale));
  gap: calc(6px * var(--ui-scale));
  z-index: 50;
}

#app.table-view .btn-icon {
  width: var(--tap);
  height: var(--tap);
  min-width: var(--tap);
  min-height: var(--tap);
}

#app.table-view .bk-scorechip {
  min-height: max(28px, calc(32px * var(--ui-scale)));
  font-size: max(10px, calc(11px * var(--ui-scale)));
  padding: calc(3px * var(--ui-scale)) calc(8px * var(--ui-scale));
}
#app.table-view .bk-scorechip b {
  font-size: max(13px, calc(15px * var(--ui-scale)));
}

#app.table-view .score-chip,
#app.table-view .hand-open-chip {
  font-size: max(11px, var(--type-sm));
  padding: calc(3px * var(--ui-scale)) calc(8px * var(--ui-scale));
}

#app.table-view .bk-names {
  min-height: max(28px, calc(34px * var(--ui-scale)));
  padding: calc(3px * var(--ui-scale)) calc(6px * var(--ui-scale));
}
#app.table-view .bk-names .ts-player,
#app.table-view .ts-player {
  font-size: max(11px, calc(13px * var(--ui-scale)));
  padding: calc(2px * var(--ui-scale)) calc(8px * var(--ui-scale));
}

#app.table-view .status-bar {
  gap: calc(5px * var(--ui-scale));
  padding: calc(4px * var(--ui-scale)) calc(8px * var(--ui-scale));
}
#app.table-view .player-status {
  padding: calc(5px * var(--ui-scale)) calc(7px * var(--ui-scale));
}
#app.table-view .ps-head { margin-bottom: calc(3px * var(--ui-scale)); }
#app.table-view .ps-name { font-size: max(11px, calc(13px * var(--ui-scale))); }
#app.table-view .ps-lab { font-size: max(9px, calc(11px * var(--ui-scale))); }
#app.table-view .ps-metric { min-height: 0; }
#app.table-view .ps-num {
  font-size: max(13px, calc(16px * var(--ui-scale)));
  padding: calc(2px * var(--ui-scale)) calc(6px * var(--ui-scale));
}
#app.table-view .ps-metric.score .ps-num,
#app.table-view .ps-board.solo .ps-num {
  font-size: max(15px, calc(20px * var(--ui-scale)));
}

#app.table-view .trick-name {
  font-size: max(10px, calc(11px * var(--ui-scale)));
  padding: calc(2px * var(--ui-scale)) calc(7px * var(--ui-scale));
}

#app.table-view .table-msg {
  font-size: max(12px, calc(13px * var(--ui-scale)));
  padding: calc(5px * var(--ui-scale)) calc(12px * var(--ui-scale));
}

#app.table-view .bk-bidbar .btn {
  min-height: max(40px, calc(44px * var(--ui-scale)));
  font-size: max(14px, calc(16px * var(--ui-scale)));
  padding: calc(8px * var(--ui-scale)) calc(16px * var(--ui-scale));
}

#app.table-view .sg-coach,
#app.table-view .gk-coach {
  margin: 0 calc(6px * var(--ui-scale)) calc(6px * var(--ui-scale));
  padding: calc(8px * var(--ui-scale)) calc(10px * var(--ui-scale));
  gap: calc(8px * var(--ui-scale));
}
#app.table-view .sg-coach-kicker { font-size: max(10px, calc(10px * var(--ui-scale))); }
#app.table-view .sg-coach-title { font-size: max(13px, calc(15px * var(--ui-scale))); }
#app.table-view .sg-coach-body {
  font-size: max(12px, calc(13px * var(--ui-scale)));
  max-height: 4.6em;
  overflow: hidden;
}

#app.table-view .hand-dock {
  max-height: none;
  padding: calc(4px * var(--ui-scale)) calc(8px * var(--ui-scale)) calc(8px * var(--ui-scale));
}
#app.table-view .hand-row {
  max-height: calc(var(--card-h) * 2.35 + 40px);
}

/* Felt cards follow the same card token */
#app.table-view .felt.hand-cloth {
  --felt-card-w: calc(var(--card-w) * 1.12);
  --felt-card-h: calc(var(--card-h) * 1.12);
  --felt-pile-w: calc(var(--card-w) * 0.9);
  --felt-pile-h: calc(var(--card-h) * 0.9);
  overflow: hidden;
}
#app.table-view .table-stage.view-sabeeta .felt.hand-cloth {
  overflow: visible;
}

html[data-layout="phone"] #app.table-view .toolbar,
html[data-layout="phone"] #app.table-view .bk-toolbar {
  flex-wrap: nowrap;
  padding: 4px 6px;
  gap: 4px;
}
html[data-layout="phone"] #app.table-view .toolbar .scores {
  flex-wrap: nowrap;
  min-width: 0;
  overflow: hidden;
}
html[data-layout="phone"] #app.table-view .table-stage.view-sabeeta .status-bar.n4 {
  grid-template-columns: 1fr 1fr !important;
  gap: 4px;
  padding: 3px 6px 4px;
}
html[data-layout="phone"] #app.table-view .table-stage.view-sabeeta .player-status {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  min-height: 0;
}
html[data-layout="phone"] #app.table-view .table-stage.view-sabeeta .ps-head {
  margin-bottom: 0;
  flex: 1;
  min-width: 0;
  gap: 3px;
}
html[data-layout="phone"] #app.table-view .table-stage.view-sabeeta .ps-name {
  font-size: 12px;
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
html[data-layout="phone"] #app.table-view .table-stage.view-sabeeta .ps-hearts { display: none; }
html[data-layout="phone"] #app.table-view .table-stage.view-sabeeta .ps-pens { display: inline-flex; }
html[data-layout="phone"] #app.table-view .table-stage.view-sabeeta .taken-pile.sb-trophies { display: none; }
html[data-layout="phone"] #app.table-view .table-stage.view-sabeeta .sb-hearts { display: none; }
html[data-layout="phone"] #app.table-view .table-stage.view-sabeeta .ps-star { font-size: 11px; }
html[data-layout="phone"] #app.table-view .table-stage.view-sabeeta .ps-board.solo {
  flex-direction: row;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
html[data-layout="phone"] #app.table-view .table-stage.view-sabeeta .ps-lab { display: none; }
html[data-layout="phone"] #app.table-view .table-stage.view-sabeeta .ps-metric { min-height: 0; gap: 0; }
html[data-layout="phone"] #app.table-view .table-stage.view-sabeeta .ps-num,
html[data-layout="phone"] #app.table-view .table-stage.view-sabeeta .ps-metric.score .ps-num,
html[data-layout="phone"] #app.table-view .table-stage.view-sabeeta .ps-board.solo .ps-num {
  font-size: 14px;
  padding: 1px 6px 2px;
  min-width: 1.4em;
}
html[data-layout="phone"] #app.table-view .table-stage.view-sabeeta .ps-delta {
  font-size: 10px;
  align-self: center;
}

/* Trick cards grow with the cloth, not the hand */
#app.table-view .trick-area.seats-4 {
  width: auto;
  max-width: none;
  align-self: stretch;
  margin-inline: 0;
  flex: 1 1 0;
  padding: 6px 5%;
}
#app.table-view .trick-area.seats-3 {
  width: min(92%, 920px);
  align-self: center;
  margin-inline: auto;
  flex: 1 1 0;
}
#app.table-view .trick-p .pcard,
#app.table-view .trick-p .trick-slot,
#app.table-view .trick-p.team-us .pcard,
#app.table-view .trick-p.team-us .trick-slot {
  width: clamp(50px, min(16.5cqh, 12.5cqi), 120px);
  height: auto;
  aspect-ratio: 5 / 7;
  min-width: 0;
}
#app.table-view .trick-p.team-them .pcard,
#app.table-view .trick-p.team-them .trick-slot {
  width: clamp(44px, min(13.5cqh, 10.5cqi), 100px);
  height: auto;
  aspect-ratio: 5 / 7;
}
#app.table-view .trick-p .taken-pile .pcard,
#app.table-view .trick-p.team-us .taken-pile .pcard,
#app.table-view .trick-p.team-them .taken-pile .pcard {
  width: 24%;
  min-width: 22px;
  max-width: 32px;
  height: auto;
  aspect-ratio: 5 / 7;
}
#app.table-view .trick-p.team-us { min-width: 0; }
#app.table-view .trick-p.team-them { min-width: 0; }

#app.table-view .trick-area.seats-6 {
  width: min(92%, calc(var(--card-w) * 10));
  height: min(78%, calc(var(--card-h) * 5.2));
  min-height: calc(var(--card-h) * 3.4);
}
#app.table-view .trick-area.seats-6 .trick-p .pcard,
#app.table-view .trick-area.seats-6 .trick-p .trick-slot {
  width: clamp(44px, min(12cqh, 10cqi), 96px);
  height: auto;
  aspect-ratio: 5 / 7;
}

@media (max-height: 820px) {
  #app.table-view .ps-lab { display: none; }
  #app.table-view .sg-coach-body { max-height: 3.2em; }
}

/* 358: compact chrome so 16 cards + scores fit without overlap */
@media (max-width: 859px) {
  #app.table-view:has(.table-stage.view-sergeant) .header { display: none; }

  #app.table-view .table-stage.view-sergeant .status-bar,
  #app.table-view .table-stage.view-sergeant .status-bar.sg-status {
    gap: 4px;
    padding: 3px 4px 4px;
  }
  #app.table-view .table-stage.view-sergeant .player-status {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 2px;
    padding: 4px 5px 5px;
    min-height: 0;
  }
  #app.table-view .table-stage.view-sergeant .ps-head {
    margin: 0;
    width: 100%;
    min-width: 0;
    align-items: flex-start;
  }
  #app.table-view .table-stage.view-sergeant .ps-name {
    font-size: 12px;
    letter-spacing: 0;
    white-space: normal;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    line-height: 1.2;
    overflow-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
    text-overflow: unset;
  }
  #app.table-view .table-stage.view-sergeant .ps-board,
  #app.table-view .table-stage.view-sergeant .ps-board.sg-inline {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 3px;
    width: 100%;
    flex-shrink: 0;
  }
  #app.table-view .table-stage.view-sergeant .ps-lab { display: none; }
  #app.table-view .table-stage.view-sergeant .ps-metric { min-height: 0; gap: 0; }
  #app.table-view .table-stage.view-sergeant .ps-num {
    font-size: 12px;
    padding: 1px 5px;
    min-width: 1.3em;
  }
  #app.table-view .table-stage.view-sergeant .ps-metric.score .ps-num { font-size: 14px; }
  #app.table-view .table-stage.view-sergeant .hand-row {
    max-height: none;
    overflow: visible;
    padding-block: 18px 8px;
    gap: 12px 4px;
    align-items: flex-end;
    align-content: flex-end;
  }
  #app.table-view .table-stage.view-sergeant .hand-dock {
    max-height: none;
    overflow: visible;
    flex: 0 0 auto;
    padding: 2px 4px calc(12px + env(safe-area-inset-bottom, 0px));
  }
  #app.table-view .table-stage.view-sergeant .felt {
    min-height: 0;
    padding-bottom: 6px;
  }
  #app.table-view .table-stage.view-sergeant .trick-area.seats-3 {
    flex: 0 1 auto;
    width: min(96%, 420px);
    padding-bottom: 4px;
  }
  #app.table-view .table-stage.view-sergeant .actions { padding-top: 4px; }
  #app.table-view .table-stage.view-sergeant .trick-p .pcard,
  #app.table-view .table-stage.view-sergeant .trick-p .trick-slot {
    width: clamp(40px, min(12cqh, 13cqi), 68px);
  }
  #app.table-view .table-stage.view-sergeant .sg-coach-kicker,
  #app.table-view .table-stage.view-sergeant .sg-coach-body { display: none; }
  #app.table-view .table-stage.view-sergeant .sg-coach {
    margin: 0 4px 4px;
    padding: 5px 8px;
    gap: 6px;
    border-radius: 10px;
  }
  #app.table-view .table-stage.view-sergeant .sg-coach-title {
    font-size: 12px;
    line-height: 1.25;
  }
  #app.table-view .table-stage.view-sergeant .bk-hukm-corner {
    min-width: 0;
    padding: 4px 6px 3px;
    top: 4px;
    inset-inline-start: 4px;
  }
  #app.table-view .table-stage.view-sergeant .bk-hukm-corner .bk-hukm-sym { font-size: 18px; }
  #app.table-view .table-stage.view-sergeant .bk-hukm-nm { font-size: 9px; }

  /* 8-card deals (Baloot, 6-player Kout): one row, slightly smaller */
  #app.table-view .table-stage.hand-8 .hand-row {
    flex-wrap: nowrap;
    justify-content: center;
    gap: 6px 3px;
    max-height: none;
    overflow: visible;
    padding-block: 16px 6px;
  }
  #app.table-view .table-stage.hand-8 .suit-gap {
    flex: 0 0 2px;
    width: 2px;
    min-width: 2px;
    overflow: hidden;
    pointer-events: none;
  }
  #app.table-view .table-stage.hand-8 .hand-row .pcard {
    width: min(var(--card-w), calc((100% - 42px) / 8));
    height: auto;
    aspect-ratio: 5 / 7;
    flex: 0 0 auto;
  }
}

html[data-layout="tablet-land"] .table-stage.view-sergeant .hand-dock {
  max-height: none !important;
  overflow: visible;
}
html[data-layout="tablet-land"] .table-stage.view-sergeant .hand-row {
  flex-wrap: wrap !important;
  overflow-x: hidden !important;
  max-height: calc(var(--card-h) * 2.2 + 24px);
}
html[data-layout="tablet-land"] .table-stage.view-sergeant .actions {
  flex-shrink: 0;
  position: relative;
  z-index: 6;
}
html[data-layout="tablet-land"] .table-stage.view-sergeant .status-bar {
  gap: 4px;
  padding: 2px 6px;
}
html[data-layout="tablet-land"] .table-stage.view-sergeant .player-status {
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 3px 6px;
}
html[data-layout="tablet-land"] .table-stage.view-sergeant .ps-head { margin: 0; }
html[data-layout="tablet-land"] .table-stage.view-sergeant .ps-lab { display: none; }
html[data-layout="tablet-land"] .table-stage.view-sergeant .ps-board,
html[data-layout="tablet-land"] .table-stage.view-sergeant .ps-board.sg-inline {
  flex-direction: row;
  gap: 4px;
}
html[data-layout="tablet-land"] .table-stage.view-sergeant .ps-num { font-size: 13px; padding: 1px 5px; }
html[data-layout="tablet-land"] .table-stage.view-sergeant .ps-metric.score .ps-num { font-size: 15px; }
html[data-layout="tablet-land"] .table-stage.view-sergeant .sg-coach-kicker,
html[data-layout="tablet-land"] .table-stage.view-sergeant .sg-coach-body { display: none; }

#app.table-view .end-mask,
#app.table-view .stage-board .end-mask {
  z-index: 80;
}
@media (max-width: 859px) {
  #app.table-view .stage-board .end-mask {
    position: fixed;
    inset: 0;
    padding: 12px;
  }
}
html[data-layout="tablet-land"] .stage-board .end-mask {
  position: fixed;
  inset: 0;
  z-index: 80;
  padding: 12px;
}
#app.table-view .end-mask .btn.primary {
  min-height: 44px;
  min-width: 8.5em;
  touch-action: manipulation;
}

