/* ==========================================================================
   ADAPTIVE TYPOGRAPHY — selected font size + live copy pressure
   Keeps controls readable without allowing long labels to collide.
   ========================================================================== */
:root{
  --mobile-card-widen:1;
  --modal-widen:1;
  --adaptive-label-tracking:1;
}

/* All seat-top markers are atomic labels: no wrapping, no character splitting. */
.role-strip{
  width:max-content;max-width:none;flex-wrap:nowrap;align-items:center;opacity:.92;
}
.role-badge{
  flex:0 0 auto;width:max-content;max-width:none;
  white-space:nowrap;text-wrap:nowrap;word-break:keep-all;overflow-wrap:normal;
  line-height:1;letter-spacing:calc(.05em * var(--adaptive-label-tracking));
}
.role-badge.turn{min-width:calc(2em + 12px)}
.role-badge.sb,.role-badge.bb{
  opacity:1;
  background:
    radial-gradient(circle at 18% 22%,rgba(255,255,255,.17) 0 1px,transparent 1.4px),
    radial-gradient(circle at 74% 68%,rgba(255,255,255,.11) 0 1px,transparent 1.5px),
    repeating-linear-gradient(135deg,rgba(255,255,255,.075) 0 1px,transparent 1px 3px),
    linear-gradient(180deg,rgba(32,52,78,.98),rgba(15,25,40,.99));
  background-size:7px 7px,9px 9px,auto,auto;
  border-color:rgba(145,202,255,.78);
  color:#c4e2ff;
  box-shadow:0 5px 12px rgba(0,0,0,.52),inset 0 1px 0 rgba(255,255,255,.15),0 0 10px rgba(70,145,215,.12);
  -webkit-backdrop-filter:blur(8px) saturate(1.18);
  backdrop-filter:blur(8px) saturate(1.18);
}

/* Result undealt cards use the same reserved-slot language as the table. */
.result-board .card.placeholder{
  background:rgba(255,255,255,.055);
  border:1px dashed rgba(255,255,255,.28);
  box-shadow:inset 0 0 0 1px rgba(0,0,0,.12);
  color:transparent;
}
.result-board .card.placeholder::before{
  content:"♤";position:absolute;inset:0;display:grid;place-items:center;
  font-size:1.2rem;color:rgba(255,255,255,.12);
}
.result-board .card.placeholder:nth-child(2)::before{content:"♡"}
.result-board .card.placeholder:nth-child(3)::before{content:"♧"}
.result-board .card.placeholder:nth-child(4)::before{content:"♢"}
.result-board .card.placeholder:nth-child(5)::before{content:"♤"}

/* Modals widen with the selected font size where viewport space is available. */
@media (min-width:1001px){
  .modal:not(.narrow){max-width:calc(100vw - 40px)}
  .result-modal{width:min(calc(640px * var(--modal-widen)),calc(100vw - 40px))}
  .mode-modal{width:min(calc(680px * var(--modal-widen)),calc(100vw - 40px))}
  .room-modal{width:min(calc(760px * var(--modal-widen)),calc(100vw - 40px))}
  .setup-modal-shell{width:min(calc(920px * var(--modal-widen)),calc(100vw - 40px))}
  html[data-font-band="large"] .game-shell,
  html[data-font-band="xlarge"] .game-shell{column-gap:clamp(14px,1vw,20px)}
}

html[data-font-band="large"] .modal-head,
html[data-font-band="xlarge"] .modal-head{padding-inline:clamp(18px,2vw,28px)}
html[data-font-band="large"] .modal-body,
html[data-font-band="xlarge"] .modal-body{padding-inline:clamp(18px,2vw,28px)}
html[data-font-band="large"] .modal-actions,
html[data-font-band="xlarge"] .modal-actions{padding-inline:clamp(18px,2vw,28px)}

/* ---------- 桌面大字号：公共牌空白区收缩，高度让给 AI 信息卡轨道 ----------
   轨道随 --ui-widen 加高（见 03 .table-stage），公共牌缩到短屏档位的既有
   56×79 尺寸，视觉语言一致。QHD(≥2200) 空间充足不收缩；≤870px 短屏档有
   自己的 48×68 压缩牌，不覆盖。 */
@media (min-width:1001px) and (max-width:2199px) and (min-height:871px){
  html[data-font-band="large"] .community,
  html[data-font-band="xlarge"] .community{min-height:76px}
  html[data-font-band="large"] .community .card,
  html[data-font-band="xlarge"] .community .card{--cw:56px;--ch:79px;--crank:1.3rem;--csuit:1.3rem}
}
/* 短屏桌面 + 大字号：压缩无法同时容纳加高轨道与 HUD——改为整页纵向滚动，
   舞台给到能完整容纳「加高轨道 + felt + HUD」的地板高度
   （与 11 号 ≤745px 档同一策略，只是触发高度随字号提前）。 */
@media (min-width:1001px) and (max-height:870px){
  html[data-font-band="large"] body,
  html[data-font-band="xlarge"] body{overflow-y:auto}
  html[data-font-band="large"] .app,
  html[data-font-band="xlarge"] .app{height:auto;min-height:100vh;min-height:100dvh}
  html[data-font-band="large"] .table-zone,
  html[data-font-band="xlarge"] .table-zone,
  html[data-font-band="large"] .table-layout,
  html[data-font-band="xlarge"] .table-layout{height:auto}
  html[data-font-band="large"] .table-stage{min-height:434px}
  html[data-font-band="xlarge"] .table-stage{min-height:448px}
  html[data-font-band="large"] .sidebar,
  html[data-font-band="xlarge"] .sidebar{max-height:calc(100dvh - 84px)}
}
html[data-copy-pressure="medium"] :is(.side-title-code,.role-badge,.hero-ledger-label,.field>label),
html[data-copy-pressure="high"] :is(.side-title-code,.role-badge,.hero-ledger-label,.field>label){
  letter-spacing:calc(.06em * var(--adaptive-label-tracking));
}

@media (max-width:1000px){
  /* Wider cards are harmless in the horizontal rail and preserve full names/status at large font sizes. */
  #seats .seat{width:calc(186px * var(--mobile-card-widen))}
  .role-strip{opacity:1;gap:4px}
  .role-badge{min-width:19px;padding-inline:5px}
  .role-badge.turn{min-width:calc(2em + 10px)}
  .mobile-player-state-line{min-width:0;flex-wrap:nowrap}
  .mobile-player-state-line :is(.status-chip,.position-chip){flex:0 0 auto;white-space:nowrap;text-wrap:nowrap;word-break:keep-all}
  .modal-actions .btn{min-width:max-content}
  html[data-font-band="large"] .modal-actions .btn,
  html[data-font-band="xlarge"] .modal-actions .btn{flex:1 1 132px}
  .result-section-head{flex-wrap:wrap;align-items:flex-start}
  .result-section-head span{margin-left:auto;text-align:right}
}

@media (max-width:700px) and (orientation:portrait),(max-width:960px) and (pointer:coarse) and (orientation:portrait){
  .seat-wager{bottom:-13px}
  .result-reveal-row{grid-template-columns:minmax(0,1fr) auto;gap:8px}
  .result-hole-cards{grid-column:1/-1;justify-content:flex-end}
  html[data-font-band="xlarge"] .hero-card-header{grid-template-columns:auto minmax(0,1fr) minmax(64px,auto)}
  html[data-font-band="xlarge"] .hero-primary-stack{min-width:64px}
}

@media (max-width:1000px) and (orientation:landscape),(max-height:540px) and (orientation:landscape) and (pointer:coarse){
  #seats .seat{width:calc(168px * var(--mobile-card-widen))}
  .role-strip{top:-7px;opacity:1}
  .role-badge{min-width:17px;height:15px;padding-inline:4px;font-size:.4rem}
  .role-badge.turn{min-width:calc(2em + 8px)}
  /* Move the wager/chip pill below the status row instead of letting it ride into it. */
  .seat-wager{bottom:-12px}
  .wager-increment{bottom:-9px}
  html[data-font-band="large"] .game-shell{grid-template-columns:minmax(0,1fr) clamp(300px,35vw,350px)}
  html[data-font-band="xlarge"] .game-shell{grid-template-columns:minmax(0,1fr) clamp(318px,37vw,374px)}
  html[data-font-band="large"] .hero-card-header,
  html[data-font-band="xlarge"] .hero-card-header{padding-inline:7px}
  html[data-font-band="large"] .hero-stat-grid,
  html[data-font-band="xlarge"] .hero-stat-grid{grid-template-columns:repeat(4,minmax(0,1fr))}
}

/* Reserve a real footer lane for mobile wagers. The pill may straddle the card
   edge, but it must never enter the snapshot/status row. */
@media (max-width:700px) and (orientation:portrait),(max-width:960px) and (pointer:coarse) and (orientation:portrait){
  #seats .player-box{padding-bottom:12px}
  #seats .mobile-player-snapshot{margin-bottom:0}
}
@media (max-width:1000px) and (orientation:landscape),(max-height:540px) and (orientation:landscape) and (pointer:coarse){
  #seats .player-box{padding-bottom:11px}
  #seats .mobile-player-snapshot{margin-bottom:0}
  .hero-info{
    display:grid;
    grid-template-columns:minmax(0,1fr);
    grid-template-rows:minmax(0,1fr) auto;
  }
}

/* Final mobile wager clearance: reserve enough footer space for both the pill
   and its +N animation, with neither crossing the status snapshot. */
@media (max-width:700px) and (orientation:portrait),(max-width:960px) and (pointer:coarse) and (orientation:portrait){
  #seats .player-box{padding-bottom:17px}
  .seat-wager{bottom:-18px}
  .wager-increment{top:-10px;bottom:auto}
}
/* Landscape rail gets a real wager lane: the pill hangs below the card and the
   +N increment floats BELOW the pill (never inside the card, where even a
   1–2px collision with the last-action glyph was measurable at top:-10px).
   Lane budget: seat bottom inset 26px = pill 16px + increment ~8px + 2px. */
@media (max-width:1000px) and (orientation:landscape),(max-height:540px) and (orientation:landscape) and (pointer:coarse){
  .table-stage{--player-rail-h:130px;--mobile-rail-h:130px}
  #seats .player-box{padding-bottom:17px}
  .seat-wager{bottom:-16px}
  .wager-increment{top:auto;bottom:-8px}
}
