* { box-sizing: border-box; }
:root { color-scheme: dark; font-family: "Instrument Sans", system-ui, sans-serif; color: #f9f2df; background: #101f1b; --gold: #f2cb80; --muted: #c2d0c2; --line: #ffffff26; }
body { margin: 0; }
button, select { font: inherit; }
button, select { min-height: 42px; border: 1px solid var(--line); border-radius: 9px; color: inherit; background: #284337; padding: .45rem .8rem; }
button { cursor: pointer; }
button:hover:not(:disabled) { filter: brightness(1.16); }
button:focus-visible, select:focus-visible { outline: 2px solid #fff2c1; outline-offset: 3px; }
button:disabled { cursor: default; }
.gold { background: var(--gold); color: #241c12; font-weight: 750; border-color: transparent; }
.outline { background: transparent; }
.shell { width: min(960px, 100%); margin: auto; padding: 0 24px 24px; }
.header { min-height: 82px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.brand { display: flex; align-items: center; gap: 11px; }
.brand span { color: var(--gold); font-size: 30px; }
h1, h2 { font-family: "Instrument Serif", Georgia, serif; font-weight: 400; margin: 0; }
h1 { font-size: clamp(22px, 4vw, 35px); }
h1 em { color: var(--gold); font-weight: 400; }
h2 { font-size: 30px; }
p { margin: .4rem 0; }
.board { display: grid; gap: 12px; }
.game-layout { display: grid; gap: 12px; }
.history-wide { display: none; }
@media (min-width: 1100px) {
  .shell { width: min(1200px, 100%); }
  .game-layout { grid-template-columns: 210px minmax(0, 1fr); align-items: start; }
  .game-layout .board { grid-column: 2; grid-row: 1; }
  .game-layout .board:only-child { grid-column: 1 / -1; }
  .game-layout .history-wide { display: block; grid-column: 1; grid-row: 1; text-align: left; }
  .history-wide h2 { font-size: 23px; margin: 0 8px 6px; }
  .history-wide .log { max-height: min(68vh, 580px); }
  .game-layout .history-narrow { display: none; }
}
.scoreboard { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; background: #182d25; border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px; }
.side { display: flex; align-items: baseline; gap: 10px; }
.side:last-child { justify-content: end; }
.side strong { font-size: clamp(19px, 4vw, 30px); color: var(--gold); }
.small { font-size: .81rem; color: var(--muted); }
.target { text-align: center; }
.preferences { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; padding: 0 2px 10px; }
.preferences label { display: inline-flex; align-items: center; gap: 5px; min-height: 34px; font-size: .85rem; cursor: pointer; }
input[type=checkbox] { accent-color: var(--gold); }
.preferences .small { margin-inline-start: auto; }
.debug-log { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 4px 9px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 9px; font-size: .8rem; color: var(--muted); }
.debug-log > span { margin-inline-end: auto; }
.debug-log[hidden] { display: none; }
.debug-log button { min-height: 34px; }
#bot-tuning { width: min(660px, calc(100% - 24px)); }
.bot-settings { margin-block: 10px; }
.bot-settings label { display: grid; grid-template-columns: minmax(0, 1fr) 5rem; gap: 12px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); }
.bot-settings small { display: block; color: var(--muted); }
.bot-settings input { width: 100%; padding: 7px 5px; font: inherit; }
.debug-hand { display: grid; grid-template-columns: repeat(2, max-content); justify-content: center; gap: 3px; margin-top: 5px; }
.mini-card { color: #1d2928; background: #fbf4e2; border-radius: 3px; padding: 2px 3px; font-size: .75rem; font-weight: 750; }
.mini-card.red { color: #ab292c; }
.card.clubs, .mini-card.clubs { color: #126044; }
.card.spades, .mini-card.spades { color: #243d86; }
.hand .card.clubs, .hand .card.spades { color: #151515; }
.mini-card { display: inline-flex; align-items: center; gap: 2px; line-height: 1; }
.mini-suit { font-size: 1.05rem; line-height: .95; }
.player .last-call { margin: 4px 0; color: var(--gold); font-size: .79rem; font-weight: 750; }
.previous-trick { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 12px; padding: 7px; border: 1px solid var(--line); border-radius: 9px; background: #182d25; font-size: .77rem; color: var(--muted); }
.previous-play { display: inline-flex; align-items: center; gap: 4px; }
.north .debug-hand { grid-template-columns: repeat(4, max-content); }
.table { min-height: 330px; border: 1px solid #58836a; border-radius: 38% / 18%; background: radial-gradient(ellipse, #2d694d, #1d4a36 75%); box-shadow: inset 0 0 0 7px #1e4b38, inset 0 0 0 8px #ffffff23; padding: 13px 22px; display: grid; grid-template: auto 1fr auto / minmax(52px, 1fr) minmax(120px, 2fr) minmax(52px, 1fr); align-items: center; justify-items: center; }
.player { padding: 4px 7px; border-radius: 7px; border: 1px solid transparent; text-align: center; font-size: .88rem; }
.player.active { border-color: var(--gold); color: var(--gold); background: #142e24; }
.player.trick-winner { border-color: var(--gold); color: #251b0d; background: var(--gold); }
.player.trick-winner small { color: #47351d; }
.winner-label { font-weight: 750; }
.player small { display: block; color: var(--muted); font-size: .69rem; }
.north { grid-area: 1 / 2; }.west { grid-area: 2 / 1; }.east { grid-area: 2 / 3; }.south { grid-area: 3 / 2; }
.center { grid-area: 2 / 2; width: 100%; text-align: center; }
.center h2 { margin-bottom: 7px; }
.contract { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 7px; }
.pill { font-size: .8rem; border-radius: 20px; padding: .22rem .55rem; background: #15372b; }
.trick { margin: auto; display: grid; grid-template: repeat(3, 55px) / repeat(3, 52px); justify-content: center; align-items: center; justify-items: center; }
.trick .card { width: 44px; height: 55px; padding: 3px; font-size: 17px; }
.trick .card span { font-size: 21px; }
.card { display: flex; flex-direction: column; justify-content: space-between; align-items: center; font-weight: 750; width: clamp(36px, 9.6vw, 73px); height: clamp(60px, 13vw, 100px); padding: 6px 3px; border-radius: 7px; border: 1px solid #c5bba3; background: #fbf4e2; color: #1d2928; font-size: clamp(16px, 3vw, 26px); line-height: 1; box-shadow: 0 3px 0 #0003; }
.card.red { color: #ab292c; }
.card.is-trump, .mini-card.is-trump { background: #ffe8a5; border-color: #e3be63; }
.card.is-highest-side-card, .mini-card.is-highest-side-card { background: #e5d2ff; border-color: #ad86df; }
.card span { font-size: clamp(24px, 4vw, 39px); }
.card:disabled { opacity: .56; }
.card[aria-pressed=true] { outline: 2px solid var(--gold); transform: translateY(-4px); }
.hand { display: flex; gap: clamp(3px, .85vw, 8px); justify-content: center; margin: 6px 0; }
.panel { background: #182d25; padding: 12px; border-radius: 12px; border: 1px solid var(--line); text-align: center; }
.buttons { display: flex; gap: 7px; flex-wrap: wrap; justify-content: center; align-items: center; margin-top: 8px; }
.log { max-height: 125px; overflow: auto; padding: 4px 8px; color: var(--muted); font-size: .83rem; }
.log span { display: block; margin-bottom: 4px; }
details { text-align: left; }
details summary { cursor: pointer; }
table { border-collapse: collapse; margin: 8px auto; width: min(100%, 420px); }
th, td { padding: 5px; text-align: right; border-bottom: 1px solid var(--line); }
th:first-child { text-align: left; }
.welcome { text-align: center; padding: 80px 16px; background: radial-gradient(ellipse, #2d694d, #1d4a36 75%); border: 1px solid #58836a; border-radius: 18px; }
.welcome h2 { font-size: clamp(32px, 8vw, 62px); }
.welcome p { margin: 12px 0 24px; }
dialog { background: #192d25; color: inherit; border: 1px solid #73947f; padding: 22px; border-radius: 14px; width: min(340px, calc(100% - 28px)); }
dialog::backdrop { background: #07120cbd; }
dialog label { display: block; margin: 14px 0 6px; }
dialog select { width: 100%; }
@media (max-width: 480px) {
  .shell { padding: 0 8px 14px; }
  .header { min-height: 62px; }
  .brand { gap: 5px; }
  .brand span { font-size: 21px; }
  .header button { padding: 4px 7px; font-size: .8rem; }
  .scoreboard { padding: 8px; gap: 5px; }
  .side { gap: 5px; }
  .side .small { font-size: .72rem; }
  .table { padding: 11px 5px; min-height: 285px; border-radius: 26% / 15%; grid-template-columns: 54px 1fr 54px; }
  .card { width: min(10.5vw, 46px); }
  .player { padding-inline: 2px; }
  .mini-card { padding-inline: 2px; font-size: .66rem; }
  .center h2 { font-size: 25px; }
}

