/*
======================================================================
Boat – Game styles (clean, commented)
- Play mode: TABLE first, then scoreboard/info, then footer
- Scoreboard/footer width matches TABLE in play mode
- Phone portrait: TABLE uses full visible height (scroll to score/footer)
- Phone landscape: TABLE uses full visible height (scroll to score/footer)
- Fix: table logo sits BELOW cards (z-index)
- Fix: instructions text always dark on light background
- Fix: play-mode always allows scrolling (no "squish" on short desktops)
======================================================================
*/

/* ------------------------------------------------------------------
   1) Design tokens (colors, sizes, radii, card sizing)
------------------------------------------------------------------ */
:root {
  /* Brand palette */
  --brand-navy: #0A1D37;
  --brand-cream: #F5F1E6;
  --brand-gold: #D4AF37;
  --brand-burgundy: #7B2D26;
  --brand-gray: #B8B4AD;

  /* Theme tokens */
  --bg-1: #071527;
  --bg-2: var(--brand-navy);
  --surface: rgba(10, 29, 55, 0.55);
  --accent: var(--brand-gold);
  --accent-2: var(--brand-gold);
  --text: var(--brand-cream);
  --muted: color-mix(in oklab, var(--brand-cream) 70%, #9aa3b2);
  --shadow: rgba(0, 0, 0, 0.35);

  /* Geometry */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;

  /* Card sizing (scaled responsively) */
  --card-w: clamp(36px, 4.2vw, 64px);
  --card-h: calc(var(--card-w) * 1.5);

  /* Trick layout */
  --trick-offset: calc(var(--card-h) * 0.6);
  --trick-gap: 12px;

  /* Side stack overlap (vertical) */
  --side-stack-overlap: -15px;
}

/* ------------------------------------------------------------------
   2) Base / reset / typography
------------------------------------------------------------------ */
* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--brand-navy);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  line-height: 1.55;
}

a { color: var(--accent-2); }
a:hover { text-decoration: underline; }

a.brand-link, .info a { color: var(--brand-burgundy); }
.brand-link:visited, .info a:visited { color: var(--brand-burgundy); }
.brand-link:hover, .info a:hover { color: var(--brand-navy); }

.container { padding: 16px; }

/* ------------------------------------------------------------------
   3) Scoreboard / info wrapper
------------------------------------------------------------------ */
.info {
  max-width: 800px;
  margin: 8px auto 12px;
  text-align: center;
  background: var(--brand-cream);
  color: var(--brand-navy);
  border: 1px solid color-mix(in oklab, var(--brand-gold) 45%, #ffffff 55%);
  border-radius: var(--radius-md);
  padding: 12px 16px 8px;
  box-shadow: 0 6px 18px var(--shadow);
}

.info-links {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid color-mix(in oklab, var(--brand-gold) 30%, transparent);
}

/* Scoreboard blocks */
.scoreboard {
  display: flex;
  flex-direction: column;
  margin: 6px 0 8px;
  padding: 12px 20px;
  background: linear-gradient(135deg, rgba(10,29,55,0.08) 0%, rgba(123,45,38,0.08) 100%);
  border-radius: var(--radius-sm);
  border: 1px solid color-mix(in oklab, var(--brand-gold) 30%, transparent);
}

.scoreboard-title-game,
.scoreboard-title-hand {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 6px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.scoreboard-title-game { color: var(--brand-burgundy); }
.scoreboard-title-hand { color: var(--brand-navy); }

.scoreboard-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.scoreboard-team {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  flex: 1;
}
.scoreboard-team-left  { align-items: flex-start; }
.scoreboard-team-right { align-items: flex-end; }

.scoreboard-team-name,
.scoreboard-team-name-hand {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 3px;
  letter-spacing: 0.02em;
}
.scoreboard-team-name      { color: var(--brand-burgundy); }
.scoreboard-team-name-hand { color: var(--brand-navy); }

.scoreboard-score {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--brand-burgundy);
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.scoreboard-score-hand { color: var(--brand-navy) !important; }

.scoreboard-hand-info {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid color-mix(in oklab, var(--brand-gold) 30%, transparent);
  gap: 20px;
}
.hand-info-item   { display: flex; flex-direction: column; align-items: center; text-align: center; min-width: 100px; }
.hand-info-label  { font-family: "Playfair Display", Georgia, serif; font-size: 12px; font-weight: 600; color: var(--brand-navy); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; opacity: 0.8; }
.hand-info-value  { font-family: "Playfair Display", Georgia, serif; font-size: 18px; font-weight: 700; color: var(--brand-navy); line-height: 1; margin-bottom: 2px; }
.hand-info-player { font-size: 14px; font-weight: 600; color: var(--brand-navy); opacity: 0.9; }

/* Mobile scoreboard tweaks */
@media (max-width: 640px) {
  .info { max-width: 95vw; padding: 10px 12px 6px; margin: 6px auto 10px; }
  .scoreboard { padding: 10px 14px; margin: 4px 0 6px; }
  .scoreboard-team-name, .scoreboard-team-name-hand { font-size: 14px; }
  .scoreboard-score { font-size: 24px; }
  .scoreboard-hand-info { gap: 12px; margin-top: 6px; padding-top: 6px; }
  .hand-info-item { min-width: 80px; }
  .hand-info-value { font-size: 16px; }
  .hand-info-label { font-size: 11px; }
  .hand-info-player { font-size: 12px; }
  .info-links { margin-top: 6px; padding-top: 6px; }
}

.brand-bar   { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 6px; }
.brand-logo  { height: 28px; width: auto; filter: drop-shadow(0 2px 2px rgba(0,0,0,0.25)); }
.brand-name  { font-family: "Playfair Display", Georgia, serif; letter-spacing: 0.08em; font-weight: 700; color: var(--brand-navy); }
.info p      { margin: 6px 0; color: #1f2c44; }
.info p strong { color: #0e1f3d; }
.info a { color: var(--brand-burgundy); font-weight: 600; }
.info a:hover { color: var(--brand-navy); }
.info a[target="_blank"]::after { content: " ↗"; font-size: 12px; opacity: 0.7; }

/* Decorative rule under info panel */
.info::after {
  content: "";
  display: block;
  height: 2px;
  width: 120px;
  margin: 8px auto 0;
  background: linear-gradient(90deg, transparent, var(--brand-gold), transparent);
  border-radius: 999px;
  opacity: 0.9;
}

/* ------------------------------------------------------------------
   4) TABLE / BOARD
------------------------------------------------------------------ */
.table {
  position: relative;
  width: min(96vw, 1200px);
  aspect-ratio: 3 / 2;
  margin: 0 auto;
  /* logo is now a background layer (always under children) */
  background:
    /* Logo layer */
    url('logo_gold.png') center /
      /* size: width height using clamp, mirrors your old ::after */
      clamp(180px, 22vmin, 340px) clamp(180px, 22vmin, 340px)
      no-repeat,
    radial-gradient(120% 100% at 50% 40%, rgba(0,0,0,0.25) 0%, rgba(0,0,0,0.35) 60%, rgba(0,0,0,0.5) 100%),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.04) 0 2px, rgba(0,0,0,0.06) 2px 4px),
    linear-gradient(180deg, #6b3f28, #4e2e1b);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 28px var(--shadow);
  outline: 1px solid color-mix(in oklab, var(--brand-gold) 40%, transparent);
  overflow: hidden;
  /* ensure children compare z-index inside this context */
  isolation: isolate;   /* creates a new stacking context */
  z-index: 0;           /* baseline for the context */
}

/* Gold inlay and vignette rim */
.table::before {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: calc(var(--radius-lg) - 12px);
  box-shadow:
    inset 0 0 0 2px color-mix(in oklab, var(--brand-gold) 70%, #ffffff 30%),
    inset 0 0 0 8px rgba(0,0,0,0.12),
    inset 0 40px 80px rgba(0,0,0,0.18),
    inset 0 -40px 60px rgba(0,0,0,0.14);
  pointer-events: none;
  z-index: 0;
}


/* ------------------------------------------------------------------
   5) Dealer & Trump badges
------------------------------------------------------------------ */
.dealer-button {
  position: absolute;
  width: 34px;
  height: 34px;
  z-index: 6;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.45));
  pointer-events: none;
}
.dealer-button img { width: 100%; height: 100%; display: block; pointer-events: none; }
.dealer-top    { top: calc(2.5% + var(--card-h) + 40px); left: 50%; transform: translateX(-50%); }
.dealer-bottom { bottom: calc(var(--card-h) + 55px); left: 50%; transform: translateX(-50%); }
.dealer-left   { left: calc(6% + var(--card-h) + 25px); top: 50%; transform: translateY(-50%); }
.dealer-right  { right: calc(6% + var(--card-h) + 45px); top: 50%; transform: translateY(-50%); }

.trump-button {
  position: absolute;
  width: 45px;
  height: 45px;
  z-index: 6;
  filter: drop-shadow(0 3px 5px rgba(0,0,0,0.4));
  pointer-events: none;
}
.trump-button img { width: 100%; height: 100%; display: block; pointer-events: none; }
.trump-top    { top: calc(2.5% + var(--card-h) + 35px); left: calc(50% - 50px); transform: translateX(-50%); }
.trump-bottom { bottom: calc(var(--card-h) + 50px);     left: calc(50% - 50px); transform: translateX(-50%); }
.trump-left   { left: calc(6% + var(--card-h) + 20px);  top: 50%; transform: translateY(-50%); }
.trump-right  { right: calc(6% + var(--card-h) + -10px + 50px); top: 50%; transform: translateY(-150%); }

/* ------------------------------------------------------------------
   6) Players (positions & card stacks)
------------------------------------------------------------------ */
.player-area {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  font-size: clamp(12px, 1.4vw, 16px);
  gap: 8px;
  z-index: 2;
}
.player-name { color: var(--brand-cream); font-weight: 600; text-shadow: 0 1px 0 rgba(0,0,0,0.55); }

.player-top    { top: 2.5%; left: 50%; transform: translateX(-50%); flex-direction: column; }
.player-bottom { bottom: 17%; left: 50%; transform: translateX(-50%); flex-direction: column; }
.player-left   { top: 50%; left: 6%;  transform: translateY(-50%); flex-direction: row; }
.player-right  { top: 50%; right: 6%; transform: translateY(-50%); flex-direction: row-reverse; }

.player-area .cards { display: flex; align-items: center; justify-content: center; gap: 6px; }
.player-top .cards, .player-bottom .cards { flex-direction: row; }
.player-left .cards, .player-right .cards { flex-direction: column; }

.player-area .cards img { width: var(--card-w); height: var(--card-h); margin: 0; filter: drop-shadow(0 4px 4px rgba(0,0,0,0.35)); }
.player-left .cards img, .player-left .played-card img   { transform: rotate(90deg); }
.player-right .cards img, .player-right .played-card img { transform: rotate(-90deg); }

/* Slight extra fit for sides */
.player-left .cards, .player-right .cards { gap: 2px; }
.player-left .cards img, .player-right .cards img {
  width: calc(var(--card-w) * 0.95);
  height: calc(var(--card-h) * 0.95);
  margin: var(--side-stack-overlap) 0;
}

.player-top .played-card img, .player-bottom .played-card img { width: var(--card-w); height: var(--card-h); }
.player-left .player-name { margin-right: 8px; }
.player-right .player-name { margin-left: 8px; }
.player-left .played-card  { margin-left: 10px; }
.player-right .played-card { margin-right: 10px; }

/* ------------------------------------------------------------------
   7) Trick center (played cards + fly-in)
------------------------------------------------------------------ */
.trick-center {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  transform: translate(-50%, -50%);
  z-index: 5;
}
.trick-center::before {
  content: "";
  position: absolute;
  top: -28vmin; left: -28vmin; right: -28vmin; bottom: -28vmin;
  pointer-events: none;
  background: radial-gradient(closest-side, rgba(0,0,0,0.18), transparent 60%);
  border-radius: 50%;
  filter: blur(6px);
  opacity: .6;
}
.trick-card { position: absolute; width: var(--card-w); height: var(--card-h); filter: drop-shadow(0 8px 16px rgba(0,0,0,0.45)); opacity: 0; }
.no-fly { animation: none !important; opacity: 1 !important; }
.trick-card.latest { z-index: auto; }

/* Diamond slots */
.slot-top    { top: calc(-1 * var(--card-h) - var(--trick-gap)); left: calc(-0.5 * var(--card-w)); z-index: 40; }
.slot-right  { left: var(--trick-gap); top: calc(-0.5 * var(--card-h)); z-index: 30; }
.slot-bottom { top: var(--trick-gap); left: calc(-0.5 * var(--card-w)); z-index: 20; }
.slot-left   { left: calc(-1 * var(--card-w) - var(--trick-gap)); top: calc(-0.5 * var(--card-h)); z-index: 10; }

.trick-card.from-bottom { animation: fly-in-bottom 220ms ease-out forwards; }
.trick-card.from-top    { animation: fly-in-top    220ms ease-out forwards; }
.trick-card.from-left   { animation: fly-in-left   220ms ease-out forwards; }
.trick-card.from-right  { animation: fly-in-right  220ms ease-out forwards; }

@keyframes fly-in-bottom {
  from { opacity: 0; transform: translate(-50%, calc(var(--trick-offset) + var(--card-h))) scale(0.98) rotate(-1deg); }
  to   { opacity: 1; transform: translate(0, 0) scale(1) rotate(0deg); }
}
@keyframes fly-in-top {
  from { opacity: 0; transform: translate(-50%, calc(-1 * (var(--trick-offset) + var(--card-h)))) scale(0.98) rotate(1deg); }
  to   { opacity: 1; transform: translate(0, 0) scale(1) rotate(0deg); }
}
@keyframes fly-in-left {
  from { opacity: 0; transform: translate(calc(-1 * (var(--trick-offset) + var(--card-w))), -50%) scale(0.98) rotate(2deg); }
  to   { opacity: 1; transform: translate(0, 0) scale(1) rotate(0deg); }
}
@keyframes fly-in-right {
  from { opacity: 0; transform: translate(calc(var(--trick-offset) + var(--card-w)), -50%) scale(0.98) rotate(-2deg); }
  to   { opacity: 1; transform: translate(0, 0) scale(1) rotate(0deg); }
}

/* ------------------------------------------------------------------
   8) Hand area (your cards at bottom)
------------------------------------------------------------------ */
.hand-wrapper {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  width: 100%;
  padding-bottom: 10px;
  z-index: 4;
}
.hand-area {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  width: 100%;
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.25) transparent;
  gap: 4px;
  z-index: 1;
  text-align: center;
}
.hand-area::-webkit-scrollbar { height: 8px; }
.hand-area::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.25); border-radius: 999px; }
.hand-area img { width: var(--card-w); height: var(--card-h); margin: 2px; cursor: pointer; transition: transform .08s ease, filter .08s ease; }
.hand-area img:hover { transform: translateY(-2px); filter: drop-shadow(0 6px 8px rgba(0,0,0,0.4)); }
.hand-area .dim { opacity: 0.4; cursor: default; }
.hand-area button img { border: 1px solid transparent; border-radius: 6px; transition: transform .08s ease, box-shadow .12s ease, filter .08s ease; }
.hand-area button:hover img { transform: translateY(-4px); box-shadow: 0 10px 18px rgba(0,0,0,0.45), 0 0 0 2px var(--brand-gold); filter: saturate(1.05); }
.hand-area button:focus-visible img { box-shadow: 0 0 0 3px var(--brand-gold); }

/* Deal-in animation */
@keyframes deal-in { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.hand-area.deal-in img { animation: deal-in 260ms ease-out both; }
.hand-area.deal-in img:nth-child(1) { animation-delay: 20ms; }
.hand-area.deal-in img:nth-child(2) { animation-delay: 40ms; }
.hand-area.deal-in img:nth-child(3) { animation-delay: 60ms; }
.hand-area.deal-in img:nth-child(4) { animation-delay: 80ms; }
.hand-area.deal-in img:nth-child(5) { animation-delay: 100ms; }
.hand-area.deal-in img:nth-child(6) { animation-delay: 120ms; }
.hand-area.deal-in img:nth-child(7) { animation-delay: 140ms; }
.hand-area.deal-in img:nth-child(8) { animation-delay: 160ms; }
.hand-area.deal-in img:nth-child(9) { animation-delay: 180ms; }

/* ------------------------------------------------------------------
   9) Panels / buttons / alerts
------------------------------------------------------------------ */
.panel {
  max-width: 1040px;
  margin: 12px auto;
  text-align: center;
  padding: 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px var(--shadow);
}
button, .button {
  appearance: none;
  border: 1px solid color-mix(in oklab, var(--brand-gold) 60%, #ffffff 40%);
  outline: none;
  background: var(--brand-cream);
  color: var(--brand-navy);
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.15);
  transition: transform .06s ease, filter .1s ease, background .2s ease;
}
button:hover, .button:hover { background: var(--brand-navy); color: var(--brand-gold); border-color: var(--brand-gold); }
button:active, .button:active { transform: translateY(1px); }
button:focus-visible { outline: 2px solid var(--brand-gold); outline-offset: 2px; }

.bidding button, .discard button { margin: 4px; font-size: 14px; }
.bidding button {
  border-color: color-mix(in oklab, var(--brand-burgundy) 35%, var(--brand-gold) 65%);
  border-width: 1px; border-style: solid; border-radius: 999px;
  padding: 8px 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.18);
}
.bidding h2 { letter-spacing: .04em; }

.bidding, .discard, .result {
  max-width: 1040px;
  margin: 12px auto;
  text-align: center;
  padding: 16px 18px;
  background: color-mix(in oklab, var(--brand-cream) 92%, #ffffff);
  color: #0f203d;
  border: 1px solid color-mix(in oklab, var(--brand-gold) 45%, #ffffff 55%);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px var(--shadow);
}

h1, h2, h3 { font-family: "Playfair Display", Georgia, serif; color: #0b1e3a; letter-spacing: 0.02em; }
.game_over { color: var(--brand-burgundy); }

.alert {
  margin: 10px auto 12px;
  max-width: 840px;
  text-align: left;
  border-radius: 10px;
  padding: 10px 14px;
  box-shadow: 0 8px 18px rgba(0,0,0,0.18);
  border: 1px solid color-mix(in oklab, var(--brand-burgundy) 30%, #000 70%);
}
.alert-error { background: color-mix(in oklab, var(--brand-cream) 85%, #fff); color: var(--brand-burgundy); }
.alert-error strong { color: #5a1f1a; }

/* Form controls */
select {
  background: var(--brand-cream);
  color: #0f203d;
  border: 1px solid color-mix(in oklab, var(--brand-gold) 35%, #ffffff 65%);
  border-radius: 10px;
  padding: 8px 12px;
}
select option, select optgroup { color: #0f203d; background: #ffffff; text-shadow: none; }
select option:checked { background: #f1ead7; color: #0b1e3a; }
select:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* ------------------------------------------------------------------
   10) Instructions page (strong text color overrides)
------------------------------------------------------------------ */
.instructions-container { max-width: 900px; margin: 0 auto; padding: 20px; min-height: 100vh; display: flex; flex-direction: column; }
.instructions-header {
  text-align: center; margin-bottom: 40px; padding: 24px;
  background: var(--brand-cream); border-radius: var(--radius-md);
  border: 1px solid color-mix(in oklab, var(--brand-gold) 45%, #ffffff 55%);
  box-shadow: 0 6px 18px var(--shadow);
}
.instructions-header .brand-bar { margin-bottom: 0; padding: 20px 0; }
.instructions-header .brand-logo { height: 96px; width: auto; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3)); }
.instructions-header .brand-name {
  font-size: 72px; font-weight: 700; color: var(--brand-navy);
  letter-spacing: 0.08em; text-shadow: 0 3px 6px rgba(0,0,0,0.15); text-transform: uppercase;
}
.instructions-header .header-action { margin-top: 20px; }
.instructions-header .header-action .button {
  display: inline-block; padding: 12px 24px; font-size: 16px; font-weight: 600; text-decoration: none;
  background: var(--brand-navy); color: var(--brand-gold);
  border: 2px solid var(--brand-gold); border-radius: var(--radius-sm);
  transition: all 0.2s ease; box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.instructions-header .header-action .button:hover { background: var(--brand-gold); color: var(--brand-navy); transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.3); }
.instructions-content {
  flex: 1; background: var(--brand-cream); border-radius: var(--radius-md);
  border: 1px solid color-mix(in oklab, var(--brand-gold) 45%, #ffffff 55%);
  box-shadow: 0 6px 18px var(--shadow); overflow: hidden; padding: 24px;
}
.instructions-content h1 {
  font-family: "Playfair Display", Georgia, serif; font-size: 28px; font-weight: 700; color: var(--brand-navy);
  text-align: center; margin: 0; padding: 32px 32px 24px; letter-spacing: 0.02em;
  border-bottom: 1px solid color-mix(in oklab, var(--brand-gold) 20%, transparent);
}

/* Strong text color so it never inherits the cream body color */
.instructions-content,
.instructions-content p,
.instructions-content li {
  color: #1f2c44;
}

.instructions-footer {
  text-align: center; margin-top: 32px; padding: 24px; background: var(--brand-cream);
  border-radius: var(--radius-md);
  border: 1px solid color-mix(in oklab, var(--brand-gold) 45%, #ffffff 55%);
  box-shadow: 0 6px 18px var(--shadow);
}
.instructions-footer .button {
  display: inline-block; padding: 12px 24px; font-size: 16px; font-weight: 600; text-decoration: none;
  background: var(--brand-navy); color: var(--brand-gold);
  border: 2px solid var(--brand-gold); border-radius: var(--radius-sm);
  transition: all 0.2s ease; box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.instructions-footer .button:hover { background: var(--brand-gold); color: var(--brand-navy); transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.3); }

/* Copyright box */
.copyright { text-align: center; margin-top: 24px; }
.copyright-content {
  background: var(--brand-cream); border-radius: var(--radius-md);
  border: 1px solid color-mix(in oklab, var(--brand-gold) 45%, #ffffff 55%);
  box-shadow: 0 6px 18px var(--shadow);
  padding: 16px; color: var(--brand-navy); font-size: 14px; font-weight: 500;
}
.copyright a { color: var(--brand-burgundy); text-decoration: none; font-weight: 600; transition: color 0.2s ease; }
.copyright a:hover { color: var(--brand-navy); text-decoration: underline; }

/* ------------------------------------------------------------------
   11) Footer container caps
------------------------------------------------------------------ */
.footer-container { max-width: 800px; margin: 0 auto; }
@media (min-width: 1040px) { .footer-container { max-width: 1040px; } }

/* ------------------------------------------------------------------
   12) PLAY MODE layout: reorder + width sync + scroll friendly
------------------------------------------------------------------ */
body.play-mode {
  display: flex;
  flex-direction: column;
  align-items: stretch;

  /* NEW: always allow scrolling in play mode, even on short desktops */
  height: auto;
  min-height: 100vh;
  overflow-y: auto;
}

/* Order: 1) table, 2) info/scoreboard, 3) footer */
body.play-mode .table            { order: -1; }
body.play-mode .info             { order:  1; }
body.play-mode .footer-container { order:  2; }

/* Match table width for info/footer in play mode */
body.play-mode .info,
body.play-mode .footer-container {
  width: min(96vw, 1200px);
  max-width: none;
  margin-left: auto;
  margin-right: auto;
}

/* ------------------------------------------------------------------
   13) Phones (width ≤ 640px): general play-mode tweaks
------------------------------------------------------------------ */
@media (max-width: 640px) {
  /* slightly smaller cards than before to avoid portrait crowding */
  body.play-mode :root { --card-w: clamp(26px, 8.2vw, 44px); --card-h: calc(var(--card-w) * 1.45); }

  body.play-mode .player-top    { top: 4%; }
  body.play-mode .player-bottom { bottom: 26%; } /* give a bit more bottom space */
  body.play-mode .player-left   { left: 0;  top: 50%; }
  body.play-mode .player-right  { right: 0; top: 50%; }

  body.play-mode .hand-area { gap: 0; padding-bottom: 4px; scrollbar-width: none; }
  body.play-mode .hand-area::-webkit-scrollbar { display: none; }
  body.play-mode .hand-area img { margin: 0; }

  body.play-mode .player-left .cards img,
  body.play-mode .player-right .cards img { margin-top: -35%; }
  body.play-mode .player-left .cards img:first-child,
  body.play-mode .player-right .cards img:first-child { margin-top: 0; }
}

/* ------------------------------------------------------------------
   14) PHONE PORTRAIT: make TABLE fill the visible height,
       let user scroll to scoreboard/footer below
------------------------------------------------------------------ */
@media (max-width: 640px) and (orientation: portrait) {
  /* allow page to extend and scroll */
  html, body { height: auto; min-height: 100vh; }
  body.play-mode { overflow-y: auto; }

  /* table height = visible viewport height; width stays capped */
  body.play-mode .table {
    height: 100vh;   /* fallback */
    height: 100svh;  /* iOS safe viewport */
    height: 100dvh;  /* dynamic viewport (Android/Chrome) */
    width: min(100vw, 1200px);
    aspect-ratio: auto;    /* height drives size */
    margin: 0 auto;
    flex: 0 0 auto;
  }

  /* give a little more breathing room inside */
  body.play-mode .player-top    { top: 3.5%; }
  body.play-mode .player-bottom { bottom: 18%; } /* increased from 14% */
}

/* ------------------------------------------------------------------
   15) PHONE LANDSCAPE (short height): table fills screen,
       score/footer live below the fold (scroll to them)
------------------------------------------------------------------ */
@media (orientation: landscape) and (max-height: 600px) {
  /* allow scroll below the table */
  html, body { height: auto; min-height: 100vh; }
  body.play-mode { overflow-y: auto; }

  /* IMPORTANT: order these so the LAST wins (best viewport unit available) */
  body.play-mode .table {
    height: 100vh;   /* fallback first */
    height: 100svh;  /* iOS/Safari safe viewport */
    height: 100dvh;  /* dynamic viewport – final winner */
    width: min(100vw, 1200px);
    aspect-ratio: auto;   /* height controls size now */
    margin: 0 auto;
    flex: 0 0 auto;       /* don't let flexbox shrink it */
  }

  /* slight spacing tune inside the shorter board */
  body.play-mode .player-top    { top: 2%; }
  body.play-mode .player-bottom { bottom: 12%; }

  /* compact scoreboard when you scroll to it */
  body.play-mode .info            { margin: 10px auto 8px; padding: 8px 10px; }
  body.play-mode .scoreboard      { padding: 8px 10px; }
  body.play-mode .scoreboard-hand-info { display: none; }
}