:root {
    color-scheme: light;
    font-family: system-ui, sans-serif;
    color: #13241d;
    background: #ecf5f6;
    --muted: #43585d;
    --accent: #0a707a;
    --line: #cddfe2;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
main { max-width: 806px; padding: clamp(8px, 3vw, 28px); margin: auto; }
.masthead { display: flex; justify-content: space-between; gap: 12px; align-items: end; margin-bottom: 12px; }
.eyebrow { font-size: .65rem; font-weight: 700; letter-spacing: .14em; color: var(--accent); }
.masthead h1 { font-size: clamp(2rem, 8vw, 3.15rem); line-height: 1.05; margin: .05em 0; }
.masthead p { margin: 0 0 .35rem; color: var(--muted); font-size: clamp(.75rem, 3vw, .95rem); text-align: right; }
#lobby, #board { border: 1px solid var(--line); border-radius: 1rem; text-align: center; padding: clamp(6px, 1.1vw, 10px); background: #fff; }
#lobby h2 { margin: .3rem 0 .8rem; }
#lobby label { display: block; margin-bottom: .3rem; }
#lobby label span, .scoreboard small { color: var(--muted); }
input { font: inherit; color: inherit; background: #fff; border: 1px solid #899fa3; border-radius: .5rem; padding: .5rem; max-width: 100%; }
.lobby-actions { margin: .7rem 0 .3rem; }
.game-layout { display: grid; grid-template-columns: minmax(0, 505px) minmax(170px, 1fr); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.game-stage { container-type: inline-size; min-width: 0; }
.scoreboard { display: flex; flex-direction: column; gap: .4rem; padding: .6rem; background: #fff; min-width: 0; }
.match-target { margin: 0; padding: .45rem .65rem; text-align: left; color: #fff; background: var(--accent); border-radius: .65rem; line-height: 1.25; font-weight: 700; }
.match-target small { color: inherit; text-transform: uppercase; letter-spacing: .12em; }
.pair-score { padding: .5rem .65rem; background: #eef3f5; border: 1px solid var(--line); border-radius: .65rem; text-align: left; }
.pair-score:nth-child(2) { background: #e4f5f6; }
.pair-names { display: block; font-size: .78rem; color: var(--muted); overflow-wrap: anywhere; }
.scoreboard strong { font-variant-numeric: tabular-nums; color: var(--accent); margin-left: .2rem; }
.invite { max-width: 32rem; margin: .5rem auto .75rem; }
.invite-row { display: flex; gap: .4rem; margin-top: .25rem; }
.invite-row input { flex: 1; min-width: 0; }
/* The Trešeta championship table is 505 × 519. Scale its slots with the stage, not the viewport. */
#arena {
    --card: 14.46cqw;
    --back: 9.9cqw;
    --avatar: 10.3cqw;
    position: relative;
    isolation: isolate;
    overflow: hidden;
    aspect-ratio: 505 / 519;
    background: linear-gradient(rgba(255,255,255,.06),rgba(70,33,7,.05)),
        repeating-linear-gradient(0deg,rgba(116,66,22,.06) 0,rgba(116,66,22,.06) 1px,transparent 1px,transparent 6px),
        radial-gradient(ellipse at 50% 42%,#f1cf91 0,#e2b76f 48%,#c99350 100%);
}
.table-mv-lockup { position: absolute; width: 49.5%; top: 50%; left: 50%; transform: translate(-50%, -50%); pointer-events: none; }
.table-mv-lockup span { display: block; background: center / contain no-repeat; }
.table-mv-lockup span:first-child { height: 61.75cqw; opacity: .11; background-image: url('/trijumf-art/morskavila-znak-tamni.svg'); }
.table-mv-lockup span:last-child { height: 5.52cqw; opacity: .16; margin-top: -2cqw; background-image: url('/trijumf-art/morskavila-com-logo-tamni.svg'); }
.who { position: absolute; width: 16cqw; z-index: 1; display: grid; justify-items: center; gap: .1em; font-size: clamp(.6rem, 2.65cqw, .85rem); line-height: 1.15; color: #34230c; }
.who::before { content: ''; width: var(--avatar); aspect-ratio: 1; border: 2px solid #fff; border-radius: 14%; background: #f3f5f5 url('/trijumf-art/default-avatar.svg') center / cover no-repeat; }
.seat.is-bot .who::before { background-image: url('/trijumf-art/bot-avatar.svg'); }
.seat.is-empty .who::before { opacity: .45; }
.who strong { width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who span { font-size: .83em; }
.seat.is-turn .who::before { box-shadow: 0 0 7px 3px #fff; outline: 2px solid var(--accent); }
.south.is-turn .who::before { box-shadow: 0 0 7px 3px #dc3f29; outline-color: #b22c1b; }
.north .who { top: 2cqw; left: 25.5cqw; }
.west .who, .east .who { top: 22.8cqw; }
.west .who { left: 0; }
.east .who { right: 0; }
.south .who { top: 81.2cqw; right: 0; }
.hand { position: absolute; display: flex; }
.hand > * { width: var(--card); flex: 0 0 auto; }
.opponent > * { width: var(--back); }
.north .hand { top: -5.94cqw; left: 40cqw; }
.north .hand > * + * { margin-left: calc(3.17cqw - var(--back)); }
.west .hand, .east .hand { top: 41cqw; flex-direction: column; }
.west .hand { left: 2cqw; }
.east .hand { right: 2cqw; }
.west .hand > * + *, .east .hand > * + * { margin-top: calc(1.58cqw - var(--back) * 1.85); }
.south .hand { top: 73.27cqw; left: 2cqw; z-index: 2; }
.south .hand > * + * { margin-left: calc(7.72cqw - var(--card)); }
.card { border: 0; padding: 0; background: transparent; border-radius: 5%; position: relative; }
.card[aria-disabled=true] img { filter: brightness(.72); }
@media (hover: hover) { .card[aria-disabled=false]:hover { transform: translateY(-4px); z-index: 1; } }
.card:focus-visible { transform: translateY(-4px); z-index: 1; }
#arena img { display: block; width: 100%; aspect-ratio: 300 / 555; border-radius: 5%; }
#arena .hand > img { width: var(--card); }
#arena .opponent > img { width: var(--back); }
.card img, .trick-card img { box-shadow: -1px 2px 4px #37200a55; }
.undealt { visibility: hidden; }
.flying { position: relative; z-index: 3; pointer-events: none; }
.stock { position: absolute; top: 2cqw; right: 2cqw; display: grid; justify-items: end; gap: .25rem; max-width: 21cqw; font-size: clamp(.65rem, 2.6cqw, .85rem); text-align: right; }
#deck { width: 8cqw; aspect-ratio: 300 / 555; }
#deck:empty { aspect-ratio: auto; }
.trick-card { position: absolute; width: var(--card); }
.trick-card.north { left: 42.57cqw; top: 13.86cqw; }
.trick-card.west { left: 20.79cqw; top: 27.72cqw; }
.trick-card.east { left: 64.36cqw; top: 27.72cqw; }
.trick-card.south { left: 42.57cqw; top: 43.56cqw; }
button { font: inherit; color: var(--accent); background: #fff; border: 1px solid #86babf; padding: .45rem .65rem; border-radius: .6rem; cursor: pointer; }
button:focus-visible, input:focus-visible, a:focus-visible, summary:focus-visible, [tabindex="-1"]:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
button[aria-disabled=true] { cursor: default; }
button:not(.card)[aria-disabled=true] { opacity: .58; }
button.primary, button[aria-pressed=true] { background: var(--accent); border-color: var(--accent); color: #fff; }
.actions { display: flex; gap: .35rem; justify-content: center; flex-wrap: wrap; }
#status { font-weight: bold; min-height: 1.4em; margin: .55em 0; }
#last-trick, #announcements, #notice, #copy-note { color: var(--muted); font-size: .84rem; margin: .5em 0 0; }
#last-trick:empty, #announcements:empty, #declarations:empty, #notice:empty, #trump-name:empty { display: none; }
.help { margin: 1rem 0; color: var(--muted); }
.help summary { cursor: pointer; font-weight: bold; }
.help li { margin-bottom: .35rem; }
footer a { color: var(--accent); }
@media (max-width: 640px) {
    .game-layout { grid-template-columns: minmax(0, 1fr); }
    .scoreboard { grid-row: 1; flex-direction: row; justify-content: center; padding: .35rem; }
    .match-target, .pair-names { display: none; }
    .pair-score { padding: .24rem .6rem; }
}
