:root {
  --bg: #0e1a13; --bg2: #14261c; --panel: #172b20; --line: #2a4636;
  --ink: #f2efe4; --dim: #9db3a5; --gold: #e8c872; --gold2: #b8943f;
  --felt1: #21714a; --felt2: #0f3d29;
  --card: #fbf8f0; --red: #c8352f; --blk: #1b1b1f;
  --cr: 1.6; /* card height : width — all card styles use the same shape (1 : 1.6) */
  --cw: clamp(48px, 11.5vw, 82px); --ch: calc(var(--cw) * var(--cr));
  --ok: #5bd08a; --bad: #e5675f;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: radial-gradient(1200px 700px at 50% -10%, #1b3a29, var(--bg)); color: var(--ink); font-family: var(--sans); -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.screen { min-height: 100%; }
.dim { color: var(--dim); }

/* ---------- buttons / inputs */
.btn { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 16px; font-weight: 600; transition: transform .08s, background .15s; }
.btn:hover:not(:disabled) { background: #1f3a2b; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(#f0d487, var(--gold2)); color: #20180a; border-color: #f4dc98; }
.btn.primary:hover:not(:disabled) { background: linear-gradient(#f6dc99, #c7a24a); }
.btn.small { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn.ghost { background: transparent; }
.input { width: 100%; background: #0d1812; border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; outline: none; }
.input:focus { border-color: var(--gold); }
.code-input { text-transform: uppercase; letter-spacing: .3em; text-align: center; font-weight: 700; }
select.input { appearance: auto; }

/* ---------- home */
.home-wrap { max-width: 980px; margin: 0 auto; padding: 28px 16px 40px; display: grid; gap: 22px; }
.brand { text-align: center; padding-top: 6px; }
.brand h1 { font-family: var(--serif); font-size: clamp(40px, 9vw, 68px); margin: 0; letter-spacing: .02em; color: var(--gold); line-height: 1; }
.brand h1 span { color: var(--ink); }
.brand p { margin: 10px 0 0; color: var(--dim); }
.suits { letter-spacing: .5em; color: var(--dim); font-size: 18px; margin-top: 8px; padding-left: .5em; }
.suits .r { color: #d8645d; }
.home-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 16px; }
@media (max-width: 760px) { .home-grid { grid-template-columns: 1fr; } }
.card-panel { background: linear-gradient(var(--panel), #12241a); border: 1px solid var(--line); border-radius: 16px; padding: 18px; display: grid; gap: 12px; align-content: start; }
.card-panel h2 { margin: 0; font-family: var(--serif); font-size: 20px; }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; }
.row > .btn { flex: 0 0 auto; }
.rooms { display: grid; gap: 8px; max-height: 260px; overflow: auto; }
.room-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: #0f1e16; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; }
.room-item b { letter-spacing: .15em; }
.foot { text-align: center; color: var(--dim); font-size: 13px; }
.foot a, .linkish { color: var(--gold); background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }

/* ---------- lobby */
.lobby-wrap { max-width: 760px; margin: 0 auto; padding: 22px 16px 40px; display: grid; gap: 16px; }
.lobby-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.codebox { font-family: var(--serif); font-size: 34px; letter-spacing: .25em; color: var(--gold); }
.teams { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .teams { grid-template-columns: 1fr; } }
.team { border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: grid; gap: 8px; background: #11241a; }
.team h3 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .12em; color: var(--dim); }
.seat-slot { flex-wrap: wrap; min-height: 52px; border-radius: 10px; border: 1px dashed var(--line); display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; }
.seat-slot.filled { border-style: solid; background: #0f1e16; }
.seat-slot.me { border-color: var(--gold); }
.badge { font-size: 11px; background: var(--gold); color: #1d1608; border-radius: 6px; padding: 1px 6px; margin-left: 6px; font-weight: 700; vertical-align: middle; }
.opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.opts label { display: grid; gap: 5px; font-size: 13px; color: var(--dim); }
.check { display: flex !important; grid-template-columns: none; align-items: center; gap: 8px; color: var(--ink) !important; }
.check input { width: 18px; height: 18px; accent-color: var(--gold); }

/* ---------- game */
#game { display: flex; flex-direction: column; height: 100dvh; min-height: 0; }
.topbar { display: flex; align-items: center; gap: 8px; padding: 8px 10px; padding-top: max(8px, env(safe-area-inset-top)); background: rgba(8, 16, 11, .75); border-bottom: 1px solid var(--line); }
.scorechip { display: flex; gap: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-right: auto; }
.scorechip > div { padding: 4px 12px; text-align: center; background: #0f1e16; min-width: 78px; }
.scorechip > div + div { border-left: 1px solid var(--line); }
.scorechip small { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .12em; color: var(--dim); }
.scorechip b { font-family: var(--serif); font-size: 20px; }
.scorechip .us b { color: var(--gold); }
.tb-info { color: var(--dim); font-size: 12px; text-align: right; line-height: 1.25; }
.iconbtn { position: relative; width: 38px; height: 38px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); display: grid; place-items: center; font-size: 17px; padding: 0; }
.iconbtn .dot { position: absolute; top: -4px; right: -4px; background: var(--bad); color: #fff; border-radius: 9px; font-size: 10px; padding: 1px 5px; font-weight: 700; }

.table { position: relative; flex: 1; min-height: 0; margin: 8px; border-radius: 28px; background: radial-gradient(ellipse at 50% 45%, var(--felt1), var(--felt2) 75%); border: 6px solid #3a2a17; box-shadow: inset 0 0 60px rgba(0, 0, 0, .45), 0 8px 30px rgba(0, 0, 0, .45); display: grid; grid-template-columns: minmax(70px, 1fr) minmax(0, 2.4fr) minmax(70px, 1fr); grid-template-rows: auto 1fr; grid-template-areas: ". top ." "left center right"; overflow: hidden; }
.pl { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 4px; }
.pl.top { grid-area: top; } .pl.left { grid-area: left; justify-content: center; } .pl.right { grid-area: right; justify-content: center; }
.plate { position: relative; background: rgba(6, 14, 9, .62); border: 1px solid rgba(255, 255, 255, .12); border-radius: 12px; padding: 5px 10px 7px; text-align: center; font-size: 13px; max-width: 100%; transition: box-shadow .2s, border-color .2s; }
.plate .nm { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; display: block; }
.plate .st { font-size: 11px; color: var(--dim); min-height: 14px; }
.plate.turn { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(232, 200, 114, .35), 0 0 22px rgba(232, 200, 114, .35); }
.plate.partner .nm::before { content: "★ "; color: var(--gold); }
.plate.off { opacity: .55; }
.tbar { position: absolute; left: 6px; right: 6px; bottom: 2px; height: 3px; background: rgba(255, 255, 255, .1); border-radius: 2px; overflow: hidden; }
.tbar i { display: block; height: 100%; background: var(--gold); width: 100%; }
.chip { display: inline-block; font-size: 10px; font-weight: 800; border-radius: 50%; width: 18px; height: 18px; line-height: 18px; text-align: center; margin-left: 4px; vertical-align: middle; }
.chip.d { background: #fff; color: #222; } .chip.c { background: var(--gold); color: #221a09; }
.backs { display: flex; height: calc(var(--ch) * .5); align-items: center; }
.backs .card { --w: calc(var(--cw) * .36); width: var(--w); height: calc(var(--w) * var(--cr)); margin-left: calc(var(--w) * -.62); border-radius: 4px; flex: none; }
.backs .card:first-child { margin-left: 0; }
.pl.left .backs, .pl.right .backs { flex-direction: column; height: auto; }
.pl.left .backs .card, .pl.right .backs .card { margin-left: 0; margin-top: calc(var(--w) * -1.05); }
.pl.left .backs .card:first-child, .pl.right .backs .card:first-child { margin-top: 0; }

.center { grid-area: center; position: relative; display: grid; grid-template: "a t b" 1fr "l m r" 1fr "c bo d" 1fr / 1fr 1fr 1fr; place-items: center; padding: 4px; min-height: 0; }
.slot { grid-area: m; position: relative; }
.s0 { grid-area: bo; } .s1 { grid-area: r; } .s2 { grid-area: t; } .s3 { grid-area: l; }
.center .card { --w: calc(var(--cw) * .95); }
.center .card.new { animation: pop .28s ease-out; }
.center .card.win { box-shadow: 0 0 0 3px var(--gold), 0 0 24px var(--gold); transform: scale(1.06); }
@keyframes pop { from { transform: scale(.6) translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.trumpbadge { position: absolute; left: 10px; top: 8px; background: rgba(6, 14, 9, .62); border: 1px solid rgba(255, 255, 255, .14); border-radius: 12px; padding: 4px 10px; text-align: center; z-index: 2; }
.trumpbadge small { display: block; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }
.trumpbadge .sym { font-size: 28px; line-height: 1; } .red { color: #ff7d73; }
.logbox { position: absolute; right: 10px; top: 8px; max-width: 34%; text-align: right; font-size: 11px; color: rgba(255, 255, 255, .6); line-height: 1.35; z-index: 2; pointer-events: none; }
.logbox div:last-child { color: rgba(255, 255, 255, .95); }
.banner { position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%); background: rgba(6, 14, 9, .8); border: 1px solid var(--gold); color: var(--gold); border-radius: 20px; padding: 5px 16px; font-weight: 700; font-size: 14px; white-space: nowrap; z-index: 3; }

/* cards */
.card { --w: var(--cw); position: relative; width: var(--w); height: calc(var(--w) * var(--cr)); border-radius: calc(var(--w) * .1); background: var(--card); box-shadow: 0 2px 6px rgba(0, 0, 0, .45), inset 0 0 0 1px rgba(0, 0, 0, .12); font-family: var(--serif); user-select: none; flex: none; }
.card.red { color: var(--red); } .card.blk { color: var(--blk); }
.card .cr { position: absolute; display: flex; flex-direction: column; align-items: center; line-height: 1; font-size: calc(var(--w) * .27); font-weight: 700; }
.card .cr i { font-style: normal; font-size: .9em; }
.card .tl { left: 7%; top: 5%; } .card .br { right: 7%; bottom: 5%; transform: rotate(180deg); }
.card .cc { position: absolute; inset: 0; display: grid; place-items: center; font-size: calc(var(--w) * .62); opacity: .92; }
.card.back { background: repeating-linear-gradient(45deg, #1f4f8f 0 4px, #2a62ad 4px 8px); box-shadow: 0 2px 5px rgba(0, 0, 0, .5), inset 0 0 0 3px #f2efe4; }
.card.back * { display: none; }

.handbar { padding: 4px 8px calc(8px + env(safe-area-inset-bottom)); display: grid; gap: 6px; justify-items: center; }
.actions { min-height: 46px; display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; }
.bidbtn { background: var(--card); border: 2px solid transparent; border-radius: 12px; width: 62px; height: 46px; font-size: 28px; line-height: 1; }
.bidbtn.red { color: var(--red); } .bidbtn.blk { color: var(--blk); }
.bidbtn:hover { border-color: var(--gold); transform: translateY(-2px); }
.hand { display: flex; justify-content: center; align-items: flex-end; min-height: calc(var(--ch) + 14px); padding-bottom: 2px; max-width: 100%; }
.hand .card { margin-left: calc(var(--cw) * -.34); cursor: pointer; transition: transform .12s, filter .15s; }
.hand .card:first-child { margin-left: 0; }
.hand.mine .card.ok:hover { transform: translateY(-14px); z-index: 5; }
.hand .card.ok { box-shadow: 0 2px 6px rgba(0, 0, 0, .45), 0 0 0 2px rgba(232, 200, 114, .0); }
.hand.myturn .card.ok { box-shadow: 0 3px 8px rgba(0, 0, 0, .5), 0 0 0 2px var(--gold); transform: translateY(-6px); }
.hand .card.no { filter: brightness(.55) saturate(.6); cursor: not-allowed; }
.hand .card.decl { outline: 3px solid var(--ok); outline-offset: -3px; }
@media (min-width: 900px) { .hand .card { margin-left: calc(var(--cw) * -.2); } }
.declbtn { background: #10261a; border: 1px solid var(--ok); color: var(--ok); border-radius: 10px; padding: 8px 14px; font-weight: 700; }
.declbtn.off { border-color: var(--line); color: var(--dim); text-decoration: line-through; }

/* modal / overlays */
.modal { position: fixed; inset: 0; background: rgba(3, 8, 5, .72); z-index: 50; display: grid; place-items: center; padding: 14px; backdrop-filter: blur(3px); }
.sheet { background: linear-gradient(var(--panel), #101f17); border: 1px solid var(--line); border-radius: 18px; padding: 20px; width: min(560px, 100%); max-height: 92dvh; overflow: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, .6); }
.sheet h2 { margin: 0 0 10px; font-family: var(--serif); color: var(--gold); }
.sheet table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.sheet th, .sheet td { padding: 6px 8px; text-align: right; border-bottom: 1px solid var(--line); font-size: 14px; }
.sheet th:first-child, .sheet td:first-child { text-align: left; }
.sheet th { color: var(--dim); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.sheet tr.total td { font-weight: 800; border-top: 2px solid var(--gold2); font-size: 16px; }
.sheet .us { color: var(--gold); }
.sheet .big { font-family: var(--serif); font-size: 26px; margin: 4px 0 10px; }
.sheet .win { color: var(--ok); } .sheet .lose { color: var(--bad); }
.sheet .actions { margin-top: 14px; }
.rules p, .rules li { color: #d3dfd7; line-height: 1.5; font-size: 14px; }
.rules h3 { margin: 14px 0 4px; color: var(--gold); font-size: 15px; }
.rules ul { padding-left: 18px; margin: 4px 0; }
.declrow { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 8px; }
.declrow .card { --w: 34px; font-size: 10px; }
.chatpanel { position: fixed; right: 10px; bottom: 10px; width: min(340px, calc(100vw - 20px)); height: min(420px, 60dvh); z-index: 40; background: #0e1b14; border: 1px solid var(--line); border-radius: 14px; display: flex; flex-direction: column; box-shadow: 0 14px 40px rgba(0, 0, 0, .6); }
.chathead { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); font-weight: 700; }
.chatlog { flex: 1; overflow: auto; padding: 8px 12px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.chatlog b { color: var(--gold); }
.chatform { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--line); }
.chatform .input { padding: 8px 10px; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 8px 8px; }
.quick button { background: #12261b; border: 1px solid var(--line); border-radius: 14px; padding: 3px 9px; font-size: 12px; }

.conn { position: fixed; top: 0; left: 0; right: 0; background: var(--bad); color: #fff; text-align: center; padding: 6px; font-size: 14px; z-index: 100; }
#toasts { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 90; pointer-events: none; width: max-content; max-width: 92vw; }
.toast { background: rgba(10, 20, 14, .94); border: 1px solid var(--gold); color: var(--ink); border-radius: 12px; padding: 8px 16px; font-weight: 600; animation: pop .25s ease-out; text-align: center; }
.toast.err { border-color: var(--bad); }

@media (max-width: 560px) {
  .plate .nm { max-width: 78px; font-size: 12px; }
  .scorechip > div { min-width: 64px; padding: 3px 8px; }
  .tb-info { display: none; }
  .logbox { display: none; }
  .center .card { --w: calc(var(--cw) * .9); }
}
@media (max-height: 560px) and (orientation: landscape) {
  :root { --cw: clamp(34px, 7vh, 52px); }
  .handbar { padding-top: 0; }
  .actions { min-height: 38px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* zvanja selection, reveal, bela */
.hand .card.sel { transform: translateY(-18px); box-shadow: 0 0 0 3px var(--gold), 0 6px 14px rgba(0, 0, 0, .5); z-index: 6; }
.hand .card.grp { outline: 3px solid var(--ok); outline-offset: -3px; }
.declpanel { position: absolute; inset: 6px; z-index: 5; background: rgba(6, 14, 9, .88); border: 1px solid var(--gold); border-radius: 16px; padding: 10px 12px; overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.declpanel .t { font-family: var(--serif); color: var(--gold); font-size: 20px; text-align: center; }
.declpanel .di { font-size: 13px; }
.declpanel .declrow { margin: 3px 0 6px; }
.declpanel .declrow .card { --w: clamp(26px, 5.2vw, 40px); }
.declchip { margin-top: 4px; font-size: 11px; color: var(--gold); font-weight: 700; white-space: nowrap; }
.belapop { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 8; background: #10221a; border: 2px solid var(--gold); border-radius: 16px; padding: 16px 20px; text-align: center; box-shadow: 0 14px 40px rgba(0, 0, 0, .65); animation: pop .22s ease-out; max-width: 92%; }
.belapop .t { font-family: var(--serif); font-size: 26px; color: var(--gold); }

.declpanel .items { display: flex; flex-wrap: wrap; gap: 4px 22px; justify-content: center; }
.declpanel .di { text-align: center; }
.declpanel .declrow { justify-content: center; }
.seat-slot { padding: 8px 8px 8px 12px; }

/* ---- stage 2: turn glow, trump mark, time bank, own plate */
@keyframes turnpulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(232, 200, 114, .45), 0 0 8px rgba(232, 200, 114, .25); }
  50% { box-shadow: 0 0 0 3px rgba(232, 200, 114, .95), 0 0 30px rgba(232, 200, 114, .8); }
}
.plate.turn { border-color: var(--gold); animation: turnpulse 1.3s ease-in-out infinite; }
.plate .nm { display: flex; align-items: center; justify-content: center; gap: 4px; max-width: none; overflow: visible; }
.plate .nmt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 120px; }
.plate .tm { font-size: 24px; line-height: 1; margin-left: 2px; }
.plate .bank { display: block; font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums; }
.plate .bank.low { color: #ffb36b; }
.plate .bank.running { color: #ff9b4a; font-weight: 700; }
.tbar.banking i { background: #ff9b4a; }
.merow { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; width: 100%; }
.merow .actions { min-height: 46px; }
.plate.me { padding: 4px 10px 6px; }
@media (max-width: 560px) { .plate .nmt { max-width: 70px; } .plate .nm { max-width: none; } .plate .tm { font-size: 20px; } }

/* bigger opponent cards; east/west hold theirs sideways, facing the centre */
.backs { height: auto; }
.backs .card { --w: calc(var(--cw) * .5); margin-left: calc(var(--w) * -.6); border-radius: 5px; }
.pl.left .backs .card, .pl.right .backs .card { width: calc(var(--w) * var(--cr)); height: var(--w); margin-left: 0; margin-top: calc(var(--w) * -.72);
  background: repeating-linear-gradient(-45deg, #1f4f8f 0 4px, #2a62ad 4px 8px); }
.pl.left .backs .card:first-child, .pl.right .backs .card:first-child { margin-top: 0; }

/* zvanja announcement pop-up (everybody sees it, closes after ~2 s, never blocks clicks) */
.declpop { position: fixed; left: 50%; top: 40%; z-index: 70; pointer-events: none; opacity: 0; transform: translate(-50%, -50%) scale(.85);
  transition: opacity .2s, transform .2s; background: rgba(10, 22, 15, .96); border: 2px solid var(--gold); border-radius: 18px; padding: 14px 28px;
  text-align: center; box-shadow: 0 16px 50px rgba(0, 0, 0, .6); min-width: 200px; }
.declpop.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.declpop .n { color: var(--dim); font-size: 14px; }
.declpop .v { font-family: var(--serif); font-size: 30px; color: var(--gold); }
.declpop .v.none { color: var(--ink); font-size: 24px; }

/* suit glyphs (text in classic style, small SVG for mađarice) */
.sg { display: inline-flex; align-items: center; line-height: 1; }
.sg.red { color: #ff7d73; } .sg.blk { color: var(--ink); }
.bidbtn .sg.red { color: var(--red); } .bidbtn .sg.blk { color: var(--blk); }
.trumpbadge .sym .sg { font-size: 28px; }
.sv { display: inline-block; width: 1em; height: 1em; }
.sv svg { width: 100%; height: 100%; display: block; }
.card .cr .sv { width: .95em; height: .95em; }
html[data-cards="mad"] .sg.su-H { color: #ff7d73; } html[data-cards="mad"] .sg.su-D { color: #f2c14e; }
html[data-cards="mad"] .sg.su-S { color: #7fd17f; } html[data-cards="mad"] .sg.su-C { color: #d49a62; }
html[data-cards="mad"] .card.su-H, html[data-cards="mad"] .bidbtn .sg.su-H { color: #c8352f; }
html[data-cards="mad"] .card.su-D, html[data-cards="mad"] .bidbtn .sg.su-D { color: #b97c06; }
html[data-cards="mad"] .card.su-S, html[data-cards="mad"] .bidbtn .sg.su-S { color: #2e7d32; }
html[data-cards="mad"] .card.su-C, html[data-cards="mad"] .bidbtn .sg.su-C { color: #7a4a1e; }
html[data-cards="mad"] .card .cc { font-size: calc(var(--w) * .5); }
/* gornji / donji: simple coloured court card for now (illustrated figures can be added later) */
html[data-cards="mad"] .card.court { background: linear-gradient(160deg, #fbf8f0 35%, #efe4c8); }
.card .courtface { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.card .courtface b { font-size: calc(var(--w) * .46); line-height: 1; border: 2px solid currentColor; border-radius: 8px; padding: 1px 7px; }
.card .courtface i { font-size: calc(var(--w) * .26); font-style: normal; }

/* options */
.styleopt { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; margin-top: 8px; cursor: pointer; }
.styleopt.on { border-color: var(--gold); background: #13281d; }
.styleopt input { width: 18px; height: 18px; accent-color: var(--gold); }
.declrow.preview .card { --w: 52px; }
@media (max-width: 560px) {
  .pl.left .plate .nmt, .pl.right .plate .nmt { max-width: 44px; }
  .plate .chip { width: 16px; height: 16px; line-height: 16px; font-size: 9px; margin-left: 2px; }
  .pl.left .plate, .pl.right .plate { padding: 4px 6px 6px; }
}

/* ---- stage 3: one green felt, no table frame, fixed layout, avatars ---- */
#game { background: radial-gradient(ellipse at 50% 42%, var(--felt1), var(--felt2) 85%); }
.table { margin: 0; border: 0; border-radius: 0; background: none; box-shadow: none; }
.topbar { background: rgba(4, 12, 8, .45); border-bottom: 1px solid rgba(255, 255, 255, .06); }
.tb-btns { display: flex; gap: 6px; margin-right: auto; }
.topbar .scorechip { margin-right: 0; }
.tb-info { text-align: right; }

.plate { display: flex; align-items: center; gap: 8px; text-align: left; }
.plate .pinfo { display: flex; flex-direction: column; min-width: 0; }
.plate .nm { justify-content: flex-start; }
.av { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex: none; border: 2px solid rgba(255, 255, 255, .28); background: #0c1a12; display: block; }
.av.init { display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff; }
.plate.turn .av { border-color: var(--gold); }
.slotname { display: flex; align-items: center; gap: 8px; }
.slotname .av { width: 30px; height: 30px; }

/* west: avatar, then cards toward the centre; east: cards, then avatar */
.pl.left, .pl.right { flex-direction: row; gap: 10px; }
.pl.right { flex-direction: row-reverse; }

/* my side: plate in a fixed spot left of the hand, buttons in a fixed row, nothing moves */
.handbar { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: end; justify-items: stretch; column-gap: 14px; }
.meslot { justify-self: end; align-self: center; }
.meslot .plate { min-width: 150px; }
.handcol { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.handcol .actions { height: 52px; min-height: 52px; flex-wrap: nowrap; }
.hand { height: calc(var(--ch) + 16px); }
.banner.other { border-color: rgba(255, 255, 255, .22); color: var(--ink); font-weight: 600; }

/* options: avatar picker */
.avgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 8px; }
.avpick { background: none; border: 2px solid transparent; border-radius: 50%; padding: 2px; display: grid; place-items: center; }
.avpick.on { border-color: var(--gold); }
.avpick .av { width: 44px; height: 44px; }
.avcat { grid-column: 1 / -1; font-size: 12px; color: var(--dim); margin-top: 4px; }

@media (max-width: 700px) {
  .pl.left, .pl.right { flex-direction: column; gap: 6px; }
}
@media (max-width: 560px) {
  .av { width: 28px; height: 28px; font-size: 11px; }
  .plate { gap: 5px; }
  .handbar { grid-template-columns: auto minmax(0, 1fr); column-gap: 6px; }
  .sideslot { display: none; }
  .meslot { justify-self: start; }
  .meslot .plate { min-width: 0; }
  .bidbtn { width: 44px; height: 40px; font-size: 22px; }
  .handcol .actions { height: 46px; min-height: 46px; gap: 5px; }
  .handcol .actions .btn { padding: 8px 10px; font-size: 13px; }
  .tb-btns { gap: 4px; }
  .tb-btns .iconbtn { width: 32px; height: 32px; font-size: 15px; }
}
.meslot .plate { height: 58px; }
@media (max-width: 560px) { .meslot .plate { height: 64px; } .meslot .plate .st { white-space: nowrap; } }

/* ===================== stage 4: table layout from the approved mockup ===================== */
#game { position: relative; background: radial-gradient(1100px 650px at 50% 40%, #1c3a29, #0c1711); }
#game .topbar { height: 40px; padding: 4px 10px; gap: 5px; background: rgba(4, 12, 8, .55); border-bottom: 1px solid rgba(255, 255, 255, .06); }
#game .tb-btns .iconbtn { width: 30px; height: 30px; font-size: 14px; border-radius: 8px; }
#game .tb-info { margin-left: auto; margin-right: 214px; font-size: 11px; }
/* score box over the table's top-right corner */
#game .scorechip { position: absolute; right: 12px; top: 6px; z-index: 25; margin: 0; display: flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  background: #0f1e16; box-shadow: 0 8px 24px rgba(0, 0, 0, .5); cursor: pointer; }
#game .scorechip:hover { border-color: var(--gold2); }
#game .scorechip .col { min-width: 86px; padding: 5px 12px 6px; display: flex; flex-direction: column; align-items: center; background: none; text-align: center; }
#game .scorechip .col + .col { border-left: 1px solid var(--line); }
#game .scorechip small { font-size: 10px; letter-spacing: .14em; color: var(--dim); }
#game .scorechip .round { font-family: var(--serif); font-size: 30px; line-height: 1.05; font-weight: 700; }
#game .scorechip .us .round { color: var(--gold); }
#game .scorechip .note { font-size: 10.5px; color: #f2c14e; min-height: 13px; white-space: nowrap; }
#game .scorechip .total { font-size: 12px; color: var(--dim); }

/* the play area: a wide oval table in the middle, players around it */
#game .area { position: relative; flex: 1; min-height: 0;
  --fw: clamp(300px, calc(100vw - 470px), 740px); --fh: clamp(170px, calc(100dvh - 520px), 300px); --av: 76px; --tw: 62px; }
#game .felt { position: absolute; left: 50%; top: 50%; width: var(--fw); height: var(--fh); transform: translate(-50%, -50%);
  border-radius: calc(var(--fh) * .59) / calc(var(--fh) * .48);
  background: radial-gradient(ellipse at 50% 45%, var(--felt1), var(--felt2) 80%); border: 7px solid #3a2a17;
  box-shadow: inset 0 0 50px rgba(0, 0, 0, .45), 0 10px 34px rgba(0, 0, 0, .55); }
#game .felt .trumpbadge { left: 13%; bottom: 9%; top: auto; }
/* hidden cards resting on the table edge */
#game .back { --w: auto; width: 30px; height: 42px; border-radius: 5px; margin: 0; flex: none; }
#game .hb { position: absolute; display: flex; left: 50%; top: -14px; transform: translateX(-50%); z-index: 3; }
#game .hb .back + .back { margin-left: -18px; }
#game .vb { position: absolute; display: flex; flex-direction: column; top: 50%; transform: translateY(-50%); z-index: 3; }
#game .vb .back { width: 42px; height: 30px; background: repeating-linear-gradient(-45deg, #1f4f8f 0 4px, #2a62ad 4px 8px); }
#game .vb .back + .back { margin-top: -19px; }
#game .vb.l { left: -16px; } #game .vb.r { right: -16px; }
/* played cards: upright cross, no overlap */
#game .trick { position: absolute; left: 50%; top: 50%; width: 0; height: 0; z-index: 4; }
#game .trick .card { position: absolute; --w: var(--tw); }
#game .trick .s0 { left: calc(var(--tw) * -.5); top: calc(var(--tw) * .11); }
#game .trick .s2 { left: calc(var(--tw) * -.5); top: calc(var(--tw) * -1.52); }
#game .trick .s3 { left: calc(var(--tw) * -1.65); top: calc(var(--tw) * -.7); }
#game .trick .s1 { left: calc(var(--tw) * .65); top: calc(var(--tw) * -.7); }
#game .trick .card.new { animation: pop .28s ease-out; }
#game .trick .card.win { box-shadow: 0 0 0 3px var(--gold), 0 0 24px var(--gold); }
#game .fnote { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); text-align: center; color: rgba(255, 255, 255, .85); pointer-events: none; }
#game .fnote .t { font-family: var(--serif); font-size: 20px; } #game .fnote .dim { font-size: 13px; margin-top: 4px; }
#game .felt .declpanel { inset: 10px; border-radius: 20px; }

/* seats: round avatar on top, name box underneath */
#game .plate { position: absolute; display: flex; flex-direction: column; align-items: center; gap: 0; padding: 0; background: none; border: 0; border-radius: 0;
  box-shadow: none; animation: none; text-align: center; z-index: 5; max-width: none; height: auto; min-width: 0; }
#game .plate .av { width: var(--av); height: var(--av); border-width: 3px; border-color: rgba(255, 255, 255, .35); position: relative; z-index: 2; font-size: calc(var(--av) * .3); }
#game .plate .pbox { margin-top: -12px; padding: 10px 12px 7px; min-width: 122px; background: rgba(6, 14, 9, .86); border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 12px; font-size: 13px; position: relative; display: flex; flex-direction: column; align-items: center; }
#game .plate .nm { display: flex; justify-content: center; align-items: center; gap: 5px; font-weight: 700; }
#game .plate .nmt { max-width: 130px; }
#game .plate .st, #game .plate .bank { display: block; font-size: 11px; min-height: 13px; }
#game .plate.turn { animation: none; box-shadow: none; border: 0; }
#game .plate.turn .pbox { border-color: var(--gold); animation: turnpulse 1.3s ease-in-out infinite; }
#game .plate.turn .av { border-color: var(--gold); }
#game .plate.off { opacity: .6; }
#game .p-top { left: 50%; top: calc(50% - var(--fh) / 2 + 8px); transform: translate(-50%, -100%); }
#game .p-bot { left: 50%; top: calc(50% + var(--fh) / 2 + 6px); transform: translateX(-50%); }
#game .p-left { left: calc(50% - var(--fw) / 2 - 22px); top: 50%; transform: translate(-100%, -50%); }
#game .p-right { left: calc(50% + var(--fw) / 2 + 22px); top: 50%; transform: translateY(-50%); }
/* my turn message to the right of my avatar, buttons to the left — fixed spots, nothing moves */
#game .area .banner { left: calc(50% + 84px); top: calc(50% + var(--fh) / 2 + 6px + var(--av) / 2); bottom: auto; transform: translateY(-50%); z-index: 6; }
#game .area .actions { position: absolute; right: calc(50% + 84px); top: calc(50% + var(--fh) / 2 + 6px + var(--av) / 2); transform: translateY(-50%);
  display: flex; gap: 8px; align-items: center; min-height: 0; height: auto; z-index: 6; flex-wrap: nowrap; }
#game .area .actions:empty { display: none; }
#game .logbox { left: 14px; right: auto; top: 8px; text-align: left; max-width: 26%; }
#game .belapop { z-index: 30; }

/* my cards: in a framed tray below the table, with space underneath */
#game .bottom { display: flex; justify-content: center; padding: 0 8px calc(22px + env(safe-area-inset-bottom)); }
#game .tray { padding: 16px 22px 12px; border-radius: 22px; background: linear-gradient(180deg, rgba(20, 40, 28, .92), rgba(10, 22, 15, .95));
  border: 3px solid #3a2a17; box-shadow: inset 0 0 0 1px rgba(232, 200, 114, .18), inset 0 8px 24px rgba(0, 0, 0, .45), 0 10px 28px rgba(0, 0, 0, .5); max-width: 100%; }
#game .hand { height: calc(var(--ch) + 8px); min-height: 0; padding: 0; }
#game .hand .card { margin-left: calc(var(--cw) * -.22); }
#game .hand .card:first-child { margin-left: 0; }

/* chat docked in the bottom-left corner */
.chatdock { position: fixed; left: 12px; bottom: 16px; width: 290px; height: 210px; z-index: 40; background: rgba(8, 18, 12, .95); border: 1px solid var(--line);
  border-radius: 14px; display: flex; flex-direction: column; box-shadow: 0 12px 34px rgba(0, 0, 0, .55); }
.chatdock .chathead { cursor: pointer; user-select: none; display: flex; align-items: center; gap: 8px; padding: 6px 10px; font-size: 13px; font-weight: 700; border-bottom: 1px solid var(--line); }
.chatdock .ctoggle { margin-left: auto; color: var(--dim); }
.chatdock .cbadge { background: var(--bad); color: #fff; border-radius: 9px; font-size: 10px; padding: 1px 6px; }
.chatdock .chatbody { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chatdock .chatlog { padding: 6px 10px; font-size: 13px; }
.chatdock .quick { padding: 0 8px 6px; } .chatdock .chatform { padding: 6px; }
.chatdock.min { height: auto; width: auto; }
.chatdock.min .chatbody { display: none; } .chatdock.min .chathead { border-bottom: 0; } .chatdock.min .ctoggle { transform: rotate(180deg); }

@media (max-height: 760px) {
  #game .area { --av: 60px; --fh: clamp(150px, calc(100dvh - 470px), 300px); --tw: 54px; }
}
@media (max-width: 700px) {
  #game .tb-info { display: none; }
  #game .scorechip .col { min-width: 62px; padding: 3px 8px 4px; }
  #game .scorechip .round { font-size: 22px; }
  #game .area { --fw: calc(100vw - 150px); --fh: clamp(150px, calc(100dvh - 470px), 260px); --av: 46px; --tw: 44px; }
  #game .plate .pbox { min-width: 0; padding: 8px 6px 5px; font-size: 11px; }
  #game .plate .nmt { max-width: 62px; }
  #game .p-left { left: 4px; transform: translateY(-50%); }
  #game .p-right { left: auto; right: 4px; transform: translateY(-50%); }
  #game .vb.l { left: 2px; } #game .vb.r { right: 2px; }
  #game .back { width: 22px; height: 31px; } #game .hb .back + .back { margin-left: -14px; }
  #game .vb .back { width: 31px; height: 22px; } #game .vb .back + .back { margin-top: -15px; }
  #game .felt .trumpbadge { left: 50%; bottom: 6px; transform: translateX(-50%) scale(.85); }
  #game .area .banner { left: 50%; top: calc(50% + var(--fh) / 2 - 26px); transform: translate(-50%, -50%); font-size: 12px; padding: 4px 12px; }
  #game .area .actions { right: auto; left: 50%; top: calc(50% + var(--fh) / 2 - 30px); transform: translate(-50%, -50%); }
  #game .area.hasact .banner { display: none; }
  #game .felt .trumpbadge { display: none; }
  #game .bottom { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  #game .tray { padding: 10px 10px 8px; border-radius: 16px; }
  .chatdock { left: 8px; bottom: 8px; width: calc(100vw - 16px); max-width: 360px; }
}
/* partner's hidden cards sit just inside the table edge so they never cover the name box */
#game .hb { top: 8px; }
#game .p-top { top: calc(50% - var(--fh) / 2 + 2px); }
#game .hb { top: -8px; }
#game .p-top { top: calc(50% - var(--fh) / 2 - 14px); }
/* fixed-size name boxes: nothing shifts when a status line, the bank or the trump symbol appears */
#game .plate .pbox { height: 66px; justify-content: center; }
#game .plate .nm { height: 22px; line-height: 22px; }
#game .plate .tm { font-size: 20px; line-height: 1; }
@media (max-width: 700px) { #game .plate .pbox { height: 52px; } #game .plate .nm { height: 18px; line-height: 18px; } #game .plate .tm { font-size: 16px; } }
#game .tray { padding-top: 24px; }
#game .hand .card.sel { transform: translateY(-16px); }
@media (max-width: 700px) { #game .tray { padding-top: 18px; } #game .hand .card.sel { transform: translateY(-12px); } }

/* ===================== stage 5: no top bar, bigger avatars, bubbles, zvanja on the table ===================== */
#game { --hcw: clamp(30px, calc((100vw - 104px) / 8.3), 76px); --hgap: 6px; --tpad: 22px; }
/* menu floats top-left, score top-right */
#game .topbar { position: absolute; left: 8px; top: 8px; height: auto; padding: 0; background: none; border: 0; z-index: 30; }
#game .tb-info { display: none; }
#game .scorewrap { position: absolute; right: 10px; top: 8px; z-index: 25; display: flex; flex-direction: column; align-items: flex-end; }
#game .scorewrap .scorechip { position: static; }
#game .scoreinfo { font-size: 11px; color: var(--dim); margin-top: 3px; white-space: nowrap; }
#game .logbox { top: 48px; }
/* table anchored above the hand: the gap between my name box and the hand frame stays the same */
#game .area { --av: 110px; --pb: 62px; --twmax: 62px;
  --seat: calc(var(--av) + var(--pb) - 14px + 6px + 17px);
  --fh: clamp(140px, calc(100dvh - var(--hcw) * var(--cr) - 70px - 2 * var(--seat) - 24px), 290px);
  --cy: calc(100% - var(--fh) / 2 - var(--seat));
  /* played cards: the taller (1:1.6) cross must fit between the partner's hidden cards and the bottom edge */
  --tw: clamp(30px, calc((var(--fh) - 70px) / 3.35), var(--twmax)); }
#game .felt { top: var(--cy); }
#game .p-top { top: calc(var(--cy) - var(--fh) / 2 - 14px); }
#game .p-bot { top: calc(var(--cy) + var(--fh) / 2 + 6px); }
#game .p-left, #game .p-right { top: var(--cy); }
#game .area .banner, #game .area .actions { top: calc(var(--cy) + var(--fh) / 2 + 6px + var(--av) / 2); }
#game .area .banner { left: calc(50% + var(--av) / 2 + 22px); }
#game .area .actions { right: calc(50% + var(--av) / 2 + 22px); }
/* avatar circle and name box: same width */
#game .plate .av { width: var(--av); height: var(--av); font-size: calc(var(--av) * .3); }
#game .plate .pbox { width: var(--av); min-width: 0; height: var(--pb); margin-top: -14px; padding: 12px 6px 5px; box-sizing: border-box; }
#game .plate .nmt { max-width: calc(var(--av) - 30px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#game .plate .st, #game .plate .bank { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
/* hand: cards side by side in a frame that is always 8 cards wide */
#game .bottom { padding-bottom: calc(56px + env(safe-area-inset-bottom)); } /* everything sits ~40 px higher (less empty space at the top) */
#game .tray { box-sizing: border-box; width: calc(var(--hcw) * 8 + var(--hgap) * 7 + var(--tpad) * 2); padding: 22px var(--tpad) 12px; flex: none; }
#game .hand { height: calc(var(--hcw) * var(--cr) + 4px); justify-content: center; }
#game .hand .card { --w: var(--hcw); margin-left: var(--hgap); }
#game .hand .card:first-child { margin-left: 0; }
/* speech bubbles */
#game .bubbles { position: absolute; top: calc(var(--av) * .12); z-index: 9; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
#game .bubbles.b0, #game .bubbles.b1 { right: calc(100% + 12px); align-items: flex-end; }
#game .bubbles.b2, #game .bubbles.b3 { left: calc(100% + 12px); align-items: flex-start; }
#game .bubble { position: relative; background: #fbf8ef; color: #1b2a20; font-weight: 700; font-size: 15px; padding: 7px 13px; border-radius: 14px;
  white-space: nowrap; box-shadow: 0 4px 14px rgba(0, 0, 0, .45); }
#game .bubble.fx { animation: bubin .25s ease-out; }
@keyframes bubin { from { transform: scale(.5); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
#game .bubble::after { content: ''; position: absolute; top: 12px; border: 7px solid transparent; }
#game .b0 .bubble::after, #game .b1 .bubble::after { left: 100%; border-left-color: #fbf8ef; }
#game .b2 .bubble::after, #game .b3 .bubble::after { right: 100%; border-right-color: #fbf8ef; }
#game .bubble.none { color: #66706a; font-weight: 600; }
#game .bubble.belot { background: var(--gold); color: #1b1404; }
#game .b0 .bubble.belot::after, #game .b1 .bubble.belot::after { border-left-color: var(--gold); }
#game .b2 .bubble.belot::after, #game .b3 .bubble.belot::after { border-right-color: var(--gold); }
#game .bubble.sub { background: #fff1c9; font-size: 14px; }
#game .bubble.sub::after { display: none; }
/* winning zvanja on the table near each player */
#game .zseat { position: absolute; z-index: 6; display: flex; flex-direction: column; gap: 5px; }
#game .zseat.fx { animation: fadein .35s ease-out; }
#game .zseat.z0 { left: 50%; bottom: 8px; transform: translateX(-50%); align-items: center; }
#game .zseat.z2 { left: 50%; top: 10px; transform: translateX(-50%); align-items: center; }
#game .zseat.z3 { left: 70px; top: 50%; transform: translateY(-50%); align-items: flex-start; }
#game .zseat.z1 { right: 70px; top: 50%; transform: translateY(-50%); align-items: flex-end; }
#game .zgroup { display: flex; flex-direction: column; align-items: inherit; gap: 2px; }
#game .zgroup .lab { font-size: 12px; font-weight: 700; color: #ffe08a; background: rgba(6, 14, 9, .78); padding: 2px 9px; border-radius: 9px; white-space: nowrap; }
#game .zrow { display: flex; }
#game .zrow .card { --w: calc(var(--tw) * .62); }
#game .zrow .card + .card { margin-left: calc(var(--tw) * -.3); }
/* result of the round in the middle of the table */
#game .resultbox { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 8; text-align: center; min-width: 190px;
  background: rgba(6, 14, 9, .92); border: 1px solid var(--gold2); border-radius: 18px; padding: 10px 26px 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
#game .resultbox.fx { animation: fadein .3s ease-out; }
#game .resultbox .who { font-size: 13px; color: var(--dim); display: flex; align-items: center; justify-content: center; gap: 4px; }
#game .resultbox .who svg, #game .resultbox .who .suit { height: 16px; width: 16px; }
#game .resultbox .big { font-family: var(--serif); font-size: 34px; font-weight: 700; color: var(--gold); line-height: 1.15; }
#game .resultbox.fell .big { color: #ff7a6b; }
#game .resultbox .pts { font-size: 15px; white-space: nowrap; } #game .resultbox .us { color: var(--gold); font-weight: 700; }
/* card face sets and backs from the libraries */
.card.img { background: #fff; overflow: hidden; }
.card.img img { display: block !important; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; pointer-events: none; }
.card.imgback { background-size: cover !important; background-position: center !important; }
.backgrid { display: flex; flex-wrap: wrap; gap: 10px; }
.backpick { display: flex; flex-direction: column; align-items: center; gap: 4px; background: none; border: 2px solid transparent; border-radius: 10px; padding: 6px; color: inherit; cursor: pointer; font-size: 12px; }
.backpick.on { border-color: var(--gold); }
.backpick .card { --w: 44px; }
.chatdock { width: 260px; }
@media (max-height: 760px) { #game .area { --av: 84px; --pb: 58px; --twmax: 54px; } }
@media (max-width: 700px) {
  #game { --tpad: 10px; --hgap: 5px; }
  #game .area { --av: 60px; --pb: 50px; --twmax: 44px; --fw: calc(100vw - 140px); }
  #game .tray { padding: 16px var(--tpad) 8px; }
  #game .plate .pbox { padding: 10px 3px 4px; font-size: 10px; }
  #game .plate .nmt { max-width: calc(var(--av) - 8px); }
  #game .area .banner, #game .area .actions { left: 50%; right: auto; top: calc(var(--cy) + var(--fh) / 2 - 28px); transform: translate(-50%, -50%); }
  #game .bubble { font-size: 12px; padding: 5px 9px; }
  #game .bubble.sub { font-size: 11.5px; }
  #game .zseat.z3 { left: 22px; } #game .zseat.z1 { right: 22px; }
  #game .zgroup .lab { font-size: 10px; }
  #game .zrow .card { --w: 24px; } #game .zrow .card + .card { margin-left: -13px; }
  #game .resultbox { min-width: 0; padding: 8px 16px; } #game .resultbox .big { font-size: 26px; }
  #game .scorechip .col { min-width: 54px; }
  #game .scoreinfo { font-size: 10px; }
}
#game .plate:has(.bubbles) { z-index: 20; }
#game .plate .nm { max-width: 100%; overflow: hidden; }
#game .plate .nmt { max-width: none; min-width: 0; flex: 0 1 auto; }
#game .trumpbadge { z-index: 1; }
@media (max-width: 700px) {
  #game .felt.zshow .vb, #game .felt.zshow .trumpbadge { display: none; }
  #game .zseat.z3 { left: 12px; } #game .zseat.z1 { right: 12px; }
  #game .zseat.z3, #game .zseat.z1 { max-width: calc(50% - 16px); }
  #game .zgroup .lab { white-space: normal; text-align: center; line-height: 1.2; }
  .chatdock.min { bottom: auto; top: 52px; left: 8px; }
}
#game .bubble.call { display: flex; align-items: center; gap: 6px; }
#game .bubble.call .sg { font-size: 20px; line-height: 1; }
#game .bubble.call .sg svg { width: 20px; height: 20px; }

/* ===================== store (preview) ===================== */
#game .tb-btns .iconbtn.shopbtn, .iconbtn.shopbtn { width: auto; padding: 0 10px; color: var(--gold); border-color: var(--gold2); font-weight: 700; font-size: 13px; }
.sheet.shop { width: min(860px, 100%); padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.shead { display: flex; align-items: center; gap: 12px; padding: 16px 18px 10px; }
.shead h2 { margin: 0; font-family: var(--serif); color: var(--gold); font-size: 26px; }
.gems { margin-left: auto; background: #0d1c13; border: 1px solid var(--line); border-radius: 20px; padding: 5px 12px; font-weight: 700; }
.sx { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: #0d1c13; color: var(--dim); }
.stabs { display: flex; gap: 6px; padding: 0 18px 12px; border-bottom: 1px solid var(--line); }
.stab { padding: 8px 16px; border-radius: 20px; border: 1px solid var(--line); background: none; color: var(--dim); font-weight: 600; font-size: 14px; }
.stab.on { background: var(--gold); color: #20180a; border-color: var(--gold); }
.sgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; padding: 14px 18px 18px; overflow: auto; }
.sitem { position: relative; background: #0f2016; border: 1px solid var(--line); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.sitem.sel { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(232, 200, 114, .35); }
.sprev { position: relative; height: 130px; border-radius: 10px; background: radial-gradient(#22764c, #0f3d29); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.sprev .fan { position: relative; width: 120px; height: 104px; }
.sprev .fan .card { --w: 56px; position: absolute; bottom: 0; left: 50%; transform-origin: 50% 100%; }
.sprev .fan .card:nth-child(1) { transform: translateX(-50%) rotate(-16deg) translateX(-14px); }
.sprev .fan .card:nth-child(2) { transform: translateX(-50%); }
.sprev .fan .card:nth-child(3) { transform: translateX(-50%) rotate(16deg) translateX(14px); }
.sprev .shopback { --w: 64px; border: 3px solid #fbf8f0; }
.sprev img.av { width: 84px; height: 84px; border-radius: 50%; border: 3px solid #33553f; }
.slock { position: absolute; inset: 0; background: rgba(5, 12, 8, .45); display: grid; place-items: center; font-size: 30px; }
.stag { position: absolute; top: 8px; left: 8px; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 10px; background: #c8352f; color: #fff; }
.snm { font-weight: 700; font-size: 14px; margin-top: 2px; }
.ssub { font-size: 12px; color: var(--dim); margin-top: -4px; min-height: 14px; }
.sbtn { border-radius: 10px; padding: 8px 10px; font-weight: 700; font-size: 13px; text-align: center; border: 1px solid var(--line); background: #1f3a2b; margin-top: 2px; }
.sbtn.buy { background: linear-gradient(#f0d487, var(--gold2)); color: #20180a; border-color: #f4dc98; }
.sbtn.own { color: var(--ok); background: none; }
.sbtn.lock { color: var(--dim); background: #111e16; }
.sfoot { padding: 10px 18px 14px; border-top: 1px solid var(--line); font-size: 12px; }
@media (max-width: 600px) {
  #modal:has(.sheet.shop) { align-items: flex-end; padding: 0; }
  .sheet.shop { border-radius: 18px 18px 0 0; max-height: 88dvh; }
  .shead h2 { font-size: 22px; }
  .stab { padding: 7px 11px; font-size: 13px; }
  .sgrid { grid-template-columns: 1fr 1fr; gap: 9px; padding: 12px; }
  .sgrid.avg { grid-template-columns: 1fr 1fr 1fr; }
  .sgrid.avg .sprev { height: 78px; } .sgrid.avg img.av { width: 60px; height: 60px; }
  .sgrid.avg .sitem { padding: 7px; } .sgrid.avg .sbtn { padding: 6px 4px; font-size: 12px; }
  .sprev { height: 110px; } .sprev .fan { transform: scale(.85); }
  .sfoot { display: none; }
  #game .shopbtn .lbl { display: none; }
}
#game .trick { top: calc(50% + 19px); }
#game .trick .s0 { top: calc(var(--tw) * .06); }
#game .trick .s2 { top: calc(var(--tw) * -1.66); }
#game .trick .s1, #game .trick .s3 { top: calc(var(--tw) * -.8); }
#game .trick { top: calc(50% + 22px); }
#game .tb-btns .iconbtn.shopbtn { display: flex; align-items: center; gap: 4px; }

/* ===================== stage 6 ===================== */
/* one menu top-left on every page */
.floatmenu { position: fixed; left: 8px; top: 8px; z-index: 30; }
.floatmenu .tb-btns .iconbtn, #game .tb-btns .iconbtn { width: 30px; height: 30px; font-size: 14px; border-radius: 8px; }
.floatmenu .tb-btns .iconbtn.shopbtn, #game .tb-btns .iconbtn.shopbtn { width: auto; display: flex; align-items: center; gap: 4px; padding: 0 10px; font-size: 13px; }
.floatmenu .tb-btns { gap: 6px; }
#home, #lobby { padding-top: 34px; }
@media (max-width: 600px) { .floatmenu .shopbtn .lbl { display: none; } }
/* Postavke: styles of the chosen main type */
.stylerow { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin: 10px 0 4px; }
.stylepick { display: flex; flex-direction: column; align-items: center; gap: 4px; background: none; border: 2px solid transparent; border-radius: 10px; padding: 6px; color: inherit; font-size: 12px; }
.stylepick.on { border-color: var(--gold); }
.stylepick .card { --w: 44px; }
.shead2 { grid-column: 1 / -1; font-family: var(--serif); color: var(--gold); font-size: 17px; margin: 4px 0 -4px; }
/* thinner name boxes: name + one line (status and time bank) */
#game .area { --pb: 46px; }
#game .plate .pbox { padding: 12px 5px 3px; justify-content: center; }
#game .plate .nm { height: 18px; line-height: 18px; }
#game .plate .pline { display: flex; justify-content: center; gap: 6px; font-size: 11px; line-height: 13px; min-height: 13px; max-width: 100%; overflow: hidden; white-space: nowrap; }
#game .plate .pline .st, #game .plate .pline .bank { display: inline; min-height: 0; overflow: hidden; text-overflow: ellipsis; }
#game .plate .pline .bank { flex: none; }
@media (max-height: 760px) { #game .area { --pb: 44px; } }
@media (max-width: 700px) { #game .area { --pb: 42px; } #game .plate .pbox { padding: 10px 3px 2px; } #game .plate .pline { font-size: 10px; gap: 3px; } }
/* bigger played cards; the cross fits between the partner's hidden cards and the bottom edge */
#game .area { --twmax: 64px; --tw: clamp(48px, calc((var(--fh) - 46px) / 3.35), var(--twmax)); }
@media (max-height: 760px) { #game .area { --twmax: 60px; } }
@media (max-width: 700px) { #game .area { --twmax: 50px; }
  #game .trick .s3 { left: calc(var(--tw) * -1.58); } #game .trick .s1 { left: calc(var(--tw) * .58); } }
#game .hb { top: -16px; }
#game .trick { top: calc(50% + 9px); }
/* hand cards centred top-to-bottom in the fixed frame */
#game .tray { padding-top: 17px; padding-bottom: 17px; }
@media (max-width: 700px) { #game .tray { padding-top: 12px; padding-bottom: 12px; } }

/* ===================== v0.9: rooms ===================== */
.roomname, .roomname-input { font-family: var(--serif); font-size: 24px; font-weight: 700; color: var(--ink); margin-bottom: 2px; }
.roomname-input { background: transparent; border: 1px dashed transparent; border-radius: 8px; padding: 2px 6px; margin-left: -7px; width: min(340px, 70vw); }
.roomname-input:hover { border-color: var(--line); }
.roomname-input:focus { outline: none; border-color: var(--gold2); background: rgba(0, 0, 0, .2); }
.room-item.locked b { color: var(--dim); }
.seat-slot .kick { color: #ff8a7d; }
.version { text-align: center; font-size: 11px; margin: 14px 0 4px; opacity: .7; }
.room-item b { letter-spacing: normal; font-family: var(--sans); }
/* v1.0: chat switched off by the host */
.chatoff { padding: 8px 10px; font-size: 13px; text-align: center; }
.chathost { font-size: 12px; padding: 2px 8px 8px; align-self: center; }

/* =====================================================================================
   v1.1 — BELOT ARENA look: dark polished wood, champagne-gold trim, gold title, metal / gold buttons, felt
   ===================================================================================== */
@font-face { font-family: 'Lora Arena'; src: url('fonts/Lora.woff') format('woff'); font-weight: 400 700; font-display: swap; }
:root {
  --serif: 'Lora Arena', Georgia, 'Times New Roman', serif;
  --sans: 'Lora Arena', Georgia, serif;
  --cream: #f3e6c4; --trim: #c4a078; --trim-dark: #2a140a;
  --wood-a: #4a2818; --wood-b: #3c2013; --wood-c: #30180d;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='800' height='160'%3E%3Cfilter id='w'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.0025 0.32' numOctaves='4' seed='11' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.20  0 0 0 0 0.09  0 0 0 0 0.05  0 0 0 0.9 -0.28'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23w)'/%3E%3C/svg%3E");
  --sheen: linear-gradient(180deg, rgba(255,210,170,.10), rgba(255,210,170,0) 35%, rgba(0,0,0,.10));
  --felt-noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' seed='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.10 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --ink: var(--cream);
}
body { font-family: var(--sans); background: var(--felt-noise), radial-gradient(ellipse at 50% 35%, #1f6a44, #0f3d27 60%, #08241a); background-attachment: fixed; }
/* --- wood surfaces (shared recipe) */
.woodbar, .card-panel h2, .lobby-wrap .card-panel h2, #game .tb-btns .iconbtn, .floatmenu .iconbtn, #game .plate .pbox, .scorechip > div, .trumpbadge, .chatdock .chathead, .sheet h2 {
  background-image: var(--grain), var(--sheen), linear-gradient(var(--wood-a), var(--wood-b) 50%, var(--wood-c));
  background-size: 800px 100%, 100% 100%, auto;
}
/* --- top wooden bar with the menu (front page + lobby) */
.floatmenu.woodbar { position: fixed; left: 0; right: 0; top: 0; height: 52px; padding: 0 12px; display: flex; align-items: center; z-index: 30;
  box-shadow: 0 3px 0 var(--trim-dark), 0 8px 18px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,220,170,.2); }
#home, #lobby { padding-top: 58px; }
.floatmenu .iconbtn, #game .tb-btns .iconbtn { color: var(--cream); border: 1px solid var(--trim) !important; border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(255,230,180,.3), inset 0 -2px 3px rgba(0,0,0,.5), 0 2px 3px rgba(0,0,0,.45); }
.floatmenu .iconbtn:hover, #game .tb-btns .iconbtn:hover { filter: brightness(1.15); }
/* --- faded court cards behind the front page */
.bgcards { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.bgcards img { position: absolute; width: 300px; border-radius: 18px; opacity: .085; filter: grayscale(1) sepia(.5) hue-rotate(70deg) brightness(1.2); }
.bgcards .bg1 { left: -70px; top: 150px; transform: rotate(-14deg); }
.bgcards .bg2 { right: -80px; top: 300px; transform: rotate(12deg); }
.home-wrap { position: relative; z-index: 1; max-width: 1080px; }
/* --- title */
.brand { padding-top: 10px; }
.brand .title { display: inline-flex; align-items: center; gap: 18px; }
.brand .gem { width: clamp(34px, 5.5vw, 58px); height: clamp(34px, 5.5vw, 58px); display: inline-block; filter: drop-shadow(0 4px 5px rgba(0,0,0,.55)); }
.brand .gem svg { width: 100%; height: 100%; display: block; }
.brand h1.arena-title { display: inline-flex; flex-direction: column; align-items: center; margin: 0 clamp(8px, 2vw, 26px); font-family: var(--serif); color: inherit; }
.brand .word { font-size: clamp(54px, 9vw, 104px); font-weight: 700; line-height: 1; letter-spacing: .01em;
  background: linear-gradient(180deg, #fff6cf 0%, #f2d27a 30%, #c8922f 52%, #f6dc8c 70%, #9a6418 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 0 #5b380c) drop-shadow(0 4px 0 #3a2306) drop-shadow(0 10px 14px rgba(0,0,0,.6)); }
.brand .arena { display: flex; align-items: center; gap: 14px; margin-top: 4px; font-size: clamp(17px, 2.6vw, 30px); font-weight: 700; letter-spacing: .55em; padding-left: .55em;
  background: linear-gradient(180deg, #fff3c4, #e2b453 50%, #a26a1c); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 0 #3a2306) drop-shadow(0 4px 6px rgba(0,0,0,.6)); }
.brand .arena i { display: block; width: clamp(26px, 6vw, 80px); height: 2px; background: linear-gradient(90deg, transparent, #e2b453, transparent); }
.brand .minisuits { display: flex; gap: 22px; justify-content: center; margin: 12px 0 0; color: #e8c46a; }
.brand .msym svg { width: 20px; height: 20px; display: block; filter: drop-shadow(0 1px 1px rgba(0,0,0,.7)); }
/* --- panels: felt inside a dark wooden frame with a champagne-gold line */
.card-panel { position: relative; border-radius: 12px; border: 2px solid var(--trim); padding: 18px; margin: 12px;
  background: var(--felt-noise), radial-gradient(ellipse at 50% 0%, #1d5d3c, #0f3b26 70%);
  box-shadow: inset 0 0 30px rgba(0,0,0,.5), 0 0 0 3px #3a1d10, 0 0 0 11px var(--wood-b), 0 0 0 13px var(--trim), 0 0 0 14px var(--trim-dark), 0 16px 34px 14px rgba(0,0,0,.45); }
.card-panel h2 { margin: -18px -18px 6px; padding: 12px 18px; border-radius: 10px 10px 0 0; border-bottom: 2px solid var(--trim); font-family: var(--serif); font-size: 24px; color: var(--cream); text-shadow: 0 2px 2px rgba(0,0,0,.7); }
.home-grid { gap: 30px; }
/* --- metal plate inputs */
.input { color: #3e3424; font-family: var(--serif); font-size: 18px; border: 2px solid var(--trim); border-radius: 10px;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,.07) 0 1px, rgba(0,0,0,.03) 1px 3px), linear-gradient(180deg, #e9e3d3, #bdb39c 45%, #d9d0b9 60%, #a99d82);
  box-shadow: inset 0 2px 4px rgba(0,0,0,.45), inset 0 -1px 0 rgba(255,255,255,.4), 0 2px 3px rgba(0,0,0,.5); }
.input::placeholder { color: #6e624c; }
.input:focus { border-color: #f2d27a; }
.code-input { text-align: center; letter-spacing: .3em; font-weight: 700; }
/* --- buttons */
.btn { font-family: var(--serif); font-weight: 700; font-size: 17px; color: var(--cream); border: 2px solid #d9ad55; border-radius: 12px; text-shadow: 0 2px 2px #000;
  background: linear-gradient(180deg, #2a6f49, #154a2f 55%, #0f3a24);
  box-shadow: 0 0 0 1px #4b2d0c, inset 0 1px 0 rgba(255,255,255,.25), inset 0 -3px 5px rgba(0,0,0,.45), 0 5px 9px rgba(0,0,0,.45); }
.btn:hover:not(:disabled) { background: linear-gradient(180deg, #318055, #185436 55%, #11402a); }
.btn.ghost { background: linear-gradient(180deg, #2a6f49, #154a2f 55%, #0f3a24); }
.btn.primary { color: #3a2304; text-shadow: 0 1px 0 rgba(255,240,190,.7); border-color: #ffe7a1;
  background: linear-gradient(180deg, #fff2bf 0%, #f3cd68 35%, #d29b33 55%, #b67b1f 75%, #e5b85a 100%);
  box-shadow: 0 0 0 1px #7a4f12, inset 0 2px 0 rgba(255,255,255,.7), inset 0 -3px 4px rgba(90,50,5,.5), 0 5px 9px rgba(0,0,0,.5); }
.btn.primary:hover:not(:disabled) { background: linear-gradient(180deg, #fff6d0 0%, #f6d57a 35%, #daa53e 55%, #bf8426 75%, #ecc26a 100%); }
.btn.silver { color: #262a2e; text-shadow: 0 1px 0 rgba(255,255,255,.8); border-color: #fafafa;
  background: linear-gradient(180deg, #ffffff 0%, #e1e4e8 35%, #b7bcc3 55%, #9aa0a8 75%, #d8dbdf 100%);
  box-shadow: 0 0 0 1px #5d6268, inset 0 2px 0 rgba(255,255,255,.9), inset 0 -3px 4px rgba(40,45,50,.45), 0 5px 9px rgba(0,0,0,.5); }
.btn.silver:hover:not(:disabled) { background: linear-gradient(180deg, #ffffff 0%, #eceef1 35%, #c3c8ce 55%, #a7adb4 75%, #e2e4e7 100%); }
.btn.glass { width: 100%; color: #f1f4f0; border-color: #dfe5e2; border-radius: 26px;
  background: linear-gradient(180deg, #8fb7a1 0%, #4f8a6a 40%, #2f6a4c 60%, #4c8466 100%);
  box-shadow: 0 0 0 1px #556660, inset 0 2px 0 rgba(255,255,255,.55), inset 0 -3px 5px rgba(0,0,0,.35), 0 5px 9px rgba(0,0,0,.45); }
.btn.small { font-size: 14px; }
.btn.botsbtn { position: relative; padding-left: 70px; overflow: visible; }
.btn.botsbtn .robot { position: absolute; left: 10px; bottom: -6px; width: 52px; height: 52px; border-radius: 50%; filter: drop-shadow(0 4px 4px rgba(0,0,0,.6)); }
.version { color: #e8d6a5; }
/* --- lobby */
.codebox { color: #f2d27a; text-shadow: 0 2px 3px rgba(0,0,0,.7); }
.seat-slot { border-color: rgba(196,160,120,.45); }
.seat-slot.filled { background: rgba(10,24,16,.6); border-color: rgba(196,160,120,.7); }
.seat-slot.me { border-color: #f2d27a; }
.roomname, .roomname-input { color: var(--cream); }
/* --- modals: felt sheet in a wooden frame */
.sheet { border: 2px solid var(--trim); background: var(--felt-noise), linear-gradient(#174a31, #0e3322);
  box-shadow: 0 0 0 3px #3a1d10, 0 0 0 10px var(--wood-b), 0 0 0 12px var(--trim), 0 20px 60px rgba(0,0,0,.7); }
.sheet h2 { margin: -20px -20px 14px; padding: 14px 20px; border-bottom: 2px solid var(--trim); border-radius: 16px 16px 0 0; color: #f2d27a; text-shadow: 0 2px 2px rgba(0,0,0,.7); }
.sheet.shop .shead h2 { margin: 0; padding: 0; background: none; border: 0; }
.styleopt { border-color: rgba(196,160,120,.45); }
.styleopt.on { border-color: #f2d27a; background: rgba(10,24,16,.6); }
/* --- game table: wood rim with a gold line */
#game .felt { border: 0; background: var(--felt-noise), radial-gradient(ellipse at 50% 45%, #237a4e, #145234 60%, #0d3a25);
  box-shadow: 0 0 0 9px var(--wood-b), 0 0 0 11px var(--trim), 0 0 0 12px var(--trim-dark), inset 0 0 50px rgba(0,0,0,.45), 0 14px 36px rgba(0,0,0,.6); }
#game .plate .pbox { border: 1px solid var(--trim); box-shadow: inset 0 1px 0 rgba(255,220,170,.2), 0 4px 10px rgba(0,0,0,.5); }
#game .plate.turn .pbox { border-color: #f2d27a; }
.scorechip { border: 1px solid var(--trim); box-shadow: 0 4px 12px rgba(0,0,0,.5); }
.scorechip > div + div { border-left-color: rgba(196,160,120,.5); }
.scorechip small { color: #d8c59b; }
#game .tray { border-color: var(--trim) !important; }
/* ADUT box: same size as before, wood + champagne-gold trim, gold letters */
#game .felt .trumpbadge { border: 1.5px solid var(--trim); border-radius: 12px; padding: 4px 10px 5px;
  box-shadow: inset 0 1px 0 rgba(255,220,170,.25), 0 6px 14px rgba(0,0,0,.55); }
.trumpbadge small { color: #e8c46a; font-weight: 700; letter-spacing: .16em; }
.trumpbadge .sym .sg.red { color: #ff7d73; } .trumpbadge .sym .sg.blk { color: var(--cream); }
.trumpbadge.mad .sym .sg, .trumpbadge.mad .sym .sg.red, .trumpbadge.mad .sym .sg.blk { color: #e8c46a; filter: drop-shadow(0 1px 1px rgba(0,0,0,.6)); }
/* chat dock + result box + toasts */
.chatdock { border: 1px solid var(--trim); background: rgba(9, 28, 18, .96); }
.chatdock .chathead { border-bottom: 1px solid var(--trim); border-radius: 13px 13px 0 0; color: var(--cream); }
#game .resultbox { border-color: var(--trim); background-image: var(--grain), var(--sheen), linear-gradient(var(--wood-a), var(--wood-c)); background-size: 800px 100%, 100% 100%, auto; }
.toast { border-color: var(--trim); background: rgba(20, 10, 5, .94); }
@media (max-width: 760px) {
  .home-grid { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .card-panel { margin: 12px 10px; }
  .brand .title { gap: 8px; }
  .brand .word { font-size: 52px; }
  .brand .gem { width: 30px; height: 30px; }
  .btn.silver { flex: 1 1 100%; }
  .btn { font-size: 16px; }
  .bgcards img { width: 220px; }
}
html { background: #08241a; }
#game .scorechip > div { background-image: var(--grain), var(--sheen), linear-gradient(var(--wood-a), var(--wood-b) 50%, var(--wood-c)); background-size: 800px 100%, 100% 100%, auto; }
@media (max-width: 760px) { .home-wrap .row { flex-wrap: wrap; } .home-wrap .row .btn.silver { flex: 1 1 100%; } }
#game .scorechip { border: 1px solid var(--trim); background-image: var(--grain), var(--sheen), linear-gradient(var(--wood-a), var(--wood-b) 50%, var(--wood-c)); background-size: 800px 100%, 100% 100%, auto; box-shadow: inset 0 1px 0 rgba(255,220,170,.2), 0 6px 14px rgba(0,0,0,.55); }
#game .scorechip .col + .col { border-left-color: rgba(196,160,120,.55); }
#game .scorechip small { color: #d8c59b; }
#game .scorechip .note, #game .scorechip .total { display: block; height: 14px; line-height: 14px; min-height: 0; }
#game .scorechip .round { height: 32px; line-height: 32px; }
#game .scorechip small { height: 12px; line-height: 12px; }

/* =====================================================================================
   v1.2 — the game fills the screen: everything scales with --k (set by fitGame() in app.js; 1 = laptop design)
   ===================================================================================== */
#game.fit { --k: 1;
  --hcw: min(calc(76px * var(--k)), max(60px, calc((100vw - 660px) / 8)), calc((100vw - 104px) / 8.3)); }
#game.fit .area {
  --av: calc(110px * var(--k)); --pb: calc(46px * var(--k)); --twmax: calc(64px * var(--k));
  --fh: calc(254px * var(--k));
  --fw: min(calc(740px * var(--k)), calc(100vw - 2 * var(--av) - 90px));
  --tw: clamp(30px, calc((var(--fh) - 46px * var(--k)) / 3.35), var(--twmax)); }
#game.fit .bottom { padding-bottom: calc(var(--padb, 56px) + env(safe-area-inset-bottom)); }
#game.fit .plate .pbox { font-size: calc(13px * var(--k)); }
#game.fit .plate .nm { height: calc(18px * var(--k)); line-height: calc(18px * var(--k)); font-size: calc(14px * var(--k)); }
#game.fit .plate .pline { font-size: calc(11px * var(--k)); line-height: calc(13px * var(--k)); min-height: calc(13px * var(--k)); }
#game.fit .bubble { font-size: calc(15px * min(var(--k), 1.4)); }
#game.fit .area .banner { font-size: calc(16px * min(var(--k), 1.3)); }
#game.fit .felt .trumpbadge { transform: scale(min(var(--k), 1.5)); transform-origin: left bottom; }
#game.fit .felt .fnote { font-size: calc(20px * min(var(--k), 1.4)); }
@media (max-width: 700px) {
  #game.fit { --hcw: min(calc(76px * var(--k)), calc((100vw - 20px - 35px - 6px) / 8)); }
  #game.fit .area { --av: min(calc(60px * var(--k)), 19vw); --pb: min(calc(42px * var(--k)), 13vw); --twmax: min(calc(50px * var(--k)), calc((100vw - 2 * var(--av) - 20px) / 4.7));
    --fw: calc(100vw - 2 * var(--av) - 20px);
    --fh: min(calc(220px * var(--k)), calc((100vw - 2 * var(--av) - 20px) * 1.75)); }
  #game.fit .plate .pbox { font-size: min(calc(10px * var(--k)), 3.2vw); }
  #game.fit .plate .nm { font-size: min(calc(11px * var(--k)), 3.6vw); height: min(calc(18px * var(--k)), 5vw); line-height: min(calc(18px * var(--k)), 5vw); }
  #game.fit .plate .pline { font-size: min(calc(9px * var(--k)), 3vw); line-height: min(calc(13px * var(--k)), 4vw); min-height: 0; }
}
/* zvanja on the table: bigger cards, less overlap, bigger label */
#game .zrow .card { --w: calc(var(--tw) * .88); }
#game .zrow .card + .card { margin-left: calc(var(--tw) * -.34); }
#game .zgroup .lab { font-size: calc(14px * min(var(--k, 1), 1.4)); padding: 3px 11px; }
@media (max-width: 700px) { #game .zrow .card { --w: calc(var(--tw) * .7); } #game .zrow .card + .card { margin-left: calc(var(--tw) * -.36); } #game .zgroup .lab { font-size: 11px; } }
/* score box: the game total white and bigger */
#game .scorechip .total { color: #fff; font-size: 18px; font-weight: 700; height: 22px; line-height: 22px; text-shadow: 0 1px 2px rgba(0,0,0,.7); }
/* front page: Nova soba / Nova privatna soba / Osvježi in the green "Pridruži se" style */
.btn.grow { flex: 1; }
.btn.full { width: 100%; }
@media (max-width: 760px) { .home-wrap .row .btn.grow { flex: 1 1 100%; } }
@media (max-width: 700px) { #game.fit .area .banner { font-size: 14px; } }

/* =====================================================================================
   v1.3
   ===================================================================================== */
/* avatar circle = 70 % of the name box width */
#game .area { --avc: calc(var(--av) * .7); --seat: calc(var(--avc) + var(--pb) - 14px + 6px + 17px); }
#game .plate .av { width: var(--avc); height: var(--avc); font-size: calc(var(--avc) * .34); }
#game .plate .pbox { margin-top: calc(var(--avc) * -.14); }
#game .bubbles { top: calc(var(--avc) * .1); }
/* bigger cards on the table (~92 % of the hand cards): taller table, higher limit */
#game.fit .area { --fh: calc(285px * var(--k)); --twmax: calc(70px * var(--k));
  --tw: clamp(30px, calc((var(--fh) - 46px * var(--k)) / 3.35), var(--twmax)); }
/* message to the right of my avatar; when I have to act, the buttons sit under it */
#game.fit .area .banner { top: calc(var(--cy) + var(--fh) / 2 + 6px + var(--avc) / 2); left: calc(50% + var(--av) / 2 + 22px); }
#game.fit .area .actions { left: calc(50% + var(--av) / 2 + 22px); right: auto; transform: none; justify-content: flex-start;
  top: calc(var(--cy) + var(--fh) / 2 + 6px + var(--avc) / 2 + 4px); }
#game.fit .area:has(.actions:not(:empty)) .banner { transform: translateY(calc(-100% - 4px)); }
/* avatar frames */
.avf { position: relative; display: inline-block; line-height: 0; flex: none; }
.avf .frame { position: absolute; left: 50%; top: 50%; width: 118%; height: 118%; transform: translate(-50%, -50%); pointer-events: none; z-index: 3; }
#game .plate .avf { position: relative; z-index: 2; }
#game .plate .avf .av { z-index: auto; }
.slotname .avf { margin-right: 8px; }
.avgrid.frames .avpick { padding: 6px; }
/* speech bubbles: square corners */
#game .bubble { border-radius: 0; }
/* less rounded corners */
#game .plate .pbox, #game .scorechip, #game .felt .trumpbadge, #game .resultbox { border-radius: 4px; }
#game .tray { border-radius: 6px !important; }
/* taller chat box (computer) */
@media (min-width: 701px) { .chatdock:not(.min) { height: 300px; } }
/* front page: Igraj narrower, Sobe wider */
@media (min-width: 761px) { .home-grid { grid-template-columns: 2fr 3fr; } .home-wrap .row .btn.grow { flex: 1 1 100%; } }
/* phones: play sideways */
#rotate { display: none; }
body.rotate-now #rotate { display: flex; position: fixed; inset: 0; z-index: 200; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 30px;
  background: var(--felt-noise), radial-gradient(ellipse at 50% 35%, #1f6a44, #0f3d27 60%, #08241a); color: var(--cream); }
#rotate .rot-ph { font-size: 72px; animation: rotph 1.8s ease-in-out infinite; }
#rotate .rot-t { font-family: var(--serif); font-size: 28px; font-weight: 700; color: #f2d27a; }
#rotate .rot-d { font-size: 15px; opacity: .85; max-width: 280px; }
@keyframes rotph { 0%, 30% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }
/* landscape phones (short screens): chat as a small button, slimmer menu, compact score */
@media (max-height: 500px) and (orientation: landscape) {
  .chatdock { left: 8px; bottom: 8px; width: 260px; }
  .chatdock:not(.min) { height: min(260px, calc(100dvh - 60px)); }
  #game .tb-btns .iconbtn { width: 26px; height: 26px; font-size: 12px; }
  #game .scorechip .round { font-size: 20px; height: 24px; line-height: 24px; }
  #game .scorechip .total { font-size: 14px; height: 18px; line-height: 18px; }
  #game .scorechip small, #game .scorechip .note { display: none; }
  #game .scoreinfo { display: none; }
}
/* landscape phones: no avatar circles, slim name boxes, smaller hidden cards, actions on the table edge */
#game.fit.land .area { --avc: 0px; --pb: 30px; --av: calc(96px * min(var(--k) * 1.6, 1.2)); }
#game.fit.land .plate .av, #game.fit.land .plate .avf { display: none; }
#game.fit.land .plate .pbox { margin-top: 0; padding: 3px 6px; font-size: 11px; }
#game.fit.land .plate .nm { height: 14px; line-height: 14px; font-size: 12px; }
#game.fit.land .plate .pline { font-size: 10px; line-height: 11px; }
#game.fit.land .back { width: 18px; height: 26px; } #game.fit.land .hb .back + .back { margin-left: -12px; }
#game.fit.land .vb .back { width: 26px; height: 18px; } #game.fit.land .vb .back + .back { margin-top: -13px; }
#game.fit.land .hb { top: -8px; }
#game.fit.land .area .actions { left: 50%; transform: translate(-50%, -100%); top: calc(var(--cy) + var(--fh) / 2 - 4px); }
#game.fit.land .area:has(.actions:not(:empty)) .banner { transform: translateY(-50%); }
#game.fit.land .area .banner { top: calc(var(--cy) + var(--fh) / 2 + 6px + var(--pb) / 2); transform: translateY(-50%); font-size: 12px; padding: 3px 10px; }
#game.fit.land .bubbles { top: -6px; }
#game.fit.land .bubble { font-size: 12px; padding: 4px 8px; }
#game.fit.land .tray { padding-top: 8px !important; padding-bottom: 8px !important; }
#game.fit.land .felt .trumpbadge { transform: scale(.8); }
#game .plate .pbox { z-index: 4; }
@media (min-width: 761px) { .home-wrap .row:has(.btn.grow) { flex-wrap: wrap; } }
.home-wrap .card-panel > .row > .btn.primary:only-child { flex: 1; }

/* ---------- v1.4 */
/* no accidental text selection (double clicks, dragging); typing and chat stay selectable */
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input, textarea, select, .code-input, .roomname-input, .chatlog, .chatlog * { -webkit-user-select: text; user-select: text; }
#toasts.low { top: auto; bottom: 24px; }
/* room list badges */
.room-item .ri-main { min-width: 0; flex: 1; }
.room-item .ri-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.room-item .ri-top b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.rbadges { display: inline-flex; gap: 5px; flex-wrap: wrap; }
.rbadge { font-size: 11px; line-height: 1; padding: 4px 7px; border-radius: 4px; border: 1px solid rgba(196, 160, 120, .45); background: rgba(0, 0, 0, .28); color: #e9dcc8; white-space: nowrap; font-weight: 600; }
.rbadge.gold { color: #2a1207; border-color: #e7c066; background: linear-gradient(#f3d98f, #c4a078 55%, #9c7646); font-weight: 800; letter-spacing: .03em; }
@media (max-width: 560px) { .room-item .ri-top { flex-direction: column; align-items: flex-start; gap: 4px; } }

/* ---------- v1.5 */
/* cards: smaller rounded corners (5 % of the width instead of 10 %) */
.card { border-radius: calc(var(--w) * .05); }
.backs .card { border-radius: 2px; }
.bgcards img { border-radius: 10px; }
/* Nova igra = the one gold main button */
.home-wrap .btn.newgame { flex: 1; font-size: 18px; }
/* Nova igra window */
.ngform { display: grid; gap: 12px; margin: 4px 0 16px; }
.ngline { display: grid; gap: 6px; }
.nglabel { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); font-weight: 700; }
.ngnote { font-size: 12px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.segbtn { flex: 1 1 auto; min-width: 56px; padding: 8px 10px; border-radius: 4px; border: 1px solid rgba(196, 160, 120, .45); background: rgba(0, 0, 0, .28); color: #e9dcc8; font: inherit; font-weight: 600; cursor: pointer; }
.segbtn:hover { border-color: #e7c066; }
.segbtn.on { color: #2a1207; border-color: #ffe7a1; background: linear-gradient(#f3d98f, #c4a078 55%, #9c7646); font-weight: 800; }
/* room cards: name + badges on top, the two pairs below */
.rooms { max-height: none; }
.room-item.rcard { display: grid; gap: 8px; align-items: stretch; }
.rcard .ri-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.rpairs { display: flex; gap: 14px; }
.rpair { display: inline-flex; gap: 6px; padding-bottom: 5px; border-bottom: 2px solid var(--trim); }
.rpair + .rpair { border-bottom-color: #9c7646; }
.rseat { width: 38px; height: 38px; display: inline-grid; place-items: center; padding: 0; border: 0; background: none; border-radius: 50%; position: relative; }
.rseat .avf { width: 38px; height: 38px; }
.rseat .avf .av { width: 38px; height: 38px; font-size: 14px; }
button.rseat { cursor: pointer; }
.rseat.empty { border: 2px dashed rgba(196, 160, 120, .6); color: #e7c066; font-size: 20px; font-weight: 700; line-height: 1; }
button.rseat.empty:hover { border-style: solid; background: rgba(231, 192, 102, .15); transform: scale(1.06); }
button.rseat.bot:hover { transform: scale(1.06); filter: brightness(1.15); }
.rcard.playing .rseat.empty { opacity: .35; }
.rstatus { white-space: nowrap; font-size: 12px; font-weight: 800; padding: 4px 9px; border-radius: 4px; color: var(--dim); border: 1px solid var(--line); }
.rstatus.playing { color: #2a1207; background: #d9822b; border-color: #f0a75a; }
.room-item.locked b { color: inherit; }
@media (min-width: 1000px) { .rooms { grid-template-columns: 1fr 1fr; } }

/* ---------- v1.6 */
/* logo at 70 % */
.brand { padding-top: 0; }
.brand .title { gap: 13px; }
.brand .gem { width: clamp(24px, 3.9vw, 41px); height: clamp(24px, 3.9vw, 41px); }
.brand h1.arena-title { margin: 0 clamp(6px, 1.4vw, 18px); }
.brand .word { font-size: clamp(38px, 6.3vw, 73px); }
.brand .arena { font-size: clamp(12px, 1.8vw, 21px); gap: 10px; margin-top: 3px; }
.brand .arena i { width: clamp(18px, 4.2vw, 56px); }
.brand .minisuits { gap: 15px; margin-top: 8px; }
.brand .msym svg { width: 14px; height: 14px; }
@media (max-width: 760px) { .brand .word { font-size: 38px; } .brand .gem { width: 22px; height: 22px; } .brand .title { gap: 6px; } }
.home-wrap { gap: 10px; padding-top: 18px; }
/* Igraj on top (one row), Sobe under it — one column */
.home-grid, .home-wrap .home-grid { grid-template-columns: minmax(0, 1fr) !important; gap: 4px; }
.playpanel { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.playpanel > h2 { flex: 0 0 calc(100% + 36px); }
.playpanel > #name { flex: 1 1 180px; width: auto; }
.playpanel > .row { flex: 1 1 220px; margin: 0; }
.playpanel > .row:has(.code-input) { flex: 1.4 1 280px; }
.playpanel > .botsbtn { flex: 1.2 1 240px; margin: 0; }
.home-wrap .rooms { grid-template-columns: 1fr; }
@media (min-width: 700px) { .home-wrap .rooms { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1200px) { .home-wrap { max-width: 1240px; } .home-wrap .rooms { grid-template-columns: 1fr 1fr 1fr; } }

/* ---------- v1.61 */
/* room list: 2 cards per row on computers (also big screens), 1 on phones */
@media (min-width: 700px) { .home-wrap .rooms { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1200px) { .home-wrap .rooms { grid-template-columns: 1fr 1fr; } }
.rcard .ri-bottom { width: 100%; }
/* search + filter chips */
.rfilter { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.rfilter .rsearch { flex: 1 1 220px; width: auto; min-width: 0; padding-top: 8px; padding-bottom: 8px; }
.rchips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rchip { padding: 7px 12px; border-radius: 4px; border: 1px solid rgba(196, 160, 120, .45); background: rgba(0, 0, 0, .28); color: #e9dcc8; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.rchip:hover { border-color: #e7c066; }
.rchip.on { color: #2a1207; border-color: #ffe7a1; background: linear-gradient(#f3d98f, #c4a078 55%, #9c7646); }
.rsep { width: 1px; height: 22px; background: rgba(196, 160, 120, .45); margin: 0 4px; }
/* thinner wooden frames on the boxes and windows (about half) */
.card-panel { margin: 7px; box-shadow: inset 0 0 30px rgba(0,0,0,.5), 0 0 0 2px #3a1d10, 0 0 0 6px var(--wood-b), 0 0 0 7px var(--trim), 0 0 0 8px var(--trim-dark), 0 14px 30px 8px rgba(0,0,0,.45); }
.sheet { box-shadow: 0 0 0 2px #3a1d10, 0 0 0 5px var(--wood-b), 0 0 0 6px var(--trim), 0 20px 60px rgba(0,0,0,.7); }
.home-grid, .home-wrap .home-grid { gap: 14px; }
.rcard .ri-bottom > :last-child { margin-left: auto; }
.room-item.rcard { grid-template-columns: minmax(0, 1fr); }

/* ---------- v1.62 */
/* lobby: seats on the left, Postavke + Pokreni igru on the right */
.lobby-wrap { max-width: 1100px; }
.lobby-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.lobby-cols .lcol, .lobby-cols .rcol { display: grid; gap: 14px; align-content: start; }
.lobby-cols .teams { grid-template-columns: 1fr; }
.lobby-cols .rcol .card-panel { margin: 7px 7px 4px; }
.lobby-cols .rcol .opts { grid-template-columns: 1fr 1fr; }
.lobby-cols .rcol > .row .btn.primary { flex: 1; }
@media (max-width: 860px) { .lobby-cols { grid-template-columns: minmax(0, 1fr); } }

/* (v1.63: only Mađarice keep the white edge — see the v1.63 block) */
/* keep the selection / win glow on top of the new outline */
.hand .card.sel { box-shadow: 0 0 0 3px var(--gold), 0 6px 14px rgba(0, 0, 0, .5); }
#game .trick .card.win { box-shadow: 0 0 0 3px var(--gold), 0 0 24px var(--gold); }
/* all cards ~6 % bigger (the game still fits the screen: fitGame() picks the scale) */
#game.fit { --hcw: min(calc(80.5px * var(--k)), max(64px, calc((100vw - 660px) / 8)), calc((100vw - 104px) / 8.3)); }
#game.fit .area { --fh: calc(300px * var(--k)); --twmax: calc(74px * var(--k));
  --tw: clamp(30px, calc((var(--fh) - 46px * var(--k)) / 3.35), var(--twmax)); }
@media (max-width: 700px) { #game.fit { --hcw: min(calc(80.5px * var(--k)), calc((100vw - 20px - 35px - 6px) / 8)); } }
/* throwing is done by animateTable() (Web Animations), not the old pop */
#game .trick .card.new { animation: none; }
#game .trick.ghost { z-index: 5; pointer-events: none; }

/* ---------- v1.63 */
/* thinner wooden title bars (~36 px) on all boxes and windows */
.card-panel h2, .lobby-wrap .card-panel h2 { padding: 6px 18px; font-size: 19px; margin-bottom: 4px; }
.sheet h2 { padding: 7px 20px; font-size: 19px; margin-bottom: 12px; }
/* only Mađarice: thin white edge, the whole picture inside, fine dark outline (Klasične / Poker as before v1.62) */
.card.madf { background: #fbfaf6; box-shadow: 0 2px 6px rgba(0, 0, 0, .45), inset 0 0 0 1px rgba(0, 0, 0, .15); padding: calc(var(--w) * .04); box-sizing: border-box; }
.card.madf img { object-fit: fill !important; border-radius: calc(var(--w) * .025) !important; }
.hand .card.madf.sel { box-shadow: 0 0 0 3px var(--gold), 0 6px 14px rgba(0, 0, 0, .5); }
.hand.myturn .card.madf.ok { box-shadow: 0 3px 8px rgba(0, 0, 0, .5), 0 0 0 2px var(--gold); }
#game .trick .card.madf.win { box-shadow: 0 0 0 3px var(--gold), 0 0 24px var(--gold); }
/* lobby ready check */
.rdy { font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 4px; color: #b9b2a4; border: 1px solid rgba(255,255,255,.18); margin-left: 6px; }
.rdy.on { color: #0f2a17; background: #7fd492; border-color: #a9ecb7; }
.btn.readybtn { flex: 1; font-size: 18px; }
.btn.readybtn.on { background: linear-gradient(#3f9a5a, #23703c); border-color: #a9ecb7; }
.btn.primary:disabled { filter: grayscale(.75) brightness(.8); cursor: not-allowed; }
.readynote { font-size: 13px; text-align: center; min-height: 16px; }
.iconbtn.fsbtn.on { border-color: #f2d27a; }
