/* oh.css — Oh Hell table layout (loaded after gw.css, which supplies cards,
   baize, start overlay and shared styling). */

/* ===== Start screen title ===== */

.start-title-text {
  font-size: 4.4em;
  font-weight: 600;
  font-style: italic;
  letter-spacing: 0.02em;
  line-height: 1.05;
  color: #1fa2e6;
  text-shadow:
    1px 0 0 #fff, -1px 0 0 #fff, 0 1px 0 #fff, 0 -1px 0 #fff,
    0 6px 14px rgba(0, 0, 0, 0.6);
}

.players-block { margin-top: 0.2em; margin-bottom: 0.6em; }

.start-buttons-main button small {
  font-weight: 500;
  opacity: 0.8;
  font-size: 0.78em;
}

/* ===== Opponent seats ===== */

.seat {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(3px * var(--card-scale));
  z-index: 50;
}

.seat-top      { top: 1.5vh; left: 50%; transform: translateX(-50%); }
.seat-topleft  { top: 1.5vh; left: 31%; transform: translateX(-50%); }
.seat-topright { top: 1.5vh; left: 69%; transform: translateX(-50%); }
/* Side seats sit a little low so they clear the scoreboard (top-right). */
.seat-left     { top: 57%;   left: 2.5vw;  transform: translateY(-50%); }
.seat-right    { top: 57%;   right: 2.5vw; transform: translateY(-50%); }

.seat-hand {
  position: relative;
  width: calc(var(--small-card-width) * 1.6);
  height: calc(var(--small-card-height) * var(--opp-scale, 0.85) + 8px * var(--card-scale));
  /* turned to face the middle of the table (set per seat in oh-app.js) */
  transform: rotate(var(--seat-rot, 0deg));
}

/* Rotated hands need extra room so they don't overlap their name labels. */
.seat-left .seat-hand,
.seat-right .seat-hand    { margin: calc(16px * var(--card-scale)) 0; }
.seat-topleft .seat-hand,
.seat-topright .seat-hand { margin: calc(18px * var(--card-scale)) calc(10px * var(--card-scale)) calc(22px * var(--card-scale)); }

.seat-hand .card {
  position: absolute;
  left: 50%;
  bottom: 0;
  --fan-x: 0px;
  --fan-y: 0px;
  --fan-angle: 0deg;
  transform:
    translateX(-50%)
    translateX(var(--fan-x))
    translateY(var(--fan-y))
    rotate(var(--fan-angle))
    scale(var(--opp-scale, 0.85));
  transform-origin: 50% 100%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.45);
}

/* ===== Seat labels (name / bid / tokens) ===== */

.seat-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(3px * var(--card-scale));
  pointer-events: none;
}

.seat-info .name-label {
  position: static;
  display: inline-block;
  font-size: calc(18px * var(--card-scale));
  line-height: 1.15;
  font-weight: 600;
  font-style: italic;
  color: lab(19.34% 17.6 -42.6);
  -webkit-text-stroke: 0.02em #ffffff;
  background: rgba(0, 0, 0, 0.4);
  padding: 0.05em 0.7em 0.1em;
  border-radius: 9999px;
  white-space: nowrap;
}

.seat-info .name-label.turn-glow {
  animation: turnPulse 0.9s ease-in-out infinite;
  will-change: text-shadow;
}

.seat-stats {
  font-size: calc(12.5px * var(--card-scale));
  color: #fdf6e3;
  white-space: nowrap;
  min-height: 1.3em;
  display: flex;
  align-items: center;
  gap: 0.4em;
}

.seat-stats .stat,
.seat-stats .stat-muted {
  background: rgba(0, 0, 0, 0.38);
  border-radius: 999px;
  padding: 0.1em 0.65em;
}

.seat-stats .stat-muted { opacity: 0.7; font-style: italic; }
.seat-stats .stat.on-target { color: #8fd8ff; box-shadow: inset 0 0 0 1px rgba(141, 255, 122, 0.55); }
.seat-stats .stat.over      { color: #ff8a7a; box-shadow: inset 0 0 0 1px rgba(255, 138, 122, 0.55); }

.dealer-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.45em;
  height: 1.45em;
  border-radius: 50%;
  background: #fdf6e3;
  color: #061e33;
  font-weight: 600;
  font-style: normal;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.seat-stats.just-bid { animation: bidPop 0.45s ease-out; }

@keyframes bidPop {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.seat-tokens {
  display: flex;
  gap: calc(1px * var(--card-scale));
  min-height: calc(14px * var(--card-scale));
}

.seat-tokens .token {
  width: calc(14px * var(--card-scale));
  height: calc(14px * var(--card-scale));
  object-fit: contain;
}

/* ===== Human seat ===== */

#player-hand {
  bottom: calc(1.5vh + 26px * var(--card-scale));
}

#player-seat-info {
  position: absolute;
  left: 50%;
  bottom: 1.2vh;
  transform: translateX(-50%);
  flex-direction: row;
  gap: calc(8px * var(--card-scale));
  z-index: 300;
}

/* Cards you can't play are dimmed on your turn. */
body.player-turn #player-hand .card:not(.legal-move) {
  filter: brightness(0.6) saturate(0.7);
  cursor: not-allowed;
}

body.player-turn #player-hand .card.legal-move {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.35);
}

/* ===== Centre trick ===== */

#trick-area {
  position: absolute;
  left: 50%;
  top: 47%;
  width: 0;
  height: 0;
}

.trick-slot {
  position: absolute;
  width: var(--small-card-width);
  height: var(--small-card-height);
}

.trick-slot > .card {
  position: absolute;
  inset: 0;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
}

/* ===== Deck + trump (top-left) ===== */

#deck-area {
  position: absolute;
  top: calc(1.5vh + 6px * var(--card-scale));
  left: 2vw;
  margin: 0;
  display: flex;
  gap: var(--table-gap);
  z-index: 40;
}

#trump-slot {
  min-width: calc(64px * var(--card-scale));
  min-height: calc(96px * var(--card-scale));
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

#trump-slot::before {
  content: "";
  position: absolute;
  inset: calc(-6px * var(--card-scale));
  border-radius: calc(10px * var(--card-scale));
  border: calc(1px * var(--card-scale)) solid rgba(255, 255, 255, 0.9);
  pointer-events: none;
  opacity: 0.6;
}

#trump-slot > .card {
  position: relative;
  z-index: 1;
}

#deck-area .deck-col > div:first-child {
  top: calc(100% + 0.08 * var(--small-card-height));
}

body[data-phase] #deck-area { display: flex; }

/* ===== Scoreboard (top-right) ===== */

#scoreboard {
  position: absolute;
  top: calc(12px + 30px * var(--card-scale));
  right: 8px;
  min-width: calc(120px * var(--card-scale));
  padding: calc(6px * var(--card-scale)) calc(10px * var(--card-scale));
  background: rgba(var(--ui-rgb, 3, 32, 18), 0.72);
  border: 1px solid var(--ui-accent, #1fa2e6);
  border-radius: 8px;
  font-size: calc(12.5px * var(--card-scale));
  color: #fdf6e3;
  z-index: 60;
}

#scoreboard #round-label {
  position: static;
  transform: none;
  font-size: 1em;
  font-weight: 500;
  opacity: 0.9;
  margin-bottom: 0.3em;
  white-space: nowrap;
}

#scoreboard #round-label:empty { display: none; }

#score-table {
  width: 100%;
  border-collapse: collapse;
}

#score-table td {
  padding: 0.12em 0;
  white-space: nowrap;
}

#score-table td:last-child {
  text-align: right;
  padding-left: 1em;
  font-weight: 600;
}

#score-table tr.me td:first-child { font-style: italic; }
#score-table tr.leader td { color: #8fd8ff; }

#score-table tfoot td {
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  padding-top: 0.3em;
  opacity: 0.85;
  font-weight: 500;
}

#score-table .over  { color: #ff8a7a; }
#score-table .under { color: #8ecbff; }

/* ===== Bid panel (centre of table) ===== */

#bid-panel {
  position: absolute;
  left: 50%;
  top: 47%;
  transform: translate(-50%, -50%);
  z-index: 9000;
  flex-direction: column;
  align-items: center;
  gap: calc(8px * var(--card-scale));
  max-width: 92vw;
  padding: calc(12px * var(--card-scale)) calc(18px * var(--card-scale));
  background: rgba(var(--ui-rgb, 3, 32, 18), 0.94);
  border: 2px solid var(--ui-accent, #1fa2e6);
  border-radius: 14px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.75);
  font-size: calc(15px * var(--card-scale));
  color: #fdf6e3;
}

#bid-title { font-weight: 600; }

#bid-title .suit-inline {
  font-size: 1.3em;
  -webkit-text-stroke: 0.6px rgba(255, 255, 255, 0.95);
}

#bid-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: calc(6px * var(--card-scale));
}

#bid-buttons .bid-btn {
  min-width: calc(38px * var(--card-scale));
  margin: 0;
  padding: calc(7px * var(--card-scale)) calc(10px * var(--card-scale));
  font-size: calc(17px * var(--card-scale));
  font-weight: 600;
  background: #1fa2e6;
  color: #021408;
  border-radius: 8px;
}

#bid-buttons .bid-btn:hover:not(:disabled) { background: #3fb4f0; }

#bid-buttons .bid-btn:disabled {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.45);
  text-decoration: line-through;
  opacity: 1;
}

#bid-note {
  font-size: 0.85em;
  opacity: 0.8;
  text-align: center;
}

/* ===== Round summary (uses #end-overlay styles from gw.css) ===== */

#end-panel .end-table th:not(:first-child),
#end-panel .end-table td:not(:first-child) {
  text-align: center;
}

#end-panel .end-table tr.exact td   { color: #8fd8ff; }
#end-panel .end-table tr.missed td  { color: #fdf6e3; }
#end-panel .end-table tr.me td:first-child { font-style: italic; }

#btn-end-next { margin: 0; }

/* ===== Trump coin (five-sided: four suits + blank) ===== */

.trump-coin {
  position: relative;
  z-index: 1;
  width: calc(var(--small-card-width) * 0.95);
  height: calc(var(--small-card-width) * 0.95);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 35% 30%, #fff9e6 0%, #f1dc9a 45%, #c9a64a 100%);
  box-shadow:
    inset 0 0 0 calc(3px * var(--card-scale)) #b48a2c,
    inset 0 0 0 calc(5px * var(--card-scale)) #f6e7b8,
    0 calc(4px * var(--card-scale)) calc(8px * var(--card-scale)) rgba(0, 0, 0, 0.55);
}

.trump-coin .coin-suit {
  font-size: calc(34px * var(--card-scale));
  line-height: 1;
  font-weight: 600;
  -webkit-text-stroke: 0.5px rgba(255, 255, 255, 0.8);
}

.trump-coin .coin-blank {
  font-size: calc(11px * var(--card-scale));
  font-weight: 600;
  line-height: 1.05;
  text-align: center;
  color: #6b4f12;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.trump-coin.spinning { animation: coinSpin 0.18s linear infinite; }
.trump-coin.landed   { animation: coinLand 0.45s ease-out; }

@keyframes coinSpin {
  0%   { transform: scaleX(1); }
  50%  { transform: scaleX(0.08); }
  100% { transform: scaleX(1); }
}

@keyframes coinLand {
  0%   { transform: scale(1.35); }
  60%  { transform: scale(0.94); }
  100% { transform: scale(1); }
}

/* ===== Bid tokens ===== */

.bid-token {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75em;
  height: 1.75em;
  border-radius: 50%;
  font-weight: 600;
  font-style: normal;
  font-size: 1.3em;
  line-height: 1;
  color: #061e33;
  background: radial-gradient(circle at 35% 30%, #ffffff 0%, #f3ead0 55%, #d9c98f 100%);
  box-shadow:
    inset 0 0 0 2px #b48a2c,
    0 2px 4px rgba(0, 0, 0, 0.6);
}

.bid-token.empty {
  background: rgba(0, 0, 0, 0.25);
  box-shadow: inset 0 0 0 2px rgba(253, 246, 227, 0.35);
  color: rgba(253, 246, 227, 0.7);
}

.bid-token.face-down {
  color: #f6e7b8;
  background: radial-gradient(circle at 35% 30%, #3d7a54 0%, #1d5233 60%, #0f3420 100%);
  box-shadow:
    inset 0 0 0 2px #b48a2c,
    0 2px 4px rgba(0, 0, 0, 0.6);
  animation: tokenDrop 0.3s ease-out;
}

.bid-token.revealed.on-target { box-shadow: inset 0 0 0 3px #3fcf2a, 0 0 8px rgba(141, 255, 122, 0.7); }
.bid-token.revealed.over      { box-shadow: inset 0 0 0 3px #e0503a, 0 0 8px rgba(255, 138, 122, 0.7); }

.bid-token.flipping { animation: tokenFlip 0.6s ease-in-out; }

@keyframes tokenFlip {
  0%   { transform: scaleX(1);    filter: brightness(0.6); }
  50%  { transform: scaleX(0.05); filter: brightness(0.6); }
  100% { transform: scaleX(1);    filter: none; }
}

@keyframes tokenDrop {
  0%   { transform: translateY(-0.6em) scale(1.3); opacity: 0; }
  100% { transform: none; opacity: 1; }
}

.options-block { margin-top: 0.2em; margin-bottom: 0.6em; }

#scoreboard .sb-nt {
  font-weight: 600;
  color: #ffd27a;
  margin-top: 0.1em;
}

/* ===== Traditional cards ===== */

/* Classic serif indices. */
.card .corner {
  font-family: var(--font);
  font-weight: 600;
}

/* Court art fills the framed area edge to edge (no rounded crop). */
.card .royal-inset {
  border-radius: 2px;
}

/* Big suit pip in the frame corner of each court card (both ends). */
.card .court-pip {
  position: absolute;
  left: 19%;
  top: 11.5%;
  transform: translate(-50%, -50%);
  font-size: calc(var(--small-card-width) * 0.23);
  line-height: 1;
  pointer-events: none;
}

.card .court-pip.flipped {
  left: 81%;
  top: 88.5%;
  transform: translate(-50%, -50%) rotate(180deg);
}

/* Court art sits inside the card like the original Goodall layout,
   leaving room for the corner indices. */
.card .royal-inset {
  inset: 11.2% 15.7%;
}

/* Traditional single large pip on aces. */
.card .face-icon .ace-pip {
  font-size: calc(var(--pip-size) * 4.2);
  line-height: 1;
}

/* Five players: angled upper hands need headroom and must clear the
   deck (left) and scoreboard (right); side seats drop a little lower. */
body[data-players="5"] .seat-topleft  { left: 35%; }
body[data-players="5"] .seat-topright { left: 65%; }
body[data-players="5"] .seat-topleft .seat-hand,
body[data-players="5"] .seat-topright .seat-hand {
  margin-top: calc(34px * var(--card-scale));
}
body[data-players="5"] .seat-left,
body[data-players="5"] .seat-right { top: 62%; }

/* ===== Extended deck: special cards (court-card style) ===== */

/* Whole-card art layer for special cards (frame + figure that may overlap it). */
.card.special .special-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

/* Corner icon sits where a rank + suit would, and is about as big,
   so a special card is recognisable when fanned in a hand. */
.card.special .sp-corner {
  position: absolute;
  top: 2%;
  left: 1%;
  width: 22%;
  height: auto;
  z-index: 2;
  pointer-events: none;
  filter: drop-shadow(0 0 0.6px rgba(0, 0, 0, 0.5));
}

.card.special .sp-corner.bottom {
  top: auto;
  left: auto;
  bottom: 2%;
  right: 1%;
  transform: rotate(180deg);
}

/* Moon captures Sun toast */
.capture-toast {
  position: fixed;
  left: 50%;
  top: 40%;
  transform: translate(-50%, -50%);
  z-index: 12000;
  padding: 0.5em 1.1em;
  border-radius: 14px;
  background: rgba(13, 19, 48, 0.94);
  border: 2px solid #c9d6ff;
  color: #fdf6e3;
  font-weight: 600;
  font-size: calc(18px * var(--card-scale));
  white-space: nowrap;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  pointer-events: none;
  animation: toastPop 1.8s ease-out forwards;
}

@keyframes toastPop {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
  15%  { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
  25%  { transform: translate(-50%, -50%) scale(1); }
  80%  { opacity: 1; }
  100% { opacity: 0; }
}

.bonus-tag {
  display: inline-block;
  font-size: 0.8em;
  padding: 0 0.45em;
  border-radius: 999px;
  background: rgba(28, 39, 82, 0.9);
  color: #dfe6ff;
  vertical-align: middle;
}

/* =====================================================================
   Card face grid. Everything below is measured in container units of the
   card itself (1cqw = 1% of card width; the card is 150cqw tall), so every
   card has identical proportions at any size, in hand, on the table or in
   flight.
     index column ........ x 1 - 17cqw (rank over suit, or special icon)
     court frame ......... inset 11.2% / 15.7% (from the Goodall layout)
     court corner pip .... centred 24.3% x, 19% y inside the frame
     number-card pips .... kept right of x 24cqw
   ===================================================================== */

.card {
  container-type: size;
}

.card .corner {
  top: 2cqw;
  left: 1cqw;
  width: 16cqw;
  font-size: 17cqw;
  line-height: 1;
  align-items: center;
  gap: 0;
}

.card .corner.bottom {
  top: auto;
  left: auto;
  bottom: 2cqw;
  right: 1cqw;
}

.card .corner .rank {
  display: block;
  white-space: nowrap;
}

/* "10" is squeezed to the width of a single figure, as on printed cards. */
.card .corner .rank.ten {
  letter-spacing: -0.1em;
  transform: scaleX(0.78);
  margin-left: -0.1em;
}

.card .corner .suit {
  font-size: 0.9em;
  margin-top: 0.08em;
}

/* Number-card pips and ace pip. */
.card .face-icon {
  font-size: 15cqw;
}

.card .face-icon .ace-pip {
  font-size: 52cqw;
}

/* Court corner pip, inside the frame at the Goodall position. */
.card .court-pip {
  left: 24.3%;
  top: 19%;
  font-size: 19cqw;
}

.card .court-pip.flipped {
  left: 75.7%;
  top: 81%;
}

/* Special cards: the symbol occupies the same index box as rank + suit,
   with the same cream halo as the printed indices so artwork behind it
   never muddles it. */
.card.special .sp-corner {
  top: 2.5cqw;
  left: 0.5cqw;
  width: 17cqw;
  filter:
    drop-shadow(1px 0 0 #fdf6e3) drop-shadow(-1px 0 0 #fdf6e3)
    drop-shadow(0 1px 0 #fdf6e3) drop-shadow(0 -1px 0 #fdf6e3);
}

.card.special .sp-corner.bottom {
  top: auto;
  left: auto;
  bottom: 2.5cqw;
  right: 0.5cqw;
}

/* Lining numerals (Georgia's old-style 3/4/5/7/9 drop below the line) and a
   proper-sized suit under the rank. */
.card .corner {
  font-family: var(--font);
  font-variant-numeric: lining-nums;
  font-size: 19cqw;
}

.card .corner .suit {
  font-family: var(--font);
  font-size: 0.8em;
  margin-top: 0.02em;
}

.card.special .sp-corner { width: 18cqw; }

/* ===== Tutorial coach ===== */

#coach {
  position: fixed;
  left: 50%;
  top: 2vh;
  transform: translateX(-50%);
  z-index: 12500;
  width: min(600px, 58vw);
  display: none;
  flex-direction: column;
  gap: 0.6em;
  padding: 0.9em 1.1em 0.8em;
  background: rgba(var(--ui-rgb, 3, 32, 18), 0.96);
  border: 2px solid #ffd54a;
  border-radius: 14px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.75);
  color: #fdf6e3;
  font-size: clamp(14px, calc(15px * var(--card-scale)), 22px);
  line-height: 1.4;
}

#coach.prompt { border-color: #1fa2e6; }
#coach .coach-text b { color: #ffd54a; }
#coach.prompt .coach-text b { color: #8fd8ff; }

#coach .coach-buttons {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#coach .coach-next {
  margin: 0;
  background: #ffd54a;
  color: #2a1c00;
  font-weight: 600;
  font-size: 1em;
  padding: 0.35em 1em;
  border-radius: 8px;
}

#coach .coach-skip {
  margin: 0;
  background: transparent;
  color: rgba(253, 246, 227, 0.6);
  font-size: 0.8em;
  padding: 0.2em 0;
  text-decoration: underline;
}

#tut-spot {
  position: fixed;
  z-index: 9500;
  pointer-events: none;
  border: 3px solid #ffd54a;
  border-radius: 12px;
  box-shadow: 0 0 18px rgba(255, 213, 74, 0.45);
  animation: tutPulse 1.1s ease-in-out infinite;
}

@keyframes tutPulse {
  0%, 100% { border-color: rgba(255, 213, 74, 1); }
  50%      { border-color: rgba(255, 213, 74, 0.3); }
}

#btn-tutorial {
  background: transparent;
  border: 2px solid #1fa2e6;
  color: #1fa2e6;
  font-weight: 600;
}

#btn-tutorial:hover { background: rgba(31, 162, 230, 0.16); }

.options-block .firstdeal-cell { padding-top: 0.25em; padding-bottom: 0.25em; }

/* Larger face pips (number cards) and court corner pips. */
.card .face-icon { font-size: 19cqw; }
.card .court-pip { font-size: 24cqw; }

/* Pips use the same symbol font as the index suits (the serif card font
   draws tiny suit glyphs). */
.card .face-icon,
.card .court-pip {
  font-family: var(--font);
}
.card .face-icon { font-size: 25cqw; }
.card .court-pip { font-size: 28cqw; }
.card .face-icon .ace-pip { font-size: 56cqw; }

/* Side seats sit a fixed distance from the table centre (in card widths),
   not at the window edges, so wide screens keep everyone near the table. */
.seat-left  { left:  max(2.5vw, calc(50% - 4.6 * var(--small-card-width))); }
.seat-right { right: max(2.5vw, calc(50% - 4.6 * var(--small-card-width))); }

/* Compact bid panel, a little below centre, clear of the top seats' names. */
#bid-panel {
  top: 53%;
  width: max-content;
  max-width: min(92vw, calc(5.4 * var(--small-card-width)));
}
#bid-buttons { max-width: 100%; }
#bid-buttons .bid-btn {
  min-width: calc(32px * var(--card-scale));
  padding: calc(5px * var(--card-scale)) calc(8px * var(--card-scale));
  font-size: calc(15px * var(--card-scale));
}
#bid-panel { top: 55%; gap: calc(6px * var(--card-scale)); padding: calc(9px * var(--card-scale)) calc(14px * var(--card-scale)); }
#bid-panel { max-width: min(92vw, calc(4.9 * var(--small-card-width))); }

/* Start screen logo */
.start-header { margin-bottom: 0.3em; }
.start-title-img {
  display: block;
  margin: 0 auto;
  width: 100%;
  max-width: 26em;
  max-height: 11em;
  object-fit: contain;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.55));
}

/* ===== Splash (BugVictim) ===== */
#splash {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4vh;
  cursor: pointer;
  outline: none;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(40, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0.92) 70%),
    #050302;
  transition: opacity 0.55s ease;
}
#splash.gone { opacity: 0; pointer-events: none; }

#splash .splash-logo {
  width: min(52vh, 70vw);
  height: auto;
  filter: drop-shadow(0 0 28px rgba(200, 0, 0, 0.35));
  animation: splashIn 0.9s ease-out both;
}

#splash .splash-start {
  color: #f2d7c9;
  font-size: clamp(16px, 2.6vh, 28px);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  animation: splashPulse 1.6s ease-in-out infinite;
}

@keyframes splashIn {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: none; }
}
@keyframes splashPulse {
  0%, 100% { opacity: 0.35; }
  50%      { opacity: 1; }
}

/* Start panel credit: plain text, no logo */
.start-logo-row.start-credit-line {
  display: block;
  text-align: center;
  color: #1fa2e6;
  letter-spacing: 0.06em;
  font-size: 0.95em;
  margin: 0.2em 0 0.8em;
}

/* ===== First-time tutorial offer ===== */
#tut-offer {
  position: fixed;
  inset: 0;
  z-index: 15000;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
}
#tut-offer .tut-offer-panel {
  background: rgba(var(--ui-rgb, 3, 32, 18), 0.97);
  border: 2px solid #ffd54a;
  border-radius: 16px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.85);
  padding: 1.4em 1.8em 1.2em;
  text-align: center;
  color: #fdf6e3;
  font-size: clamp(15px, 2.2vh, 22px);
  max-width: min(90vw, 28em);
}
#tut-offer .tut-offer-title { font-size: 1.5em; font-weight: 600; color: #ffd54a; margin-bottom: 0.3em; }
#tut-offer .tut-offer-text { opacity: 0.9; margin-bottom: 1.1em; }
#tut-offer .tut-offer-buttons { display: flex; gap: 0.8em; justify-content: center; }
#tut-offer button { margin: 0; font-size: 1em; padding: 0.55em 1.2em; border-radius: 8px; font-weight: 600; }
#btn-offer-tutorial { background: #1fa2e6; color: #021408; }
#btn-offer-tutorial:hover { background: #3fb4f0; }
#btn-offer-skip { background: transparent; border: 1px solid rgba(253, 246, 227, 0.4); color: #fdf6e3; }

/* Splash: main logo large, BugVictim smaller below */
#splash { gap: 3vh; }
#splash .splash-title {
  width: min(110vh, 82vw);
  height: auto;
  filter: drop-shadow(0 10px 30px rgba(200, 0, 0, 0.35));
  animation: splashIn 0.9s ease-out both;
}
#splash .splash-logo {
  width: min(16vh, 22vw);
  filter: drop-shadow(0 0 14px rgba(200, 0, 0, 0.3));
  animation: splashIn 0.9s 0.25s ease-out both;
}

/* Tagline under the main logo */
.logo-subtitle {
  text-align: center;
  font-family: var(--font);
  font-style: italic;
  font-weight: 600;
  color: #ffcf6b;
  letter-spacing: 0.03em;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
  font-size: 1.1em;
  margin-top: 0.15em;
}
#splash .splash-subtitle {
  font-size: clamp(18px, 3.4vh, 38px);
  margin-top: -2.2vh;
  animation: splashIn 0.9s 0.15s ease-out both;
}
#splash .splash-title { width: auto; max-width: 82vw; max-height: 58vh; }
#splash .splash-logo { width: auto; height: min(13vh, 22vw); }

/* Your own bid status during play */
.seat-stats .stat-hint {
  font-style: italic;
  color: #ffd27a;
  opacity: 0.9;
  white-space: nowrap;
}

/* ===== Scorecard ===== */
#scoreboard { cursor: pointer; }
#scoreboard:hover { border-color: #1fa2e6; }
#scorecard {
  position: fixed; inset: 0; z-index: 14000;
  align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.5);
}
#scorecard .scorecard-panel {
  background: rgba(var(--ui-rgb, 3, 32, 18), 0.97);
  border: 2px solid var(--ui-accent, #1fa2e6);
  border-radius: 14px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.85);
  padding: 1em 1.2em;
  color: #fdf6e3;
  max-width: 94vw; max-height: 86vh;
  display: flex; flex-direction: column; gap: 0.6em;
  font-size: clamp(13px, 1.8vh, 18px);
}
#scorecard .scorecard-title { font-size: 1.4em; font-weight: 600; text-align: center; }
#scorecard .scorecard-body { overflow: auto; }
.scorecard-table { border-collapse: collapse; width: 100%; }
.scorecard-table th, .scorecard-table td {
  padding: 0.25em 0.7em; text-align: center; white-space: nowrap;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.scorecard-table th { position: sticky; top: 0; background: rgba(var(--ui-rgb, 3, 32, 18), 1); }
.scorecard-table td.exact { color: #8fd8ff; }
.scorecard-table .sc-bw { opacity: 0.7; font-size: 0.85em; }
.scorecard-key { font-size: 0.8em; opacity: 0.7; text-align: center; }
#scorecard .scorecard-buttons { display: flex; justify-content: center; }
#btn-scorecard-close { margin: 0; background: #1fa2e6; color: #021408; font-weight: 600; border-radius: 8px; padding: 0.4em 1.4em; }

/* Suit-colour row: same label column as the other option rows */
.settings4 .settings4-label { width: 18%; padding-left: 0; }
.settings4 .settings4-opt { width: auto; }

#splash .splash-credit {
  color: #f2d7c9;
  opacity: 0.8;
  letter-spacing: 0.12em;
  font-size: clamp(13px, 2vh, 20px);
  margin-top: -2vh;
}

/* Bigger face pips */
.card .face-icon { font-size: 31cqw; }
.card .face-icon .ace-pip { font-size: 62cqw; }
.card .court-pip { font-size: 30cqw; }

/* Suit symbols in coach text: on a small card-coloured chip, so black
   spades and clubs read on the dark panel; forced to text (not emoji)
   glyphs, with a little space after the rank. */
#coach .coach-suit {
  display: inline-block;
  font-family: var(--font);
  font-weight: normal;
  line-height: 1.15;
  margin-left: 0.2em;
  padding: 0 0.14em;
  border-radius: 0.2em;
  background: #fdf6e3;
}

/* =====================================================================
   Start panel: tabs + segmented options
   ===================================================================== */
#start-panel .start-field-row { margin-bottom: 0.7em; }

.tab-bar {
  display: flex;
  gap: 0.3em;
  border-bottom: 2px solid rgba(31, 162, 230, 0.45);
  margin: 0 0 0.8em;
}
.tab-btn {
  margin: 0;
  flex: 1;
  background: transparent;
  color: rgba(253, 246, 227, 0.65);
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  padding: 0.45em 0.6em;
  font-size: 1em;
  font-weight: 600;
}
.tab-btn:hover { background: rgba(31, 162, 230, 0.1); color: #fdf6e3; }
.tab-btn.active {
  background: rgba(31, 162, 230, 0.2);
  color: #fdf6e3;
  border-color: rgba(31, 162, 230, 0.45);
}

.tab-pane { display: none; }
.tab-pane.active { display: block; }

.opt-row {
  display: grid;
  grid-template-columns: 6.2em 1fr;
  align-items: center;
  gap: 0.6em;
  margin-bottom: 0.65em;
}
.opt-row-end { display: flex; justify-content: flex-end; }
.opt-label { font-weight: 600; opacity: 0.85; white-space: nowrap; }

/* Segmented radio buttons */
.seg {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3em;
}
.seg label {
  flex: 1 1 auto;
  cursor: pointer;
  user-select: none;
}
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label > span {
  display: block;
  text-align: center;
  padding: 0.38em 0.6em;
  border-radius: 8px;
  border: 1px solid rgba(31, 162, 230, 0.45);
  background: rgba(0, 0, 0, 0.25);
  color: #fdf6e3;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s;
}
.seg label:hover > span { background: rgba(31, 162, 230, 0.15); }
.seg input:checked + span {
  background: #1fa2e6;
  border-color: #1fa2e6;
  color: #021408;
  font-weight: 600;
}
.seg input:focus-visible + span { outline: 2px solid #ffd54a; outline-offset: 2px; }

/* Suit colour pills inside a seg */
.seg-suits label > span.pill-suits {
  background: rgba(245, 236, 210, 0.85);
  border-color: transparent;
  display: flex; justify-content: center; gap: 4px;
  font-weight: 600;
}
.seg-suits input:checked + span.pill-suits {
  background: rgba(245, 236, 210, 1);
  box-shadow: 0 0 0 3px #1fa2e6;
}

/* Presets */
.preset-row { display: flex; flex-wrap: wrap; gap: 0.3em; }
.preset-btn {
  margin: 0;
  flex: 1 1 auto;
  background: transparent;
  border: 1px dashed rgba(255, 213, 74, 0.7);
  color: #ffd54a;
  border-radius: 8px;
  padding: 0.38em 0.6em;
  font-size: 1em;
  font-weight: 600;
}
.preset-btn:hover, .preset-btn.active { background: rgba(255, 213, 74, 0.16); border-style: solid; }

/* Max cards stepper */
.cards-control { display: flex; align-items: center; gap: 0.5em; }
.step-btn {
  margin: 0;
  width: 2em; height: 2em;
  padding: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(31, 162, 230, 0.6);
  color: #fdf6e3;
  font-size: 1.1em;
  font-weight: 600;
  line-height: 1;
}
.step-btn:hover { background: rgba(31, 162, 230, 0.2); }
#max-cards-value { min-width: 1.6em; text-align: center; font-size: 1.4em; font-weight: 600; }
.cards-note { opacity: 0.6; font-size: 0.85em; }

.round-summary-line {
  text-align: center;
  color: #ffd54a;
  font-weight: 600;
  margin-top: 0.2em;
}

/* Footer buttons: Tutorial + Play */
#btn-play {
  background: #1fa2e6;
  color: #021408;
  font-weight: 600;
  flex: 2 1 auto;
  font-size: 1.3em;
}
#btn-play small { font-size: 0.62em; font-weight: 600; opacity: 0.8; }
#btn-play:hover { background: #3fb4f0; }
#start-panel .start-panel-content { overflow-x: hidden; }

/* Larger corner indices (+21%). Court frames step in a little to make
   room; measured clearance to pips and frames is >= 1.3% of card width. */
.card .corner { font-size: 23cqw; width: 20.3cqw; }
.card .royal-inset { inset: 11.2% 20.5%; }
.card .court-pip { left: 29%; }
.card .court-pip.flipped { left: 71%; }
.card .face-icon .ace-spade-svg { width: 62%; height: 62%; }
.card.special .sp-corner { width: 22cqw; }

/* ===== Table surfaces ===== */
body.table-red    { background-image: radial-gradient(ellipse at 50% 46%, rgba(0,0,0,0) 0%, rgba(0,0,0,0.18) 42%, rgba(0,0,0,0.72) 78%, rgba(0,0,0,0.88) 100%), url("baize-red.jpg");  background-color: #2a0507; }
body.table-blue   { background-image: radial-gradient(ellipse at 50% 46%, rgba(0,0,0,0) 0%, rgba(0,0,0,0.18) 42%, rgba(0,0,0,0.72) 78%, rgba(0,0,0,0.88) 100%), url("baize-blue.jpg"); background-color: #05102a; }
body.table-walnut { background-image: radial-gradient(ellipse at 50% 46%, rgba(0,0,0,0) 0%, rgba(0,0,0,0.12) 42%, rgba(0,0,0,0.65) 78%, rgba(0,0,0,0.85) 100%), url("walnut.jpg");     background-color: #2a160c; }
html:has(body.table-red)    { background-color: #2a0507; }
html:has(body.table-blue)   { background-color: #05102a; }
html:has(body.table-walnut) { background-color: #2a160c; }

/* Swatch buttons */
.seg-tables .sw { color: #fdf6e3 !important; text-shadow: 0 1px 2px rgba(0,0,0,0.8); background-size: cover !important; }
.seg-tables .sw-green  { background: url("baize.jpg") center / 200% !important; }
.seg-tables .sw-red    { background: url("baize-red.jpg") center / 200% !important; }
.seg-tables .sw-blue   { background: url("baize-blue.jpg") center / 200% !important; }
.seg-tables .sw-walnut { background: url("walnut.jpg") center / 200% !important; }
.seg-tables input:checked + .sw { box-shadow: 0 0 0 3px #1fa2e6; border-color: #1fa2e6; font-weight: 600; }
body.table-mahogany { background-image: radial-gradient(ellipse at 50% 46%, rgba(0,0,0,0) 0%, rgba(0,0,0,0.12) 42%, rgba(0,0,0,0.65) 78%, rgba(0,0,0,0.85) 100%), url("table-mahogany.jpg"); background-color: #2a0c08; }
body.table-tavern   { background-image: radial-gradient(ellipse at 50% 46%, rgba(0,0,0,0) 0%, rgba(0,0,0,0.12) 42%, rgba(0,0,0,0.65) 78%, rgba(0,0,0,0.85) 100%), url("table-tavern.jpg");   background-color: #2a180c; }
body.table-marble   { background-image: radial-gradient(ellipse at 50% 46%, rgba(0,0,0,0) 0%, rgba(0,0,0,0.12) 42%, rgba(0,0,0,0.65) 78%, rgba(0,0,0,0.85) 100%), url("table-marble.jpg");   background-color: #1c1c1e; }
html:has(body.table-mahogany) { background-color: #2a0c08; }
html:has(body.table-tavern)   { background-color: #2a180c; }
html:has(body.table-marble)   { background-color: #1c1c1e; }
.seg-tables .sw-mahogany { background: url("table-mahogany.jpg") center / 200% !important; }
.seg-tables .sw-tavern   { background: url("table-tavern.jpg") center / 200% !important; }
.seg-tables .sw-marble   { background: url("table-marble.jpg") center / 200% !important; }
.seg-tables label { flex: 1 1 22%; }

/* ===== Card backs ===== */
body.back-hellfire .card.back {
  background: #1a0602 url("back-hellfire.webp") center / 100% 100% no-repeat;
  border-color: #1a0602;
}
body.back-classic-blue .card.back {
  background: #fff url("back-classic-blue.svg") center / 100% 100% no-repeat;
  border-color: #d8d8d8;
}
body.back-classic-red .card.back {
  background: #fff url("back-classic-red.svg") center / 100% 100% no-repeat;
  border-color: #d8d8d8;
}

/* Back swatches: little cards */
.seg-backs label { flex: 0 0 auto; }
.seg-backs .bk {
  width: 2.4em; height: 3.6em; padding: 0 !important;
  border-radius: 5px !important;
  background-color: #fdf6e3 !important;
  background-repeat: no-repeat !important;
}
.seg-backs .bk-bugvictim    { background-image: url("back.svg") !important; background-size: 92% 92% !important; background-position: center !important; }
.seg-backs .bk-hellfire     { background: #1a0602 url("back-hellfire.webp") center / 100% 100% no-repeat !important; }
.seg-backs .bk-classic-blue { background: #fff url("back-classic-blue.svg") center / 100% 100% no-repeat !important; }
.seg-backs .bk-classic-red  { background: #fff url("back-classic-red.svg") center / 100% 100% no-repeat !important; }
.seg-backs input:checked + .bk { box-shadow: 0 0 0 3px #1fa2e6; }

/* Larger opponent cards (85%): give the top seat headroom and keep the
   bid panel clear of the upper seats' status rows with five players. */
.seat-top .seat-hand { margin-top: calc(22px * var(--card-scale)); }
body[data-players="5"] #bid-panel { top: 58.5%; }

/* Deck: only visible (centre of the table) while dealing */
#deck-slot {
  position: absolute;
  left: 50%;
  top: 47%;
  transform: translate(-50%, -50%);
  width: var(--small-card-width);
  height: var(--small-card-height);
  z-index: 30;
  display: none;
}
#deck-slot.dealing { display: block; }
#deck-slot::before { display: none; }

/* Trump marker: bottom-left, near your own hand */
#deck-area {
  top: auto;
  left: 2vw;
  bottom: calc(2vh + 22px * var(--card-scale));
}

/* Bid buttons: balanced grid (columns set per hand size in JS). */
#bid-buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(6px * var(--card-scale));
}
#bid-buttons .bid-row {
  display: flex;
  justify-content: center;
  gap: calc(6px * var(--card-scale));
}

/* Trick area sits a little lower so played cards clear the top seats' labels */
#trick-area { top: 52%; }

/* ===== Panels take their tint from the chosen table ===== */
body               { --ui-rgb: 3, 32, 18;   --ui-accent: #1fa2e6; }
body.table-red     { --ui-rgb: 36, 6, 8;    --ui-accent: #d8452e; }
body.table-blue    { --ui-rgb: 6, 14, 38;   --ui-accent: #4f7fe0; }
body.table-walnut  { --ui-rgb: 34, 18, 9;   --ui-accent: #c08a4a; }
body.table-mahogany{ --ui-rgb: 36, 12, 7;   --ui-accent: #c86a3c; }
body.table-tavern  { --ui-rgb: 33, 21, 10;  --ui-accent: #b98a4e; }
body.table-marble  { --ui-rgb: 22, 22, 25;  --ui-accent: #a8a8b4; }

/* Trump marker: no frame, just the coin / card */
#trump-slot::before { display: none; }
body[data-phase="idle"] #deck-area { display: none; }

/* Quit button only during a game; confirm dialog */
body.overlay-active #btn-quit { display: none; }
.modal-shade {
  position: fixed; inset: 0; z-index: 15000;
  align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.5);
}
.modal-shade .tut-offer-panel {
  background: rgba(var(--ui-rgb, 3, 32, 18), 0.97);
  border: 2px solid var(--ui-accent, #1fa2e6);
  border-radius: 16px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.85);
  padding: 1.4em 1.8em 1.2em;
  text-align: center;
  color: #fdf6e3;
  font-size: clamp(15px, 2.2vh, 22px);
}
.modal-shade .tut-offer-title { font-size: 1.4em; font-weight: 600; margin-bottom: 0.3em; }
.modal-shade .tut-offer-text { opacity: 0.85; margin-bottom: 1.1em; }
.modal-shade .tut-offer-buttons { display: flex; gap: 0.8em; justify-content: center; }
.modal-shade button { margin: 0; font-size: 1em; padding: 0.55em 1.2em; border-radius: 8px; font-weight: 600; }
#btn-quit-no { background: #1fa2e6; color: #021408; }
#btn-quit-yes { background: transparent; border: 1px solid #e05a4a; color: #ff9c8c; }
#btn-quit-yes:hover { background: rgba(224, 90, 74, 0.18); }

/* No table furniture before a game starts: the start panel sits on an
   empty table (no preview seats, names or scoreboard). */
body[data-phase="idle"] #seats,
body[data-phase="idle"] #player-seat-info,
body[data-phase="idle"] #player-hand,
body[data-phase="idle"] #scoreboard { display: none; }

/* ===== Portrait phones: ask to rotate ===== */
#rotate-prompt { display: none; }
@media (orientation: portrait) and (max-width: 820px) {
  #rotate-prompt {
    position: fixed; inset: 0; z-index: 30000;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 0.8em; padding: 2em; text-align: center;
    background: radial-gradient(ellipse at 50% 45%, rgba(60, 0, 0, 0.6), #050302 75%), #050302;
    color: #fdf6e3;
    font-family: var(--font);
  }
  #rotate-prompt .rotate-phone {
    font-size: 64px;
    animation: rotatePhone 2.2s ease-in-out infinite;
  }
  #rotate-prompt .rotate-title { font-size: 22px; font-weight: 600; color: #ffcf6b; }
  #rotate-prompt .rotate-text { font-size: 16px; opacity: 0.8; }
}
@keyframes rotatePhone {
  0%, 25%  { transform: rotate(0deg); }
  50%, 75% { transform: rotate(-90deg); }
  100%     { transform: rotate(0deg); }
}

/* =====================================================================
   Large-index faces: big top-left index + one enlarged pip, no artwork.
   Used automatically on small screens, or chosen in Look & feel.
   ===================================================================== */
.card .jumbo-pip { display: none; }

body.faces-large .card .face-icon,
body.faces-large .card .special-art,
body.faces-large .card .corner.bottom,
body.faces-large .card.special .sp-corner.bottom { display: none !important; }

body.faces-large .card .corner {
  top: 3cqw;
  left: 3cqw;
  width: 38cqw;
  font-size: 40cqw;
}
body.faces-large .card .corner .suit { font-size: 0.82em; }

body.faces-large .card .jumbo-pip {
  display: block;
  position: absolute;
  /* Centred across the card, and in the space below the corner index. */
  left: 50%;
  top: 65%;
  transform: translate(-50%, -50%);
  font-family: var(--font);
  font-size: 64cqw;
  line-height: 1;
  pointer-events: none;
}

body.faces-large .card.special .sp-corner {
  top: 3cqw;
  left: 3cqw;
  width: 38cqw;
}
body.faces-large .card.special .jumbo-icon {
  top: 54%;   /* specials' corner icon is shorter, so there's more room */
  width: 58cqw;
  height: auto;
}
body.faces-large .card .jumbo-ace { width: 62cqw; height: auto; }
/* In a fanned hand only the top card's symbol is visible; the rest would
   just leave slivers peeking out from under the next card. */
body.faces-large #player-hand .card:not(:last-child) .jumbo-pip { display: none; }
/* Court symbols: crown (K), coronet (Q), feathered cap (J) */
body.faces-large .card .jumbo-court { width: 64cqw; height: auto; }

/* ===== Start panel: two columns on landscape screens =====
   Logo, credit and the Tutorial/Play buttons on the left; name, tabs and
   options on the right, so nothing needs scrolling. */
@media (orientation: landscape) {
  #start-panel:not(.instructions-open):not(.results-open) {
    display: grid;
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
    grid-template-rows: auto auto;
    align-content: center;
    column-gap: 1.8em;
    width: min(96vw, calc(var(--scale-factor) * 135));
    max-width: calc(100vw - 160px);   /* clear the sound/fullscreen buttons */
    height: auto;                     /* fit the content, not the screen */
    row-gap: 0;
  }
  #start-panel:not(.instructions-open):not(.results-open) .start-panel-header {
    grid-column: 1; grid-row: 1;
    align-self: end;
  }
  #start-panel:not(.instructions-open):not(.results-open) .start-panel-footer {
    grid-column: 1; grid-row: 2;
    align-self: start;
    margin-top: 1.2em;
  }
  #start-panel:not(.instructions-open):not(.results-open) .start-panel-content {
    grid-column: 2; grid-row: 1 / span 2;
    margin-top: 0;
    align-self: center;
    max-height: 100%;
  }
  #start-panel:not(.instructions-open):not(.results-open) .start-title-img {
    max-height: 20em;
  }
  #start-panel:not(.instructions-open):not(.results-open) .start-buttons-main small {
    white-space: nowrap;
  }
  /* Stack the tabs in one cell so the panel keeps the tallest tab's height
     and doesn't jump when switching tabs. */
  #start-panel .start-body { display: grid; grid-template-columns: minmax(0, 1fr); }
  #start-panel .start-body > * { grid-column: 1; }
  #start-panel .start-body > .tab-pane { display: block; grid-row: 3; visibility: hidden; }
  #start-panel .start-body > .tab-pane.active { visibility: visible; }
}
/* Phones: bigger touch targets in the options column; there's room. */
@media (orientation: landscape) and (max-height: 500px) {
  #start-panel:not(.instructions-open):not(.results-open) {
    width: min(96vw, calc(var(--scale-factor) * 170));
    height: var(--panel-height);
  }
  #start-panel:not(.instructions-open):not(.results-open) .start-panel-content {
    font-size: 1.25em;
  }
}

/* Trump coin spinning mid-table before it slides to the trump slot */
.coin-flight {
  position: fixed;
  z-index: 9000;
  transform: translate(-50%, -50%) scale(2.2);   /* = COIN_BIG in oh-app.js */
  pointer-events: none;
}

/* ===== Touch screens: tap a card to pick it, tap it again to play ===== */
body.player-turn #player-hand .card.legal-move.picked {
  --sel-lift: -24%;   /* of the card's own height: clears its neighbours */
  --hover-scale: 1;    /* no growing, so it doesn't cover the card to its left */
  box-shadow:
    0 10px 18px rgba(0, 0, 0, 0.85),
    0 0 0 3px #ffd84a;
}
/* The picked card's big symbol stays visible even if it isn't the top card. */
body.faces-large #player-hand .card.picked .jumbo-pip { display: block; }
#play-hint {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9500;
  padding: 0.25em 0.8em;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.7);
  color: #ffd84a;
  font-weight: 600;
  font-size: calc(13px * var(--card-scale));
  pointer-events: none;
  white-space: nowrap;
}

/* ===== Phones: bigger bid buttons ===== */
@media (max-height: 500px) {
  #bid-buttons { gap: 8px; }
  #bid-buttons .bid-btn {
    min-width: 44px;
    min-height: 40px;
    padding: 4px 10px;
    font-size: 20px;
  }
  #bid-panel { max-width: 92vw; }
}

/* ===== Touch screens: slider bid picker =====
   Sits in the middle of the table (empty while bidding), clear of the
   opponents' cards. */
#bid-panel.touch {
  top: 41%;
  gap: 6px;
  padding: 8px 14px 10px;
  font-size: 13px;
  width: min(62vw, 430px);
  max-width: none;
}
#bid-panel.touch #bid-title { text-align: center; white-space: nowrap; }
#bid-panel.touch #bid-note { font-size: 11px; text-align: center; }
#bid-panel.touch #bid-note:empty { display: none; }
#bid-panel.touch #bid-buttons {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  width: 100%;
}
.bid-slider { flex: 1 1 auto; min-width: 0; }
.bid-range {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 34px;
  margin: 0;
  background: transparent;
  touch-action: none;
}
.bid-range::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.25);
}
.bid-range::-moz-range-track {
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.25);
}
.bid-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 30px;
  height: 30px;
  margin-top: -11px;
  border-radius: 50%;
  background: #ffd84a;
  border: 3px solid #021408;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}
.bid-range::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ffd84a;
  border: 3px solid #021408;
}
/* Numbers under the track, lined up with the thumb's stops
   (the thumb centre runs from 15px to 100% - 15px). */
.bid-ticks {
  display: flex;
  justify-content: space-between;
  margin: 0 3px;
}
.bid-tick {
  width: 24px;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  line-height: 24px;
  color: rgba(253, 246, 227, 0.7);
}
.bid-tick.on { color: #ffd84a; font-size: 22px; }
.bid-tick.no { color: rgba(253, 246, 227, 0.3); text-decoration: line-through; }
.bid-confirm {
  flex: 0 0 auto;
  margin: 0;
  min-height: 48px;
  min-width: 92px;
  padding: 0 14px;
  font-size: 18px;
  font-weight: 600;
  white-space: nowrap;
  background: #1fa2e6;
  color: #021408;
  border-radius: 10px;
}
.bid-confirm b { font-size: 26px; font-weight: 600; }
.bid-confirm:disabled { background: rgba(255, 255, 255, 0.15); color: rgba(255, 255, 255, 0.6); font-size: 14px; }

/* Phones: plain solid white seat names; the outlined italic is hard to read small. */
@media (orientation: landscape) and (max-height: 500px) {
  .seat-info .name-label {
    color: #fff;
    -webkit-text-stroke: 0;
  }
}

/* Phones: bigger corner controls (quit, sound, fullscreen) for fingers. */
@media (orientation: landscape) and (max-height: 500px) {
  #controls { top: 6px; right: 8px; }
  #controls .icon-btn {
    width: 46px;
    height: 40px;
    margin-left: 8px;
    font-size: 22px;
    border-radius: 8px;
  }
  /* Keep the scoreboard below them... */
  #scoreboard { top: 54px; transform: scale(var(--sb-scale, 1.2)); transform-origin: top right; }
  /* ...and the start panel to their left. */
  #start-overlay { justify-content: flex-start; padding-left: 10px; }
  #start-panel:not(.instructions-open):not(.results-open) { max-width: calc(100vw - 140px); }
}
/* Phones: shift the playing area left a little to make room for the
   score box in the top-right corner. */
@media (orientation: landscape) and (max-height: 500px) {
  :root { --play-shift: 5vw; }
  #trick-area, #player-seat-info, .seat-top, .seat-topleft, .seat-topright, #deck-slot, #bid-panel {
    margin-left: calc(-1 * var(--play-shift));
  }
  #player-hand { left: calc(-1 * var(--play-shift)); }
  .seat-left  { margin-left: calc(-0.5 * var(--play-shift)); }
  .seat-right { margin-right: var(--play-shift); }
}
/* Narrow phones: shift a bit further, score box slightly smaller. */
@media (orientation: landscape) and (max-height: 500px) and (max-width: 720px) {
  :root { --play-shift: 8vw; }
  #scoreboard { --sb-scale: 1.1; }
}

/* ===== How to play: use most of the screen, text in a readable column ===== */
#start-panel.instructions-open {
  width: min(96vw, 1200px);
  max-width: 96vw;
  height: min(92vh, 100vh - 130px);   /* clear of the corner buttons */
  max-height: none;
}
#start-panel.instructions-open .start-title-img { max-height: 5.5em; }
#instructions-panel .instructions-content {
  font-size: clamp(15px, 0.75vw + 0.9vh, 19px);
  line-height: 1.5;
}
/* Centre a ~68 character column inside the wide panel. */
#instructions-panel .instructions-content {
  padding-left: max(8px, calc((100% - 68ch) / 2));
  padding-right: max(18px, calc((100% - 68ch) / 2));
}
#instructions-panel .instructions-content h3 { font-size: 1.25em; margin-top: 0.9em; }
#instructions-panel .instructions-content h3:first-child { margin-top: 0; }
#instructions-panel .instructions-content ul { padding-left: 1.2em; }
#instructions-panel .instructions-content li { margin-bottom: 0.45em; }
#instructions-panel .instructions-footer { justify-content: center; padding-right: 0; }
#btn-instructions-done { font-size: 18px; font-weight: 600; padding: 8px 34px; min-height: 42px; border-radius: 10px; }
@media (orientation: landscape) and (max-height: 500px) {
  /* Phones: no logo here, and keep clear of the corner buttons. */
  #start-panel.instructions-open { max-width: calc(100vw - 140px); width: calc(100vw - 140px); height: 92vh; }
  #start-panel.instructions-open .start-panel-header { display: none; }
}
