/* On the wide table the forecast and the wall share one column. */
.trial-anchor:empty { display: none; }
.qt-own > .trial-anchor {
  grid-area: wall;
  position: relative;
  z-index: 3;
  align-self: start;
  width: 100%;
  height: 0;
}
.qt-own > .trial-anchor > .trial-readout {
  position: absolute;
  bottom: 8px;
  inset-inline: 0;
}
.trial-readout {
  box-sizing: border-box;
  margin: 0;
  padding: 0 4px;
  min-width: 0;
  color: #fff3ce;
  text-align: left;
  font-variant-numeric: tabular-nums;
  font-weight: 450;
  line-height: 1.4;
}
.trial-summary { display: grid; grid-template-columns: minmax(0, .88fr) minmax(0, 1.12fr); align-items: start; gap: 8px; }
.trial-caption span { display: inline-block; }
.trial-metric { flex: 0 0 auto; }
.trial-caption, .trial-types h4 {
  color: #d6e1d3;
  font: inherit;
  font-size: 12px;
  line-height: 1.4;
  margin: 0 0 4px;
}
.trial-number {
  font: 500 clamp(40px, 4.4vw, 60px)/.94 "Baskerville", "Palatino Linotype", Georgia, serif;
  font-variant-numeric: lining-nums tabular-nums;
  letter-spacing: -.055em;
  white-space: nowrap;
}
.trial-number span { font-size: .46em; margin-left: .09em; letter-spacing: -.03em; }
.trial-types { flex: 1; min-width: 0; padding-left: 9px; border-left: 1px solid #c9d6b94a; }
.trial-types dl, .trial-risk dl { margin: 0; }
.trial-types dl > div { display: flex; align-items: baseline; justify-content: space-between; gap: 4px; }
.trial-types dt, .trial-types dd, .trial-types p, .trial-risk dt, .trial-risk dd {
  margin: 0; font-size: 12px; line-height: 1.5;
}
.trial-types dt { overflow-wrap: anywhere; color: #edf1e5; }
.trial-types dd, .trial-risk dd { font-weight: 630; color: #fff1c5; }
.trial-note { margin: 6px 0 0; font-size: 12px; line-height: 1.45; color: #e0e8d9; }
.trial-risk { border-top: 1px solid #c9d6b94a; margin: 7px 0 0; padding: 5px 0 0; }
.trial-risk header, .trial-risk dl, .trial-risk dl > div { display: flex; align-items: baseline; justify-content: space-between; gap: 3px; }
.trial-risk header b { color: #f4dfac; font-size: 12px; font-weight: 600; }
.trial-risk header small { color: #c9d9ce; font-size: 11px; }
.trial-risk dt { color: #ccdbd0; }
.deal-in-warning header b { color: #ffe1aa; }
.deal-in-warning.certain { border-color: #efa47a; }
.deal-in-warning.certain header b, .deal-in-warning.certain header small { color: #ffccaa; font-weight: 650; }
.qt-own:has(.deal-in-warning.certain) .qt-hand-tile.selected .qt-tap-cue { font-size: 0; background: #ffd7b9; }
.qt-own:has(.deal-in-warning.certain) .qt-hand-tile.selected .qt-tap-cue::before { content: '可点炮 · 再点打出'; font-size: 12px; }
.am-table:has(.deal-in-warning.certain) .am-hand .am-tile[aria-pressed="true"]::before { content: '可点炮 · 再点打出'; color: #ffd7b9; }
.discard-advice { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 8px; line-height: 1.55; text-align: start; }
.discard-advice strong { color: #ffdfa2; font-size: 14px; font-weight: 660; white-space: nowrap; }
.discard-advice small, .discard-advice span { color: #d3e1d5; font-weight: 450; font-size: 12px; }
.discard-advice small { color: #e0cba0; }
@container (min-width:641px) and (max-width:900px) {
  .qt-own > .trial-anchor { grid-area: trend; }
  .qt-own > .trial-anchor > .trial-readout { bottom: 5px; }
  .trial-summary { gap: 5px; }
  .trial-types { padding-left: 5px; }
}
@container (max-width:640px) {
  .qt-own {
    grid-template-areas: "person trend" "hand hand" "trial trial" "forecast forecast" "wall wall";
  }
  .qt-own > .trial-anchor { grid-area: forecast; position: static; height: auto; padding: 4px 0 8px; }
  .qt-own > .trial-anchor > .trial-readout { position: static; }
  .qt-own > .trial-anchor, .qt-own > #wall-panel { justify-self: end; width: min(100%, 295px); }
  .qt-own .qt-hero-data { justify-self: end; }
  .trial-number { font-size: 44px; }
  .trial-readout { padding: 0 6px; }
  .qt-own .qt-trial:has(.discard-advice) { min-height: 0; padding-bottom: 6px; }
}
/* Keep the lower right of a shallow table available while the hand stays put. */
@container (min-width:641px) {
  .qt-seat-1, .qt-seat-3 {
    margin-top: 0;
    margin-bottom: clamp(0px, calc(1005px - 103svh), 230px);
  }
}

/* Mark the physical tile before selection. Gold remains the discard confirmation. */
.qt-rack .qt-hand-tile.is-recommended:not(.selected) .qt-tile-face,
.am-table .am-hand .am-tile.is-recommended[aria-pressed="false"] {
  outline: 3px solid #79f7cd;
  outline-offset: 0;
  box-shadow: 0 0 0 5px #174a3c, 0 0 15px 4px #55d5a24d;
}
.is-recommended .recommend-mark {
  position: absolute;
  z-index: 2;
  right: -1px;
  top: -10px;
  display: grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  padding: 0 3px;
  border: 1px solid #c5ffe5;
  border-radius: 5px 5px 5px 1px;
  color: #123f31;
  background: #8af4c8;
  box-shadow: 0 1px 4px #11251a77;
  font: 700 12px/1 system-ui, sans-serif;
  pointer-events: none;
}
.qt-hand-tile.is-recommended.selected .recommend-mark { top: -9px; }
.trial-secondary-rate { color: #f6ecd6; font-size: 18px; font-weight: 550; }
.trial-number { font-size: clamp(32px, 3.6vw, 50px); }
.trial-caption span { display: block; }
.trial-horizon b { white-space: nowrap; }
.trial-proof { position: relative; margin: 5px 0 0; font-size: 12px; color: #dce6da; }
.trial-proof summary { cursor: pointer; width: fit-content; text-decoration: underline dotted #a8bfad; text-underline-offset: 3px; }
.trial-proof summary:focus-visible { outline: 2px solid #a0ecc3; outline-offset: 2px; }
.trial-proof-body {
  position: absolute;
  z-index: 8;
  inset-inline-end: 0;
  bottom: calc(100% + 5px);
  width: min(318px, 84vw);
  padding: 12px 14px;
  border: 1px solid #648576;
  border-radius: 8px;
  background: #163c30;
  box-shadow: 0 4px 14px #072b2180;
  max-height: min(45vh, 295px);
  overflow: auto;
}
.trial-proof-body h4, .trial-proof-body p, .trial-proof-body dl, .trial-proof-body dt, .trial-proof-body dd { margin: 0; }
.trial-proof-body p + p, .trial-proof-body dl + p, .trial-proof-body h4 + dl { margin-top: 7px; }
.trial-proof-body dl { display:grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap:4px 10px; }
.trial-proof-body .trial-weighted-outs { grid-template-columns: repeat(auto-fit,minmax(min(100%,8rem),1fr)); }
.trial-proof-body dl div { display:flex; align-items:baseline; gap:4px; }
.trial-proof-body dd { white-space:nowrap; color:#e5d4a5; }
@container (max-width:640px) {
  .is-recommended .recommend-mark { min-width:16px; height:16px; font-size:10px; top:-7px; }
  .trial-proof[open] .trial-proof-body { position:static; margin-top:6px; width:100%; }
  .trial-caption span { display:inline-block; }
}
@media (forced-colors:active) {
  .is-recommended .recommend-mark { color:HighlightText; background:Highlight; border-color:Highlight; }
}

.qt-kong-options button.is-recommended-action, .am-controls button.is-recommended-action {
  outline: 2px solid #88efc9; outline-offset: 2px; color: #113828; background: #b7edcf;
}
.action-recommend-mark { margin-left: 5px; color:#123c2a; font-size:11px; font-weight:750; }
.claim-advice { margin:5px 0 2px; color:#d3e1d5; font-size:12px; line-height:1.5; text-align:start; }
.claim-advice strong { color:#a8f2cf; font-size:14px; margin-right:4px; }
.claim-advice small { color:#cddccd; margin-left:6px; font-size:12px; }
.claim-routes table { margin-top: 4px; max-width: 100%; border-collapse: collapse; color: #f5eedc; font-variant-numeric: tabular-nums; }
.claim-routes td, .claim-routes th { padding: 1px 12px 1px 0; text-align: start; font-size: inherit; }
.claim-routes thead th { color: #bbcfbf; font-weight: 450; }
.claim-routes tbody th, .claim-routes td:last-child { font-weight: 650; }
.claim-routes .trial-proof-body { inset-inline: 0 auto; width: min(350px, 82vw); }
.seat-chips {
  display:inline-flex; gap:4px; align-items:center; color:#f1daa5; font:560 12px/1.2 system-ui,sans-serif;
  width:max-content; margin-top:2px; font-variant-numeric:tabular-nums;
}
.seat-chips::before {
  content:""; display:inline-block; width:10px; height:8px; border-radius:50%;
  border:1px solid #e2c27f; box-shadow:0 2px 0 -1px #294530,0 3px 0 -1px #e3c381;
}
.round-settlement {
  position:relative; z-index:2; align-self:center; display:flex; align-items:center; flex-wrap:wrap; justify-content:center;
  gap:10px 20px; margin:9px auto 12px; padding:12px 16px; max-width:100%;
  color:#f5efdd; background:#193b2f; border:1px solid #afaa764d; border-radius:12px;
}
.settlement-title { display:grid; gap:2px; max-width:300px; }
.settlement-title small { color:#d8cca4; font-size:12px; }
.settlement-title strong { font-size:16px; font-weight:640; }
.settlement-changes { display:flex; gap:12px; margin:0; text-align:center; }
.settlement-changes dt { color:#c1d5c7; font-size:12px; }
.settlement-changes dd { margin:0; font:650 17px/1.4 system-ui,sans-serif; }
.settlement-changes .chip-gain { color:#a1ebc6; }
.settlement-changes .chip-loss { color:#efc6aa; }
.round-settlement .next-hand {
  font:650 15px/1.2 system-ui,sans-serif; color:#243b2d; background:#f2d893;
  min-height:43px; border:1px solid #fae8b2; padding:8px 20px; border-radius:7px; cursor:pointer;
}
.next-hand:focus-visible { outline:2px solid white; outline-offset:3px; }
.am-person .seat-chips { color:#f1daa5; display:inline-flex; }

/* Put the mobile warning at the decision point. The advice and warning
   share a reserved line, so selecting a tile leaves its hit target in place. */
@media (min-width: 701px) {
  .am-table:has(.discard-advice) > .am-board { flex: 0 0 auto; }
  .am-hero:has(.discard-advice) > .am-rack { align-self: start; }
}
@container (max-width: 640px) {
  .qt-own:has([data-tile-slot]):has(.discard-advice) {
    grid-template-areas: "person trend" "notice notice" "hand hand" "trial trial"
                         "summary summary" "note note" "horizon horizon" "calls calls" "proof proof" "wall wall";
    grid-template-rows: auto 44px;
  }
  .qt-own:has([data-tile-slot]):has(.discard-advice) > .qt-trial { grid-area: notice; align-self: center; }
  .qt-own:has([data-tile-slot]):has(.deal-in-warning) > .qt-trial { grid-area: trial; }
  .qt-own:has(.deal-in-warning) > .trial-anchor,
  .qt-own:has(.deal-in-warning) > .trial-anchor > .trial-readout { display: contents; }
  .qt-own .deal-in-warning { grid-area: notice; align-self: center; width: 100%; margin: 0; }
  .qt-own .trial-summary { grid-area: summary; }
  .qt-own .trial-note { grid-area: note; }
  .qt-own .trial-horizon { grid-area: horizon; }
  .qt-own .trial-risk:not(.deal-in-warning) { grid-area: calls; }
  .qt-own .trial-proof { grid-area: proof; }
}
@media (max-width: 700px) {
  .am-hero:has(.discard-advice),
  .am-hero:has(.discard-advice):has(> .trial-anchor:not(:empty)) {
    grid-template-columns: minmax(0, 1fr) minmax(128px, 50%);
    grid-template-areas: "notice notice" "rack rack" "meld meld" "advice advice" "controls controls"
                         "summary summary" "note note" "horizon horizon" "calls calls" "proof proof" "seat wall";
    grid-template-rows: 44px;
  }
  .am-hero:has(.discard-advice) > .am-rack,
  .am-hero:has(.deal-in-warning) > .trial-anchor,
  .am-hero:has(.deal-in-warning) > .trial-anchor > .trial-readout { display: contents; }
  .am-hero:has(.discard-advice) .am-hand { grid-area: rack; }
  .am-hero:has(.discard-advice) .am-rack > .am-melds { grid-area: meld; }
  .am-hero:has(.discard-advice) .am-controls { grid-area: controls; }
  .am-hero .discard-advice { grid-area: notice; align-self: center; margin: 0; }
  .am-hero:has(.deal-in-warning) .discard-advice { grid-area: advice; }
  .am-hero .deal-in-warning { grid-area: notice; align-self: center; margin: 0; }
  .am-hero .trial-summary { grid-area: summary; }
  .am-hero .trial-note { grid-area: note; }
  .am-hero .trial-horizon { grid-area: horizon; }
  .am-hero .trial-risk:not(.deal-in-warning) { grid-area: calls; }
  .am-hero .trial-proof { grid-area: proof; }
  .am-hero .trial-summary { grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 5px; }
  .am-hero .trial-number { font-size: clamp(28px, 8.4vw, 37px); }
  .am-hero .trial-types { padding-left: 5px; }
  .am-hero .trial-risk:not(.deal-in-warning) dl { flex-wrap: wrap; }
  .am-hero .trial-proof-body { max-width: 100%; }
}
@container (max-width: 520px) {
  .qt-own:has(.deal-in-warning.certain) .qt-hand-tile:nth-child(7n+1) .qt-tap-cue { inset-inline-start: 0; transform: none; }
  .qt-own:has(.deal-in-warning.certain) .qt-hand-tile:nth-child(7n) .qt-tap-cue { inset-inline: auto 0; transform: none; }
  .qt-own:has(.deal-in-warning.certain) .qt-hand-tile:nth-child(7n+1) .qt-tap-cue::after { left: 19px; }
  .qt-own:has(.deal-in-warning.certain) .qt-hand-tile:nth-child(7n) .qt-tap-cue::after { left: auto; right: 19px; }
}
@container (min-width: 521px) and (max-width: 900px) {
  .qt-own:has(.deal-in-warning.certain) .qt-hand-tile:first-child .qt-tap-cue { inset-inline-start: 0; transform: none; }
  .qt-own:has(.deal-in-warning.certain) .qt-hand-tile:first-child .qt-tap-cue::after { left: 19px; }
}
@media (max-width: 540px) {
  .am-table:has(.deal-in-warning.certain) .am-hand .am-tile:nth-child(7n+1)[aria-pressed="true"]::before { left: 0; translate: 0; }
  .am-table:has(.deal-in-warning.certain) .am-hand .am-tile:nth-child(7n)[aria-pressed="true"]::before { left: auto; right: 0; translate: 0; }
}
@media (max-width:640px) {
  .round-settlement {display:grid; grid-template-columns:minmax(0,1fr) auto; gap:9px; width:100%; max-width:380px; padding:10px 12px; }
  .round-settlement .next-hand {grid-column:2; grid-row:1/3;}
  .settlement-changes {justify-content:space-between; max-width:230px;}
  .seat-chips {font-size:10px;}
}

.kong-advice details { display:block; max-width:min(100%,46rem); margin-top:3px; }
.kong-advice summary { cursor:pointer; color:#d9eee0; text-decoration:underline dotted; text-underline-offset:3px; }
.kong-advice table { border-collapse:collapse; text-align:start; margin-block:7px; font-variant-numeric:tabular-nums; }
.kong-advice th,.kong-advice td { text-align:start; padding:3px clamp(7px,1vw,15px) 3px 0; }
.kong-advice tbody th { font-weight:600; color:#f4eedb; }
.kong-advice tr { border-bottom:1px solid #ffffff2c; }
.kong-advice .kong-draw-label { display:flex; flex-wrap:wrap; gap:6px; align-items:center; }
.kong-draw-label select { padding:3px; border-radius:3px; background:#173e34; color:#f3efdc; border:1px solid #98ad9c; font:inherit; }
.kong-advice p { margin:4px 0; }
.method-link { color: inherit; text-decoration: underline dotted; text-underline-offset: 3px; }
.method-link:hover, .method-link:focus-visible { text-decoration-style: solid; }
.rule-guide-links { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.rule-guide-links a { color: inherit; text-underline-offset: 3px; }
