:root {
  --paper: #F1EADB;
  --stock: #FBF8F1;
  --ink: #1C1B22;
  --faded: #6E6A63;
  --red: #C2361F;
  --pencil: #4A5A78;
  --rule: #CFC5B0;
  --shadow: 0 1px 0 #00000014, 0 2px 6px #0000000F;
  --serif: "Suits", "Source Serif 4", Georgia, "Times New Roman", serif;
  --hand: "Caveat", "Segoe Print", cursive;
  --cw: 66px; --ch: 94px;      /* South's cards */
  --tw: 50px; --th: 70px;      /* cards in the trick */
  --compass: 230px;
  --motion: 220ms;
  --dock: 0px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); }
body {
  font-family: var(--serif);
  font-size: 16px; line-height: 1.35;
  font-variant-numeric: lining-nums tabular-nums;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
}
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.red { color: var(--red); }
.blk { color: var(--ink); }
.sc { font-variant-caps: all-small-caps; letter-spacing: .09em; font-weight: 600; }

#page { max-width: 1320px; margin: 0 auto; padding: 14px 22px 28px; }

/* ---------- masthead ---------- */
.mast { margin-bottom: 10px; }
.mast-top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 12px; }
.ear { font-style: italic; font-size: 13px; color: var(--faded); }
.mast h1 {
  margin: 0; font-weight: 700; font-size: 44px; line-height: 1; letter-spacing: -.01em;
  font-variation-settings: "opsz" 60; text-align: center;
}
.mast-nav { justify-self: end; display: flex; gap: 14px; }
.linkish {
  background: none; border: 0; padding: 2px 0; cursor: pointer;
  font-style: italic; font-size: 14px; color: var(--faded);
  text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 3px;
}
.linkish:hover { color: var(--ink); text-decoration-color: var(--ink); }
.dblrule { border-top: 3px double var(--ink); margin: 8px 0 6px; }
.dateline { margin: 0; text-align: center; font-style: italic; font-size: 14px; color: var(--faded); }
.dateline .vul { color: var(--red); }
.headline {
  margin: 4px 0 0; text-align: center; font-weight: 700; font-size: 24px; min-height: 1.3em;
  font-variation-settings: "opsz" 40;
}
.headline:empty { display: none; }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 26px; align-items: start; }

/* ---------- table ---------- */
.table {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(var(--compass), 320px) minmax(0, 1fr);
  grid-template-areas: ". n ." "w c e" "note note note" "s s s";
  row-gap: 10px; column-gap: 10px;
  border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink);
  padding: 14px 6px 16px;
}
.seat-n { grid-area: n; justify-self: center; text-align: left; }
.seat-w { grid-area: w; align-self: center; justify-self: end; }
.seat-e { grid-area: e; align-self: center; justify-self: start; }
.seat-s { grid-area: s; }
.centre { grid-area: c; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.table > .note { grid-area: note; }
.table > .bidslot { grid-area: c; }
.label { display: flex; align-items: baseline; gap: 6px; font-size: 15px; min-height: 22px; }
.label .name { color: var(--faded); }
.label .role { font-style: italic; font-size: 13px; color: var(--faded); }
.label .vul { font-style: italic; font-size: 12px; color: var(--red); }
.label .pts { font-style: italic; font-size: 13px; color: var(--faded); }
.seat.turn .label .name { color: var(--ink); }
.turnmark { display: inline-block; width: 0; height: 0; border-left: 7px solid var(--red); border-top: 5px solid transparent; border-bottom: 5px solid transparent; visibility: hidden; transform: translateY(-1px); }
.seat.turn .turnmark, th.turn .turnmark { visibility: visible; }
.flash { animation: flash 600ms ease-out; }
@keyframes flash { 0% { background: #C2361F33; } 100% { background: transparent; } }
.seat-s .label { justify-content: center; }

/* hand diagram rows */
.rows { font-weight: 700; font-size: 19px; line-height: 1.25; }
.rows .row { display: flex; align-items: baseline; gap: 2px; min-height: 1.3em; flex-wrap: wrap; }
.rows .row .sg { width: 1.25em; display: inline-block; }
.rows .rk {
  background: none; border: 0; padding: 0 .16em; font-weight: 700; font-size: inherit; cursor: default;
  border-radius: 2px; min-width: 1em; line-height: 1.2;
}
.rows .rk:disabled { color: inherit; }
.rows .void { color: var(--faded); font-weight: 400; }
.rows.live .rk.ok { cursor: pointer; text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 4px; }
.rows.live .rk.ok:hover { background: var(--stock); box-shadow: var(--shadow); }
.rows.live .rk.no { opacity: .45; }

/* backs */
.backs { display: flex; align-items: center; gap: 8px; }
.backs .fanb { position: relative; height: 46px; }
.backs .fanb .back { position: absolute; top: 0; width: 32px; height: 46px; }
.backs .count { font-style: italic; font-size: 14px; color: var(--faded); }
.seat-n .backs .fanb { height: 40px; }

.back {
  border-radius: 3px; border: 1px solid #1C1B22;
  background-color: var(--ink);
  background-image:
    repeating-linear-gradient(45deg, transparent 0 3px, #CFC5B055 3px 4px),
    repeating-linear-gradient(-45deg, transparent 0 3px, #CFC5B055 3px 4px);
  box-shadow: inset 0 0 0 2px var(--ink), inset 0 0 0 3px #CFC5B088, var(--shadow);
}

/* cards */
.card {
  position: relative; width: var(--cw); height: var(--ch); flex: none;
  background: var(--stock); border: 1px solid #1C1B2226; border-radius: 4px; box-shadow: var(--shadow);
  font-weight: 700; user-select: none;
}
.card .idx { position: absolute; left: 5px; top: 3px; display: flex; flex-direction: column; align-items: center; line-height: .95; }
.card .idx b { font-size: calc(var(--cw) * .33); letter-spacing: -.04em; }
.card .idx i { font-style: normal; font-size: calc(var(--cw) * .27); }
.card .mid { position: absolute; left: 0; right: 0; top: 50%; text-align: center; transform: translateY(-38%); font-size: calc(var(--cw) * .58); line-height: 1; }
.card .mid.court { font-size: calc(var(--cw) * .5); }
.card .mid.court::after { content: ""; display: block; width: 46%; margin: 3px auto 0; border-top: 3px double currentColor; }
.card.red { color: var(--red); }

.hand { display: flex; justify-content: center; padding-top: 10px; min-height: calc(var(--ch) + 12px); }
.hand .card { margin-left: var(--ov, -30px); transition: transform 180ms ease-out, opacity 180ms; }
.hand .card:first-child { margin-left: 0; }
.hand .card.ok { cursor: pointer; }
.hand .card.ok:hover, .hand .card.ok:focus-visible { transform: translateY(-6px); }
.hand.live .card.no { opacity: .45; pointer-events: none; }
.hand.tight .card:not(:last-child) .mid { visibility: hidden; }
.hand .card.gap { margin-left: calc(var(--ov, -30px) + 6px); }

/* compass and trick */
.compass {
  position: relative; width: var(--compass); height: var(--compass);
  border: 1px solid var(--ink); background: transparent;
}
.compass .pt { position: absolute; font-variant-caps: all-small-caps; font-size: 13px; letter-spacing: .1em; color: var(--faded); font-weight: 600; }
.pt-n { top: 2px; left: 50%; transform: translateX(-50%); }
.pt-s { bottom: 2px; left: 50%; transform: translateX(-50%); }
.pt-w { left: 5px; top: 50%; transform: translateY(-50%); }
.pt-e { right: 5px; top: 50%; transform: translateY(-50%); }
.trick { position: absolute; inset: 0; }
.trick .card { --cw: var(--tw); --ch: var(--th); position: absolute; left: 50%; top: 50%; }
.trick .p0 { transform: translate(-50%, -100%) translateY(-6px) rotate(-2deg); }
.trick .p2 { transform: translate(-50%, 0%) translateY(6px) rotate(1.5deg); }
.trick .p3 { transform: translate(-100%, -50%) translateX(-10px) rotate(-3deg); }
.trick .p1 { transform: translate(0%, -50%) translateX(10px) rotate(2.5deg); }
.trick.review::after { content: attr(data-cap); position: absolute; left: 0; right: 0; bottom: -1px; text-align: center; font-style: italic; font-size: 12px; color: var(--faded); background: var(--paper); }
.trick .card.win { box-shadow: 0 0 0 1px var(--ink), var(--shadow); }

.tricks-line { display: grid; grid-template-columns: 54px 1fr 54px; align-items: center; width: 100%; gap: 6px; }
.counter { margin: 0; text-align: center; font-style: italic; font-size: 14px; color: var(--ink); }
.counter .tgt { color: var(--faded); }
.stack { position: relative; height: 30px; }
.stack .back { position: absolute; width: 20px; height: 28px; top: 0; }
.review { font-size: 13px; }
.review[hidden] { display: none; }

.note { margin: 0; text-align: center; font-style: italic; font-size: 16px; min-height: 1.4em; }
.note b { font-style: normal; }
#note-dock { display: none; }

/* ---------- bidding box ---------- */
.bidslot:empty { display: none; }
.table > .bidslot { align-self: start; justify-self: center; }
body.phase-auction .centre { display: none; }
.bidbox { display: none; }
body.phase-auction .bidbox { display: block; }
.bidbox .grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.bidbox .tab {
  height: 32px; min-width: 50px; background: var(--stock); border: 1px solid #1C1B2233; border-radius: 2px;
  font-weight: 700; font-size: 16px; cursor: pointer; box-shadow: var(--shadow); padding: 0 4px; white-space: nowrap;
}
.bidbox .tab:hover:not(:disabled) { border-color: var(--ink); }
.bidbox .tab:disabled { cursor: default; color: var(--faded) !important; opacity: .45; text-decoration: line-through; box-shadow: none; background: transparent; }
.bidbox .calls { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 4px; margin-top: 6px; }
.bidbox .calls .tab { border: 2px solid var(--ink); font-variant-caps: all-small-caps; letter-spacing: .08em; font-size: 17px; height: 36px; }
.bidbox .calls .tab:disabled { border-color: var(--rule); }
.bidbox.wait .tab:not(:disabled) { opacity: .6; cursor: default; }
.bidbox.wait { pointer-events: none; }
.bidbox .nt { font-variant-caps: all-small-caps; }

/* ---------- side panels ---------- */
.side { display: flex; flex-direction: column; gap: 18px; }
.panel h2 { margin: 0 0 6px; font-size: 20px; font-weight: 700; font-variation-settings: "opsz" 30; border-bottom: 1px solid var(--ink); padding-bottom: 3px; }
.auction { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 17px; }
.auction th { font-variant-caps: all-small-caps; letter-spacing: .09em; font-size: 14px; font-weight: 600; color: var(--faded); text-align: left; padding: 3px 4px; border-bottom: 1px solid var(--rule); }
.auction th.turn { color: var(--ink); }
.auction td { padding: 3px 4px; border-bottom: 1px solid var(--rule); font-weight: 700; height: 28px; }
.auction td.pass { color: var(--faded); font-weight: 400; font-style: italic; }
.auction td.x { font-weight: 700; }
.auction td.new { animation: inbid 240ms ease-out; }
.auction td.final { text-decoration: underline; text-decoration-color: var(--ink); text-underline-offset: 3px; }
@keyframes inbid { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.auction .q { color: var(--red); }
.auction-panel .foot { margin: 6px 0 0; font-style: italic; font-size: 13px; color: var(--faded); }

.pad-panel summary { list-style: none; cursor: default; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.pad-panel summary::-webkit-details-marker { display: none; }
.pad-panel summary h2 { flex: 1; }
.padsum { display: none; font-style: italic; font-size: 14px; color: var(--faded); }
.pad {
  background: var(--stock); box-shadow: var(--shadow); border: 1px solid #1C1B2215;
  max-width: 300px; margin: 0 auto; padding: 10px 0 14px; position: relative;
  background-image: repeating-linear-gradient(to bottom, transparent 0 25px, #CFC5B066 25px 26px);
  background-position: 0 6px;
}
.pad .head { display: grid; grid-template-columns: 1fr 1fr; text-align: center; font-weight: 700; letter-spacing: .12em; font-size: 15px; padding-bottom: 2px; }
.pad .head .v { display: block; font-weight: 400; font-style: italic; letter-spacing: 0; font-size: 12px; color: var(--red); min-height: 15px; }
.pad .cols { display: grid; grid-template-columns: 1fr 1fr; position: relative; }
.pad .cols::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; border-left: 1px solid var(--ink); }
.pad .above .col { display: flex; flex-direction: column-reverse; align-items: center; min-height: 104px; justify-content: flex-start; }
.pad .theline { border-top: 2.5px solid var(--ink); margin: 2px 0; }
.pad .seg .col { display: flex; flex-direction: column; align-items: center; min-height: 26px; }
.pad .gameline { border-top: 1px solid var(--ink); margin: 0 18px; position: relative; }
.pad .e { font-family: var(--hand); color: var(--pencil); font-size: 23px; line-height: 26px; height: 26px; font-weight: 500; }
.pad .e.write { animation: write 700ms ease-out both; }
@keyframes write { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.pad .tot { border-top: 1.5px solid var(--ink); margin-top: 4px; }
.pad .tot .col { display: flex; justify-content: center; }
.pad .tot .e { font-size: 26px; text-decoration: underline; }
.pad .empty { text-align: center; font-style: italic; color: var(--faded); font-size: 13px; margin: 6px 12px 0; }

/* ---------- slips and overlays ---------- */
.slip {
  position: absolute; left: 50%; top: 50%; width: min(400px, calc(100% - 24px));
  transform: translate(-50%, -50%); z-index: 20;
  background: var(--stock); border: 1px solid var(--ink); box-shadow: var(--shadow), 0 10px 30px #0000001a;
  padding: 16px 20px 18px; text-align: center;
  animation: slipin 260ms ease-out;
}
.slip[hidden] { display: none; }
.slip.big { width: min(480px, calc(100% - 24px)); }
@keyframes slipin { from { opacity: 0; transform: translate(-50%, calc(-50% + 18px)); } to { opacity: 1; transform: translate(-50%, -50%); } }
.slip .kicker { font-variant-caps: all-small-caps; letter-spacing: .14em; font-size: 14px; color: var(--faded); font-weight: 600; border-bottom: 3px double var(--ink); padding-bottom: 4px; margin-bottom: 8px; }
.slip .ct { font-size: 26px; font-weight: 700; margin: 0; }
.slip .res { font-size: 21px; font-weight: 700; margin: 4px 0; }
.slip .res .neg { color: var(--ink); }
.slip .line { font-style: italic; color: var(--faded); font-size: 15px; margin: 4px 0 0; }
.slip .det { font-size: 14px; margin: 8px 0 0; color: var(--ink); }
.slip .btns { display: flex; justify-content: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

.btn {
  border: 2px solid var(--ink); background: var(--stock); border-radius: 2px; padding: 6px 16px; cursor: pointer;
  font-variant-caps: all-small-caps; letter-spacing: .09em; font-weight: 600; font-size: 17px;
}
.btn.primary { background: var(--ink); color: var(--stock); }
.btn:hover { box-shadow: var(--shadow); }

.overlay { position: fixed; inset: 0; z-index: 50; background: #F1EADBcc; display: flex; justify-content: center; align-items: flex-start; overflow: auto; padding: 24px 12px; }
.overlay[hidden] { display: none; }
.rules-col {
  position: relative; max-width: 860px; width: 100%; background: var(--stock); border: 1px solid var(--ink);
  box-shadow: var(--shadow); padding: 22px 26px 26px;
}
.rules-col .close { position: absolute; right: 14px; top: 14px; font-size: 15px; padding: 3px 12px; }
.rules-col h3 { margin: 0 0 4px; font-size: 30px; text-align: center; }
.rules-col .sub { text-align: center; font-style: italic; color: var(--faded); margin: 0 0 6px; }
.rules-col .body { columns: 2 300px; column-gap: 28px; column-rule: 1px solid var(--rule); border-top: 3px double var(--ink); padding-top: 10px; font-size: 15px; }
.rules-col h4 { margin: 10px 0 2px; font-variant-caps: all-small-caps; letter-spacing: .1em; font-size: 16px; break-after: avoid; }
.rules-col p { margin: 0 0 8px; text-align: justify; hyphens: auto; }
.rules-col table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 2px 0 10px; break-inside: avoid; }
.rules-col td, .rules-col th { border-bottom: 1px solid var(--rule); padding: 2px 4px; text-align: right; }
.rules-col th { font-weight: 600; font-style: italic; color: var(--faded); }
.rules-col td:first-child, .rules-col th:first-child { text-align: left; }

/* flying clones */
.fly { position: fixed; z-index: 40; pointer-events: none; margin: 0 !important; }

/* ---------- landscape, short windows ---------- */
@media (min-width: 761px) and (max-height: 640px) {
  :root { --cw: 50px; --ch: 70px; --tw: 38px; --th: 54px; --compass: 128px; }
  #page { padding: 6px 16px calc(var(--dock) + 10px); }
  .mast { margin-bottom: 4px; }
  .mast h1 { font-size: 26px; }
  .ear { font-size: 12px; }
  .dblrule { margin: 3px 0 3px; }
  .dateline { font-size: 12px; display: inline; }
  .mast { text-align: center; }
  .headline { font-size: 15px; display: inline; margin-left: 10px; }
  .headline:empty { display: none; }
  .layout { gap: 18px; }
  .table { padding: 6px 4px 6px; row-gap: 4px; border-bottom: 0; grid-template-areas: ". n ." "w c e"; }
  .table > .note { display: none; }
  .rows { font-size: 15px; line-height: 1.15; }
  .label { font-size: 13px; min-height: 18px; }
  .counter { font-size: 12px; }
  .backs .fanb, .seat-n .backs .fanb { height: 34px; }
  .backs .fanb .back { width: 24px; height: 34px; }
  body.phase-auction .seat-n, body.phase-auction .seat-w, body.phase-auction .seat-e { display: none; }
  .bidbox .tab { height: 24px; font-size: 14px; min-width: 44px; }
  .bidbox .grid { gap: 3px; }
  .bidbox .calls { margin-top: 4px; gap: 3px; }
  .bidbox .calls .tab { height: 27px; font-size: 15px; }
  .seat-s {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--paper); border-top: 1px solid var(--ink);
    padding: 2px 6px calc(4px + env(safe-area-inset-bottom));
    display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "note label" "hand hand"; align-items: baseline; column-gap: 12px;
  }
  .seat-s .label { grid-area: label; }
  .seat-s .hand { grid-area: hand; padding-top: 6px; min-height: calc(var(--ch) + 6px); }
  #note-dock { display: block; grid-area: note; text-align: left; font-size: 14px; }
  .seat-s .bidslot { display: none; }
  .panel h2 { font-size: 17px; }
  .auction { font-size: 15px; }
  .auction td { height: 24px; padding: 2px 4px; }
  .pad .above .col { min-height: 60px; }
}

/* ---------- narrow screens ---------- */
@media (max-width: 760px) {
  :root { --cw: 54px; --ch: 78px; --tw: 40px; --th: 56px; --compass: 150px; }
  #page { padding: 8px 10px calc(var(--dock) + 16px); }
  .mast-top { grid-template-columns: 1fr auto; grid-template-areas: "t t" "e n"; row-gap: 2px; }
  .mast h1 { grid-area: t; font-size: 30px; }
  .ear { grid-area: e; font-size: 12px; }
  .mast-nav { grid-area: n; gap: 10px; }
  .linkish { font-size: 13px; }
  .dblrule { margin: 4px 0 4px; }
  .dateline { font-size: 13px; }
  .headline { font-size: 19px; }
  .layout { grid-template-columns: 1fr; gap: 12px; }
  .table {
    grid-template-columns: minmax(0, 1fr) minmax(var(--compass), 172px) minmax(0, 1fr);
    grid-template-areas: "n n n" "w c e";
    padding: 8px 0 10px; column-gap: 6px; row-gap: 6px;
  }
  .table > .note, .table > .bidslot { display: none; }
  .seat-w, .seat-e { justify-self: stretch; }
  .seat-w { text-align: left; }
  .seat-s {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--paper); border-top: 1px solid var(--ink);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -2px 8px #0000000d;
  }
  #note-dock { display: block; font-size: 15px; margin: 0 0 2px; }
  .seat-s .bidslot { margin: 0 auto 6px; max-width: 420px; }
  .hand { padding-top: 8px; min-height: calc(var(--ch) + 10px); }
  .label { font-size: 14px; min-height: 20px; flex-wrap: wrap; column-gap: 5px; row-gap: 0; }
  .rows { font-size: 16px; }
  .seat-w .rows, .seat-e .rows { font-size: 14px; }
  .seat-n .rows { font-size: 17px; }
  .seat-n .rows .rk { padding: 2px .32em; min-width: 26px; }
  .backs .fanb .back { width: 24px; height: 34px; }
  .backs .fanb { height: 34px; }
  .seat-n .backs .fanb { height: 34px; }
  .compass .pt { font-size: 11px; }
  .counter { font-size: 12px; line-height: 1.25; }
  .counter .tgt { display: block; }
  .tricks-line { grid-template-columns: 20px 1fr 20px; gap: 1px; }
  .stack .back { width: 14px; height: 20px; }
  .bidbox .grid { gap: 3px; }
  .bidbox .tab { height: 29px; min-width: 0; font-size: 15px; }
  .bidbox .calls { margin-top: 4px; gap: 3px; }
  .bidbox .calls .tab { height: 34px; font-size: 16px; }
  .pad-panel summary { cursor: pointer; }
  .padsum { display: inline; }
  .pad-panel:not([open]) summary h2 { border-bottom-color: var(--rule); }
  body.phase-auction .table { grid-template-areas: "w n e"; grid-template-columns: 1fr auto 1fr; }
  body.phase-auction .centre { display: none; }
  body.phase-auction .seat-n { align-self: center; }
  body.phase-auction .seat-w { justify-self: start; }
  body.phase-auction .seat-e { justify-self: end; }
  .slip { position: fixed; top: 38%; }
  .rules-col { padding: 18px 16px 20px; }
  .rules-col h3 { font-size: 24px; padding-right: 60px; text-align: left; }
  .rules-col .sub { text-align: left; }
}
@media (max-width: 360px) {
  :root { --cw: 48px; --ch: 70px; --compass: 136px; }
  .mast h1 { font-size: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  .auction td.new { animation: fadein 200ms linear; }
  .slip { animation: fadein 200ms linear; }
  .pad .e.write { animation: fadein 300ms linear both; }
  .hand .card.ok:hover { transform: none; }
  @keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
}

/* =====================================================================
   SALON THEME: burgundy damask walls, green baize table, gilt and ivory.
   Overrides the colours and surfaces above; layout is unchanged.
   ===================================================================== */
:root {
  --paper: #F4ECD8;          /* ivory parchment for panels */
  --stock: #FBF6EA;          /* card stock */
  --ink: #1E1A17;
  --faded: #6F6250;
  --red: #B3261E;
  --pencil: #3E4E70;
  --rule: #D8C9A6;
  --gold: #C9A55C;
  --gold-hi: #E9D49A;
  --gold-lo: #8A6A2F;
  --felt: #1F5A3D;
  --felt-dk: #133C28;
  --wood: #3B1A10;
  --on-felt: #F3EAD3;
  --on-felt-dim: #BFD0BE;
  --serif: "Suits", "EB Garamond", Georgia, serif;
  --display: "Cormorant Garamond", "EB Garamond", Georgia, serif;
  --shadow: 0 1px 0 #00000022, 0 3px 8px #00000030;
}
html, body { background: #4A1218 url(img/damask.jpg) repeat; background-size: 384px 384px; }
body { color: var(--ink); font-size: 17px; }
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background: radial-gradient(ellipse at 50% 35%, transparent 40%, #00000066 100%);
}
#page { position: relative; z-index: 1; }

/* masthead: a gilt title plate on the wall */
.mast { color: var(--gold-hi); }
.mast h1 {
  font-family: var(--display); font-weight: 600; letter-spacing: .02em;
  background: linear-gradient(180deg, #F6E7B8 0%, #D9B66A 45%, #A47A34 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 1px 0 #00000040;
}
.ear, .dateline { color: #E6D3A8; }
.dateline .vul { color: #FF9C8A; }
.headline { font-family: var(--display); font-weight: 700; color: #FFF4D6; font-size: 28px; }
.dblrule { border-top: 3px double var(--gold); position: relative; }
.dblrule::after { content: "❦"; position: absolute; left: 50%; top: -0.8em; transform: translateX(-50%); color: var(--gold); background: #4A1218; padding: 0 .4em; font-size: 15px; line-height: 1; border-radius: 50%; }
.linkish { color: #E6D3A8; text-decoration-color: #C9A55C88; }
.linkish:hover { color: #FFF4D6; text-decoration-color: var(--gold-hi); }

/* the table: green baize in a mahogany frame with a gilt inlay */
.table {
  border: 0;
  background:
    radial-gradient(ellipse at 50% 40%, #2C7550 0%, var(--felt) 45%, var(--felt-dk) 100%);
  border-radius: 18px;
  box-shadow:
    0 0 0 2px var(--gold-lo), 0 0 0 4px var(--gold), 0 0 0 5px var(--gold-lo),
    0 0 0 16px var(--wood), 0 0 0 17px #6B3A22,
    0 18px 40px #00000080, inset 0 0 60px #00000066;
  margin: 18px 18px 10px;
  padding: 18px 12px 20px;
  color: var(--on-felt);
}
.table::before {
  content: ""; position: absolute; inset: 0; border-radius: 18px; pointer-events: none; opacity: .35;
  background-image:
    repeating-linear-gradient(35deg, #ffffff07 0 1px, transparent 1px 3px),
    repeating-linear-gradient(-35deg, #00000010 0 1px, transparent 1px 3px);
}
.table::after {
  content: ""; position: absolute; inset: 10px; border: 1px solid #C9A55C55; border-radius: 12px; pointer-events: none;
}
.table > :not(.seat-s):not(.slip) { position: relative; z-index: 1; }

.label { color: var(--on-felt); }
.label .name { color: var(--gold-hi); font-family: var(--display); font-size: 17px; }
.seat.turn .label .name { color: #FFFFFF; }
.label .role, .label .pts, .backs .count { color: var(--on-felt-dim); }
.label .vul { color: #FFB4A6; }
.turnmark { border-left-color: #FF6B55; }
.note { color: var(--on-felt); }
.note b { color: #FFF8E6; }
.counter { color: var(--on-felt); }
.counter .tgt { color: var(--on-felt-dim); }
.review.linkish { color: var(--on-felt-dim); }

/* dummy and declarer rows sit on a small ivory placard */
.rows {
  background: var(--stock); color: var(--ink); padding: 6px 12px 6px 10px; border-radius: 4px;
  box-shadow: 0 0 0 1px var(--gold), 0 0 0 3px #FBF6EA, 0 0 0 4px var(--gold-lo), var(--shadow);
  margin: 4px;
}

/* compass: a gilt inlay on the baize */
.compass { border: 1px solid var(--gold); box-shadow: inset 0 0 0 4px transparent, inset 0 0 0 5px #C9A55C55; border-radius: 4px; }
.compass .pt { color: var(--gold-hi); font-family: var(--display); }
.trick.review::after { background: var(--felt); color: var(--on-felt-dim); }

/* cards: ivory with a hairline gilt border; backs in burgundy with a gold lattice */
.card {
  background: linear-gradient(180deg, #FFFDF6, #F6EEDC);
  border: 1px solid #8A6A2F55; border-radius: 5px;
  box-shadow: inset 0 0 0 3px #FFFDF6, inset 0 0 0 4px #C9A55C55, 0 1px 0 #00000030, 0 3px 8px #00000040;
}
.card .idx b, .card .mid.court { font-family: var(--display); font-weight: 700; }
.back {
  border: 1px solid var(--gold-lo); border-radius: 4px;
  background-color: #6A1622;
  background-image:
    repeating-linear-gradient(45deg, transparent 0 4px, #E0C07A55 4px 5px),
    repeating-linear-gradient(-45deg, transparent 0 4px, #E0C07A55 4px 5px);
  box-shadow: inset 0 0 0 2px #6A1622, inset 0 0 0 3px #E0C07A99, 0 2px 4px #00000050;
}

/* bidding box: ivory tablets on the baize */
.bidbox .tab { color: var(--ink); background: linear-gradient(180deg, #FFFDF6, #F1E7D0); border: 1px solid #8A6A2F66; border-radius: 3px; font-family: var(--serif); box-shadow: 0 1px 0 #00000030, 0 2px 5px #00000035; }
.bidbox .tab:hover:not(:disabled) { border-color: var(--gold-lo); box-shadow: 0 0 0 1px var(--gold), 0 2px 6px #00000040; }
.bidbox .tab:disabled { background: #FFFFFF14; color: #C8D6C6 !important; border-color: #FFFFFF22; opacity: .55; }
.bidbox .calls .tab { border: 1px solid var(--gold-lo); box-shadow: inset 0 0 0 2px #FFFDF6, inset 0 0 0 3px var(--gold), 0 2px 5px #00000035; font-family: var(--display); font-size: 18px; }
.bidbox .calls .tab:disabled { box-shadow: none; }

/* side panels: framed parchment placards hung on the wall */
.panel {
  background: linear-gradient(180deg, #F8F1DF, #EFE4C8);
  padding: 14px 16px 16px;
  box-shadow: 0 0 0 1px var(--gold-lo), 0 0 0 4px var(--gold), 0 0 0 5px var(--gold-lo), 0 10px 26px #00000070;
  border-radius: 2px;
  margin: 6px 6px 10px;
}
.panel h2 { font-family: var(--display); font-weight: 700; font-size: 23px; border-bottom: 3px double var(--gold-lo); text-align: center; }
.auction th { font-family: var(--display); color: var(--gold-lo); font-size: 15px; }
.auction th.turn { color: var(--ink); }
.auction td { border-bottom-color: #D8C9A6aa; }
.pad { background-color: #FFFDF6; border: 1px solid #C9A55C66; }
.pad .head { font-family: var(--display); font-size: 17px; }
.padsum { color: var(--faded); }

/* slips and buttons */
.slip {
  background: linear-gradient(180deg, #FFFDF6, #F3E9D2); border: 1px solid var(--gold-lo);
  box-shadow: inset 0 0 0 4px #FFFDF6, inset 0 0 0 5px var(--gold), 0 18px 40px #00000080;
  color: var(--ink);
}
.slip .kicker { color: var(--gold-lo); border-bottom-color: var(--gold-lo); font-family: var(--display); }
.slip .ct, .slip .res { font-family: var(--display); }
.btn { border: 1px solid var(--gold-lo); background: linear-gradient(180deg, #FFFDF6, #EFE4C8); font-family: var(--display); font-size: 18px; box-shadow: inset 0 0 0 2px #FFFDF6, inset 0 0 0 3px var(--gold); }
.btn.primary { background: linear-gradient(180deg, #2A6B49, #164530); color: #F6E7B8; border-color: var(--gold-lo); box-shadow: inset 0 0 0 2px #1F5A3D, inset 0 0 0 3px var(--gold); }
.overlay { background: #2A0A0Ecc; }
.rules-col { background: linear-gradient(180deg, #FBF6EA, #F1E7D0); border: 1px solid var(--gold-lo); box-shadow: inset 0 0 0 5px #FBF6EA, inset 0 0 0 6px var(--gold), 0 20px 50px #00000090; }
.rules-col h3, .rules-col h4 { font-family: var(--display); }
.rules-col .body { border-top-color: var(--gold-lo); column-rule-color: #C9A55C66; }

.flash { animation: flash-salon 600ms ease-out; }
@keyframes flash-salon { 0% { background: #FFD9A055; } 100% { background: transparent; } }

@media (max-width: 760px) {
  .table { margin: 10px 8px 8px; border-radius: 12px; padding: 12px 6px 14px;
    box-shadow: 0 0 0 1px var(--gold-lo), 0 0 0 3px var(--gold), 0 0 0 4px var(--gold-lo), 0 0 0 10px var(--wood), 0 10px 26px #00000080, inset 0 0 40px #00000066; }
  .table::before { border-radius: 12px; }
  .table::after { inset: 6px; border-radius: 8px; }
  .headline { font-size: 22px; }
  .seat-s {
    background: radial-gradient(ellipse at 50% 0%, #2C7550, var(--felt-dk));
    border-top: 3px double var(--gold); color: var(--on-felt);
    box-shadow: 0 -6px 18px #00000070;
  }
  .rows { padding: 4px 8px; }
  .seat-w .rows, .seat-e .rows { padding: 4px 6px; }
  .panel { margin: 4px 4px 8px; padding: 10px 12px 12px; }
  .pad-panel summary h2 { text-align: left; }
}
@media (min-width: 761px) and (max-height: 640px) {
  .table { margin: 10px 12px 6px; padding: 10px 8px 10px; }
  .headline { font-size: 18px; }
  .seat-s { background: radial-gradient(ellipse at 50% 0%, #2C7550, var(--felt-dk)); border-top: 3px double var(--gold); color: var(--on-felt); }
  .panel { padding: 8px 10px 10px; }
}

/* =====================================================================
   ARISTOCRATIC REFINEMENT: quieter walls, finer gilt, engraved typography.
   ===================================================================== */
:root {
  --gold: #B89B62; --gold-hi: #D8C38E; --gold-lo: #7E6638;
  --felt: #1A4A33; --felt-dk: #0F2E20; --wood: #2A120C;
  --on-felt: #EFE6CF; --on-felt-dim: #A9BBA8;
}
html, body { background-color: #3A0E14; }
body::before { background: linear-gradient(#2A080DB3, #2A080DB3), radial-gradient(ellipse at 50% 30%, transparent 35%, #00000088 100%); }

/* engraved masthead: small capitals, wide tracking, flat gilt */
.mast h1 {
  background: none; color: var(--gold-hi); -webkit-text-fill-color: currentColor;
  font-weight: 500; font-variant-caps: small-caps; letter-spacing: .14em; font-size: 46px;
  text-shadow: 0 1px 0 #00000055;
}
.ear { font-family: var(--display); font-style: italic; letter-spacing: .04em; color: #CDBB92; }
.dateline { font-family: var(--display); font-size: 16px; letter-spacing: .03em; color: #D9C9A2; }
.dblrule { border-top: 1px solid var(--gold); margin: 12px 0 8px; }
.dblrule::before { content: ""; position: absolute; left: 0; right: 0; top: 3px; border-top: 1px solid #B89B6266; }
.dblrule::after { content: "✦"; font-size: 11px; color: var(--gold-hi); background: #2E0A10; top: -.65em; padding: 0 .7em; border-radius: 0; }
.headline { font-family: var(--display); font-style: italic; font-weight: 600; letter-spacing: .02em; color: #F3E8CB; }
.linkish { font-family: var(--display); font-size: 16px; letter-spacing: .03em; color: #CDBB92; text-decoration-color: #B89B6255; }

/* baize: deep bottle green, a slim polished rail and one fine gilt line */
.table {
  background: radial-gradient(ellipse at 50% 38%, #235C40 0%, var(--felt) 50%, var(--felt-dk) 100%);
  border-radius: 10px;
  box-shadow:
    0 0 0 1px var(--gold), 0 0 0 9px var(--wood), 0 0 0 10px #5A3422,
    0 24px 48px #00000090, inset 0 0 80px #00000070;
}
.table::before { border-radius: 10px; opacity: .25; }
.table::after { inset: 8px; border: 1px solid #B89B6240; border-radius: 6px; }
.label .name { font-variant-caps: all-small-caps; letter-spacing: .16em; font-weight: 500; font-size: 18px; color: var(--gold-hi); }
.note { font-family: var(--display); font-size: 18px; letter-spacing: .01em; }
.note b { font-weight: 600; }
.compass { border-color: #B89B62AA; border-radius: 2px; box-shadow: inset 0 0 0 5px transparent, inset 0 0 0 6px #B89B6233; }
.compass .pt { font-size: 14px; letter-spacing: .2em; }
.counter { font-family: var(--display); font-size: 15px; letter-spacing: .02em; }

/* cards and placards: finer edges */
.card { border: 1px solid #7E663844; box-shadow: inset 0 0 0 3px #FFFDF6, inset 0 0 0 3.5px #B89B6255, 0 1px 0 #00000030, 0 4px 10px #00000045; }
.back { background-color: #4E1019; border-color: #7E6638;
  background-image: repeating-linear-gradient(45deg, transparent 0 5px, #D8C38E33 5px 6px), repeating-linear-gradient(-45deg, transparent 0 5px, #D8C38E33 5px 6px);
  box-shadow: inset 0 0 0 2px #4E1019, inset 0 0 0 2.5px #D8C38E88, 0 2px 4px #00000060; }
.rows { box-shadow: 0 0 0 1px #B89B6299, 0 0 0 3px #FBF6EA, 0 0 0 3.5px #7E663888, 0 4px 10px #00000040; border-radius: 2px; }

/* bidding tablets: ivory, hairline gilt, quiet when unavailable */
.bidbox .tab { border: 1px solid #7E663855; border-radius: 2px; box-shadow: 0 1px 0 #00000030, 0 2px 4px #00000030; }
.bidbox .tab:disabled { background: transparent; border-color: #EFE6CF1F; color: #A9BBA8 !important; opacity: .4; }
.bidbox .calls .tab { font-variant-caps: all-small-caps; letter-spacing: .14em; font-weight: 500; box-shadow: inset 0 0 0 2px #FFFDF6, inset 0 0 0 2.5px var(--gold), 0 2px 4px #00000030; }

/* framed placards: a single gilt fillet with an inner hairline */
.panel {
  background: linear-gradient(180deg, #F7F0DE, #EEE3C7);
  box-shadow: 0 0 0 1px var(--gold-lo), 0 0 0 3px #F7F0DE, 0 0 0 4px var(--gold), 0 14px 30px #00000080;
}
.panel h2 { font-weight: 500; font-variant-caps: small-caps; letter-spacing: .12em; font-size: 22px; border-bottom: 1px solid var(--gold); padding-bottom: 6px; position: relative; }
.panel h2::after { content: ""; position: absolute; left: 30%; right: 30%; bottom: -4px; border-top: 1px solid #B89B6299; }
.auction th { letter-spacing: .16em; font-weight: 500; }
.pad .head { letter-spacing: .2em; font-weight: 500; }

/* slips, buttons, rules: engraved card */
.slip { box-shadow: inset 0 0 0 5px #FFFDF6, inset 0 0 0 6px var(--gold), 0 24px 50px #00000090; }
.slip .kicker { letter-spacing: .22em; font-weight: 500; border-bottom: 1px solid var(--gold); }
.slip .ct { font-weight: 600; font-size: 30px; }
.btn { font-variant-caps: all-small-caps; letter-spacing: .14em; font-weight: 500; border-radius: 1px; box-shadow: inset 0 0 0 2px #FFFDF6, inset 0 0 0 2.5px var(--gold); }
.btn.primary { background: linear-gradient(180deg, #21543A, #123423); color: #E9DAB0; box-shadow: inset 0 0 0 2px #1A4A33, inset 0 0 0 2.5px var(--gold); }
.rules-col { box-shadow: inset 0 0 0 6px #FBF6EA, inset 0 0 0 7px var(--gold), 0 24px 60px #000000a0; }
.rules-col h3 { font-weight: 500; font-variant-caps: small-caps; letter-spacing: .1em; }

@media (max-width: 760px) {
  .mast h1 { font-size: 30px; letter-spacing: .1em; }
  .table { box-shadow: 0 0 0 1px var(--gold), 0 0 0 7px var(--wood), 0 0 0 8px #5A3422, 0 12px 28px #00000090, inset 0 0 50px #00000070; }
  .seat-s { border-top: 1px solid var(--gold); background: radial-gradient(ellipse at 50% 0%, #235C40, var(--felt-dk)); }
  .note { font-size: 16px; }
  .label .name { font-size: 16px; }
  .bidbox .calls .tab { letter-spacing: .06em; font-size: 16px; }
}
@media (min-width: 761px) and (max-height: 640px) { .mast h1 { font-size: 28px; } }

/* landscape phones: keep the whole bidding box, the side hands and the auction header on screen */
@media (min-width: 761px) and (max-height: 640px) {
  .table { grid-template-columns: minmax(0, 1fr) calc(var(--compass) + 24px) minmax(0, 1fr); margin-top: 8px; padding: 6px 6px 6px; }
  .seat-w .rows, .seat-e .rows { font-size: 14px; }
  .rows .row { flex-wrap: nowrap; white-space: nowrap; }
  .bidbox .tab { height: 20px; font-size: 13px; }
  .bidbox .grid { gap: 2px; }
  .bidbox .calls { margin-top: 3px; }
  .bidbox .calls .tab { height: 24px; font-size: 14px; letter-spacing: .06em; }
  .auction th { white-space: nowrap; letter-spacing: .06em; font-size: 12px; padding: 3px 2px; }
  .hand:empty { min-height: 0; padding-top: 0; }
}
@media (min-width: 761px) and (max-height: 640px) {
  html { scroll-padding-bottom: calc(var(--dock) + 8px); }
}

/* the salon painting: an oil of a card party, hung in a gilt frame above the table */
.salon-painting {
  margin: 4px auto 10px; max-width: 760px; padding: 6px;
  background: linear-gradient(135deg, #8A6A2F 0%, #E9D49A 30%, #A47A34 55%, #F1DEA4 78%, #8A6A2F 100%);
  box-shadow: 0 0 0 1px #5A4219, 0 4px 14px #00000066;
}
.salon-painting img {
  display: block; width: 100%; height: 150px; object-fit: cover; object-position: 50% 45%;
  border: 1px solid #5A4219; box-shadow: inset 0 0 0 1px #00000055;
}
@media (max-width: 760px) {
  .salon-painting { padding: 4px; margin: 2px 0 6px; }
  .salon-painting img { height: 96px; }
}
@media (min-width: 761px) and (max-height: 760px) { .salon-painting img { height: 110px; } }
