table, tr, th, td {
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
}

table.allbrd, table.allbrd td{
border: 1px solid #0C479D;
border-collapse: collapse;
}
table.allbrd th {
border: 1px solid #0C479D;
border-collapse: collapse;
background:#ddffdd;
}
table.extbrd {
border: 1px solid #0C479D;
border-collapse: collapse;
}
table.extbrd th, table.extbrd td {
border: none;
}
table.nobrd, table.nobrd th, table.nobrd td {
border: none;
}

table.deal, table.deal td {
border: none;
font-family: Verdana;
font-size: 13px;
}

table.deal th{
font-family: Verdana;
font-size: 13px;
border: 1px solid #0C479D;
border-collapse: separate;
background:#ddffdd;
border-radius: 4px;
}

table.smalldeal,  table.smalldeal td {
border: none;
font-family: Verdana;
font-size: 10px;
}

table.smalldeal th{
font-family: Verdana;
font-size: 10px;
border: 1px solid #0C479D;
border-collapse: separate;
background:#ddffdd;
border-radius: 3px;
}

.west {
border-radius:45% 5% 5% 45%;
}

.east {
border-radius:5% 45% 45% 5%;
}

.north {
border-radius:45% 45% 5% 5%;
}
.south {
border-radius:5% 5% 45% 45%;
}


.brd{
border: 1px solid #0C479D;
border-collapse: collapse;
}
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
background-color: #FFFFFF;
color: #3C3C3C;
}
a {
color: #0c479d;
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
}
a.noactive {
color: #CCCCCC;
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
text-decoration: none;
}
h1, .head1 {
color: #006699;
font-family: Arial, Helvetica, sans-serif;
font-size: 20px;
text-decoration: none;
font-weight: normal;
}
h2, .head2 {
color: #006699;
font-family: Arial, Helvetica, sans-serif;
font-size: 16px;
text-decoration: none;
font-weight: bold;
}
h3, .head3 {
color: #006699;
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
text-decoration: none;
font-weight: bold;
font-style: italic;
}
TR.even{
	background-color: #FFFFFF;
}
TR.odd{
	background-color: #F4F4F4;
}
TD.home {
background-color: #FEF8BC;
border-bottom:#000000 1px;
border-right-width:1px;

}
TD.away {
background-color: #E4A0FE;
border-width:1;
}
TR.player-home TD {
background-color: #FEF8BC;
}
TR.player-away TD {
background-color: #E4A0FE;
}
TR.player-home TD.nBRD,
TR.player-away TD.nBRD {
background-color: #9BFFB9;
}
TD.nBRD {
background-color:#9BFFB9;
}
table.allbrd TD.left{
	vertical-align:middle;
	text-align:left
}

table.allbrd TD.center{
	vertical-align:middle;
	text-align:center;
}

table.allbrd TD.right{
	vertical-align:middle;
	text-align:right;
}
table.allbrd TD.big{
	font: bold;
	font-size:20px;
	text-align:right;
}
table.allbrd TD.smol{
	font-size:9px;
	text-align:center;
}

table.menu td{
font-size: 18px;
}

button {
color: #0c479d;
font-size: 18px;
border-radius: 8px;
border: 1px solid #4CAF50;
padding: 1px 1px;
background:#ddffdd;
}

button:hover {
    box-shadow: 0 6px 8px 0 rgba(0,0,0,0.24), 0 17px 50px 0 rgba(0,0,0,0.19);
    background:#aaffaa;
    cursor: pointer
}

.button{
font-size: 16px;
padding: 3px;
background:#F4F4F4;
border-radius: 8px;
border: 1px solid #4CAF50;
border-collapse: separate;
}

.button:hover{
background:#E0E0E0;
box-shadow: 0 6px 8px 0 rgba(0,0,0,0.24), 0 6px 8px 0 rgba(0,0,0,0.19);
cursor: pointer;
}

.button a{
font-size: 16px;
text-decoration: none;
}

.buttonsel a{
font-size: 16px;
text-decoration: none;
color: yellow;
}

.buttonoff{
font-size: 16px;
padding: 3px;
background:#FBFBFB;
border-radius: 8px;
border: 1px solid #4CAF50;
border-collapse: separate;
}

.buttonsel{
font-size: 16px;
padding: 3px;
background:#008000;
border-radius: 8px;
border: 1px solid #AF4C50;
border-collapse: separate;
}

.buttonsel:hover{
background:#009000;
box-shadow: 0 6px 8px 0 rgba(0,0,0,0.24), 0 6px 8px 0 rgba(0,0,0,0.19);
cursor: pointer;
}

.flag-emoji {
font-size: 22px;
line-height: 28px;
}

.bbo-btn {
background: none;
border: none;
padding: 0;
cursor: pointer;
}

.bbo-btn img {
width: 33px;
height: 15px;
}

.bbo-btn-small {
background: #ddffdd;
border: 1px solid #4CAF50;
border-radius: 8px;
padding: 1px 3px;
cursor: pointer;
line-height: 1;
}

.bbo-btn-small:hover {
background: #aaffaa;
box-shadow: 0 6px 8px 0 rgba(0,0,0,0.24), 0 17px 50px 0 rgba(0,0,0,0.19);
}

.bbo-btn-small img {
width: 22px;
height: 10px;
display: block;
}

.bid-alert {
color: #ff0000;
font-size: 0.75em;
vertical-align: super;
margin-left: 1px;
}

/* Bidding / play tooltips: ported from the original bridgeresults.org /o/results.css,
   scoped to the wz_tooltip container (#WzTtDiV) and the touch panel (#tap-tip)
   so global table/allbrd/box-sizing rules of this site cannot override them. */
#WzTtDiV table, #tap-tip table, #WzTtDiV th, #tap-tip th, #WzTtDiV td, #tap-tip td { font-family: Arial, Helvetica, sans-serif; font-size: 14px; box-sizing: content-box; color: #3c3c3c; }
#WzTtDiV table, #tap-tip table { box-sizing: border-box; text-align: start; }
#WzTtDiV table.bidding th, #tap-tip table.bidding th { border: 1px solid #0C479D; border-collapse: separate; border-radius: 6px; padding: 1px; }
#WzTtDiV table.bidding td, #tap-tip table.bidding td { border: none; padding: 1px; }
#WzTtDiV table.bidding td.alert, #tap-tip table.bidding td.alert { border: 1px solid #0C479D; background: BlanchedAlmond; border-collapse: separate; border-radius: 6px; }
#WzTtDiV table.play, #tap-tip table.play { background: #ffffff; }
#WzTtDiV table.play td, #tap-tip table.play td { font-size: 13px; border: none; padding: 1px; }
#WzTtDiV table.play th, #tap-tip table.play th { font-size: 14px; border: 1px solid #0C479D; background: #ddffdd; border-collapse: separate; border-radius: 6px; padding: 1px; }
#WzTtDiV table.play td.sel, #tap-tip table.play td.sel { font-size: 13px; border: 1px solid #0C479D; background: BlanchedAlmond; border-collapse: separate; border-radius: 6px; }

table.deal-tip {
    background: #fff;
    border: 1px solid #999;
    font-size: 12px;
}

table.deal-tip td {
    padding: 4px;
    vertical-align: top;
}

table.Deal {
    border-spacing: 1px;
}

table.Deal th,
table.Deal td {
    font-family: Verdana;
    font-size: 11px;
    text-align: center;
}

table.Deal th {
    background: #ddffdd;
    border: 1px solid #0C479D;
    border-radius: 4px;
    padding: 2px 4px;
}

table.Deal td {
    padding: 2px 4px;
}

TD.imp-pos, span.imp-pos {
    color: #008000;
    font-weight: bold;
}

TD.imp-neg, span.imp-neg {
    color: #c00000;
    font-weight: bold;
}

table.allbrd TD.decl-own {
    background-color: #FFCC66;
    font-weight: bold;
}


progress.a {
    border:0;
    width: 100%;
    height: 8px;
    border-radius: 3px;
    background: #e1e1e1;
    border-color: lime;
}
progress.a::-webkit-progress-bar {
    width: 100%;
    height: 8px;
    border-radius: 3px;
    background: #e1e1e1;
}
progress.a::-webkit-progress-value {
    border-radius: 3px;
    background: lime;
}
progress.a::-moz-progress-bar {
    border-radius: 3px;
    background: #lime;
}

progress.b {
    border:0;
    width: 100%;
    height: 8px;
    border-radius: 3px;
    background: #e1e1e1;
    border-color: lime;
}
progress.b::-webkit-progress-bar {
    width: 100%;
    height: 8px;
    border-radius: 3px;
    background: #e1e1e1;
}
progress.b::-webkit-progress-value {
    border-radius: 3px;
    background: tomato;
}
progress.b::-moz-progress-bar {
    border-radius: 3px;
    background: tomato;
}

/* ===== Ported from BridgePortal results style ===== */

/* Unicode suits (replaces gif images): four-color deck, bigger glyphs */
.suit-s { color: #1e293b; }   /* spades black */
.suit-h { color: #dc2626; }   /* hearts red */
.suit-d { color: #ea580c; }   /* diamonds orange */
.suit-c { color: #15803d; }   /* clubs green */
.suit-s, .suit-h, .suit-d, .suit-c {
  font-weight: 600;
  font-size: 1.2em;
  line-height: 1;
}
/* original shows scores in plain text colour */
.score-plus, .score-minus { color: inherit; }

/* BBO button: text pill, opens in-page popup (see results.js) */
.bbo-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 16px;
  background: #2563eb;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: 3px;
  text-decoration: none;
  margin-left: 4px;
  vertical-align: middle;
  border: 1px solid #4CAF50;
  cursor: pointer;
}
.bbo-btn:hover { background: #1d4ed8; }
.bbo-btn.bbo-text {
  width: auto;
  height: auto;
  padding: 1px 5px;
  font-size: 10px;
  line-height: 1.3;
  background: #ddffdd;
  color: #0c479d;
  border: 1px solid #4CAF50;
  border-radius: 8px;
}
.bbo-btn.bbo-text:hover { background: #aaffaa; }

/* BBO in-page popup */
.bbo-modal { position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; padding: 3vh 3vw; }
.bbo-win { background: #fff; width: min(654px, 100%); max-width: 100%; height: auto; display: flex; flex-direction: column; border-radius: 10px; overflow: hidden; box-shadow: 0 10px 40px rgba(0,0,0,.4); }
.bbo-bar { display: flex; align-items: center; gap: 8px; padding: 4px 8px; background: #eef3f8; border-bottom: 1px solid #cbd5e1; font-size: .95rem; flex-wrap: nowrap; }
.bbo-bar b { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bbo-close { font-size: 1.6rem; line-height: 1; padding: 0 10px; background: none; border: 0; cursor: pointer; color: #334155; }
.bbo-bar a.bbo-open-tab { padding: 3px 12px; border: 1.5px solid #0b4aa2; border-radius: 8px; background: #fff; color: #0b4aa2; font-weight: 600; font-size: .88rem; text-decoration: none; white-space: nowrap; }
.bbo-bar a.bbo-open-tab:hover { background: #0b4aa2; color: #fff; }
.bbo-frame { overflow: hidden; background: #006400; }
.bbo-win iframe { flex: none; width: 650px; height: 650px; transform-origin: 0 0; display: block; border: 0; background: #fff; }
body.bbo-open { overflow: hidden; }
@media (max-width: 700px) and (orientation: portrait) {
  .bbo-bar { font-size: .82rem; gap: 6px; }
  .bbo-bar a.bbo-open-tab { padding: 2px 8px; font-size: .78rem; }
  .bbo-close { font-size: 1.3rem; }
}

/* Deal box: hands around the envelope badge */
.deal-box {
  font-family: Verdana, Arial, sans-serif;
  font-size: 12px;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.deal-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  font-size: 11px;
  color: #334155;
  width: 100%;
  max-width: 280px;
}
.deal-grid {
  display: grid;
  grid-template-columns: minmax(70px, auto) auto minmax(70px, auto);
  grid-template-rows: auto auto auto;
  gap: 4px 10px;
  align-items: center;
  justify-items: center;
}
.deal-N { grid-column: 2; grid-row: 1; }
.deal-W { grid-column: 1; grid-row: 2; justify-self: end; }
.deal-E { grid-column: 3; grid-row: 2; justify-self: start; }
.deal-S { grid-column: 2; grid-row: 3; }
.deal-badge-wrap { grid-column: 2; grid-row: 2; }
.deal-hand { text-align: left; line-height: 1.35; }
.dh-line { display: flex; align-items: baseline; white-space: nowrap; line-height: 1.35; font-size: 13px; }
.dh-suit { display: inline-block; width: 1.35em; min-width: 1.35em; text-align: center; flex: 0 0 1.35em; font-size: 15px; line-height: 1.35; }
.dh-cards { letter-spacing: 0; }
.dh-cards .cd { margin-right: 1.5px; }
.deal-miss { color: #64748b; font-size: 12px; padding: 8px; }

/* Envelope board badge: four flaps by vulnerability, dealer dot, number in center */
.bb { position: relative; width: 60px; height: 60px; border-radius: 7px; overflow: hidden; background: transparent; }
.bb svg { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
.bb .z { fill: #c92a1d; }
.bb .o { fill: #7bd88f; }
.bb .c { position: absolute; left: 14px; top: 14px; width: 32px; height: 32px; box-sizing: border-box; border-radius: 4px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 20px; line-height: 1; color: #1b2433; background: transparent; }
.bb .d { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: #fff; }

/* Double-dummy table */
.deal-dd { margin-top: 8px; }
.dd-table { border-collapse: collapse; margin: 0 auto; font-size: 11px; font-family: Verdana, Arial, sans-serif; table-layout: fixed; }
.dd-table th, .dd-table td { padding: 1px 3px; text-align: center; border: none; font-size: 12px; }
.dd-table .dd-head th { background: transparent; border: none; border-radius: 3px; font-weight: 600; color: #000; }
.dd-table .dd-head th.suit-s { color: #1e293b; }
.dd-table .dd-head th.suit-h { color: #dc2626; }
.dd-table .dd-head th.suit-d { color: #ea580c; }
.dd-table .dd-head th.suit-c { color: #15803d; }
.dd-table .dd-gap { width: 8px; border: none; background: transparent; padding: 0; min-width: 8px; }
.dd-table th:first-child { font-weight: 700; color: #0c479d; }
.dd-table .dd-val { width: 1.35em; min-width: 1.35em; max-width: 1.5em; text-align: center; padding: 1px; font-size: 11px; }
.dd-table .dd-val.suit-s, .dd-table .dd-val.suit-h,
.dd-table .dd-val.suit-d, .dd-table .dd-val.suit-c { font-size: 15px; }
.dd-table .dd-seat { width: 1.1em; min-width: 1.1em; text-align: center; padding: 1px; font-weight: 700; color: #0c479d; font-size: 11px; }

/* Minimax line + actions under the deal */
.deal-minimax { margin-top: 8px; padding-top: 6px; border-top: 1px solid #e2e8f0; font-size: 12px; text-align: center; color: #334155; }
.deal-minimax .bbo-btn { vertical-align: middle; margin-left: 6px; }
.deal-actions { margin-top: 8px; text-align: center; }
.deal-open-btn { display: inline-block; padding: 6px 12px; background: #0c479d; color: #fff !important; border-radius: 8px; text-decoration: none !important; font-size: 12px; font-weight: 600; }
.dbl-x { font-weight: 700; color: #c53030; }

/* Deal tooltip (hover on desktop, bottom sheet on mobile) */
.deal-tooltip {
  display: none;
  position: fixed;
  z-index: 10000;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 6px 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
  font-size: 12px;
  line-height: 1.25;
  min-width: 220px;
  max-width: min(320px, calc(100vw - 16px));
  max-height: calc(100vh - 16px);
  overflow: auto;
  box-sizing: border-box;
  color: #1e293b;
  font-family: Arial, Helvetica, sans-serif;
}
.deal-tooltip.visible { display: block; }
/* Mobile: deal pops up as a centered modal window with backdrop */
.deal-tip-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 9999; }
.deal-tip-backdrop.visible { display: block; }
.deal-tooltip.modal {
  left: 50% !important;
  top: 50% !important;
  right: auto !important;
  bottom: auto !important;
  transform: translate(-50%, -50%);
  width: min(92vw, 360px);
  max-height: 86vh;
  overflow: auto;
  padding: 0;
  z-index: 10001;
}
.deal-tip-bar { display: flex; align-items: center; gap: 10px; padding: 6px 10px; background: #eef3f8; border-bottom: 1px solid #cbd5e1; border-radius: 8px 8px 0 0; }
.deal-tip-bar b { flex: 1; font-size: 14px; color: #334155; }
.deal-tip-close { font-size: 1.5rem; line-height: 1; padding: 0 8px; background: none; border: 0; cursor: pointer; color: #334155; }
.deal-tooltip.modal .deal-box { padding: 8px 10px 10px; }
.deal-tooltip .deal-box { min-width: 0; font-size: 11px; }
.deal-tooltip .deal-grid { gap: 2px 6px; grid-template-columns: minmax(56px, auto) auto minmax(56px, auto); }
.deal-tooltip .deal-hand .dh-line { font-size: 11px; line-height: 1.2; }
.deal-tooltip .deal-hand .dh-suit { width: 1.25em; min-width: 1.25em; font-size: 14px; }
.deal-tooltip .deal-dd { margin-top: 4px; }
.deal-tooltip .dd-table { font-size: 10px; }
.deal-tooltip .dd-table th, .deal-tooltip .dd-table td { padding: 0 2px; }
.deal-tooltip .deal-minimax { margin-top: 4px; font-size: 10px; }
.deal-tooltip .deal-actions { margin-top: 6px; }

/* Protocol page layout: big deal on top, results table below */
.protocol-section { padding: 8px 0; }
.protocol-layout { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.protocol-layout > * { min-width: 0; max-width: 100%; }
.board-picker { width: 100%; }
.protocol-deal { width: 100%; max-width: 640px; }
.protocol-deal .deal-box { margin: 0 auto; }
.protocol-deal .deal-hand .dh-line { font-size: 18px; }
.protocol-deal .deal-hand .dh-suit { font-size: 20px; }
.protocol-deal .deal-dd { margin-top: 12px; }

/* deal with side DD: hands left, 4-row DD right at South level; DLR/VUL inside the deal */
.deal-wrap { display: flex; align-items: flex-end; justify-content: center; gap: 18px; }
/* DLR left / VUL right at the level of the N hand */
.deal-corner { font-size: 12px; color: #64748b; white-space: nowrap; align-self: start; margin-top: 2px; }
.deal-corner b { color: #334155; }
.deal-dlr { grid-column: 1; grid-row: 1; justify-self: end; padding-right: 8px; }
.deal-vul { grid-column: 3; grid-row: 1; justify-self: start; padding-left: 8px; }
.dd-side .deal-minimax { margin-top: 4px; }
.mx-mobile { display: none; }
.dd-side .dd-table .dd-val, .dd-side .dd-table .dd-seat { font-size: 13px; }
.dd-mobile { display: none; }
.protocol-deal .dd-table { font-size: 13px; }
.protocol-deal .dd-table .dd-val, .protocol-deal .dd-table .dd-seat { font-size: 13px; }
.protocol-deal .deal-minimax { font-size: 14px; }
.protocol-results { width: 100%; min-width: 0; }

/* No wrapping in data tables: numbers, contracts, scores, names stay on one line.
   If something doesn't fit — widen the column, shrink the font or let the table scroll. */
table.allbrd th, table.allbrd td { white-space: nowrap; }

/* Table look as on the original bridgeresults.org: navy borders, light-green th */
table.allbrd, table.allbrd td { border: 1px solid #0C479D; }
table.allbrd th { background: #ddffdd; border: 1px solid #0C479D; color: #3C3C3C; }
/* The original has zebra rows only in the board protocol (100% wide table) */
table.allbrd TR.odd { background-color: transparent; }
table.allbrd[width="100%"] TR.odd { background-color: #F4F4F4; }
/* nested layout tables (contract cell, team name cell) must stay borderless */
table.allbrd table.nobrd, table.allbrd table.nobrd th, table.allbrd table.nobrd td { border: none; }
a.board-link { color: #0c479d; cursor: pointer; }

/* WBF card hover tooltip container */
#wbf-tip {
  position: fixed;
  z-index: 10001;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  max-width: 340px;
}
#wbf-tip[hidden] { display: none; }

/* Compact WBF player card: photo left, params column right, series as rows */
.wbf-card { display: flex; gap: 10px; text-align: left; width: max-content; margin: 0 auto; }
.wbf-photo { width: 88px; height: 117px; object-fit: cover; border: 1px solid #cbd5e1; border-radius: 4px; flex: none; }
.wbf-photo-empty { background: #f1f5f9 url('/images/flags/_unknown.png') center/contain no-repeat; }
.wbf-info { font-size: 12px; line-height: 1.45; min-width: 170px; }
.wbf-name { font-weight: 700; font-size: 13px; margin-bottom: 3px; }
.wbf-row span { color: #64748b; display: inline-block; min-width: 58px; }
.wbf-series-table { border-collapse: collapse; margin-top: 4px; }
.wbf-series-table th, .wbf-series-table td { padding: 0 6px; font-size: 11px; text-align: right; white-space: nowrap; }
.wbf-series-table th { color: #64748b; font-weight: 600; border-bottom: 1px solid #e2e8f0; }
.wbf-series-table td.wbf-sname { text-align: left; }

/* Team roster popup table */
.roster-pop td { padding: 3px 10px 3px 0; font-size: 13px; }



/* Opening-lead verdict: DD result in apostrophes next to the lead card */
.lead-res { font-size: 9px; font-weight: 700; white-space: nowrap; line-height: 1; }
.lead-res.ok { color: #15803d; }
.lead-res.bad { color: #dc2626; }

/* Butler page */
.butler-page table.allbrd td { text-align: left; }
.butler-page table.allbrd td a { font-size: 14px; }
.butler-page { max-width: 1050px; margin: 0 auto; }
.butler-page h2 { text-align: center; }

/* Player page */
.pp-head { text-align: center; margin: 8px 0; }
.pp-head h1 { display: inline-flex; align-items: center; gap: 8px; }
.pp-allhist { margin-top: 2px; font-size: 13px; }
.pp-meta { text-align: center; margin: 8px 0; }
.pp-card { display: flex; justify-content: center; margin: 12px 0; }
.pp-table { max-width: 780px; margin: 0 auto 12px; }
.pp-seg { max-width: 640px; margin: 0 auto; }
.pp-empty { text-align: center; }

/* Leaderboard/cross wrapper */
.lb-wrap { max-width: 1190px; margin: 0 auto; }
.lb-wrap h1 { text-align: center; }

/* Home page: tournament list with prize winners */
.home-tournaments { max-width: 720px; margin: 0 auto; }
.home-tournament { margin: 20px 0; }
.home-tournament h2 { text-align: center; }
.home-subtitle { text-align: center; color: #64748b; margin-bottom: 8px; }
table.home-winners { width: 100%; }

/* ALT player page: card + tournament list */
.ap-name { text-align: center; }
.ap-nick { text-align: center; color: #64748b; margin-bottom: 8px; }
.ap-nick b { margin-left: 10px; color: #3C3C3C; }
/* section caption sits on its own line so it does not blend with the
   neighbouring column headers */
.pp-note { display: block; font-weight: normal; font-style: italic; font-size: 11px; color: #64748b; white-space: normal; line-height: 1.3; margin-top: 2px; }
.ap-card { display: flex; justify-content: center; margin: 12px 0 20px; }
.ap-tournaments-h { text-align: center; }
.ap-table-wrap { max-width: 860px; margin: 0 auto; }
table.ap-table { width: 100%; }

/* Round page header */
.round-head { display: flex; justify-content: space-between; align-items: baseline; max-width: 1190px; margin: 0 auto; }
.round-head h2.rh-scores { text-align: right; white-space: nowrap; }
@media (max-width: 800px) and (orientation: portrait) { .round-head { flex-direction: column; align-items: center; } }

/* Round page: matches table + ranking below (grid on desktop, column on phones) */
.round-layout { max-width: 1190px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 16px; align-items: start; }
.round-ranking { min-width: 0; }
.round-ranking table.allbrd { width: 100%; table-layout: fixed; } /* equal-width standings tables (source uses width=310) */
@media (min-width: 801px), (orientation: landscape) {
  /* Classic fixed-width desktop like the source site: below 1190px the page
     scrolls horizontally. The results table has a fixed min-content width,
     so when the grid track shrinks the ranking column slides on top of it
     (overlapping layers) — keep the whole grid at the classic width. */
  .round-head, .round-layout { min-width: 1190px; }
}
.cross-table th.vp-after-team, .cross-table td.vp-after-team { width: 72px; }
/* desktop cross columns: wider rank/team/VP (mobile keeps its own sizes below) */
.cross-table .sticky-col { width: 48px; }
.cross-table .sticky-col2 { width: 230px; }
.cross-scroll { overflow-x: auto; }
@media (max-width: 800px) and (orientation: portrait) {
  .round-layout { grid-template-columns: minmax(0, 1fr); }
}

/* Team page: history table left + roster right (like the original), stacked on phones */
.team-page { max-width: 1000px; margin: 0 auto; }
.team-title { text-align: center; margin-bottom: 10px; }
.team-cell td:last-child { padding-left: 6px; }
.team-cols { display: flex; gap: 16px; align-items: flex-start; justify-content: center; }
.team-hist-wrap { flex: 1 1 auto; min-width: 0; }
.team-roster { flex: 0 0 auto; margin: 0; }
/* Team page stacks below 1151px in ANY orientation: the side-by-side layout
   needs history (700px) + gap + roster (~380px); a landscape phone is far too
   narrow for it and the roster would slide on top of the history table. */
@media (max-width: 1150px) {
  .team-title { margin-top: 14px; }
  .team-cols { flex-direction: column; align-items: stretch; }
  .team-roster { margin: 12px auto 0; }
  /* stacked: history table centred like the roster under it */
  .team-hist-wrap table.team-hist { margin: 0 auto; }
}

/* Team page: VP value with IMPs underneath */
.vp-val { font-weight: 700; font-variant-numeric: tabular-nums; }
.imp-under { font-size: 10px; color: #64748b; line-height: 1.1; font-variant-numeric: tabular-nums; }
@media (max-width: 800px) and (orientation: portrait) {
  /* narrow team history: IMP columns drop out, their values sit under the
     bold VP numbers (the .imp-under span itself is .only-mobile) */
  .team-hist .c-imp { display: none; }
  .team-hist td.c-vps a { font-weight: 700; }
}

/* Team name cell: flag + link, adaptive */
table.team-cell { width: auto; max-width: 100%; }
table.team-cell td.tc-flag { width: 30px; }

/* Contract cell: chip + bid + declarer + BBO in one flex line */
.cell-cont {display: flex; align-items: center; gap: 3px; white-space: nowrap; }
.contract-bid { width: 30%; flex: 0 0 auto; text-align: left; padding-left: 10px;}
.contract-decl { width: 25%; flex: 0 0 auto; min-width: 14px; text-align: center; }
.cell-cont .bbo-btn { width: 30%; flex: none; margin-left: auto; }

/* Room chips (OR/CR) in match protocol: click opens team & pairs popup */
.room-label-desk { font-size: 12px; }
.room-tag {
  display: none;
  font-size: 10px;
  font-weight: 700;
  padding: 0 4px;
  border-radius: 4px;
  margin-right: 4px;
  cursor: pointer;
  border: 1px solid #cbd5e1;
  background: #f1f5f9;
  color: #334155;
  user-select: none;
}
.room-tag.rt-open { background: #FEF8BC; border-color: #d9c84a; }
.room-tag.rt-closed { background: #E4A0FE; border-color: #b06fd6; }
.room-win { width: min(92vw, 420px); height: auto; }
.room-body { padding: 14px 16px; font-size: 14px; }
.room-team { font-weight: 700; font-size: 16px; margin-bottom: 10px; }
.room-line { margin: 5px 0; }
.room-line b { color: #0c479d; margin-right: 6px; }


/* ===== Clean responsive layer (single markup for desktop + mobile) ===== */

/* Page frame */
.althead { max-width: 1190px; margin: 0 auto; }
.altbody { max-width: 1190px; margin: 0 auto; padding: 0 8px; }

/* Banner */
.ah-banner { display: flex; align-items: center; justify-content: center; gap: 16px; }
.ah-logo img { height: 120px; width: auto; }
.ah-title { text-align: center; }
.ah-credit { font-size: 13px; margin-top: 8px; }
.ah-coc { margin-top: 8px; text-align: center; }

/* Nav */
/* Mobile-only / desktop-only helpers */
.only-mobile { display: none; }
@media (max-width: 800px) and (orientation: portrait) {
  .only-desktop { display: none !important; }
  .only-mobile { display: block; }
}

/* Nav: 2x2 button block + 2 link rows below */
.ah-nav { margin-top: 12px; display: flex; gap: 20px; align-items: center; justify-content: center; }
.ah-main { display: grid; grid-template-columns: repeat(2, 170px); gap: 6px; flex: none; }
.ah-main .ah-btn-main { text-align: center; }
.ah-main .ah-btn-main a { display: block; }
.ah-links { flex: 1 1 auto; max-width: 720px; }
.ah-row { display: flex; align-items: center; gap: 6px; margin-top: 5px; justify-content: center; }
.ah-row-label { color: #64748b; white-space: nowrap; width: 140px; text-align: right; }
.nav-row { display: flex; align-items: center; gap: 6px; margin-top: 5px; justify-content: center; }
.nav-row .nav-label { color: #64748b; white-space: nowrap; width: 140px; text-align: right; font-weight: 700; }
.nav-cells { display: flex; flex-wrap: nowrap; gap: 4px; flex: 1 1 auto; justify-content: center; }
.nav-cell { min-width: 34px; padding: 2px 6px; text-align: center; background: #F4F4F4; border: 1px solid #4CAF50; border-radius: 8px; text-decoration: none; }
.nav-cell-off { background: #FBFBFB; color: #9CA3AF; cursor: default; }
.nav-cell-off:hover { background: #FBFBFB; }
.board-picker .nav-cell { width: 38px; }
.nav-cell:hover { background: #E0E0E0; }
.nav-cell.current { background: #9BFFB9; font-weight: 700; }
.ah-stages { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; justify-content: center; }

/* view-toggle: JS-controlled, fixed on phones, stays visible in forced full mode */
#view-toggle { display: none; font-size: 13px; padding: 2px 10px; border: 1px solid #4CAF50; border-radius: 999px; background: #fff; white-space: nowrap; text-decoration: none; }
body.forced-desktop #view-toggle { position: fixed; top: 8px; right: 8px; z-index: 999; }

/* hover tooltips never work on touch; hide the layer so taps reach the links */
@media (max-width: 700px) and (orientation: portrait) {
  #WzTtDiV { display: none !important; }
}




/* Match header: teams + two room columns (desktop) */
.match-head { max-width: 880px; margin: 0 auto 12px; }
.match-head-desk { max-width: 880px; margin: 0 auto 12px; }
@media (max-width: 800px) and (orientation: portrait) { .match-head-desk { display: none; } }
table.match-table { max-width: 880px; margin: 0 auto; width: 100%;}
.mh-teams { display: flex; align-items: center; justify-content: center; gap: 16px; margin-bottom: 10px; }
.mh-teams .mh-team { flex: 0 1 auto; }
.mh-teams .mh-team.mh-home { text-align: right; }
.mh-vs { font-weight: 700; font-size: 18px; color: #64748b; }
.mh-rooms { display: flex; gap: 24px; justify-content: center; }
.mh-room { text-align: left; min-width: 0; }
.mh-label { font-weight: 700; font-size: 14px; margin-bottom: 2px; }
.mh-pair { font-size: 12px; line-height: 1.5; }
.mh-pair b { color: #0c479d; margin-right: 4px; }
@media (max-width: 800px) and (orientation: portrait) {
  /* team chips carry the same home/away colours as the IMPs/VP values, so
     the numbers in the protocol map to teams */
  .mh-teams .mh-team.mh-home { background: #FEF8BC; border-radius: 6px; padding: 4px 10px; }
  .mh-teams .mh-team.mh-away { background: #E4A0FE; border-radius: 6px; padding: 4px 10px; }
}
.sub-blocks { display: flex; gap: 24px; justify-content: center; padding: 6px 8px; background: #f8fafc; border-top: 1px solid #e2e8f0; border-bottom: 1px solid #e2e8f0; }
.match-hint { margin: 0 auto; max-width: 880px;}
/* Responsive: phones */
@media (max-width: 800px) and (orientation: portrait) {
  .ah-banner { flex-direction: column; gap: 4px; }
  .ah-logo { display: none; }
  .ah-banner .ah-title h1 { margin: 4px 0; }
  .ah-logo:first-child { display: block; }
  .ah-logo:first-child img { max-width: 52vw; height: auto; }
  .ah-credit, .ah-coc { display: none; }

  /* data tables: no inner scroll, no sticky header; cross wraps 2 cells per row */
  table.allbrd { font-size: 11px; width: 100%; }
  table.allbrd th { font-size: 10px; padding: 3px 2px; white-space: nowrap; }
  table.allbrd td { padding: 3px 2px; }
  /* cross table: cells shrink to fit, no wrap */
  .cross-table td, .cross-table th { text-align: center; }
  .cross-table td:nth-child(4), .cross-table th:nth-child(4) { display: none; } /* team number */

  /* player stat blocks: label spans full line, stat cells 2 per row, columns aligned */
  .pp-table tr { display: grid; grid-template-columns: 1fr 1fr; align-items: center; }
  .pp-table tr > th, .pp-table tr > td:first-child { grid-column: 1 / -1; }
  .pp-table td { text-align: center !important; border-bottom: 1px solid #e2e8f0; padding: 4px 2px !important; }
  .pp-table tr > td:last-child { grid-column: auto; }

  /* secondary columns hidden on phones */
  .c-tbl, .c-team, .c-butler, .c-other, .c-brd, .c-adj,
  .c-nbrds, .c-imp-tot, .c-nick, .c-team-col, .c-pair { display: none !important; }

  /* match protocol: native mobile markup already in DOM (match-head, sub-mobile) */
  .stack-mobile table.nobrd[width="920"] { display: none !important; }
  td[colspan="13"] table.sub-desk { display: none !important; }

  .c-imp, .c-adj, .c-rk { display: none !important; }

  /* deal layout: column, mobile DD tables */
  .deal-wrap { flex-direction: column; align-items: center; gap: 8px; }
  .dd-side { display: none !important; }
  .dd-mobile { display: block !important; }
  .mx-desktop { display: none !important; }
  .mx-mobile { display: block !important; }

  /* board page picker + match header native blocks */
  .board-picker-desk { display: none; }
  .room-label-desk { display: none; }
  .room-tag { display: inline-block; font-size: 11px; padding: 2px 6px; }

  .match-head { padding: 0 4px; }
  .mh-rooms { flex-direction: column; gap: 10px; }
  .mh-room.mh-closed { margin-top: 0; }
  .sub-blocks { flex-direction: column; gap: 10px; }

  /* desktop roster side column hidden, mobile bottom table shown */
  .team-roster-desk { display: none; }
  .team-roster-mob { display: block; }
}
@media (min-width: 801px), (orientation: landscape) {
  .dd-mobile, .mx-mobile { display: none; }
  .match-head { display: none; }
  .sub-mobile { display: none; }
  .team-roster-mob { display: none; }
  .room-tag { display: none; }
  .mx-desktop { display: block; }
}

/* ===== Mobile round matches: two-line native rows ===== */
.rm-mob { display: none; }
@media (max-width: 800px) and (orientation: portrait) {
  .rm-mob { display: block; }
  .rm-m { border: 1px solid #0C479D; border-radius: 6px; margin-bottom: 6px; overflow: hidden; }
  .rm-m.rm-even { background: #F4F4F4; }
  .rm-line { display: grid; grid-template-columns: 22px minmax(0, 1fr) 30px 34px 52px; align-items: center; gap: 4px; padding: 3px 6px; }
  .rm-tbl { font-weight: 700; font-size: 13px; color: #0c479d; text-align: center; }
  .rm-imp a, .rm-vp a, .rm-tbl a { display: block; color: inherit; text-decoration: none; }
  .rm-team { min-width: 0; overflow: hidden; }
  .rm-team .team-cell, .rm-team .team-cell font { font-size: 12px; }
  .rm-team .team-cell .tc-flag img { width: 18px; height: 18px; }
  .rm-adj { font-size: 10px; color: #64748b; text-align: right; }
  .rm-imp { font-size: 13px; text-align: center; font-variant-numeric: tabular-nums; }
  .rm-vp { font-size: 13px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }

  /* Cross table: horizontal scroll with sticky rank+team columns */
  .cross-scroll { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
  .cross-table { margin: 0; border-collapse: separate; border-spacing: 0; }
  .cross-table th, .cross-table td { border-width: 0 1px 1px 0; }
  .cross-table tr:first-child > * { border-top-width: 1px; }
  .cross-table tr > :first-child { border-left-width: 1px; }
  .cross-table .sticky-col { box-sizing: border-box; width: 32px; min-width: 32px; max-width: 32px; }
  .cross-table .sticky-col { position: sticky; left: 0; background: #fff; z-index: 2; }
  .cross-table .sticky-col2 { position: sticky; left: 32px; background: #fff; z-index: 2; box-shadow: 4px 0 6px -4px rgba(0,0,0,0.25); }

  /* Team history: compact */
  .team-hist { font-size: 11px; }
  .team-hist th { font-size: 10px; padding: 3px 3px; }
  .team-hist td { padding: 3px 3px; }
  .team-hist .team-cell, .team-hist .team-cell font { font-size: 11px; }
  .team-hist .team-cell .tc-flag img { width: 16px; height: 16px; }

  /* ALT player page table: let long tournament titles wrap */
  table.allbrd.ap-table td, table.allbrd.ap-table th { white-space: normal; }
  .ap-table { font-size: 12px; }
  .ap-table .team-cell, .ap-table .team-cell font { font-size: 12px; }

  /* Player stats table: never wider than the screen */
  .pp-table { max-width: 100%; }
  table.allbrd.pp-table td, table.allbrd.pp-table th { white-space: normal; }
  .pp-table { font-size: 12px; }

  /* Butler: 8 round columns must fit — compact cells, name column auto */
  .butler-page table.allbrd th, .butler-page table.allbrd td,
  .butler-page table.allbrd td a, .butler-page table.allbrd td font { font-size: 10px; }
  .butler-page table.allbrd th, .butler-page table.allbrd td { padding: 2px 0; }
  .butler-page td[width="180"], .butler-page td[width="80"] { width: auto !important; }
  .butler-page th[width="210"], .butler-page th[width="50"] { width: auto !important; }
}

/* ===== Mobile match protocol: one grid row per room ===== */
.mp-mob { display: none; }
@media (max-width: 800px) and (orientation: portrait) {
  .mp-mob { display: block; margin: 0 auto; max-width: 100%; }
  .mp-row { display: grid; grid-template-columns: 26px 26px minmax(0, 1fr) 40px 24px 52px 32px; align-items: center; gap: 3px; padding: 4px 4px; border-bottom: 1px solid #e2e8f0; }
  /* player page segments have no room chip — 6 columns, not 7 */
  .pp-seg .mp-row { grid-template-columns: 26px minmax(0, 1fr) 40px 24px 52px 32px; }
  .mp-row.mp-even { background: #F4F4F4; }
  .mp-brd { text-align: center; font-weight: 700; }
  .mp-brd a { color: #0c479d; }
  .mp-row .room-tag { display: inline-block; text-align: center; font-size: 10px; padding: 1px 0; margin: 0; width: 26px; }
  .mp-cont { display: flex; align-items: center; gap: 3px; min-width: 0; white-space: nowrap; overflow: hidden; }
  .mp-cont .bbo-btn { padding: 0 4px; font-size: 10px; margin-left: auto; }
  .mp-decl { min-width: 12px; text-align: center; }
  .mp-ol { text-align: center; white-space: nowrap; overflow: hidden; }
  .mp-tr { text-align: center; }
  .mp-sc { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
  .mp-imp { text-align: center; font-weight: 700; border-radius: 4px; padding: 1px 0; }
  .mp-imp-home { background: #FEF8BC; }
  .mp-imp-away { background: #E4A0FE; }
  .mp-tot { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: center; padding: 8px 4px 2px; }
  .mp-tot-round { font-size: 15px; margin-right: 6px; }
  .mp-tot-cell { border-radius: 4px; padding: 2px 8px; font-size: 13px; }
  /* labels stay plain, only the home/away values carry the backgrounds;
     extra gap before the VP group */
  .mp-tot-lbl { font-size: 13px; margin-right: -2px; }
  .mp-tot-lbl.mp-tot-vp { margin-left: 12px; }
}

/* ===== Touch: tap-to-show tooltip panel (results.js, #tap-tip) ===== */
.tap-tip { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1001; background: #fff; border-top: 2px solid #0C479D; box-shadow: 0 -4px 16px rgba(0,0,0,.25); padding: 10px 12px 14px; max-height: 60vh; overflow: auto; font-size: 14px; }
.tap-tip-close { position: absolute; top: 4px; right: 8px; min-width: 32px; min-height: 32px; font-size: 22px; background: none; border: 0; cursor: pointer; }
.tap-tip-body { display: flex; justify-content: center; padding-right: 28px; }
.tap-tip-body > table { margin: 0 auto; }
.hover-cell.tap-tip-on, .mp-cont.tap-tip-on, .mp-tr.tap-tip-on { outline: 2px solid #0C479D; border-radius: 4px; }
@media (hover: none), (pointer: coarse) {
  #WzTtDiV { display: none !important; }
  .hover-cell, .lead-res { cursor: pointer; }
  .mp-cont.hover-cell .contract-bid, .mp-cont.hover-cell { text-decoration: underline dotted #0C479D; }
}
@media (max-width: 800px) and (orientation: portrait) {
  .bbo-btn, .mp-cont .bbo-btn { min-height: 32px; }
  table.allbrd:not(.team-hist):not(.cross-table) th { font-size: 12px; }
  .room-tag, .mp-row .room-tag { font-size: 12px; }
  .mp-row { grid-template-columns: 32px 30px minmax(0, 1fr) 40px 24px 52px 32px; }
  .pp-seg .mp-row { grid-template-columns: 32px minmax(0, 1fr) 40px 24px 52px 32px; }
  .mp-brd a { display: block; min-height: 32px; line-height: 32px; font-size: 15px; }
  .board-picker .nav-cell { width: auto; }
}


/* ===== Desktop look aligned with the original ASP pages (bridgeresults.org/o/) ===== */
@media (min-width: 801px), (orientation: landscape) {
  /* Banner: 1180 wide, logos 245x120 at the edges, as in the original header table */
  .ah-banner { max-width: 1180px; margin: 0 auto; justify-content: space-between; }
  .ah-logo img { width: 245px; height: 120px; }
  .ah-coc { margin-top: 18px; }
  /* Nav: Leaderboard/Cross Table on the left, round rows, Butler/Line-Up on the
     right. Width-adaptive: the side button columns and the round cells shrink
     with the viewport. Right column stays compact (Butler/Line-Up are short
     words), like the original's 195px/100px split. Lives in its own media
     block: portrait phones and very narrow landscape use the mobile nav. */

  /* Cell padding the original sets via cellpadding= */
  table.round-matches th, table.round-matches td,
  .round-ranking table.allbrd th, .round-ranking table.allbrd td,
  table.team-roster th, table.team-roster td { padding: 3px; }
  table.match-table th, table.match-table td { padding: 2px; }
  table.match-table td { height: 27px; }

  /* Team page: 1180 frame, 700px history table left, roster right, centred title —
     only where the side-by-side layout fits (see the ≤1150px stacking block) */

  table.team-roster td { border: none; }

  /* Butler: 1040 wide table, 20px flags and smaller bold team names as in the original */
  .butler-page table.allbrd { width: 1040px; margin: 0 auto; }
  .butler-page td.c-team-col img { width: 20px; height: 20px; }
  .butler-page table.allbrd td.c-team-col a, .butler-page table.allbrd td.c-team-col a * { font-size: 13px !important; }
  .butler-page table.allbrd td[align=center] { text-align: center; }
  .butler-page table.allbrd td[align=right] { text-align: right; }
  .butler-page table.allbrd td:nth-child(n+7) { width: 45px; }
}

/* Match protocol columns/rows as on the original r?t? page (900px table, 27px rows) */
@media (min-width: 801px), (orientation: landscape) {
  table.match-table:not(.pp-match) { width: 900px; table-layout: fixed; }
  table.match-table.pp-match { width: 658px; table-layout: fixed; }
  table.match-table td { height: auto; line-height: 18px; }
  table.match-table tr { height: 27px; }
  table.match-table th, table.match-table td { box-sizing: border-box; }
  table.match-table td.cell-cont { display: table-cell; white-space: nowrap; overflow: hidden; }
  table.match-table td.cell-cont > span, table.match-table td.cell-cont > .bbo-btn { display: inline-block; vertical-align: middle; }
  table.match-table td.cell-cont .contract-bid { width: 40px; padding-left: 2px; }
  table.match-table td.cell-cont .room-tag { display: none; }
  table.match-table td.cell-cont .contract-decl { width: 16px; }
  table.match-table td.cell-cont .bbo-btn { width: auto; float: none; margin-left: 2px; padding: 0 4px; line-height: 16px; font-size: 11px; }
  table.match-table sup { line-height: 0; }
  table.match-table:not(.pp-match) tr:first-child th:nth-child(1), table.match-table:not(.pp-match) tr:first-child th:nth-child(7) { width: 111px; }
  table.match-table:not(.pp-match) tr:first-child th:nth-child(2), table.match-table:not(.pp-match) tr:first-child th:nth-child(8) { width: 44px; }
  table.match-table:not(.pp-match) tr:first-child th:nth-child(3), table.match-table:not(.pp-match) tr:first-child th:nth-child(9) { width: 37px; }
  table.match-table:not(.pp-match) tr:first-child th:nth-child(4), table.match-table:not(.pp-match) tr:first-child th:nth-child(10) { width: 100px; }
  table.match-table:not(.pp-match) tr:first-child th:nth-child(5), table.match-table:not(.pp-match) tr:first-child th:nth-child(11) { width: 58px; }
  table.match-table:not(.pp-match) tr:first-child th:nth-child(6) { width: 55px; }
  table.match-table:not(.pp-match) tr:first-child th:nth-child(12) { width: 72px; }
  table.match-table:not(.pp-match) tr:first-child th:nth-child(13) { width: 71px; }
  table.pp-match tr:first-child th:nth-child(1) { width: 55px; }
  table.pp-match tr:first-child th:nth-child(2) { width: 111px; }
  table.pp-match tr:first-child th:nth-child(3) { width: 44px; }
  table.pp-match tr:first-child th:nth-child(4) { width: 37px; }
  table.pp-match tr:first-child th:nth-child(5) { width: 100px; }
  table.pp-match tr:first-child th:nth-child(6) { width: 58px; }
  table.pp-match tr:first-child th:nth-child(7) { width: 110px; }
  table.pp-match tr:first-child th:nth-child(8) { width: 72px; }
  table.pp-match tr:first-child th:nth-child(9) { width: 71px; }
  table.pp-match td.cell-other { white-space: nowrap; text-align: right; }
  table.pp-match td.cell-other .other-score { display: inline-block; min-width: 56px; }
  table.pp-match td.cell-other .bbo-btn { padding: 0 4px; line-height: 16px; font-size: 11px; margin-left: 4px; }
  .pp-seg { max-width: 900px; }
  .pp-seg .match-head-desk { width: 658px; margin: 0 auto; }
}

/* Board protocol "Scores of round N" picker: position as on the original d?p
   page. Width-adaptive: the label column and the board cells shrink with the
   viewport (same scheme as the header nav). */
@media (min-width: 801px), (orientation: landscape) {
  .board-picker .nav-row { display: grid; grid-template-columns: max-content minmax(0, 1fr);
                           max-width: 1100px; margin: 5px auto 0; gap: 0 4px; align-items: center; }
  .board-picker .nav-row .nav-label { width: auto; text-align: left; color: #3C3C3C; padding-left: 3px; }
  .board-picker .nav-cells { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(22px, 42px);
                             justify-content: start; gap: 2px; }
  .board-picker .nav-cell { width: auto; min-width: 0; margin: 0; padding: 3px 0; font-size: 16px; line-height: normal; color: #0c479d; background: #F4F4F4; font-weight: normal; }
  .board-picker .nav-cell.current { background: #F4F4F4; color: #0c479d; }
}

/* Team page: roster 36px right of the history table, as on the original t?h page */
@media (min-width: 1151px) {
  .team-cols { justify-content: flex-start; gap: 36px; }
  .team-roster-wrap, .team-cols > :last-child { margin-left: 0; }
}
.pp-round { text-align: center; margin: 8px 0; }

/* Player history half protocol: other room's score + BBO on its own line under the row */
.mp-oth { display: none; }
@media (max-width: 800px) and (orientation: portrait) {
  .pp-seg .mp-oth { display: flex; grid-row: 2; grid-column: 3 / -1; justify-content: flex-end; align-items: center; gap: 4px; font-size: 12px; color: #64748b; white-space: nowrap; }
  .pp-seg .mp-oth::before { content: "Other:"; }
  .pp-seg .mp-oth .bbo-btn { min-height: 0; padding: 0 4px; font-size: 10px; line-height: 16px; }
}

/* Mobile tweaks v81 */
@media (max-width: 800px) and (orientation: portrait) {
  /* round page: hide the "Round N. 16 boards. date" meta line */
  .rh-meta { display: none; }
  /* butler: keep the intended cell alignment on phones */
  .butler-page table.allbrd td[align="center"] { text-align: center; }
  .butler-page table.allbrd td[align="right"] { text-align: right; }
  /* player history: other room's score on its own line */
  .pp-seg .mp-oth { grid-column: 2 / -1; }
  .pp-seg .mp-oth::before { content: "Other room:"; }
  /* board page: double rule between matches */
  tr.match-end td { border-bottom: 3px double #0C479D; }
  /* board page room cell: short team name, whole cell opens the players popup */
  td.c-room { padding: 0; text-align: center; vertical-align: middle; }
  td.c-room.rt-open { background: #FEF8BC; }
  td.c-room.rt-closed { background: #E4A0FE; }
  td.c-room .room-tag { display: block; width: 100%; font-size: 11px; font-weight: 700; padding: 0; background: transparent; border: 0; border-radius: 0; white-space: nowrap; overflow: hidden; }
  /* team history page: title centred, roster pushed a line below the tables */
  .team-title .team-cell { margin: 0 auto; }
  .team-roster { margin: 40px auto 0; }
}

/* Player tournament statistics: one table, one header (v77) */
.pp-stats-wrap { max-width: 640px; margin: 0 auto 12px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.allbrd.pp-stats { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 12px; }
table.pp-stats col.c-lbl { width: 172px; }
table.pp-stats th, table.pp-stats td { padding: 2px 6px; text-align: right; white-space: nowrap; border: 1px solid #0C479D; font-variant-numeric: tabular-nums; }
table.pp-stats th { background: #ddffdd; text-align: center; font-weight: bold; }
table.pp-stats .l { text-align: left; }
table.pp-stats tr.pp-total td { font-weight: bold; background: #f3f8ff; }
table.pp-stats tbody.pp-sub tr.pp-subhead th { background: #eef7ee; font-weight: normal; font-style: italic; }
table.pp-stats tbody.pp-sub tr.pp-subhead th.l { font-weight: bold; font-style: normal; }
table.pp-stats tbody.pp-sub td { text-align: center; }
@media (max-width: 800px) and (orientation: portrait) {
  .pp-stats-wrap { max-width: 100%; margin: 0 0 12px; }
  table.allbrd.pp-stats { width: 560px; font-size: 13px; }
  table.pp-stats col.c-lbl { width: 128px; }
  table.pp-stats th, table.pp-stats td { padding: 3px 4px; }
  table.pp-stats .l { position: sticky; left: 0; z-index: 1; background: #fff; white-space: normal; box-shadow: 1px 0 0 #0C479D; }
  table.pp-stats th.l { background: #ddffdd; }
  table.pp-stats tr.pp-total td.l { background: #f3f8ff; }
  table.pp-stats tbody.pp-sub tr.pp-subhead th.l { background: #eef7ee; }
}

/* Mobile match protocol v78: board # and IMPs span both rooms, no OR/CR chips, team colours on pairs */
@media (max-width: 800px) and (orientation: portrait) {
  .mp-bd { display: grid; grid-template-columns: 34px minmax(0, 1fr) 34px; column-gap: 4px; align-items: stretch; border-bottom: 1px solid #0C479D; }
  .mp-bd.mp-even { background: #F4F4F4; }
  .mp-bd > .mp-brd { grid-column: 1; grid-row: 1 / 3; display: flex; align-items: center; justify-content: center; background: #9BFFB9; font-size: 17px; font-weight: 700; }
  .mp-bd > .mp-brd a { display: block; width: 100%; text-align: center; min-height: 0; line-height: normal; font-size: 17px; }
  .mp-bd > .mp-imp { grid-column: 3; grid-row: 1 / 3; display: flex; align-items: center; justify-content: center; border-radius: 0; font-size: 14px; }
  .mp-bd .mp-row { grid-column: 2; display: grid; grid-template-columns: minmax(0, 1fr) 40px 24px 52px; gap: 3px; padding: 4px 0; border-bottom: 0; background: transparent; }
  .mp-bd .mp-row.mp-r1 { grid-row: 1; border-bottom: 1px dotted #cbd5e1; }
  .mp-bd .mp-row.mp-r2 { grid-row: 2; }
  .mp-bd .mp-cont { display: flex; align-items: center; gap: 2px; }
  .mp-bd .mp-cont .mp-ct { flex: 0 0 auto; }
  .mp-bd .mp-cont .mp-decl { flex: 1 1 auto; text-align: center; }
  .mp-bd .mp-cont .bbo-btn { margin-left: 0; flex: 0 0 auto; }
  .match-head .mh-pair, .mp-sub .mh-pair { padding: 1px 6px; border-radius: 3px; margin: 1px 0; }
  .match-head .mh-open .mh-pair:nth-of-type(2), .mp-sub .mh-open .mh-pair:nth-of-type(2),
  .match-head .mh-closed .mh-pair:nth-of-type(3), .mp-sub .mh-closed .mh-pair:nth-of-type(3) { background: #FEF8BC; }
  .match-head .mh-open .mh-pair:nth-of-type(3), .mp-sub .mh-open .mh-pair:nth-of-type(3),
  .match-head .mh-closed .mh-pair:nth-of-type(2), .mp-sub .mh-closed .mh-pair:nth-of-type(2) { background: #E4A0FE; }
  .mp-sub { display: flex; flex-direction: column; gap: 6px; padding: 8px 4px; border-bottom: 1px solid #0C479D; background: #fff; }
  .mp-sub::before { content: "Line-up change"; font-weight: 700; font-size: 12px; color: #0c479d; }
}
.mp-sub { display: none; }
@media (max-width: 800px) and (orientation: portrait) { .mp-mob .mp-sub { display: flex; } }
@media (max-width: 800px) and (orientation: portrait) {
  .mp-bd > .mp-brd, .mp-bd > .mp-brd a { font-size: 22px; }
  .mp-bd .mp-row { grid-template-columns: minmax(0, 128px) 44px 24px minmax(64px, 1fr); padding: 1px 0; min-height: 28px; align-items: center; }
  .mp-bd .mp-cont .bbo-btn { min-height: 0; height: 22px; line-height: 20px; padding: 0 4px; }
  .mp-bd .mp-sc { padding-right: 4px; }
}
@media (max-width: 800px) and (orientation: portrait) {
  .mp-bd .mp-sc.sc-left { text-align: left; }
  .mp-bd .mp-sc.sc-right { text-align: right; }
  .mp-bd .mp-sc.sc-center { text-align: center; }
}
@media (max-width: 800px) and (orientation: portrait) {
  .mp-bd .mp-cont { padding-left: 6px; display: grid; grid-template-columns: 52px minmax(14px, 1fr) auto; align-items: center; gap: 0; }
  .mp-bd .mp-cont .mp-ct { text-align: left; white-space: nowrap; overflow: hidden; }
  .mp-bd .mp-cont .mp-decl { text-align: center; font-variant-numeric: tabular-nums; }
  .mp-bd .mp-cont .bbo-btn { margin-left: 0; }
}

/* ===== Adaptive desktop navigation =====
   Leaderboard/Cross Table on the left, round rows, Butler/Line-Up on the right.
   Width-adaptive: the side columns and the round cells shrink with the
   viewport; the right column stays compact (Butler/Line-Up are short words),
   like the original's 195px/100px split. Own media block: portrait phones and
   very narrow landscape fall through to the mobile nav below. */
@media (min-width: 801px), (min-width: 721px) and (orientation: landscape) {
  .ah-nav { display: grid; grid-template-columns: minmax(120px, 205px) minmax(0, 1fr) minmax(84px, 105px);
            grid-template-rows: auto auto; column-gap: 12px; row-gap: 3px;
            width: 100%; max-width: 1180px; margin: 32px auto 0; align-items: center; }
  .ah-main, .ah-links { display: contents; }
  .ah-main .ah-btn-main { width: 100%; }
  .ah-main .ah-btn-main:nth-child(1) { grid-column: 1; grid-row: 1; }
  .ah-main .ah-btn-main:nth-child(2) { grid-column: 3; grid-row: 1; }
  .ah-main .ah-btn-main:nth-child(3) { grid-column: 1; grid-row: 2; }
  .ah-main .ah-btn-main:nth-child(4) { grid-column: 3; grid-row: 2; }
  .ah-links .ah-row { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 0 6px;
                      grid-column: 2; margin: 0; align-items: center; }
  .ah-links .ah-row:nth-child(1) { grid-row: 1; }
  .ah-links .ah-row:nth-child(2) { grid-row: 2; }
  .ah-row-label { color: #3C3C3C; width: auto; padding-right: 4px; }
  /* round/board cells fill the same track in both rows: equal size within a row
     and identical between the rows, capped at 68px, shrinking on narrow screens */
  .ah-row .nav-cells { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(22px, 68px);
                       justify-content: center; gap: 4px; }
  .ah-row .nav-cell { width: auto; min-width: 0; margin: 0; font-size: 16px; padding: 3px 0; color: #0c479d; background: #F4F4F4; font-weight: normal; line-height: normal; }
  .ah-row .nav-cell-off { background: #FBFBFB; color: #3C3C3C; }
  .ah-row .nav-cell.current { background: #F4F4F4; font-weight: normal; }
}

/* Mobile navigation: portrait phones, and landscape phones too narrow for the
   adaptive desktop nav */
@media (max-width: 800px) and (orientation: portrait), (max-width: 720px) {
  .ah-nav { padding: 0 4px; }
  /* phones: buttons 2x2 full-width, link rows full-width grid */
  .ah-nav { flex-direction: column; gap: 8px; }
  .ah-main { grid-template-columns: repeat(2, 1fr); gap: 4px; width: 100%; }
  .ah-main .ah-btn-main { font-size: 13px; padding: 4px 2px; }
  .ah-links { width: 100%; max-width: none; }
  .ah-links .ah-row { display: block; }
  .ah-row-label { display: none; }
  .nav-cells { display: grid; grid-template-columns: repeat(8, 1fr); width: 100%; gap: 3px; }
  .nav-cell { min-width: 0; padding: 2px 0; text-align: center; }
}

/* Team page side-by-side (700px history + roster right, 1180 frame) only where
   it fits; ≤1150px in any orientation stacks (see the team stacking block) */
@media (min-width: 1151px) {
  .team-page { max-width: 1180px; }
  .team-cols { justify-content: space-between; }
  .team-hist-wrap { flex: 0 1 auto; }
  table.team-hist { width: 700px; }
  .team-title table.team-cell { margin: 0 auto; }
  .team-title { width: 700px; }
}
