:root {
  --green-dark: #1a5c2e;
  --card-bg: #fffef8;
  --card-shadow: rgba(0,0,0,0.35);
  --counter-red: #c0001a;
  --double-gold: #d4a900;
  --team-a: #1e40af;
  --team-b: #991b1b;
  --active-glow: #fbbf24;
  --radius: 8px;
  --card-w: 70px;
  --card-h: 95px;
  --font-card: 20px;
  --font-ui: 14px;
  --btn-min-h: 36px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--green-dark);
  font-family: 'Segoe UI', Tahoma, sans-serif;
  color: #fff;
  min-height: 100vh;
  overflow-x: hidden;
}
button {
  cursor: pointer; border: none; border-radius: 6px;
  padding: 8px 16px; font-size: var(--font-ui); font-weight: 600;
  min-height: var(--btn-min-h); transition: all 0.15s; touch-action: manipulation;
}
button:hover { filter: brightness(1.1); transform: translateY(-1px); }
button:active { transform: translateY(0); }
.btn-primary { background: #22c55e; color: #fff; }
.btn-secondary { background: #6b7280; color: #fff; }
.btn-forced { background: #f59e0b; color: #fff; }
.btn-bid { background: #3b82f6; color: #fff; }
.btn-moon { background: linear-gradient(135deg,#4c1d95,#7c3aed); color:#fff; font-size:13px; }
.btn-steal { background: linear-gradient(135deg,#7c2d12,#b45309); color:#fff; }

/* ===== SETUP ===== */
#setup-screen {
  display: flex; flex-direction: column; align-items: center;
  min-height: 100vh; gap: 20px; padding: 32px 16px; overflow-y: auto;
}
#setup-screen h1 { font-size: 48px; font-weight: 900; letter-spacing: -2px; text-shadow: 2px 4px 8px rgba(0,0,0,0.5); }
#setup-screen .subtitle { font-size: 16px; opacity: 0.75; margin-top: -12px; }
.setup-card {
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2);
  border-radius: 16px; padding: 24px 28px; width: 460px; max-width: 100%;
}
.setup-card h2 { font-size: 16px; opacity: 0.7; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 16px; }
.player-slot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,0.08);
}
.player-slot:last-of-type { border-bottom: none; }
.player-slot-label { font-size: 14px; }
.player-slot-team { font-size: 11px; padding: 2px 8px; border-radius: 10px; margin-left: 6px; }
.player-slot-team.ta { background: #1e40af; }
.player-slot-team.tb { background: #991b1b; }
.player-select {
  background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.25);
  color: #fff; border-radius: 8px; padding: 6px 10px; font-size: 13px; cursor: pointer;
  min-width: 160px;
}
.player-select:focus { outline: 2px solid #22c55e; }
.player-select option { background: #1a5c2e; color: #fff; }
.player-slot-right { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.player-name-input {
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2);
  color: #fff; border-radius: 6px; padding: 5px 8px; font-size: 13px; width: 160px;
}
.player-name-input::placeholder { color: rgba(255,255,255,0.35); }
.player-name-input:focus { outline: 2px solid #22c55e; border-color: transparent; }
.toggle-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,0.08);
}
.toggle-row:last-of-type { border-bottom: none; }
.toggle-label { font-size: 14px; }
.toggle-note { font-size: 11px; opacity: 0.55; margin-top: 2px; }
.toggle-switch {
  width: 44px; height: 24px; background: #4b5563; border-radius: 12px;
  position: relative; cursor: pointer; transition: background 0.2s; flex-shrink: 0;
}
.toggle-switch.on { background: #22c55e; }
.toggle-switch::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px; background: white; border-radius: 50%; transition: left 0.2s;
}
.toggle-switch.on::after { left: 22px; }
.start-btn {
  width: 100%; padding: 16px; font-size: 18px; margin-top: 20px;
  background: #22c55e; color: white; border-radius: 10px; min-height: 52px;
}

/* ===== INFO BAR ===== */
#game-screen { display: flex; flex-direction: column; min-height: 100vh; }
#info-bar {
  background: rgba(0,0,0,0.4); padding: 8px 16px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  border-bottom: 1px solid rgba(255,255,255,0.1); position: sticky; top: 0; z-index: 10;
}
.game-title { font-size: 18px; font-weight: 900; letter-spacing: -1px; }
.score-chip {
  display: flex; align-items: center; gap: 5px;
  background: rgba(255,255,255,0.1); border-radius: 20px; padding: 3px 10px; font-size: 12px;
}
.score-chip.ta { border-left: 3px solid #3b82f6; }
.score-chip.tb { border-left: 3px solid #ef4444; }
.score-chip .sv { font-size: 15px; font-weight: 800; }
.info-chip {
  background: rgba(255,255,255,0.08); border-radius: 20px; padding: 3px 10px; font-size: 11px;
}
.trump-chip {
  background: rgba(255,215,0,0.2); border: 1px solid gold;
  border-radius: 20px; padding: 3px 10px; font-size: 12px; font-weight: 700; color: gold;
}
.moon-chip {
  background: rgba(124,58,237,0.3); border: 1px solid #a78bfa;
  border-radius: 20px; padding: 3px 12px; font-size: 12px; font-weight: 700; color: #c4b5fd;
}
.phase-chip { margin-left: auto; background: rgba(255,255,255,0.08); border-radius: 20px; padding: 3px 10px; font-size: 11px; opacity: 0.6; }

/* ===== TABLE LAYOUT ===== */
#table-layout {
  flex: 1; display: grid;
  grid-template-areas: ". north ." "west center east" ". south .";
  grid-template-columns: 185px 1fr 185px;
  grid-template-rows: auto 1fr auto;
  gap: 6px; padding: 8px 6px;
}
.player-zone { display: flex; flex-direction: column; gap: 5px; }
.player-zone.north { grid-area: north; align-items: center; }
.player-zone.south { grid-area: south; align-items: center; margin-top: -10px; }
.player-zone.west { grid-area: west; align-items: flex-end; }
.player-zone.east { grid-area: east; align-items: flex-start; }
.center-zone { grid-area: center; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding-bottom: 8px; gap: 8px; }

/* ===== PLAYER HEADER ===== */
.player-header {
  display: flex; align-items: center; gap: 5px; padding: 5px 10px;
  border-radius: 20px; font-size: 12px; font-weight: 600;
  background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.1);
  flex-wrap: wrap; justify-content: center;
}
.player-zone.active .player-header { border-color: var(--active-glow); box-shadow: 0 0 12px rgba(251,191,36,0.4); }
.team-badge { font-size: 10px; padding: 1px 6px; border-radius: 10px; }
.team-badge.ta { background: var(--team-a); }
.team-badge.tb { background: var(--team-b); }
.dealer-badge { font-size: 10px; padding: 1px 5px; background: #f59e0b; color: #000; border-radius: 10px; font-weight: 800; }
.ai-badge { font-size: 10px; padding: 1px 6px; background: rgba(124,58,237,0.5); border: 1px solid #a78bfa; border-radius: 10px; }
.thinking-badge { font-size: 11px; color: #a78bfa; animation: pulse 1s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }
.bid-status { font-size: 10px; padding: 1px 6px; border-radius: 10px; }
.bid-status.passed { background: #4b5563; }
.bid-status.bid-placed { background: #3b82f6; }
.bid-status.bidder { background: #f59e0b; color: #000; }
.bid-status.moon-call { background: #7c3aed; }
.turn-arrow { color: var(--active-glow); font-size: 13px; }

/* ===== HANDS — fanned/overlapping layout ===== */
.hand { display: flex; flex-wrap: nowrap; justify-content: center; padding: 4px; }
.hand.west, .hand.east { flex-direction: column; align-items: center; width: 76px; }
/* Horizontal fan: north (tighter), south (looser for easier tapping) */
.hand.north .card,
.hand.north .card-back { margin-right: -28px; position: relative; }
.hand.north .card:last-child,
.hand.north .card-back:last-child { margin-right: 0; }
.hand.south .card,
.hand.south .card-back { margin-right: -8px; position: relative; }
.hand.south .card:last-child,
.hand.south .card-back:last-child { margin-right: 0; }
/* Vertical fan: west/east */
.hand.west .card, .hand.east .card,
.hand.west .card-back, .hand.east .card-back { margin-bottom: -64px; position: relative; }
.hand.west .card:last-child, .hand.east .card:last-child,
.hand.west .card-back:last-child, .hand.east .card-back:last-child { margin-bottom: 0; }
/* Hover lifts hovered card above its neighbours */
.hand .card:hover, .hand .card.playable:hover { z-index: 20; }

/* ===== CARDS ===== */
.card {
  width: var(--card-w); height: var(--card-h);
  background: var(--card-bg); border: 2px solid #d1d5db;
  border-radius: var(--radius); display: flex; flex-direction: column;
  align-items: center; justify-content: center; position: relative;
  box-shadow: 1px 2px 5px var(--card-shadow);
  user-select: none; transition: transform 0.12s, box-shadow 0.12s;
  flex-shrink: 0; touch-action: manipulation; overflow: hidden;
}
.card.playable { cursor: pointer; border-color: #22c55e; box-shadow: 0 0 10px rgba(34,197,94,0.5),1px 2px 5px var(--card-shadow); }
.card.playable:hover { transform: translateY(-6px); box-shadow: 0 6px 18px rgba(34,197,94,0.6); }
.card.not-playable { opacity: 0.45; cursor: not-allowed; }
.card.in-trick { cursor: default; width: 54px; height: 74px; }
.card.lead-card { border-color: #3b82f6; box-shadow: 0 0 0 2px #3b82f6, 1px 2px 5px var(--card-shadow); }
.card-num { font-size: var(--font-card); font-weight: 800; color: #1f2937; line-height: 1; }
.card-frac-line { width: 32px; height: 2px; background: #374151; margin: 2px 0; }
.card-den { font-size: var(--font-card); font-weight: 800; color: #1f2937; line-height: 1; }
.card.counter .card-num,.card.counter .card-den { color: var(--counter-red); }
.card.counter .card-frac-line { background: var(--counter-red); }
.card.counter { border-color: #fca5a5; }
.card .counter-pip { position:absolute;bottom:2px;right:3px;font-size:9px;font-weight:800;color:var(--counter-red); }
.card .counter-label { display:none; }
.card-back {
  width: var(--card-w); height: var(--card-h); border-radius: var(--radius);
  background: repeating-linear-gradient(45deg,#1e3a5f,#1e3a5f 4px,#1a3357 4px,#1a3357 8px);
  border: 2px solid rgba(255,255,255,0.2);
  box-shadow: 1px 2px 5px var(--card-shadow);
  flex-shrink: 0; position: relative;
}

/* ===== CENTER ===== */
.trick-box {
  background: rgba(0,0,0,0.25); border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px; padding: 14px; min-width: 300px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.trick-title { font-size: 12px; opacity: 0.5; text-transform: uppercase; letter-spacing: 1px; }

/* ── Diamond trick layout ── */
.trick-compass {
  display: grid;
  grid-template-areas: ". tc-north ." "tc-west . tc-east" ". tc-south .";
  grid-template-columns: 1fr auto 1fr;
  grid-template-rows: auto auto auto;
  gap: 6px 4px; width: 100%; min-height: 90px;
}
.tc-pos { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 60px; }
.tc-north { grid-area: tc-north; justify-self: center; align-self: end; }
.tc-south { grid-area: tc-south; justify-self: center; align-self: start; }
.tc-west  { grid-area: tc-west;  justify-self: end;   align-self: center; }
.tc-east  { grid-area: tc-east;  justify-self: start; align-self: center; }
.trick-name { font-size: 11px; opacity: 0.8; font-weight: 700; white-space: nowrap; }
.trick-name.winner { color: var(--active-glow); opacity: 1; }
.tc-empty { min-height: 10px; }
.trick-result-banner {
  background: rgba(251,191,36,0.2); border: 1px solid var(--active-glow);
  border-radius: 8px; padding: 7px 16px; font-size: 14px; font-weight: 700; color: var(--active-glow);
  text-align: center;
}
.trick-placeholder { opacity: 0.25; font-style: italic; font-size: 13px; padding: 12px 0; }
.bid-compass-chip {
  background: rgba(59,130,246,0.25); border: 2px solid #3b82f6;
  border-radius: 10px; padding: 5px 12px;
  font-size: 18px; font-weight: 900; color: #fff;
  text-align: center; min-width: 44px;
}
.bid-compass-chip.passed { background: rgba(107,114,128,0.25); border-color: #6b7280; color: #9ca3af; font-size: 13px; font-weight: 700; }
.bid-compass-chip.high   { background: rgba(251,191,36,0.25);  border-color: var(--active-glow); color: var(--active-glow); }
.tricks-taken { display: flex; gap: 18px; font-size: 12px; opacity: 0.75; }
.ta-tricks { color: #93c5fd; } .tb-tricks { color: #fca5a5; }
.play-prompt {
  background: rgba(34,197,94,0.15); border: 1px solid #22c55e;
  border-radius: 8px; padding: 7px 14px; font-size: 13px; font-weight: 600;
  text-align: center; max-width: 340px;
}
.error-msg {
  background: rgba(239,68,68,0.2); border: 1px solid #ef4444;
  border-radius: 8px; padding: 5px 12px; font-size: 12px; color: #fca5a5;
  text-align: center; animation: fadeIn 0.2s;
}
@keyframes fadeIn { from{opacity:0;transform:translateY(-4px)} to{opacity:1;transform:translateY(0)} }

/* ===== BID PANEL ===== */
.bid-panel {
  background: rgba(0,0,0,0.4); border: 1px solid rgba(255,255,255,0.2);
  border-radius: 10px; padding: 14px; width: 100%; max-width: 380px;
}
.bid-panel h3 { font-size: 14px; margin-bottom: 10px; color: var(--active-glow); }
.bid-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.bid-input {
  width: 64px; padding: 6px 8px; border-radius: 6px;
  border: 1px solid #4b5563; background: rgba(255,255,255,0.1);
  color: #fff; font-size: 15px; font-weight: 700; text-align: center;
}
.bid-input:focus { outline: 2px solid #22c55e; border-color: transparent; }
.bid-help { font-size: 11px; opacity: 0.55; margin-bottom: 8px; }
.forced-banner {
  background: rgba(245,158,11,0.2); border: 1px solid #f59e0b;
  border-radius: 8px; padding: 8px; font-size: 12px; text-align: center; margin-bottom: 8px;
}
.prev-bids { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.prev-bid-item { font-size: 11px; padding: 2px 7px; border-radius: 10px; background: rgba(255,255,255,0.1); }
/* Mobile stepper */
.bid-stepper { display: flex; align-items: center; gap: 0; border-radius: 8px; overflow: hidden; border: 1px solid #4b5563; }
.bid-stepper-btn { background: rgba(255,255,255,0.1); color: #fff; border-radius: 0; padding: 10px 16px; font-size: 18px; font-weight: 700; min-height: 44px; border: none; }
.bid-stepper-btn:hover { background: rgba(255,255,255,0.2); }
.bid-stepper-val { min-width: 44px; text-align: center; font-size: 18px; font-weight: 800; background: rgba(0,0,0,0.3); padding: 10px 0; }

/* ===== PASS SCREEN ===== */
#pass-screen {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: #0f2d18;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  z-index: 200; gap: 20px; padding: 32px;
}
#pass-screen .pass-icon { font-size: 72px; }
#pass-screen .pass-title { font-size: 28px; font-weight: 900; text-align: center; }
#pass-screen .pass-sub { font-size: 15px; opacity: 0.7; text-align: center; }
#pass-screen .pass-note { font-size: 12px; opacity: 0.4; max-width: 280px; text-align: center; }
#pass-screen .btn-ready { font-size: 20px; padding: 18px 56px; min-height: 60px; }

/* ===== SCORING / GAME OVER ===== */
#scoring-screen, #game-over-screen {
  display: flex; flex-direction: column; align-items: center;
  min-height: 100vh; padding: 28px 16px; gap: 18px; overflow-y: auto;
}
.score-panel {
  background: rgba(0,0,0,0.4); border: 1px solid rgba(255,255,255,0.2);
  border-radius: 16px; padding: 24px 28px; width: 100%; max-width: 480px;
}
.score-panel h2 { font-size: 20px; margin-bottom: 14px; }
.score-row { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid rgba(255,255,255,0.08); font-size: 13px; }
.score-row:last-child { border-bottom: none; }
.score-row .label { opacity: 0.65; }
.score-row .val { font-weight: 700; }
.result-badge { display: inline-block; padding: 5px 14px; border-radius: 20px; font-weight: 800; font-size: 14px; margin: 8px 0; }
.result-badge.made { background: #22c55e; }
.result-badge.set { background: #ef4444; }
.team-score-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.team-score-box { border-radius: 10px; padding: 12px; text-align: center; }
.team-score-box.ta { background: rgba(30,64,175,0.3); border: 1px solid #3b82f6; }
.team-score-box.tb { background: rgba(153,27,27,0.3); border: 1px solid #ef4444; }
.team-score-box .tn { font-size: 11px; opacity: 0.75; }
.team-score-box .pts { font-size: 22px; font-weight: 900; }
.sc { font-size: 12px; }
.sc.pos { color: #4ade80; } .sc.neg { color: #f87171; } .sc.zero { color: #9ca3af; }
.team-total { font-size: 13px; font-weight: 700; border-top: 1px solid rgba(255,255,255,0.15); padding-top: 5px; margin-top: 5px; }
.winner-banner { font-size: 44px; font-weight: 900; text-align: center; text-shadow: 2px 4px 12px rgba(0,0,0,0.5); }
.winner-banner.ta { color: #93c5fd; } .winner-banner.tb { color: #fca5a5; }
.winner-banner.moon { color: #c4b5fd; }
.hand-history { max-height: 180px; overflow-y: auto; }
.history-row { font-size: 11px; padding: 3px 7px; border-radius: 5px; margin-bottom: 2px; background: rgba(255,255,255,0.05); display: flex; justify-content: space-between; gap: 8px; }

/* ===== HIGH VIZ / LARGE CARDS ===== */
body.large-cards {
  --card-w: 110px; --card-h: 155px; --font-card: 34px;
  --font-ui: 20px; --btn-min-h: 54px;
}
/* --- Cards --- */
body.large-cards .card { border-width: 4px; }
body.large-cards .card-back { border-width: 4px; }
body.large-cards .card-frac-line { width: 58px; height: 5px; margin: 4px 0; }
/* In-trick cards larger */
body.large-cards .card.in-trick { width: 80px; height: 110px; }
/* Counter cards: deep saturated red, large centered value label */
body.large-cards .card.counter { border-color: #cc0000; }
body.large-cards .card.counter .card-num,
body.large-cards .card.counter .card-den { color: #cc0000; }
body.large-cards .card.counter .card-frac-line { background: #cc0000; }
body.large-cards .card .counter-pip { display: none; }
body.large-cards .card .counter-label {
  display: block; font-size: 20px; font-weight: 900;
  color: #cc0000; margin-top: 6px; text-align: center; line-height: 1;
}
/* --- Fan overlap adjustments for large cards --- */
body.large-cards .hand.north .card, body.large-cards .hand.south .card,
body.large-cards .hand.north .card-back, body.large-cards .hand.south .card-back { margin-right: -34px; }
body.large-cards .hand.north .card:last-child, body.large-cards .hand.south .card:last-child,
body.large-cards .hand.north .card-back:last-child, body.large-cards .hand.south .card-back:last-child { margin-right: 0; }
body.large-cards .hand.west .card, body.large-cards .hand.east .card,
body.large-cards .hand.west .card-back, body.large-cards .hand.east .card-back { margin-bottom: -108px; }
body.large-cards .hand.west .card:last-child, body.large-cards .hand.east .card:last-child,
body.large-cards .hand.west .card-back:last-child, body.large-cards .hand.east .card-back:last-child { margin-bottom: 0; }
body.large-cards .hand.west, body.large-cards .hand.east { width: 115px; }
/* --- Layout --- */
body.large-cards #table-layout { grid-template-columns: 210px 1fr 210px; gap: 8px; }
/* --- Info bar: everything much larger and bolder --- */
body.large-cards #info-bar { padding: 12px 20px; gap: 14px; min-height: 64px; }
body.large-cards .game-title { font-size: 26px; }
body.large-cards .score-chip { font-size: 15px; padding: 6px 18px; border-left-width: 4px; }
body.large-cards .score-chip .sv { font-size: 48px; font-weight: 900; line-height: 1; }
body.large-cards .info-chip { font-size: 15px; padding: 5px 14px; }
body.large-cards .trump-chip { font-size: 17px; padding: 6px 16px; border-width: 2px; font-weight: 900; }
body.large-cards .moon-chip { font-size: 17px; padding: 6px 16px; border-width: 2px; }
body.large-cards .phase-chip { font-size: 14px; padding: 5px 14px; }
/* --- Player headers --- */
body.large-cards .player-header {
  font-size: 20px; font-weight: 700; padding: 10px 18px; gap: 10px; border-width: 2px;
}
body.large-cards .team-badge { font-size: 15px; padding: 3px 12px; }
body.large-cards .dealer-badge { font-size: 15px; padding: 3px 10px; }
body.large-cards .ai-badge { font-size: 15px; padding: 3px 12px; }
body.large-cards .bid-status { font-size: 15px; padding: 3px 12px; }
body.large-cards .turn-arrow { font-size: 26px; }
body.large-cards .thinking-badge { font-size: 20px; }
/* Current-player highlight: very prominent */
body.large-cards .player-zone.active .player-header {
  border-color: var(--active-glow); border-width: 3px;
  box-shadow: 0 0 32px rgba(251,191,36,0.8);
  background: rgba(251,191,36,0.22);
  font-size: 22px;
}
/* --- Trick area --- */
body.large-cards .trick-box { padding: 22px 26px; min-width: 340px; gap: 14px; }
body.large-cards .trick-title { font-size: 16px; letter-spacing: 2px; }
body.large-cards .tricks-taken { font-size: 22px; font-weight: 800; gap: 30px; opacity: 1; }
body.large-cards .trick-slot { gap: 6px; }
body.large-cards .trick-label { font-size: 20px; font-weight: 700; }
body.large-cards .trick-result-banner { font-size: 26px; padding: 16px 32px; font-weight: 900; border-width: 2px; }
body.large-cards .trick-placeholder { font-size: 20px; padding: 20px 0; }
body.large-cards .play-prompt { font-size: 22px; padding: 14px 22px; font-weight: 800; border-width: 2px; }
body.large-cards .error-msg { font-size: 22px; padding: 14px 28px; font-weight: 900; border-width: 2px; }
body.large-cards .card-legend { font-size: 14px; gap: 14px; }
/* --- Buttons: tall and clear --- */
body.large-cards button { font-size: 18px; min-height: 54px; padding: 10px 20px; }
body.large-cards .btn-moon { font-size: 16px; }
/* --- Bid panel --- */
body.large-cards .bid-panel { padding: 18px 20px; }
body.large-cards .bid-panel h3 { font-size: 20px; margin-bottom: 14px; }
body.large-cards .bid-help { font-size: 16px; }
body.large-cards .forced-banner { font-size: 17px; padding: 12px; }
body.large-cards .bid-input { font-size: 22px; width: 80px; padding: 10px; }
body.large-cards .bid-stepper { border-radius: 12px; }
body.large-cards .bid-stepper-btn { font-size: 32px; padding: 0; min-height: 60px; min-width: 60px; }
body.large-cards .bid-stepper-val { font-size: 34px; min-width: 64px; padding: 14px 0; font-weight: 900; }
body.large-cards .prev-bid-item { font-size: 14px; padding: 4px 10px; }
/* --- Scoring screen --- */
body.large-cards .score-panel { padding: 28px 32px; }
body.large-cards .score-panel h2 { font-size: 28px; margin-bottom: 18px; }
body.large-cards .score-row { font-size: 18px; padding: 10px 0; }
body.large-cards .result-badge { font-size: 22px; padding: 10px 24px; margin: 10px 0; }
body.large-cards .team-score-box { padding: 18px; border-width: 2px; }
body.large-cards .team-score-box .tn { font-size: 17px; }
body.large-cards .team-score-box .pts { font-size: 56px; line-height: 1.1; }
body.large-cards .sc { font-size: 20px; font-weight: 800; margin-top: 4px; }
body.large-cards .team-total { font-size: 18px; padding-top: 8px; margin-top: 8px; }
body.large-cards .history-row { font-size: 16px; padding: 6px 12px; }
body.large-cards .winner-banner { font-size: 68px; }
/* --- Game-over screen --- */
body.large-cards #game-over-screen .score-panel h2 { font-size: 26px; }
/* --- Pass screen --- */
body.large-cards #pass-screen .pass-title { font-size: 38px; }
body.large-cards #pass-screen .pass-sub { font-size: 22px; }
body.large-cards #pass-screen .pass-note { font-size: 16px; }
/* --- Settings panel in High Viz --- */
body.large-cards .settings-panel { padding: 32px; }
body.large-cards .settings-title { font-size: 24px; }
body.large-cards .toggle-label { font-size: 20px; }
body.large-cards .toggle-note { font-size: 15px; }
body.large-cards .toggle-switch { width: 58px; height: 32px; border-radius: 16px; }
body.large-cards .toggle-switch::after { width: 28px; height: 28px; }
body.large-cards .toggle-switch.on::after { left: 28px; }

/* ===== LAST HAND OVERLAY ===== */
#last-hand-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.75); display: flex; align-items: center;
  justify-content: center; z-index: 300;
}
.last-hand-panel {
  background: #1a4a2a; border: 1px solid rgba(255,255,255,0.25);
  border-radius: 16px; padding: 24px 28px; width: 380px; max-width: 92vw;
  max-height: 80vh; overflow-y: auto;
}
.lh-title { font-size: 18px; font-weight: 800; margin-bottom: 14px; }
.lh-row { font-size: 13px; padding: 7px 0; border-bottom: 1px solid rgba(255,255,255,0.1); margin-bottom: 10px; }
#last-hand-btn {
  background: rgba(255,255,255,0.12); color: #fff; border-radius: 50%;
  width: 28px; height: 28px; padding: 0; font-size: 14px;
  min-height: unset; display: flex; align-items: center; justify-content: center;
}
#last-hand-btn:hover { background: rgba(255,255,255,0.24); }

/* ===== SETTINGS OVERLAY ===== */
#settings-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.75); display: flex; align-items: center;
  justify-content: center; z-index: 300;
}
.settings-panel {
  background: #1a4a2a; border: 1px solid rgba(255,255,255,0.25);
  border-radius: 16px; padding: 24px 28px; width: 380px; max-width: 92vw;
}
.settings-title { font-size: 18px; font-weight: 800; margin-bottom: 16px; }
#settings-btn {
  background: rgba(255,255,255,0.14); color: #fff; border-radius: 50%;
  width: 34px; height: 34px; padding: 0; font-size: 17px;
  min-height: unset; display: flex; align-items: center; justify-content: center;
  margin-left: auto;
}
#settings-btn:hover { background: rgba(255,255,255,0.28); }

/* ===== RESPONSIVE ===== */
/* Tablet / smaller desktop: tighten columns */
@media (max-width: 900px) and (min-width: 521px) {
  #table-layout { grid-template-columns: 165px 1fr 165px; }
  .trick-box { min-width: 240px; }
}
/* Small phone: shrink cards, full-width north/south */
@media (max-width: 520px) {
  :root { --card-w: 52px; --card-h: 72px; --font-card: 17px; }
  #table-layout {
    grid-template-areas: "north north north" "west center east" "south south south";
    grid-template-columns: 80px 1fr 80px;
    gap: 4px; padding: 4px;
  }
  .hand.west, .hand.east { width: 58px; }
  .trick-box { min-width: 160px; padding: 8px; }
  #info-bar { gap: 6px; padding: 6px 10px; }
  .game-title { font-size: 14px; }
}