:root {
  --felt: #1d5c3a; --felt2: #14432b; --gold: #e5c77a; --cream: #fbf5e6; --ink: #1f1a14; --red: #b8322a;
  --cw: min(28vw, 15.5vh, 130px); --ch: calc(var(--cw) * 1.6);
  --sw: min(12vw, 7vh, 60px);
  /* stol je uvijek taman: kažemo to pregledniku da ga u tamnom načinu
     ne "posvjetljava" ni ne invertira sam (Chrome/Samsung auto dark) */
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overscroll-behavior: none; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--cream);
  background: radial-gradient(ellipse at 50% 40%, #2a7a4d 0%, var(--felt) 45%, var(--felt2) 100%);
  user-select: none; -webkit-user-select: none;
}
#app { height: 100%; display: flex; flex-direction: column; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
button { font: inherit; cursor: pointer; border: 0; border-radius: 12px; padding: 12px 16px; background: var(--gold); color: #3a2a08; font-weight: 700; transition: transform .1s, filter .1s; }
button:active { transform: scale(.97); }
button:disabled { opacity: .45; cursor: default; }
button.ghost { background: rgba(255,255,255,.12); color: var(--cream); font-weight: 600; }
button.small { padding: 7px 11px; font-size: 14px; border-radius: 9px; }
input, select, textarea { font: inherit; padding: 11px 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,.25); background: rgba(0,0,0,.25); color: var(--cream); width: 100%; }
select option { color: #000; }
h1 { font-family: Georgia, serif; font-size: 44px; margin: 8px 0 0; letter-spacing: 1px; color: var(--gold); text-shadow: 0 2px 0 rgba(0,0,0,.35); }
h2 { font-size: 17px; margin: 0 0 10px; color: var(--gold); }
.muted { opacity: .7; font-size: 14px; }

/* ---------- izbornik ---------- */
.menu {
  /* cijela širina je područje za pomicanje (traka uz rub prozora, ne uz panele),
     a sadržaj je centriran u stupcu od 480 px */
  width: 100%; padding: 14px max(16px, calc((100% - 480px) / 2)) 30px;
  overflow-y: auto; flex: 1; min-height: 0;
  scrollbar-width: thin; scrollbar-color: rgba(229,199,122,.35) transparent;
}
.menu::-webkit-scrollbar { width: 8px; }
.menu::-webkit-scrollbar-track { background: transparent; }
.menu::-webkit-scrollbar-thumb { background: rgba(229,199,122,.35); border-radius: 8px; }
.logo { text-align: center; margin-bottom: 14px; }
.logo .fan { display: flex; justify-content: center; height: 92px; margin-top: 6px; }
.logo .fan > div { width: 58px; margin: 0 -10px; transform-origin: 50% 110%; filter: drop-shadow(0 3px 4px rgba(0,0,0,.35)); }
.panel { background: rgba(0,0,0,.22); border: 1px solid rgba(255,255,255,.08); border-radius: 16px; padding: 14px; margin-bottom: 14px; }
.row { display: flex; gap: 8px; align-items: center; }
.row > * { flex: 1; }
.seg { display: flex; background: rgba(0,0,0,.25); border-radius: 11px; padding: 3px; gap: 3px; margin-bottom: 10px; }
.seg button { flex: 1; background: transparent; color: var(--cream); padding: 9px 4px; font-weight: 600; font-size: 14px; border-radius: 9px; }
.seg button.on { background: var(--gold); color: #3a2a08; }
.stack > * + * { margin-top: 8px; }
.desk-only { display: none; }
.links { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
label.chk { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
label.chk input { width: 20px; height: 20px; }

/* ---------- predvorje ---------- */
.code { font-family: ui-monospace, Menlo, monospace; font-size: 40px; letter-spacing: 6px; text-align: center; color: var(--gold); margin: 4px 0 8px; }
.seats { list-style: none; padding: 0; margin: 0 0 12px; }
.seats li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: rgba(0,0,0,.2); border-radius: 10px; margin-bottom: 6px; }
.seats li .n { flex: 1; }
.tag { font-size: 12px; padding: 2px 7px; border-radius: 6px; background: rgba(255,255,255,.15); }
.tag.team0 { background: #2a5596; } .tag.team1 { background: #b8322a; }

/* ---------- stol ---------- */
.topbar { display: flex; align-items: center; gap: 6px; padding: 6px 8px; font-size: 14px; }
.topbar .mid { flex: 1; text-align: center; opacity: .95; font-weight: 600; }
.table { position: relative; flex: 1; min-height: 0; }
.card { width: var(--cw); height: var(--ch); position: relative; border-radius: 9%/6%; filter: drop-shadow(0 2px 3px rgba(0,0,0,.35)); }
.card svg, .card img { width: 100%; height: 100%; display: block; }
.card-img { pointer-events: none; -webkit-user-drag: none; -webkit-touch-callout: none; }
.logo .fan img { width: 100%; display: block; }
.card.sm { width: var(--sw); height: calc(var(--sw) * 1.6); }

.seat { position: absolute; display: flex; flex-direction: column; align-items: center; gap: 4px; z-index: 3; }
.seat.top { top: 4px; left: 50%; transform: translateX(-50%); }
.seat.left { left: 6px; top: 30%; transform: translateY(-50%); }
.seat.right { right: 6px; top: 30%; transform: translateY(-50%); }
.seat .backs { display: flex; }
.seat .backs .card { margin: 0 calc(var(--sw) * -0.32); }
.seat.left .backs, .seat.right .backs { }
.nameplate { background: rgba(0,0,0,.55); color: #fff; padding: 5px 12px; border-radius: 999px; font-size: 16px; font-weight: 600; white-space: nowrap; display: flex; gap: 6px; align-items: center; border: 2px solid transparent; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; }
.nameplate.turn { border-color: var(--gold); box-shadow: 0 0 12px rgba(229,199,122,.7); animation: pulse 1.4s infinite; }
.nameplate .pts { color: #ffd76a; font-weight: 800; font-size: 1.15em; }
.nameplate .muted { opacity: .9; font-weight: 700; font-size: 1.1em; }
.nameplate .off { color: #ff9b8f; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.t0 { background: #6fa0ec; } .dot.t1 { background: #ef7c72; }
@keyframes pulse { 50% { box-shadow: 0 0 2px rgba(229,199,122,.2); } }
.partner-hand { display: flex; gap: 3px; }

.deck { position: absolute; left: 10px; top: 52%; transform: translateY(-50%); width: calc(var(--sw) * 2.1); height: calc(var(--sw) * 2.2); z-index: 1; }
.deck .trump { position: absolute; left: calc(var(--sw) * .55); top: calc(var(--sw) * .25); transform: rotate(90deg); }
.deck .pile { position: absolute; left: 0; top: 0; }
.deck .count { position: absolute; left: 0; top: calc(var(--sw) * 1.68); width: var(--sw); text-align: center; font-weight: 800; font-size: 18px; color: #fff; text-shadow: 0 1px 3px #000, 0 0 2px #000; }
.trumpinfo { position: absolute; left: 8px; top: 52%; transform: translateY(-50%); display: flex; flex-direction: column; align-items: center; font-size: 13px; font-weight: 600; text-shadow: 0 1px 2px #000; gap: 2px; }
.trumpinfo .suit-svg { width: 38px; height: 38px; background: var(--cream); border-radius: 50%; padding: 3px; }
.seat.left ~ .deck, .has-left .deck, .has-left .trumpinfo { top: 74%; }

.trick { position: absolute; left: 50%; top: 52%; width: 0; height: 0; z-index: 2; }
.trick .card { width: calc(var(--cw) * .8); height: calc(var(--ch) * .8); position: absolute; left: calc(var(--cw) * -0.4); top: calc(var(--ch) * -0.4); transition: transform .45s ease, opacity .45s ease; }
.trick .pos-bottom { transform: translate(0, 40%) rotate(2deg); }
.trick .pos-top { transform: translate(0, -40%) rotate(-3deg); }
.trick .pos-left { transform: translate(-72%, 0) rotate(-9deg); }
.trick .pos-right { transform: translate(72%, 0) rotate(8deg); }
.mode2 .trick .pos-bottom { transform: translate(18%, 18%) rotate(6deg); }
.mode2 .trick .pos-top { transform: translate(-18%, -18%) rotate(-6deg); }
.trick .win { filter: drop-shadow(0 0 10px #ffe27a) drop-shadow(0 2px 3px rgba(0,0,0,.4)); z-index: 5; }
.trick.fly-bottom .card { transform: translate(0, 260%) scale(.5); opacity: 0; }
.trick.fly-top .card { transform: translate(0, -260%) scale(.5); opacity: 0; }
.trick.fly-left .card { transform: translate(-260%, 0) scale(.5); opacity: 0; }
.trick.fly-right .card { transform: translate(260%, 0) scale(.5); opacity: 0; }
@keyframes in-bottom { from { transform: translate(0, 160%); opacity: .3; } }
@keyframes in-top { from { transform: translate(0, -160%); opacity: .3; } }
@keyframes in-left { from { transform: translate(-200%, 0); opacity: .3; } }
@keyframes in-right { from { transform: translate(200%, 0); opacity: .3; } }
.trick .enter.pos-bottom { animation: in-bottom .28s ease-out; }
.trick .enter.pos-top { animation: in-top .28s ease-out; }
.trick .enter.pos-left { animation: in-left .28s ease-out; }
.trick .enter.pos-right { animation: in-right .28s ease-out; }

.status { position: absolute; left: 0; right: 0; bottom: 6px; text-align: center; font-size: 17px; font-weight: 700; color: #fff; text-shadow: 0 1px 3px #000, 0 0 2px #000; z-index: 4; pointer-events: none; }
.bubble { position: absolute; background: var(--cream); color: var(--ink); padding: 6px 10px; border-radius: 12px; font-size: 14px; font-weight: 600; white-space: nowrap; z-index: 20; box-shadow: 0 3px 8px rgba(0,0,0,.35); animation: pop .25s ease-out; }
.bubble.team { background: #dce8ff; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
.seat .bubble { top: 100%; margin-top: 4px; }
.me .bubble { bottom: 100%; left: 50%; transform: translateX(-50%); }

.me { position: relative; padding: 4px 6px 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.hand { display: flex; justify-content: center; gap: 8px; min-height: var(--ch); }
.hand .card { transition: transform .15s; }
.hand .card.playable { cursor: pointer; }
.hand .card.playable:hover { transform: translateY(-8px); }
.hand .card.playable { animation: none; }
.hand.myturn .card.playable { transform: translateY(-6px); }
.hand.myturn .card.playable:active { transform: translateY(-14px) scale(1.03); }
.hand .card.trumpcard::after { content: ''; position: absolute; inset: -3px; border-radius: 10%/7%; border: 2px solid rgba(229,199,122,.55); pointer-events: none; }
.signals { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; max-width: 100%; }
.signals button { padding: 6px 9px; font-size: 13px; border-radius: 999px; }
.signals .team { background: rgba(111,160,236,.3); color: #fff; }

/* ---------- prozori ---------- */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 18px; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: #173f2a; border: 1px solid rgba(229,199,122,.4); border-radius: 18px; padding: 18px; max-width: 440px; width: 100%; max-height: 86vh; overflow-y: auto; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.modal h2 { font-size: 22px; text-align: center; }
.result-big { text-align: center; font-family: Georgia, serif; font-size: 30px; color: var(--gold); margin: 4px 0 10px; }
.scores { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
.scores td { padding: 7px 6px; border-bottom: 1px solid rgba(255,255,255,.1); }
.scores td:last-child { text-align: right; font-weight: 700; font-size: 18px; }
.scores tr.win td { color: var(--gold); }
.rules p, .rules li { font-size: 15px; line-height: 1.45; }
.lasttrick { display: flex; gap: 6px; justify-content: center; margin: 10px 0; }
#toast { position: fixed; left: 50%; bottom: 22%; transform: translateX(-50%); background: rgba(0,0,0,.8); padding: 10px 16px; border-radius: 12px; font-size: 15px; opacity: 0; transition: opacity .25s; pointer-events: none; z-index: 99; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; }
/* tamni način uređaja: još malo jači kontrast teksta i obruba */
@media (prefers-color-scheme: dark) {
  .nameplate { background: rgba(0,0,0,.7); border-color: rgba(255,255,255,.18); }
  .nameplate.turn { border-color: #ffd76a; }
  .card { filter: drop-shadow(0 0 1px rgba(255,255,255,.35)) drop-shadow(0 2px 3px rgba(0,0,0,.4)); }
  .muted { opacity: .85; }
}
@media (min-width: 700px) { :root { --cw: min(14vw, 14vh, 120px); --sw: min(6vw, 6.5vh, 56px); } }

/* ---------- veliki ekran (desktop) ---------- */
@media (min-width: 900px) and (min-height: 520px) {
  /* početni izbornik u dva stupca da stane na ekran bez pomicanja */
  .menu.home { padding-left: max(24px, calc((100% - 940px) / 2)); padding-right: max(24px, calc((100% - 940px) / 2));
    display: grid; grid-template-columns: 1fr 1fr; column-gap: 20px; align-content: safe center; }
  .menu.home > .logo, .menu.home > .links, .menu.home > p { grid-column: 1 / -1; }
  .menu.home .logo { display: flex; align-items: center; justify-content: center; gap: 24px; margin-bottom: 16px; }
  .menu.home .logo .fan { margin: 0 28px 0 0; }
  .menu.home .desk-only { display: block; }
  .menu.home .logo h1 { margin: 0; }
  :root { --cw: min(11.5vw, calc((100vh - 100px) / 5.2), 175px); --sw: calc(var(--cw) * .56); }
  .topbar, .table, .me { width: 100%; max-width: 1280px; margin-left: auto; margin-right: auto; }
  .topbar { font-size: 16px; padding: 8px 16px; }
  .topbar button.small { font-size: 15px; padding: 8px 14px; }
  .nameplate { font-size: 17px; padding: 6px 14px; }
  .status { font-size: 20px; bottom: 10px; }
  .seat.top { flex-direction: row; gap: 14px; top: 6px; }
  .seat.left { left: 16px; top: 36%; }
  .seat.right { right: 16px; top: 36%; }
  .mode3 .seat.left, .mode3 .seat.right { top: 30%; }
  .deck { left: 20px; top: auto; bottom: 16px; transform: none; }
  .has-left .deck { top: auto; }
  .trumpinfo, .has-left .trumpinfo { left: 20px; top: auto; bottom: 20px; transform: none; font-size: 14px; }
  .trumpinfo .suit-svg { width: 48px; height: 48px; }
  .deck .count { font-size: 18px; }
  .trick { top: calc(50% + var(--sw) * .75); }
  .trick .card { width: calc(var(--cw) * .84); height: calc(var(--ch) * .84); left: calc(var(--cw) * -0.42); top: calc(var(--ch) * -0.42); }
  .trick .pos-bottom { transform: translate(0, 36%) rotate(2deg); }
  .trick .pos-top { transform: translate(0, -36%) rotate(-3deg); }
  .trick .pos-left { transform: translate(-80%, 0) rotate(-9deg); }
  .trick .pos-right { transform: translate(80%, 0) rotate(8deg); }
  .me { flex-direction: row; justify-content: center; align-items: center; gap: 22px; padding: 6px 16px 14px; }
  .me > div:has(> .nameplate) { order: -1; min-width: 180px; display: flex; justify-content: flex-end; }
  .hand { gap: 16px; }
  .hand.myturn .card.playable { transform: translateY(-10px); }
  .hand .card.playable:hover { transform: translateY(-18px); }
  .signals { display: grid; grid-template-columns: auto auto; grid-auto-flow: column; grid-template-rows: repeat(6, auto); gap: 6px; min-width: 180px; justify-content: start; }
  .signals button { font-size: 14px; padding: 7px 12px; }
  .seat .bubble, .me .bubble { font-size: 17px; }
}


.mode3 .seat.left, .mode3 .seat.right { top: 24%; }
.mode3 .trick { top: 56%; }

/* ---------- mobitel: parovi i niski ekrani ---------- */
@media (max-width: 899px) {
  /* briškula uspravno pokraj špila, veća i cijela vidljiva */
  .deck { --tw: calc(var(--sw) * 1.4); width: calc(var(--sw) + var(--tw) + 8px); height: calc(var(--tw) * 1.6); }
  .deck .trump { left: calc(var(--sw) + 6px); top: 0; transform: none; width: var(--tw); height: calc(var(--tw) * 1.6); }
  .deck .trump::after { content: ''; position: absolute; inset: -3px; border-radius: 10%/7%; border: 2px solid var(--gold); pointer-events: none; }
  .deck .pile { top: calc((var(--tw) - var(--sw)) * .8); }
  .deck .count { top: calc((var(--tw) - var(--sw)) * .8 + var(--sw) * 1.68); }
  /* špil dolje lijevo, iznad poruke, da ga karte na stolu ne prekrivaju */
  .deck, .has-left .deck { top: auto; bottom: 34px; transform: none; z-index: 3; }
  .trumpinfo, .has-left .trumpinfo { top: auto; bottom: 40px; transform: none; }
  .mode4 { --sw: min(10vw, 5.5vh, 50px); }
  .mode4 .seat.top { flex-direction: row; gap: 8px; }
  .mode4 .seat.left, .mode4 .seat.right { top: calc(var(--sw) * 1.6 + 64px); }
  .mode4 .nameplate { max-width: 46vw; }
  .mode4 .trick { top: 56%; }
  .signals { gap: 5px; }
  .signals button { padding: 6px 9px; font-size: 13px; }
}
@media (max-width: 899px) and (max-height: 760px) {
  :root { --cw: min(28vw, 14vh, 130px); }
  .nameplate { font-size: 15px; padding: 4px 10px; }
  .me { gap: 4px; padding-bottom: 6px; }
}

/* ---------- chat ---------- */
.chat-btn { position: relative; }
.chat-btn.on { background: rgba(229,199,122,.35); }
.chat-btn .badge { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 800; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--felt2); }
.chat { position: fixed; z-index: 40; display: flex; flex-direction: column; background: #173f2a; border: 1px solid rgba(229,199,122,.4); box-shadow: 0 -6px 30px rgba(0,0,0,.45);
  /* mobitel: ploča odozdo preko ruke, iznad tipkovnice */
  left: 0; right: 0; bottom: 0; height: min(58vh, 440px); height: min(58dvh, 440px); border-radius: 18px 18px 0 0; border-bottom: 0;
  padding: 10px 10px calc(10px + env(safe-area-inset-bottom)); animation: chat-up .2s ease-out; }
.chat[hidden] { display: none; }
@keyframes chat-up { from { transform: translateY(30px); opacity: 0; } }
.chat-head { display: flex; align-items: center; gap: 8px; padding: 0 2px 8px; border-bottom: 1px solid rgba(255,255,255,.1); }
.chat-head b { color: var(--gold); font-size: 17px; }
.chat-head .muted { flex: 1; font-size: 13px; }
.chat-list { flex: 1; min-height: 0; overflow-y: auto; padding: 10px 2px; display: flex; flex-direction: column; gap: 8px; user-select: text; -webkit-user-select: text; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: rgba(229,199,122,.35) transparent; }
.chat-list::-webkit-scrollbar { width: 6px; }
.chat-list::-webkit-scrollbar-thumb { background: rgba(229,199,122,.35); border-radius: 6px; }
.chat-empty { text-align: center; margin: auto 0; }
.msg { max-width: 85%; align-self: flex-start; }
.msg .who { font-size: 12px; font-weight: 700; color: var(--gold); margin: 0 0 2px 4px; display: flex; align-items: center; gap: 5px; }
.msg .who .t { color: var(--cream); opacity: .55; font-weight: 500; }
.msg .txt { background: rgba(0,0,0,.3); padding: 8px 11px; border-radius: 4px 14px 14px 14px; font-size: 15px; line-height: 1.35; overflow-wrap: anywhere; white-space: pre-wrap; }
.msg.mine { align-self: flex-end; }
.msg.mine .who { justify-content: flex-end; margin: 0 4px 2px 0; }
.msg.mine .txt { background: var(--gold); color: #3a2a08; border-radius: 14px 4px 14px 14px; }
.chat-form { display: flex; gap: 8px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,.1); }
.chat-form input { flex: 1; min-width: 0; font-size: 16px; /* 16px: iPhone ne zumira */ user-select: text; -webkit-user-select: text; }
.chat-form button { flex: 0 0 auto; padding: 10px 14px; }
.bubble.chatb { max-width: min(60vw, 260px); overflow: hidden; text-overflow: ellipsis; }
.seat.right .bubble.chatb { right: 0; }
.seat.left .bubble.chatb { left: 0; }
@media (prefers-color-scheme: dark) { .chat { background: #102e1f; } .msg .txt { background: rgba(0,0,0,.45); } }
/* PC: chat kao stupac s desne strane, stol se suzi da ništa ne prekrije */
@media (min-width: 900px) and (min-height: 520px) {
  .chat { left: auto; top: 10px; right: 10px; bottom: 10px; width: 340px; height: auto; border-radius: 16px; border-bottom: 1px solid rgba(229,199,122,.4); padding: 12px; animation: fade .2s; }
  body.chat-open #app { padding-right: 360px; }
  body.chat-open #toast { left: calc(50% - 180px); }
}

/* ---------- trešeta ---------- */
/* puno karata u ruci (10–13): karte se preklapaju taman toliko da stanu u širinu */
.me.tre { --cw: min(24vw, 13.5vh, 130px); }
.hand.many { gap: 0; width: 100%; max-width: calc(var(--n) * (var(--cw) + 8px)); }
.hand.many .card { flex: 0 0 auto; }
.hand.many .card + .card { margin-left: min(8px, calc((100% - var(--n) * var(--cw)) / (var(--n) - 1))); }
.hand .card.dim { filter: brightness(.5) saturate(.6); }
.tcards { display: flex; align-items: center; gap: 6px; }
.tcards .known { display: flex; }
.tcards .known .card + .card { margin-left: calc(var(--sw) * -0.45); }
.tcards.side .known .card + .card { margin-left: calc(var(--sw) * -0.6); }
.tcards.side .known + .backs { display: none; }
.tcards .hc { font-weight: 800; font-size: 15px; text-shadow: 0 1px 3px #000; min-width: 16px; }
.tinfo { position: absolute; left: 8px; bottom: 34px; display: flex; align-items: flex-end; gap: 8px; z-index: 3; }
.tdeck { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.tdeck .count { font-weight: 800; font-size: 16px; text-shadow: 0 1px 3px #000, 0 0 2px #000; }
.tscore { background: rgba(0,0,0,.4); border: 1px solid rgba(255,255,255,.1); border-radius: 10px; padding: 5px 9px; font-size: 13px; min-width: 92px; }
.tscore .muted { font-size: 11px; margin-bottom: 2px; white-space: nowrap; }
.tscore .ts { display: flex; justify-content: space-between; gap: 10px; font-weight: 600; }
.tscore .ts span { max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tscore .ts b { color: #ffd76a; }
.bubble.akuza { background: #fff1bf; white-space: normal; width: max-content; max-width: min(62vw, 280px); text-align: center; }
.seat.right .bubble.akuza { right: 0; }
.seat.left .bubble.akuza { left: 0; }
.hand-table td { text-align: center; padding: 6px 3px; font-size: 15px; }
.hand-table td:first-child { text-align: left; }
.hand-table td.tot { font-size: 18px; color: var(--gold); }
.hand-table .ak { font-size: 12px; }
.scores tr.th td { font-size: 12px; font-weight: 600; opacity: .7; }
.scores.small td, .scores.small td:last-child { font-size: 14px; font-weight: 600; text-align: center; }
.scores.small td:first-child { text-align: left; }
details.hist { margin-bottom: 10px; }
details.hist summary { cursor: pointer; text-align: center; margin-bottom: 6px; }
@media (min-width: 900px) and (min-height: 520px) {
  .me.tre { --cw: min(9vw, calc((100vh - 100px) / 5.4), 150px); }
  .me.tre .hand.many { flex: 1 1 auto; min-width: 0; }
  .tinfo { left: 20px; bottom: 20px; }
  .tscore { font-size: 15px; min-width: 120px; padding: 8px 12px; }
  .tscore .muted { font-size: 13px; }
  .signals.tre { grid-template-rows: repeat(4, auto); }
}
.bubble.akuza { animation: none; }
.tcards .backs { padding: 0 calc(var(--sw) * .32); }

/* ---------- avatari ---------- */
.av { --s: 36px; position: relative; flex: 0 0 auto; width: var(--s); height: var(--s); border-radius: 50%; display: inline-block; background: rgba(0,0,0,.3); box-shadow: 0 0 0 2px rgba(255,255,255,.75), 0 2px 6px rgba(0,0,0,.4); }
.av > svg, .av > img { width: 100%; height: 100%; display: block; border-radius: 50%; object-fit: cover; pointer-events: none; -webkit-user-drag: none; }
.av.empty { box-shadow: 0 0 0 2px rgba(255,255,255,.25); background: rgba(0,0,0,.2); }
.av.xs { --s: 20px; box-shadow: 0 0 0 1px rgba(255,255,255,.6); }
.av.md { --s: 40px; }
.av.lg { --s: 64px; box-shadow: 0 0 0 3px var(--gold), 0 3px 10px rgba(0,0,0,.4); }
.av.turn { box-shadow: 0 0 0 3px var(--gold), 0 0 14px rgba(229,199,122,.8); }

/* izbornik: avatar + ime + dužina */
.prof-row { display: flex; gap: 12px; align-items: center; }
.prof-row input { flex: 1; min-width: 0; }
.av-pick { position: relative; padding: 0; background: none; border-radius: 50%; flex: 0 0 auto; }
.av-pick .pen { position: absolute; left: -4px; bottom: -4px; width: 24px; height: 24px; border-radius: 50%; background: var(--felt2); border: 2px solid var(--gold); color: var(--gold); font-size: 12px; line-height: 20px; text-align: center; }
.prof-stats { display: flex; width: 100%; margin-top: 12px; padding: 8px 6px; gap: 4px; justify-content: space-around; background: rgba(0,0,0,.22); border: 1px solid rgba(232,193,90,.35); border-radius: 12px; color: var(--cream); font-weight: 400; box-shadow: none; }
.prof-stats > span { display: flex; flex-direction: column; align-items: center; flex: 1; min-width: 0; }
.prof-stats b { color: var(--gold); font-size: 16px; white-space: nowrap; }
.prof-stats small { font-size: 12px; opacity: .75; }
.prof-stats.guest > span { font-size: 13px; opacity: .85; }
.st-sum { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 4px 0 6px; }
.st-tile { display: flex; flex-direction: column; align-items: center; padding: 8px 2px; border-radius: 10px; background: rgba(0,0,0,.22); border: 1px solid rgba(232,193,90,.3); }
.st-tile b { color: var(--gold); font-size: 15px; white-space: nowrap; }
.st-tile small { font-size: 11px; opacity: .75; }
@media (max-width: 380px) { .st-sum { grid-template-columns: repeat(2, 1fr); } }
.st-note { margin: 0 0 10px; font-size: 12.5px; }
.av-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); gap: 10px; margin: 6px 0 14px; }
.av-opt { padding: 0; aspect-ratio: 1; border-radius: 50%; background: rgba(0,0,0,.25); overflow: hidden; box-shadow: 0 0 0 2px rgba(255,255,255,.2); }
.av-opt svg, .av-opt img { width: 100%; height: 100%; display: block; object-fit: cover; }
.av-opt.on { box-shadow: 0 0 0 3px var(--gold), 0 0 12px rgba(229,199,122,.7); }
label.upload { display: block; text-align: center; padding: 12px; border-radius: 12px; background: rgba(255,255,255,.12); font-weight: 700; cursor: pointer; }
label.upload:active { transform: scale(.98); }

/* predvorje */
.seats li .n { display: flex; flex-direction: column; min-width: 0; }
.seats .cmt { font-size: 12px; opacity: .75; }
.msg .who .av { margin-right: 1px; }

/* stol: avatar + pločica s imenom; oblačić poruke iznad avatara */
.pl { display: flex; align-items: center; gap: 6px; max-width: 100%; }
.pl .nameplate { min-width: 0; }
.pl-right { flex-direction: row-reverse; }
.av .bubble { position: absolute; top: auto; bottom: calc(100% + 9px); margin: 0; left: 50%; translate: -50% 0; transform: none;
  white-space: normal; width: max-content; max-width: min(60vw, 240px); text-align: center; line-height: 1.25; pointer-events: none; transform-origin: 50% 100%; }
.av .bubble::after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -7px; border: 7px solid transparent; border-top-color: var(--cream); border-bottom: 0; }
.av .bubble.team::after { border-top-color: #dce8ff; }
.av .bubble.akuza::after { border-top-color: #fff1bf; }
.pl-left .av .bubble { left: -6px; translate: none; transform-origin: 12px 100%; }
.pl-left .av .bubble::after { left: 24px; }
.pl-right .av .bubble { left: auto; right: -6px; translate: none; transform-origin: calc(100% - 12px) 100%; }
.pl-right .av .bubble::after { left: auto; right: 24px; margin: 0 -7px 0 0; }
.av .bubble.chatb { overflow: visible; display: block; }
.seat.right .av .bubble.chatb, .seat.right .av .bubble.akuza { right: -6px; }
.seat.left .av .bubble.chatb, .seat.left .av .bubble.akuza { left: -6px; }
@media (max-width: 899px) {
  .pl .av { --s: 32px; }
  .pl .nameplate { max-width: 34vw; }
  .mode4 .pl .nameplate { max-width: 36vw; }
  .pl-me .nameplate { max-width: 60vw; }
}
@media (min-width: 900px) and (min-height: 520px) {
  .pl { gap: 10px; }
  .pl .av { --s: 54px; }
  .me > .mypl { order: -1; min-width: 180px; display: flex; justify-content: flex-end; }
  .av .bubble { max-width: 300px; }
}
/* karte gornjeg igrača vire preko ruba (negativni razmak), pa avatar malo odmaknemo */
.seat.top .backs + .pl, .seat.top .partner-hand + .pl { margin-left: calc(var(--sw) * .34); }

/* ---------- timer za potez (online) ---------- */
.av .tt { position: absolute; inset: -6px; pointer-events: none; }
.av .tt svg { width: 100%; height: 100%; display: block; transform: rotate(-90deg); overflow: visible; }
.av .tt .trk { fill: none; stroke: rgba(0,0,0,.45); stroke-width: 3.5; }
.av .tt .run { fill: none; stroke: var(--gold); stroke-width: 3.5; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 0;
  animation: tt-run var(--d) linear var(--e) forwards; filter: drop-shadow(0 0 3px rgba(0,0,0,.5)); }
@keyframes tt-run { 0% { stroke: var(--gold); stroke-dashoffset: 0; } 60% { stroke: var(--gold); } 80% { stroke: #ff5a4a; } 100% { stroke: #ff5a4a; stroke-dashoffset: 100; } }
.av .tt .ttn { position: absolute; left: -8px; top: -8px; min-width: 20px; height: 20px; padding: 0 4px; border-radius: 10px; background: #14432b; border: 2px solid var(--gold); color: var(--gold); font-size: 11px; line-height: 16px; font-weight: 800; text-align: center; }
.av .tt .ttn.low { border-color: #ff5a4a; color: #fff; background: var(--red); animation: tt-blink 1s infinite; }
@keyframes tt-blink { 50% { transform: scale(1.15); } }
.ttn.low { color: #ff7a6a; }
.forfeit { text-align: center; margin: 4px 0 10px; padding: 8px 10px; border-radius: 10px; background: rgba(184,50,42,.25); border: 1px solid rgba(255,90,74,.5); }

/* pločica ispod avatara u igri (broj pobjeda / bot / gost) */
.avw { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; flex: none; }
.cml { background: var(--gold); color: #3a2a08; font-size: 10px; font-weight: 800; line-height: 1; padding: 2px 5px; border-radius: 7px; white-space: nowrap; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.cml.secret { background: rgba(0,0,0,.5); color: #fff; font-weight: 600; opacity: .85; }
@media (min-width: 900px) and (min-height: 520px) { .cml { font-size: 12px; padding: 3px 7px; } }
/* parovi: zbrojeni bodovi para */
.tscore .ts .dot { width: 8px; height: 8px; vertical-align: 1px; }
.tscore .tsh { margin-top: 2px; font-size: 10px; }
.tscore .ts em { font-style: normal; font-weight: 600; font-size: .85em; color: var(--cream); opacity: .75; }
.pscore { position: absolute; right: 8px; top: 74%; transform: translateY(-50%); z-index: 3; }
@media (min-width: 900px) and (min-height: 520px) { .pscore { right: 20px; top: auto; bottom: 20px; transform: none; } }

/* ---------- mobitel: kompaktniji stol (manje karte, pločice i gumbi) ---------- */
@media (max-width: 899px) {
  :root { --cw: min(24vw, 13.5vh, 112px); --sw: min(10vw, 6vh, 46px); }
  .mode4 { --sw: min(8.5vw, 4.8vh, 40px); }
  .topbar { padding: 4px 6px; font-size: 13px; }
  .topbar button.small { padding: 6px 9px; font-size: 13px; }
  .nameplate, .mode4 .nameplate { font-size: 13px; padding: 3px 9px; gap: 5px; border-width: 1.5px; }
  .nameplate .pts { font-size: 1.1em; }
  .pl { gap: 4px; }
  .pl .av { --s: 28px; }
  .cml { font-size: 9px; padding: 1px 4px; border-radius: 6px; }
  .avw { gap: 1px; }
  .seat { gap: 2px; }
  .seat.top { top: 2px; }
  .mode4 .seat.top { gap: 6px; }
  .mode4 .seat.left, .mode4 .seat.right { top: calc(var(--sw) * 1.6 + 46px); }
  .tcards .hc { font-size: 13px; }
  /* karte na stolu manje i bliže sredini da ne prekrivaju igrače sa strane */
  .trick .card { width: calc(var(--cw) * .72); height: calc(var(--ch) * .72); left: calc(var(--cw) * -0.36); top: calc(var(--ch) * -0.36); }
  .trick .pos-left { transform: translate(-58%, 0) rotate(-9deg); }
  .trick .pos-right { transform: translate(58%, 0) rotate(8deg); }
  .trick .pos-top { transform: translate(0, -34%) rotate(-3deg); }
  .trick .pos-bottom { transform: translate(0, 34%) rotate(2deg); }
  .mode4 .trick, .mode3 .trick { top: 57%; }
  .status { font-size: 15px; bottom: 4px; }
  .deck .count, .tdeck .count { font-size: 14px; }
  .tinfo { bottom: 28px; left: 6px; gap: 6px; }
  .deck, .has-left .deck { bottom: 28px; left: 6px; }
  .tscore { font-size: 12px; padding: 4px 7px; min-width: 0; border-radius: 8px; }
  .tscore .muted { font-size: 10px; }
  .tscore .ts { gap: 8px; }
  .pscore { top: auto; bottom: 28px; right: 6px; transform: none; }
  .me { padding: 2px 4px 6px; gap: 4px; }
  .hand { gap: 5px; }
  .hand.myturn .card.playable { transform: translateY(-4px); }
  .signals { gap: 4px; }
  .signals button { padding: 4px 8px; font-size: 12px; }
  .bubble { font-size: 13px; padding: 5px 9px; }
}
@media (max-width: 899px) and (max-height: 760px) {
  :root { --cw: min(23vw, 12.5vh, 104px); }
  .nameplate, .mode4 .nameplate { font-size: 12px; padding: 2px 8px; }
}
/* gornji igrač: oblačić ispod avatara, da ne ide preko gornje trake */
.seat.top .av .bubble { bottom: auto; top: calc(100% + 9px); transform-origin: 50% 0; }
.seat.top .av .bubble::after { top: auto; bottom: 100%; border-top-color: transparent; border-bottom: 7px solid var(--cream); border-top: 0; }
.seat.top .av .bubble.team::after { border-bottom-color: #dce8ff; }
.seat.top .av .bubble.akuza::after { border-bottom-color: #fff1bf; }
.seat:has(.bubble) { z-index: 6; }

/* ---------- poker ---------- */
.chips { display: inline-flex; align-items: center; gap: 4px; color: #ffd76a; font-weight: 800; }
.chips::before { content: ''; width: .8em; height: .8em; border-radius: 50%; flex: none;
  background: radial-gradient(circle, #ffd76a 0 28%, #b8322a 30% 58%, #fff 60% 70%, #b8322a 72%); box-shadow: 0 0 0 1px rgba(0,0,0,.35); }
.dealer { display: inline-block; width: 1.25em; height: 1.25em; line-height: 1.25em; border-radius: 50%; background: #fff; color: #222; font-size: .8em; font-weight: 900; text-align: center; flex: none; box-shadow: 0 1px 2px rgba(0,0,0,.5); }
.pl.folded .nameplate { opacity: .6; }
.act { font-size: 12px; font-weight: 700; padding: 2px 7px; border-radius: 7px; background: rgba(0,0,0,.45); white-space: nowrap; }
.act.allin { background: var(--red); color: #fff; }
.act.won { background: var(--gold); color: #3a2a08; }
.pcards { display: flex; gap: 3px; }
.pcards.folded { opacity: .35; filter: grayscale(.6); }
.card.best { filter: drop-shadow(0 0 7px #ffe27a) drop-shadow(0 2px 3px rgba(0,0,0,.4)); }
.card.best::after { content: ''; position: absolute; inset: -2px; border-radius: 10%/7%; border: 2px solid #ffe27a; pointer-events: none; }
.hname { font-size: 13px; font-weight: 700; color: #fff; text-shadow: 0 1px 3px #000; white-space: nowrap; }
.me.poker .hname { color: var(--gold); }
.pbet { pointer-events: none; display: flex; gap: 5px; align-items: center; }
.me.poker .mypl { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.pbet .chips { background: rgba(0,0,0,.55); padding: 2px 8px; border-radius: 999px; font-size: 14px; border: 1px solid rgba(255,215,106,.35); }
.pboard { position: absolute; left: 50%; top: 54%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 6px; z-index: 2; }
.bcards { display: flex; gap: 5px; }
.card.bc { width: calc(var(--cw) * .62); height: calc(var(--ch) * .62); }
.card.bc.slot { border: 2px dashed rgba(255,255,255,.18); border-radius: 9%/6%; filter: none; }
.pot { background: rgba(0,0,0,.45); padding: 4px 12px; border-radius: 999px; font-weight: 700; font-size: 15px; display: flex; gap: 6px; align-items: center; }
.pblinds { position: absolute; left: 8px; bottom: 34px; z-index: 3; }
.me.poker .hand .card.dim { filter: brightness(.5) saturate(.6); }
.pctl { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; }
.pact { display: flex; gap: 8px; width: 100%; max-width: 520px; }
.pact button { flex: 1; padding: 10px 8px; }
.pact button.on { background: #f0d891; box-shadow: inset 0 0 0 2px #3a2a08; }
.pact .fold { color: #ffb3aa; }
.praise { width: 100%; max-width: 520px; background: rgba(0,0,0,.3); border-radius: 12px; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.praise input[type=range] { flex: 1; padding: 0; border: 0; background: none; accent-color: var(--gold); height: 28px; }
.praise .row b { flex: 0 0 auto; min-width: 54px; text-align: right; color: #ffd76a; font-size: 17px; }
.praise .pre button { padding: 6px 4px; }
.card.xs { width: 34px; height: calc(34px * 1.6); }
.pboard-sm { display: flex; gap: 4px; justify-content: center; }
.ptable .hc2 { display: flex; gap: 3px; justify-content: center; }
.ptable td.plus { color: #9be59b; font-weight: 700; }
.ptable td.minus { color: #ff9b8f; font-weight: 700; }
.ptable .ak { font-size: 12px; }
@media (max-width: 899px) {
  .table.poker .seat.left, .table.poker .seat.right { top: 26%; }
  .mode4.poker .seat.left, .mode4.poker .seat.right { top: calc(var(--sw) * 1.6 + 50px); }
  .table.poker .seat .card.sm { width: calc(var(--sw) * .9); height: calc(var(--sw) * 1.44); }
  .pboard { top: 58%; }
  .card.bc { width: min(calc(var(--cw) * .62), 17vw); height: calc(min(calc(var(--cw) * .62), 17vw) * 1.6); }
  .pot { font-size: 13px; padding: 3px 10px; }
  .pblinds { bottom: 28px; left: 6px; }
  .act { font-size: 11px; padding: 1px 6px; }
  .hname { font-size: 11px; }
  .pact button { padding: 9px 6px; font-size: 14px; }
  .me.poker .pbet .chips { font-size: 12px; }
}
@media (min-width: 900px) and (min-height: 520px) {
  .pboard { top: 52%; gap: 10px; }
  .bcards { gap: 10px; }
  .card.bc { width: calc(var(--cw) * .72); height: calc(var(--ch) * .72); }
  .pot { font-size: 18px; }
  .pblinds { left: 20px; bottom: 20px; }
  .act { font-size: 14px; }
  .hname { font-size: 15px; }
  .me.poker { position: relative; }
  .me.poker > .pbet { position: absolute; left: 50%; top: -30px; transform: translateX(-50%); }
  .me.poker .mypl { align-items: flex-end; }
  .me.poker .pctl { width: 380px; }
}

/* ---------- turnir ---------- */
.tour { margin: 4px 0 12px; padding: 8px 10px 2px; border-radius: 12px; background: rgba(0,0,0,.22); border: 1px solid rgba(229,199,122,.3); }
.tour-h { text-align: center; font-weight: 700; color: var(--gold); font-size: 14px; margin-bottom: 4px; }
.ttable { margin-bottom: 6px; }
.ttable td.tot, .ttable td:last-child { color: var(--gold); font-size: 16px; }
.ttable tr.win td:first-child { color: var(--gold); }
.tour-win { text-align: center; font-weight: 800; font-size: 18px; color: var(--gold); margin: 0 0 12px; }
@media (max-width: 899px) {
  /* povišenje na mobitelu: ploča iznad mojih karata, da stol ne postane prenizak */
  .me.poker .praise { position: absolute; left: 8px; right: 8px; width: auto; max-width: none; bottom: calc(100% + 6px); z-index: 12;
    background: rgba(12,40,26,.96); border: 1px solid rgba(229,199,122,.4); box-shadow: 0 6px 24px rgba(0,0,0,.5); }
}

/* ---------- račun, statistika, prijatelji ---------- */
.acc-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.1); }
.acc-row.guest { justify-content: space-between; }
.acc-row:not(.guest) > button { flex: 1 1 auto; padding: 8px 8px; font-size: 13px; position: relative; white-space: nowrap; }
.acc-row #accBtn { overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.on-n { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 3px; border-radius: 9px; background: #3fbf6a; color: #08260f; font-size: 11px; font-weight: 800; line-height: 18px; text-align: center; }
.acc-row .badge, .friends .badge { position: absolute; top: -6px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 800; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--felt2); }
.center-row { justify-content: center; flex-wrap: wrap; }
.center-row > * { flex: 0 0 auto; }
.modal .err { color: #ffb4a8; background: rgba(184,50,42,.25); border-radius: 8px; padding: 7px 10px; margin: 8px 0 0; font-size: 14px; }
.modal .warn { color: #ffe3a3; background: rgba(229,199,122,.14); border-radius: 8px; padding: 7px 10px; font-size: 13px; }
.modal form.stack { margin-bottom: 10px; }
.modal h3 { font-size: 15px; color: var(--gold); margin: 14px 0 4px; }
.acc-head { display: flex; gap: 14px; align-items: center; margin: 4px 0 10px; }
.acc-head b { font-size: 18px; }
details.pw { margin: 8px 0; }
details.pw summary { cursor: pointer; padding: 6px 0; color: var(--gold); font-weight: 600; }
.scores.stats th { font-size: 12px; font-weight: 600; opacity: .75; text-align: right; padding: 4px 6px; }
.scores.stats th:first-child { text-align: left; }
.scores.stats td { padding: 6px; font-size: 14px; }
.scores.stats td:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.scores.stats td:last-child { font-size: 14px; }
.scores.stats tr.zero td { opacity: .45; }
.scores.stats tr.tot td { font-weight: 800; color: var(--gold); border-bottom: 0; }
.friends li { gap: 8px; padding: 8px 10px; }
.friends li .n { min-width: 0; overflow: hidden; }
.friends li .n b { font-weight: 700; }
.friends li .n .muted { font-size: 12px; }
.friends li .sub { display: block; font-size: 12px; opacity: .7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.friends li.online .sub { color: #8be0a6; opacity: 1; }
.friends li button { flex: 0 0 auto; padding: 7px 10px; }
.av .pres { position: absolute; right: -2px; bottom: -2px; width: 12px; height: 12px; border-radius: 50%; background: #777; box-shadow: 0 0 0 2px #173f2a; }
.av .pres.on { background: #3fbf6a; }
.invite { position: fixed; left: 0; right: 0; margin: 0 auto; top: calc(10px + env(safe-area-inset-top)); z-index: 120; display: flex; gap: 10px; align-items: center;
  background: #173f2a; border: 1px solid var(--gold); border-radius: 14px; padding: 10px 12px; box-shadow: 0 8px 30px rgba(0,0,0,.55); width: max-content; max-width: calc(100vw - 20px); animation: pop .25s ease-out; }
.invite[hidden] { display: none; }
.invite > div { flex: 1; font-size: 14px; line-height: 1.35; }
.invite .muted { font-size: 12px; }
.invite button { flex: 0 0 auto; }

/* ---------- direktne poruke među prijateljima ---------- */
.chat.dm .chat-head { gap: 10px; }
.chat.dm .chat-head .av { --s: 34px; }
.dm-who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.dm-who b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-who .muted { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat.dm .msg .seen { font-size: 11px; opacity: .6; text-align: right; margin: 2px 4px 0 0; }
.friends li .msg-btn, #inviteF { position: relative; }
#inviteF .badge { position: absolute; top: -6px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 800; line-height: 18px; text-align: center; }
.friends li.unread { background: rgba(229,199,122,.12); }
.friends li.unread .sub { color: var(--gold); opacity: 1; font-weight: 700; }
@media (max-width: 899px), (max-height: 519px) {
  .chat.dm { height: min(78vh, 600px); height: min(78dvh, 600px); }
}

/* ---------- bočna ploča: online prijatelji na početnom ekranu ---------- */
.side-f[hidden] { display: none; }
.sf-panel { display: flex; flex-direction: column; gap: 8px; background: #173f2a; border: 1px solid rgba(229,199,122,.4); box-shadow: 0 6px 30px rgba(0,0,0,.45); padding: 12px; }
.sf-head { display: flex; align-items: center; gap: 6px; padding-bottom: 8px; border-bottom: 1px solid rgba(255,255,255,.1); }
.sf-head b { color: var(--gold); font-size: 16px; }
.sf-head #sfClose { margin-left: auto; }
.sf-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; min-height: 0; flex: 1 1 auto; display: flex; flex-direction: column; gap: 6px;
  scrollbar-width: thin; scrollbar-color: rgba(229,199,122,.35) transparent; overscroll-behavior: contain; }
.sf-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px; background: rgba(0,0,0,.2); border-radius: 10px; }
.sf-list li .n { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sf-list li .n b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sf-list li .fst { font-size: 12px; color: var(--gold); opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sf-list li .sub { font-size: 12px; color: #8be0a6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sf-list li.busy .sub { color: var(--gold); }
.sf-btns { display: flex; gap: 6px; flex: 1 0 100%; justify-content: flex-end; }
.sf-btns button { padding: 7px 10px; }
.sf-btns .msg-btn { position: relative; margin-right: auto; }
.sf-btns .badge, .sf-tab .badge { position: absolute; top: -6px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 800; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--felt2); }
.sf-empty { text-align: center; margin: 8px 0; }
.sf-note { font-size: 12px; margin: 0; }
.sf-all { width: 100%; }
.sf-tab { position: relative; display: none; }
.sf-back { display: none; }
@media (prefers-color-scheme: dark) { .sf-panel { background: #102e1f; } }

/* PC: stalni stupac s desne strane, izbornik se pomakne ulijevo */
@media (min-width: 900px) and (min-height: 520px) {
  .sf-panel { position: fixed; z-index: 30; top: 14px; right: 14px; width: 290px; max-height: calc(100vh - 28px); border-radius: 16px; animation: fade .2s; }
  .sf-head #sfClose { display: none; }
  body.side-f #app { padding-right: 310px; }
  body.side-f #toast { left: calc(50% - 155px); }
}
/* mobitel: jezičak uz desni rub, ladica se otvara na dodir */
@media (max-width: 899px), (max-height: 519px) {
  .sf-tab { display: flex; align-items: center; gap: 2px; position: fixed; z-index: 45; right: 0; top: calc(50% - 26px); padding: 10px 8px 10px 10px;
    border-radius: 14px 0 0 14px; background: #173f2a; color: var(--cream); border: 1px solid rgba(229,199,122,.5); border-right: 0; box-shadow: -3px 3px 14px rgba(0,0,0,.4); font-size: 20px; }
  .sf-tab .on-n { margin-left: 2px; }
  .sf-panel { position: fixed; z-index: 47; top: 0; bottom: 0; right: 0; width: min(330px, 88vw); border-radius: 16px 0 0 16px; border-right: 0;
    padding-top: calc(12px + env(safe-area-inset-top)); padding-bottom: calc(12px + env(safe-area-inset-bottom));
    transform: translateX(105%); transition: transform .22s ease; }
  .side-f.open .sf-panel { transform: none; }
  .side-f.open .sf-tab { display: none; }
  .side-f.open .sf-back { display: block; position: fixed; inset: 0; z-index: 46; background: rgba(0,0,0,.45); animation: fade .2s; }
}

/* ---------- preklapanja: popravci ---------- */
/* naslov u gornjoj traci u jednom redu (na mobitelu se lomio u 2–3 reda i gurao stol) */
.topbar .mid { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* mjehurić igrača gore ide ispod oznake s cm, da je ne prekrije */
.seat.top .avw:has(.cml) .av .bubble { top: calc(100% + 22px); }
@media (min-width: 900px) and (min-height: 520px) { .seat.top .avw:has(.cml) .av .bubble { top: calc(100% + 30px); } }
/* moj mjehurić ide udesno od avatara, da ne izađe preko lijevog ruba ekrana */
.pl-me .av .bubble { left: -6px; translate: none; transform-origin: 12px 100%; }
.pl-me .av .bubble::after { left: 24px; }
/* prsten timera ne smije ući u karte igrača gore */
.seat.top > .pl { margin-top: 4px; }
@media (max-width: 899px) { .mode2 .seat.top > .pl, .mode3 .seat.top > .pl { margin-top: 10px; } }
@media (min-width: 900px) and (min-height: 520px) {
  /* poker na PC-u: status iznad mojeg uloga, a ne preko njega */
  .table.poker .status { bottom: 44px; }
  /* poker u četvero: bočni igrači niže, da im ime ne ide ispod karata igrača gore */
  .mode4.poker .seat.left, .mode4.poker .seat.right { top: 44%; }
}
/* mobitel: jezičak online prijatelja uži, da ne prekriva gumbe i tekst izbornika */
@media (max-width: 899px), (max-height: 519px) {
  .sf-tab { flex-direction: column; gap: 0; padding: 8px 3px 8px 4px; font-size: 15px; line-height: 1.1; top: calc(50% - 30px); }
  .sf-tab .on-n { margin-left: 0; font-size: 12px; }
  .sf-tab .badge { top: -8px; right: auto; left: -8px; }
}
/* poziv i obavijest o poruci u isto vrijeme: druga ide ispod prve */
#invite:not([hidden]) ~ #dmNote:not([hidden]), #dmNote:not([hidden]) ~ #invite:not([hidden]) { top: calc(92px + env(safe-area-inset-top)); }
/* mobitel: status uvijek u jednom redu; kad se prelomio u 2 reda (online, dugo ime + timer) išao je preko špila i rezultata */
@media (max-width: 899px) { .status { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 6px; font-size: 14px; } .deck, .has-left .deck { bottom: 30px; } }
/* ---------- žetoni na računu (poker) ---------- */
.wallet { white-space: nowrap; font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums; }
.wallet-box { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; margin: 10px 0 6px; padding: 8px 12px; border-radius: 10px; background: rgba(0,0,0,.22); }
.wallet-box > div { opacity: .8; font-size: 14px; }
.wallet-box b { font-size: 18px; }
.wallet-box .plus { color: #9be59b; font-weight: 800; }
.wallet-box .minus { color: #ff9b8f; font-weight: 800; }
.pblinds .wallet { font-size: 11px; }
@media (max-width: 899px) {
  /* poker u četvero na mobitelu: imena i žetoni se ne preklapaju */
  .mode4.poker .nameplate { font-size: 13px; padding: 3px 8px; gap: 4px; max-width: 47vw; }
  .mode4.poker .seat.top .nameplate { max-width: 46vw; }
  .mode4.poker .seat.top { gap: 5px; }
  .mode4.poker .seat.top .pbet { position: absolute; left: 50%; top: 100%; transform: translateX(-50%); margin-top: 2px; }
  .mode4.poker .seat.left, .mode4.poker .seat.right { max-width: 49vw; }
}
@media (max-width: 899px) {
  .mode4.poker .seat.left, .mode4.poker .seat.right { top: calc(var(--sw) * 1.6 + 74px); }
}
@media (max-width: 899px) and (max-height: 700px) {
  .mode4.poker .pboard { top: 65%; }
}

/* ---------- broj verzije i "Što je novo" ---------- */
.ver { text-align: center; margin: 6px 0 0; }
button.linkish { background: none; color: inherit; padding: 4px 8px; font-size: 12px; font-weight: 400; opacity: .55; text-decoration: underline; text-underline-offset: 2px; }
button.linkish:hover { opacity: .85; }
ul.notes { list-style: none; padding: 0; margin: 0 0 14px; max-height: 60vh; overflow-y: auto; text-align: left; }
ul.notes li { padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.1); font-size: 14px; }
ul.notes li:last-child { border-bottom: 0; }
ul.notes li .muted { font-size: 12px; margin-left: 6px; }
ul.notes li div { margin-top: 2px; }
/* dugo ime se skrati s „…”, a bodovi/žetoni uz ime uvijek ostanu vidljivi */
.nameplate .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nameplate > :not(.nm) { flex: none; }

/* ---------- grupni chat (svi koji su online) ---------- */
.lobby-btn { position: relative; }
.lobby-btn .badge { position: absolute; top: -6px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 800; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--felt2); }
.lobby-btn .lb-n:not(:empty)::before { content: '· '; }
.lobby-btn .lb-n { font-size: .85em; font-weight: 500; }
.menu.home > .lobby-main { width: 100%; margin: 0 0 12px; display: flex; align-items: center; justify-content: center; gap: 6px; }
@media (min-width: 900px) and (min-height: 520px) { .menu.home > .lobby-main { grid-column: 1 / -1; margin: 0; } }
.chat.lobby-chat { gap: 0; }
.chat-head #lcWho.on { background: rgba(229,199,122,.35); }
.lc-u { background: none; padding: 0; margin: 0; border: 0; color: inherit; font: inherit; font-weight: 700; display: inline-flex; align-items: center; gap: 5px; cursor: pointer; box-shadow: none; min-height: 0; }
.lc-u:hover { text-decoration: underline; text-underline-offset: 2px; }
.lc-del { background: none; border: 0; box-shadow: none; padding: 0 4px; min-height: 0; font-size: 11px; color: inherit; opacity: .45; cursor: pointer; }
.lc-del:hover { opacity: .9; }
.lc-join { display: block; margin-top: 6px; }
.msg.mine .lc-join { background: #14432b; color: var(--cream); }
.lc-who { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.lc-who li { padding: 6px 8px; border-radius: 10px; background: rgba(0,0,0,.2); }
.lc-who .lc-u { width: 100%; font-weight: 500; gap: 8px; }
.lc-who .lc-u b { font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lc-who .tag { margin-left: auto; }
.lc-who-head { font-size: 13px; margin: 0 2px 6px; }
.lc-pick { margin: 0 0 8px; padding: 10px; border-radius: 12px; background: rgba(0,0,0,.3); border: 1px solid rgba(229,199,122,.35); animation: fade .15s; }
.lc-pick-head { display: flex; align-items: center; gap: 10px; }
.lc-pick-head .n { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.lc-pick-head .n b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lc-pick-head .n .muted { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lc-pick-btns { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; margin-top: 8px; }
.lc-pick-btns .muted { font-size: 13px; }
#lcRoom { padding: 10px; }
@media (max-width: 899px), (max-height: 519px) {
  .chat.lobby-chat { height: min(78vh, 600px); height: min(78dvh, 600px); }
}
.av.xs .pres { width: 8px; height: 8px; right: -2px; bottom: -2px; box-shadow: 0 0 0 1px #173f2a; }

/* ---------- Čovječe ne ljuti se ---------- */
.cj-dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; flex: none; box-shadow: 0 0 0 1.5px rgba(255,255,255,.85); vertical-align: -1px; }
.cj-dot.c0 { background: #d8443c; } .cj-dot.c1 { background: #2f78d0; } .cj-dot.c2 { background: #2ea35f; } .cj-dot.c3 { background: #e6b422; }
.cj { --bs: min(96vw, calc(100vh - 262px), 560px); flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 0 4px 8px; }
@supports (height: 100dvh) { .cj { --bs: min(96vw, calc(100dvh - 262px), 560px); } }
.cj-wrap { display: grid; width: var(--bs); grid-template-columns: 1fr 1fr; grid-template-areas: "tl tr" "b b" "bl br"; row-gap: 6px; }
.cj-board { grid-area: b; position: relative; width: var(--bs); height: var(--bs); }
.cj-pl { min-height: 40px; display: flex; align-items: center; min-width: 0; }
.cj-pl.tl { grid-area: tl; } .cj-pl.tr { grid-area: tr; justify-content: flex-end; } .cj-pl.bl { grid-area: bl; } .cj-pl.br { grid-area: br; justify-content: flex-end; }
.cj-pl .nameplate { max-width: calc(var(--bs) / 2 - 44px); }
.cj-pl .nm { overflow: hidden; text-overflow: ellipsis; }
.cj-home { font-size: .85em; font-weight: 800; color: var(--gold); margin-left: 2px; }
.cj-home::before { content: '⌂ '; font-weight: 600; opacity: .8; }
/* gornji red: oblačić ide ispod avatara (iznad bi ga sakrila gornja traka) */
.cj-pl.tl .av .bubble, .cj-pl.tr .av .bubble { bottom: auto; top: calc(100% + 9px); transform-origin: 12px 0; }
.cj-pl.tr .av .bubble { transform-origin: calc(100% - 12px) 0; }
.cj-pl.tl .av .bubble::after, .cj-pl.tr .av .bubble::after { top: auto; bottom: 100%; border-top: 0; border-bottom: 7px solid var(--cream); }
.cj-svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 4px 10px rgba(0,0,0,.45)); }
.cj-bg { fill: url(#cjbg); stroke: #8a6a35; stroke-width: .07; }
.cj-pad { opacity: .28; stroke: rgba(0,0,0,.25); stroke-width: .05; }
.cj-pad.off { opacity: .1; }
.cj-hole { fill: rgba(255,255,255,.55); stroke: rgba(0,0,0,.35); stroke-width: .05; }
.cj-path { fill: none; stroke: #8a6a35; stroke-width: .09; stroke-linejoin: round; opacity: .7; }
.cj-sq { fill: #fffaf0; stroke: #6b5129; stroke-width: .06; }
.cj-sq.st { stroke: rgba(0,0,0,.45); stroke-width: .07; }
.cj-stdot { fill: rgba(255,255,255,.75); }
.cj-ln { opacity: .55; stroke: rgba(0,0,0,.35); stroke-width: .05; }
.cj-mid { opacity: .75; stroke: #fffaf0; stroke-width: .05; }
.cj-pc .sh { fill: rgba(0,0,0,.35); }
.cj-pc .body { stroke: rgba(0,0,0,.55); stroke-width: .045; }
.cj-pc .head { stroke: rgba(255,255,255,.7); stroke-width: .04; }
.cj-pc.last .body { stroke: #fff; stroke-width: .07; }
.cj-pc.mv { cursor: pointer; }
.cj-pc .ring { fill: none; stroke: #fff; stroke-width: .07; stroke-dasharray: .25 .14; animation: cj-ring 1.6s linear infinite; transform-origin: 0 0; }
@keyframes cj-ring { to { transform: rotate(360deg); } }
.cj-pc.mv:hover .body { filter: brightness(1.15); }
.cj-dest { fill: rgba(255,255,255,.3); stroke: #1f1a14; stroke-width: .06; stroke-dasharray: .14 .1; cursor: pointer; animation: cj-dest 1s ease-in-out infinite alternate; }
.cj-dest.cap { stroke: #b8322a; stroke-width: .09; fill: rgba(216,68,60,.3); }
@keyframes cj-dest { from { opacity: .55; } to { opacity: 1; } }
/* kocka u sredini ploče */
.cj-die { position: absolute; left: 50%; top: 50%; width: calc(var(--bs) * .14); height: calc(var(--bs) * .14); margin: calc(var(--bs) * -.07) 0 0 calc(var(--bs) * -.07); padding: 0; border-radius: 18%;
  background: #fffdf7; border: 3px solid #999; box-shadow: 0 3px 8px rgba(0,0,0,.45), inset 0 -3px 0 rgba(0,0,0,.12); cursor: default; z-index: 2; }
.cj-die.c0 { border-color: #d8443c; } .cj-die.c1 { border-color: #2f78d0; } .cj-die.c2 { border-color: #2ea35f; } .cj-die.c3 { border-color: #e6b422; }
.cj-die.can { cursor: pointer; animation: cj-can 1.1s ease-in-out infinite; }
@keyframes cj-can { 50% { box-shadow: 0 0 0 5px rgba(229,199,122,.65), 0 3px 8px rgba(0,0,0,.45); } }
.cj-die.rolling { animation: cj-roll .5s ease-out; }
@keyframes cj-roll { 0% { transform: rotate(-200deg) scale(.6); } 60% { transform: rotate(20deg) scale(1.12); } 100% { transform: none; } }
.cj-die .pips { position: absolute; inset: 14%; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); place-items: center; }
.cj-die .pips i { width: 72%; height: 72%; border-radius: 50%; }
.cj-die .pips i.on { background: #1f1a14; }
.cj-die .q { font-size: calc(var(--bs) * .07); }
.cj-ctl { display: flex; flex-direction: column; align-items: center; gap: 6px; width: min(100%, 560px); }
.cj-ctl .signals { display: flex; flex-wrap: wrap; justify-content: center; min-width: 0; gap: 5px; }
.cj-status { text-align: center; font-size: 16px; font-weight: 700; color: #fff; text-shadow: 0 1px 3px #000; min-height: 1.3em; }
.cj-roll { padding: 10px 26px; font-size: 17px; border-radius: 999px; }
.seats li .cj-dot { width: 14px; height: 14px; }
@media (max-width: 899px) {
  .cj-status { font-size: 14px; }
  .cj-roll { padding: 8px 22px; font-size: 16px; }
}
/* PC: igrači lijevo i desno od ploče, ploča što veća */
@media (min-width: 900px) and (min-height: 520px) {
  .cj { --bs: min(calc(100vh - 170px), calc(100vw - 520px), 900px); gap: 8px; }
  .cj-ctl { flex-direction: row; flex-wrap: wrap; justify-content: center; width: min(100%, 900px); gap: 10px 16px; }
  .cj-ctl .signals button { font-size: 14px; padding: 6px 10px; }
  .cj-wrap { width: auto; grid-template-columns: 220px var(--bs) 220px; grid-template-rows: 1fr 1fr; grid-template-areas: "tl b tr" "bl b br"; column-gap: 18px; }
  .cj-pl { flex-direction: column; }
  .cj-pl.tl, .cj-pl.tr { align-self: start; margin-top: 8%; }
  .cj-pl.bl, .cj-pl.br { align-self: end; margin-bottom: 8%; }
  .cj-pl .pl { flex-direction: column; }
  .cj-pl .nameplate { max-width: 210px; }
  .cj-pl.tl .av .bubble, .cj-pl.tr .av .bubble { top: auto; bottom: calc(100% + 9px); }
  .cj-pl.tl .av .bubble::after, .cj-pl.tr .av .bubble::after { bottom: auto; top: 100%; border-bottom: 0; border-top: 7px solid var(--cream); }
  .cj-pl .pl-left .av .bubble, .cj-pl .pl-right .av .bubble { left: 50%; right: auto; translate: -50% 0; }
  .cj-pl .av .bubble::after { left: 50% !important; right: auto !important; margin-left: -7px !important; }
}
@media (min-width: 900px) and (min-height: 520px) { @supports (height: 100dvh) { .cj { --bs: min(calc(100dvh - 170px), calc(100vw - 520px), 900px); } } }

/* ---------- kviz Znalac ---------- */
.kv { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 4px 10px 10px; overflow-y: auto; }
.kv-card { width: min(100%, 760px); background: rgba(0,0,0,.28); border: 1px solid rgba(229,199,122,.25); border-radius: 18px; padding: 12px 14px 10px; box-shadow: 0 8px 24px rgba(0,0,0,.3); }
.kv-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
.kv-cat { flex: 1; min-width: 0; color: var(--gold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kv-no { opacity: .8; white-space: nowrap; }
.kv-x2 { background: var(--red); color: #fff; border-radius: 6px; padding: 1px 6px; font-size: 12px; }
.kv-timer { display: flex; align-items: center; gap: 8px; margin: 8px 0 4px; }
.kv-bar { flex: 1; height: 8px; border-radius: 4px; background: rgba(0,0,0,.4); overflow: hidden; }
.kv-bar i { display: block; height: 100%; width: 100%; border-radius: 4px; background: linear-gradient(90deg, #e05a3a, #e5c77a 35%, #6fcf7a);
  background-size: 100% 100%; transform-origin: 0 50%; animation: kv-bar var(--d, 15000ms) linear var(--e, 0ms) forwards; }
.kv-bar.done i { animation: none; transform: scaleX(0); }
@keyframes kv-bar { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.kv-sec { position: static; min-width: 28px; height: 24px; line-height: 20px; padding: 0 5px; border-radius: 12px; background: #14432b; border: 2px solid var(--gold); color: var(--gold); font-size: 13px; font-weight: 800; text-align: center; }
.kv-sec.low { border-color: #ff5a4a; color: #fff; background: var(--red); animation: tt-blink 1s infinite; }
.kv-q { font-size: 19px; font-weight: 700; line-height: 1.3; text-align: center; margin: 10px 4px 12px; min-height: 2.6em; display: flex; align-items: center; justify-content: center; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.kv-opts { display: grid; grid-template-columns: 1fr; gap: 7px; }
.kv-opt { display: flex; align-items: center; gap: 10px; text-align: left; padding: 10px 12px; min-height: 48px; border-radius: 12px; background: var(--cream); color: var(--ink); font-weight: 600; font-size: 16px; cursor: default; box-shadow: 0 2px 0 rgba(0,0,0,.25); }
.kv-opts.can .kv-opt { cursor: pointer; }
@media (hover: hover) { .kv-opts.can .kv-opt:hover { filter: brightness(1.06); box-shadow: 0 0 0 3px var(--gold), 0 2px 0 rgba(0,0,0,.25); } }
.kv-let { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: #14432b; color: var(--gold); font-weight: 800; font-size: 14px; }
.kv-ot { flex: 1; min-width: 0; }
.kv-who { display: flex; gap: 2px; flex: none; }
.kv-who .av { --s: 22px; }
.kv-opt.picked { background: var(--gold); color: #3a2a08; box-shadow: 0 0 0 3px #fff; }
.kv-opt.right { background: #3fae5f; color: #fff; box-shadow: 0 0 0 3px #b9f5c5; animation: kv-pop .35s ease-out; }
.kv-opt.right .kv-let { background: #fff; color: #2a7a40; }
.kv-opt.wrong { background: #c4473b; color: #fff; }
.kv-opt.wrong .kv-let { background: #fff; color: #b8322a; }
.kv-opt.dim { opacity: .55; }
@keyframes kv-pop { 50% { transform: scale(1.03); } }
.kv-opts.pics { grid-template-columns: 1fr 1fr; }
.kv-opts.pics .kv-opt { flex-wrap: wrap; justify-content: center; position: relative; padding: 8px; min-height: 76px; }
.kv-opts.pics .kv-let { position: absolute; top: 5px; left: 5px; width: 22px; height: 22px; font-size: 12px; }
.kv-opts.pics .kv-who { position: absolute; top: 4px; right: 4px; }
.kv-pic { display: block; line-height: 0; }
.kv-pic svg { display: block; height: 58px; width: auto; max-width: 100%; border-radius: 4px; box-shadow: 0 0 0 1px rgba(0,0,0,.35), 0 2px 4px rgba(0,0,0,.25); background: #fff; }
.kv-opts.pics .kv-ot.kv-pn { flex: 0 0 100%; text-align: center; font-size: 13px; line-height: 1.2; margin-top: 2px; }
.kv-status { text-align: center; font-size: 15px; font-weight: 700; min-height: 1.4em; margin-top: 9px; color: #fff; text-shadow: 0 1px 3px #000; }
.kv-intro { text-align: center; padding: 18px 14px; animation: kv-pop .4s ease-out; }
.kv-rn { font-size: 14px; letter-spacing: 2px; text-transform: uppercase; opacity: .85; }
.kv-big { font-size: 54px; line-height: 1.2; margin: 6px 0 2px; }
.kv-rt { font-family: Georgia, serif; font-size: 30px; color: var(--gold); font-weight: 700; }
.kv-mini { list-style: none; padding: 0; margin: 10px auto 0; max-width: 320px; text-align: left; counter-reset: kv; }
.kv-mini li { display: flex; gap: 8px; padding: 4px 10px; border-radius: 8px; counter-increment: kv; }
.kv-mini li::before { content: counter(kv) '.'; opacity: .7; width: 20px; }
.kv-mini li span { flex: 1; } .kv-mini li.mine { background: rgba(229,199,122,.18); }
.kv-pls { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; width: min(100%, 760px); }
.kv-pls.n2 { grid-template-columns: repeat(2, minmax(0, 170px)); justify-content: center; }
.kv-pls.n3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kv-pl { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 6px; border-radius: 12px; background: rgba(0,0,0,.2); border: 1px solid rgba(255,255,255,.08); min-width: 0; }
.kv-pl.mine { border-color: rgba(229,199,122,.55); }
.kv-pl.lead .kv-sc::before { content: '👑 '; }
.kv-pl .av { --s: 42px; }
.kv-pl .av.turn { animation: kv-think 1.4s ease-in-out infinite; }
@keyframes kv-think { 50% { box-shadow: 0 0 0 3px var(--gold), 0 2px 6px rgba(0,0,0,.4); } }
.kv-nm { font-size: 13px; font-weight: 600; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kv-sc { font-size: 15px; font-weight: 800; color: var(--gold); }
.kv-fire { font-size: 12px; color: #ffb35a; }
.kv-wins { font-size: 11px; color: #ffd35a; margin-left: 3px; white-space: nowrap; }
.kv-chip { position: absolute; top: 4px; right: 4px; font-size: 12px; font-weight: 800; padding: 1px 6px; border-radius: 8px; background: rgba(0,0,0,.4); }
.kv-chip.done { background: #2f78d0; color: #fff; } .kv-chip.wait { opacity: .6; }
.kv-chip.ok { background: #3fae5f; color: #fff; animation: kv-pop .35s ease-out; } .kv-chip.bad { background: #c4473b; color: #fff; }
.kv .signals { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; }
.kv-res .av { --s: 22px; vertical-align: middle; }
.kv-rk { display: inline-block; width: 22px; }
@media (max-width: 899px) {
  .kv { justify-content: flex-start; gap: 8px; padding-top: 2px; }
  .kv-card { padding: 10px 10px 8px; border-radius: 14px; }
  .kv-q { font-size: 17px; margin: 6px 2px 9px; min-height: 2.4em; }
  .kv-opt { font-size: 15px; min-height: 44px; padding: 8px 10px; }
  .kv-pl .av { --s: 36px; }
  .kv .signals button { padding: 6px 10px; font-size: 15px; }
}
@media (max-width: 899px) and (max-height: 700px) {
  .kv-opts { gap: 5px; } .kv-opt { min-height: 40px; padding: 6px 10px; }
  .kv-pic svg { height: 46px; } .kv-opts.pics .kv-opt { min-height: 60px; }
  .kv-pl { padding: 5px 3px 4px; } .kv-pl .avw .cml { display: none; }
}
@media (min-width: 900px) and (min-height: 520px) {
  .kv { gap: 16px; }
  .kv-card { padding: 18px 22px 14px; }
  .kv-head { font-size: 15px; }
  .kv-q { font-size: 26px; margin: 18px 8px 20px; }
  .kv-opts { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kv-opts.pics .kv-opt { min-height: 96px; } .kv-pic svg { height: 76px; }
  .kv-opt { font-size: 18px; min-height: 62px; padding: 12px 16px; }
  .kv-let { width: 34px; height: 34px; font-size: 16px; }
  .kv-status { font-size: 17px; }
  .kv-pl .av { --s: 54px; }
  .kv-nm { font-size: 15px; } .kv-sc { font-size: 18px; }
}
/* izbor igre: 6 igara u dva reda na mobitelu */
@media (max-width: 899px), (max-height: 519px) {
  .seg[data-seg="kind"], .seg[data-seg="roomKind"] { flex-wrap: wrap; }
  .seg[data-seg="kind"] button, .seg[data-seg="roomKind"] button { flex: 1 0 30%; }
}
/* kviz: stalne sobe, pitanja na pisanje, poredak s više igrača */
.kv-rooms { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.kv-room { min-width: 0; }
.kv-room { display: flex; align-items: center; gap: 7px; padding: 9px 9px; border-radius: 11px; background: rgba(255,255,255,.1); color: var(--cream); font-weight: 600; font-size: 14px; text-align: left; }
.kv-room.mix { grid-column: 1 / -1; background: rgba(229,199,122,.22); }
.kv-ri { font-size: 18px; } .kv-rn2 { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kv-rc { font-size: 12px; opacity: .6; white-space: nowrap; } .kv-rc.on { opacity: 1; color: var(--gold); font-weight: 800; }
.kv-hard { background: #c0392b; color: #fff; border-radius: 6px; padding: 1px 6px; font-size: 12px; white-space: nowrap; margin-left: 4px; }
.kv-song { text-align: center; font-size: 13px; opacity: .85; margin: 2px 0 6px; font-style: italic; }
.kv-w { background: #2f78d0; color: #fff; border-radius: 6px; padding: 1px 6px; font-size: 12px; white-space: nowrap; }
.kv-form { display: flex; gap: 8px; }
.kv-form input { flex: 1; min-width: 0; font-size: 18px; background: var(--cream); color: var(--ink); border: 0; border-radius: 12px; padding: 12px 14px; user-select: text; -webkit-user-select: text; }
.kv-form input::placeholder { color: #8a7d68; }
.kv-form button { flex: none; }
.kv-typed, .kv-answer { text-align: center; padding: 12px; border-radius: 12px; background: rgba(0,0,0,.25); font-size: 17px; }
.kv-answer { background: #3fae5f; color: #fff; animation: kv-pop .35s ease-out; }
.kv-typedlist { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; }
.kv-typedlist li { font-size: 13px; padding: 3px 8px; border-radius: 8px; background: rgba(0,0,0,.3); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kv-typedlist li.ok { background: rgba(63,174,95,.85); } .kv-typedlist li.bad { background: rgba(196,71,59,.8); }
.kv-pls.n5 { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); max-height: 34vh; overflow-y: auto; padding-top: 2px; }
.kv-row { position: relative; display: flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 10px; background: rgba(0,0,0,.2); min-width: 0; }
.kv-row.mine { box-shadow: inset 0 0 0 1px rgba(229,199,122,.6); }
.kv-row .kv-nm { flex: 1; min-width: 0; }
.kv-row .kv-chip { position: static; }
.kv-row .av { --s: 26px; }
.kv-row .av .bubble { left: 0; translate: none; }
@media (min-width: 900px) and (min-height: 520px) {
  .kv-form input { font-size: 20px; padding: 14px 16px; }
}
.kv-say { flex: 0 1 auto; min-width: 0; max-width: 55%; font-size: 12px; font-weight: 600; background: var(--cream); color: var(--ink); border-radius: 8px; padding: 1px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; animation: pop .25s ease-out; }
.kv-row .kv-nm { flex: 1 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 899px) { .kv-wt { display: none; } }
.kv-pls.n1 { grid-template-columns: minmax(0, 170px); justify-content: center; }

/* ---------- povijest partija, admin ---------- */
.hist { list-style: none; margin: 0 0 10px; padding: 0; }
.hist li + li { margin-top: 6px; }
.hist-item { width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; background: rgba(0,0,0,.2); color: var(--cream); font-weight: 500; padding: 9px 12px; border-radius: 10px; }
.hist-item .hk { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hist-item .hk .muted { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hres { flex: 0 0 auto; font-size: 12px; font-weight: 800; padding: 3px 8px; border-radius: 8px; }
.hres.win { background: #2f8f52; color: #fff; } .hres.loss { background: rgba(184,50,42,.85); color: #fff; } .hres.draw { background: rgba(255,255,255,.18); }
.glog-res { text-align: center; margin: 6px 0 8px; }
.glog { background: rgba(0,0,0,.2); border-radius: 10px; padding: 8px 10px; font-size: 13px; line-height: 1.45; }
.glog .lh { color: var(--gold); font-weight: 700; margin: 8px 0 2px; }
.glog .lh:first-child { margin-top: 0; }
.glog .ll { padding: 2px 0; border-bottom: 1px solid rgba(255,255,255,.06); }
.glog .ll .n { display: inline-block; min-width: 22px; opacity: .6; }
.glog .won { color: #8be0a6; font-weight: 600; }
.glog .ic { white-space: nowrap; font-weight: 600; }
.glog .fc { white-space: nowrap; font-weight: 700; background: var(--cream); color: var(--ink); border-radius: 4px; padding: 0 3px; }
.glog .fc.red { color: var(--red); }
.okbox { background: rgba(63,191,106,.15); border-radius: 8px; padding: 8px 10px; font-size: 14px; margin: 8px 0 0; }
.okbox code { font-size: 17px; font-weight: 800; color: var(--gold); letter-spacing: 1px; }
/* kviz: ljestvica skupljenih bodova */
.kv-top { margin-top: 12px; padding: 10px; border-radius: 12px; background: rgba(0,0,0,.18); }
.kv-th { font-weight: 800; color: var(--gold); margin-bottom: 6px; }
.kv-tabs { display: grid; grid-template-columns: auto auto repeat(8, minmax(0, 1fr)); gap: 3px; margin-bottom: 8px; }
.kv-tabs button { padding: 5px 0; min-width: 0; font-size: 13px; overflow: hidden; border-radius: 8px; background: rgba(255,255,255,.1); color: var(--cream); box-shadow: none; }
.kv-tabs button.txt { padding: 5px 7px; font-size: 12px; }
.kv-tabs button.on { background: var(--gold); color: var(--ink); font-weight: 800; }
.kv-board { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 3px; }
.kv-board li { display: flex; align-items: center; gap: 7px; padding: 4px 8px; border-radius: 9px; background: rgba(255,255,255,.06); min-width: 0; }
.kv-board li.mine { background: rgba(229,199,122,.22); }
.kv-board li.gap { background: none; justify-content: center; opacity: .6; padding: 0; }
.kv-board .av { --s: 26px; }
.kv-tr { width: 26px; text-align: center; flex: none; opacity: .75; font-variant-numeric: tabular-nums; }
.kv-tn { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kv-board b { font-variant-numeric: tabular-nums; }
.kv-tnote { margin: 8px 0 0; font-size: 13px; }
.kv-prize { margin: 0 0 8px; font-size: 13px; padding: 6px 8px; border-radius: 8px; background: rgba(240,200,90,.14); }
.kv-tot { color: var(--gold); font-weight: 800; white-space: nowrap; }

/* ---------- dukati i trgovina ---------- */
.duk { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; white-space: nowrap; }
.dk { display: inline-block; width: 1em; height: 1em; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 35% 30%, #fff6c8 0 12%, #f2cf55 30%, #c99a1c 70%, #8a6410 100%);
  box-shadow: inset 0 0 0 1.5px #a37a12, 0 1px 2px rgba(0,0,0,.4); position: relative; }
.dk::after { content: ''; position: absolute; inset: 27%; border-radius: 50%; box-shadow: inset 0 0 0 1.2px rgba(120,84,10,.8); }
button .duk { font-weight: inherit; }
.wallet-box .duk { font-size: 1.05em; }

/* titula uz ime */
.ti { display: inline-block; vertical-align: middle; font-size: 10px; font-weight: 800; letter-spacing: .02em; line-height: 1; padding: 2px 6px; margin-left: 4px; border-radius: 6px;
  background: linear-gradient(180deg, #f3dc95, #c9a13e); color: #3a2a08; white-space: nowrap; box-shadow: 0 1px 2px rgba(0,0,0,.35); }
.ti.big { font-size: 14px; padding: 5px 10px; margin: 0; }
.msg .who .ti, .lc-who .ti { font-size: 9px; padding: 1px 4px; }

/* značka u gornjem desnom kutu avatara */
.av .avbd { position: absolute; right: -7px; top: -6px; font-size: max(11px, calc(var(--s) * .42)); line-height: 1; pointer-events: none; filter: drop-shadow(0 1px 1.5px rgba(0,0,0,.6)); z-index: 2; }
.av.xs .avbd { font-size: 11px; right: -6px; top: -5px; }
.av.lg .avbd { font-size: 24px; right: -8px; top: -8px; }

/* okviri: prsten preko ruba avatara (maska ostavi samo prsten) */
.av.fr { --frg: var(--gold); --frw: 3px; box-shadow: 0 2px 6px rgba(0,0,0,.45); }
.av.fr::after { content: ''; position: absolute; inset: calc(var(--frw) * -1); border-radius: 50%; padding: var(--frw); background: var(--frg); pointer-events: none; z-index: 1;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0); }
.av.fr.turn { box-shadow: 0 0 0 calc(var(--frw) + 2px) var(--gold), 0 0 16px rgba(229,199,122,.9); }
.av.xs.fr { --frw: 2px; }
.av.lg.fr { --frw: 4px; }
.av.fr-srebro { --frg: linear-gradient(135deg, #f4f6f8, #9aa4ad 45%, #e9edf0 60%, #7d8790); }
.av.fr-zlato { --frg: linear-gradient(135deg, #fff2b0, #d4a52a 40%, #fbe08a 60%, #9c7414); }
.av.fr-more { --frg: conic-gradient(#0b4f8a, #1aa3d9, #7fe0f0, #1aa3d9, #0b4f8a); }
.av.fr-maslina { --frg: repeating-conic-gradient(#5f7d2a 0 14deg, #9bb54a 14deg 22deg, #3e5a1a 22deg 30deg); --frw: 4px; }
.av.fr-neon { --frg: #39ff88; }
.av.fr-neon:not(.turn) { box-shadow: 0 0 9px 3px rgba(57,255,136,.65); }
.av.fr-vatra { --frg: conic-gradient(#ff3b1f, #ffb21f, #ff6a00, #ffd84a, #ff3b1f); }
.av.fr-vatra::after { animation: fr-spin 2.2s linear infinite; }
.av.fr-vatra:not(.turn) { box-shadow: 0 0 10px 3px rgba(255,110,20,.75); }
.av.fr-duga { --frg: conic-gradient(#ff4d4d, #ffb84d, #fff04d, #4dff6a, #4dd2ff, #7a4dff, #ff4dd8, #ff4d4d); }
.av.fr-duga::after { animation: fr-spin 4s linear infinite; }
.av.fr-kralj { --frg: linear-gradient(135deg, #f7d778, #6a1f9a 30%, #f7d778 50%, #6a1f9a 70%, #f7d778); --frw: 4px; }
.av.fr-dijamant { --frg: conic-gradient(#ffffff, #a8f0ff, #ffffff, #c9d8ff, #ffffff, #b0fff0, #ffffff); }
.av.fr-dijamant::after { animation: fr-spin 6s linear infinite; }
.av.fr-dijamant:not(.turn) { box-shadow: 0 0 9px 3px rgba(190,240,255,.7); }
.av.fr-galaksija { --frg: conic-gradient(#1a0b3d, #6a3aff, #e04dff, #4dc3ff, #1a0b3d, #9b6bff, #1a0b3d); --frw: 4px; }
.av.fr-galaksija::after { animation: fr-spin 3s linear infinite; }
.av.fr-galaksija:not(.turn) { box-shadow: 0 0 11px 3px rgba(140,90,255,.75); }
.av.fr-sampion { --frg: conic-gradient(#fff6c8, #e5b322, #fff6c8, #c8102e, #fff6c8, #e5b322, #fff6c8); --frw: 5px; }
.av.fr-sampion::after { animation: fr-spin 2.5s linear infinite; }
.av.fr-sampion:not(.turn) { box-shadow: 0 0 12px 4px rgba(255,210,80,.85); }
@keyframes fr-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .av.fr::after { animation: none !important; } }

/* trgovina */
.sh-tabs { flex-wrap: wrap; }
.sh-tabs button { flex: 1 1 30%; font-size: 13px; padding: 8px 4px; white-space: nowrap; }
.sh-me { display: flex; align-items: center; gap: 14px; padding: 10px 12px; margin-bottom: 10px; border-radius: 12px; background: rgba(0,0,0,.2); }
.sh-grid { list-style: none; margin: 0 0 10px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.sh-it { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px 8px; border-radius: 12px; background: rgba(255,255,255,.07); text-align: center; }
.sh-it.own { background: rgba(255,255,255,.12); }
.sh-it.on { box-shadow: inset 0 0 0 2px var(--gold); }
.sh-it button { width: 100%; padding: 7px 4px; font-size: 13px; margin-top: auto; }
.sh-pv { height: 56px; display: flex; align-items: center; justify-content: center; }
.sh-nm { font-size: 13px; font-weight: 700; line-height: 1.15; }
.sh-st { font-size: 11px; min-height: 13px; color: var(--gold); }
.sh-big { font-size: 34px; line-height: 1; filter: drop-shadow(0 1px 2px rgba(0,0,0,.5)); }
.sh-tb { width: 64px; height: 44px; border-radius: 10px; box-shadow: inset 0 0 0 2px rgba(255,255,255,.3); }
.sh-kb { width: 34px; display: block; }
.sh-kb img { width: 100%; display: block; border-radius: 4px; }
.sh-earn { margin: 8px 0; padding-left: 18px; font-size: 14px; line-height: 1.5; }

/* stolovi (boja pozadine) – vidi samo igrač koji ga je kupio */
.sh-tb.tb-more, body.tb-more { --felt: #1d4f7a; --felt2: #12304f; --c1: #2c6ea6; }
.sh-tb.tb-bordo, body.tb-bordo { --felt: #6b1f2c; --felt2: #43111b; --c1: #8c2e3e; }
.sh-tb.tb-drvo, body.tb-drvo { --felt: #6a4524; --felt2: #3f2814; --c1: #8b5e34; }
.sh-tb.tb-ljubicasti, body.tb-ljubicasti { --felt: #4a2a6e; --felt2: #2b1744; --c1: #64408f; }
.sh-tb.tb-noc, body.tb-noc { --felt: #1b2330; --felt2: #0d1118; --c1: #2a3546; }
.sh-tb.tb-smaragd, body.tb-smaragd { --felt: #0f6b55; --felt2: #08402f; --c1: #18a07c; }
.sh-tb.tb-zlatni, body.tb-zlatni { --felt: #6e5416; --felt2: #3f2f0a; --c1: #a8862e; }
.sh-tb { background: radial-gradient(ellipse at 50% 40%, var(--c1, #2a7a4d) 0%, var(--felt, #1d5c3a) 45%, var(--felt2, #14432b) 100%); }
.sh-tb:not([class*="tb-"]) { --c1: #2a7a4d; }
body[class*="tb-"] { background: radial-gradient(ellipse at 50% 40%, var(--c1) 0%, var(--felt) 45%, var(--felt2) 100%); }
body.tb-drvo { background: repeating-linear-gradient(92deg, rgba(0,0,0,.06) 0 3px, transparent 3px 11px), radial-gradient(ellipse at 50% 40%, var(--c1) 0%, var(--felt) 45%, var(--felt2) 100%); }
.row-btns { display: flex; gap: 6px; }
.n > .ti { align-self: flex-start; margin: 2px 0 0; }
/* s kupljenim stolom i prozori/ladice dobiju njegovu boju */
body[class*="tb-"] .modal, body[class*="tb-"] .chat, body[class*="tb-"] .sf-panel, body[class*="tb-"] .sf-tab { background: var(--felt2); }
.av-pick .pen { z-index: 3; }

/* kutija za prijedloge */
textarea { resize: vertical; min-height: 96px; line-height: 1.4; }
.sugline { margin-top: 10px; }
.sugline button.linkish { opacity: .75; font-size: 13px; }
.sug-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.sug-list li { background: rgba(0,0,0,.2); border-radius: 10px; padding: 8px 10px; }
.sug-list li.done { opacity: .5; }
.sug-list .sug-t { white-space: pre-wrap; overflow-wrap: anywhere; margin: 4px 0 6px; }
.sug-list .row { justify-content: flex-end; }
.sug-list .row button { flex: 0 0 auto; }
/* profil igrača: klik na avatar/ime otvara njegovu statistiku */
.prof-link { background: none; border: 0; padding: 0; margin: 0; box-shadow: none; color: inherit; font: inherit; font-weight: inherit; cursor: pointer; flex: none; border-radius: 50%; }
span.prof-link { border-radius: 0; flex: 1; min-width: 0; }
.prof-link:hover .av { filter: brightness(1.08); }
.friends .fst { display: block; font-size: 12px; color: var(--gold); opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prof-head { margin-bottom: 10px; }

/* ---------- Skakavac (igra skakanja) ---------- */
.sk-stats, .sk-res { display: flex; gap: 8px; margin: 0 0 12px; }
.sk-stats > div, .sk-res > div { flex: 1; text-align: center; padding: 8px 4px; border-radius: 12px; background: rgba(0,0,0,.18); }
.sk-stats b, .sk-res b { display: block; font-size: 22px; color: var(--gold); font-variant-numeric: tabular-nums; }
.sk-stats small, .sk-res small { font-size: 12px; opacity: .8; }
.sk-how { margin: 10px 0 0; font-size: 13px; }
.kv-board .sk-fl { font-size: 12px; margin-left: auto; white-space: nowrap; }
.kv-board .sk-fl + b { min-width: 48px; text-align: right; }
body.sk-on { overflow: hidden; overscroll-behavior: none; }
body.sk-on #app { padding: 0; }
.sk-wrap { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; background: #0d2a1c; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.sk-cv { display: block; border-radius: 6px; box-shadow: 0 0 40px rgba(0,0,0,.5); }
.sk-top { position: absolute; top: calc(10px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: min(100%, 560px); display: flex; justify-content: flex-end; gap: 8px; padding: 0 12px; pointer-events: none; }
.sk-top .sk-btn { pointer-events: auto; width: 42px; height: 42px; padding: 0; border-radius: 50%; background: rgba(0,0,0,.45); color: #fff; font-size: 17px; }
.sk-pad { position: absolute; left: 0; right: 0; bottom: calc(14px + env(safe-area-inset-bottom)); display: flex; gap: 12px; padding: 0 14px; pointer-events: none; }
.sk-pad.hid, .sk-ov.hid { display: none; }
.sk-k { pointer-events: auto; width: 76px; height: 76px; padding: 0; border-radius: 50%; background: rgba(255,255,255,.22); color: #fff; font-size: 26px; border: 2px solid rgba(255,255,255,.45); touch-action: none; -webkit-tap-highlight-color: transparent; }
.sk-k.sk-j { margin-left: auto; width: 96px; height: 96px; font-size: 18px; font-weight: 900; background: rgba(229,199,122,.5); }
.sk-k.on { background: rgba(255,255,255,.5); transform: scale(.94); }
.sk-k.sk-j.on { background: rgba(229,199,122,.85); }
.sk-ov { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.45); padding: 16px; }
.sk-card { width: min(92vw, 360px); background: var(--felt2); border: 1px solid rgba(229,199,122,.4); border-radius: 18px; padding: 18px; text-align: center; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.sk-card h2 { font-size: 24px; margin-bottom: 12px; }
.sk-card .row { display: flex; gap: 8px; margin-top: 12px; }
.sk-card .row button { flex: 1; }
.sk-duk { font-weight: 800; color: var(--gold); margin: 6px 0 0; }
.sk-hint { font-size: 12px; margin: 10px 0 0; }
.sk-panel .seg { margin-bottom: 8px; }
.sk-joy { position: absolute; width: 0; height: 0; pointer-events: none; z-index: 2; }
.sk-joy.hid { display: none; }
.sk-joy::before { content: ''; position: absolute; left: -60px; top: -22px; width: 120px; height: 44px; border-radius: 22px; background: rgba(255,255,255,.18); border: 2px solid rgba(255,255,255,.4); }
.sk-joy span { position: absolute; left: -22px; top: -22px; width: 44px; height: 44px; border-radius: 50%; background: rgba(229,199,122,.75); box-shadow: 0 2px 8px rgba(0,0,0,.3); }

/* kviz + chat na mobitelu: chat je niska traka, kviz se može listati iznad nje i odgovarati dok je chat otvoren */
@media (max-width: 899px) {
  body.chat-kv .chat { height: min(34vh, 250px); height: min(34dvh, 250px); padding-top: 6px; }
  body.chat-kv .chat-head { padding-bottom: 4px; }
  body.chat-kv .chat-list { padding: 6px 2px; gap: 5px; }
  body.chat-kv .msg .txt { padding: 5px 9px; font-size: 14px; }
  body.chat-kv #app { padding-bottom: calc(min(34vh, 250px) + 12px); padding-bottom: calc(min(34dvh, 250px) + 12px); }
}

/* emoji reakcije na poruke */
.rxs { display: flex; flex-wrap: wrap; gap: 4px; margin: 3px 2px 0; align-items: center; }
.msg.mine .rxs { justify-content: flex-end; }
.rx { background: rgba(0,0,0,.25); color: inherit; border: 1px solid rgba(255,255,255,.12); border-radius: 999px; padding: 1px 7px; font-size: 13px; font-weight: 500; line-height: 1.5; min-height: 0; }
.rx span { font-size: 11px; opacity: .85; }
.rx.on { border-color: var(--gold); background: rgba(229,199,122,.2); }
.rx.add { opacity: .45; font-size: 12px; padding: 1px 6px; }
.msg:hover .rx.add, .rx.add.on { opacity: .9; }
.rx-pick { display: flex; gap: 2px; margin: 4px 0 0; background: rgba(0,0,0,.35); border-radius: 999px; padding: 3px 6px; width: max-content; max-width: 100%; }
.msg.mine .rx-pick { margin-left: auto; }
.rx-pick button { background: none; padding: 3px 5px; font-size: 20px; line-height: 1; min-height: 0; }
.rx-pick button:hover { transform: scale(1.2); }
.sug-kinds { flex-wrap: wrap; }
.sug-kinds button { flex: 1 1 45%; font-size: 14px; }
.sug-list .sug-h { font-weight: 700; margin-top: 4px; }
.sug-list .sug-st { font-size: 13px; margin-top: 2px; }
.sug-list .sug-st.ok { color: #7ee08a; }
.sug-list .sug-st.wait { opacity: .7; }
.sug-list .sug-note { color: inherit; opacity: .9; font-style: italic; margin-top: 2px; overflow-wrap: anywhere; }
.sug-list.mine li { opacity: 1; }
.sug-list li.fresh { outline: 2px solid #7ee08a; }
.sugline button.sug-res { opacity: 1; color: #7ee08a; font-weight: 700; }

/* ---------- partije uživo (gledanje) ---------- */
.live-btn { width: 100%; display: flex; align-items: center; justify-content: center; gap: 6px; }
.live-n { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: #e0473c; color: #fff; font-size: 12px; font-weight: 800; line-height: 20px; text-align: center; }
.live-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow-y: auto; }
.live-list li { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 11px; background: rgba(0,0,0,.22); }
.live-list li.cur { outline: 2px solid var(--gold); }
.live-av { display: flex; flex-wrap: wrap; width: 52px; flex: 0 0 52px; gap: 2px; }
.live-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.live-txt b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-pl { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-pl i { opacity: .6; font-size: 12px; }
.live-txt .muted { font-size: 12px; }
.live-empty { text-align: center; padding: 14px 4px; }
.spec-bar { display: flex; align-items: center; gap: 8px; margin: 0 8px 4px; padding: 5px 6px 5px 12px; border-radius: 11px; background: rgba(0,0,0,.35); border: 1px solid rgba(229,199,122,.35); color: var(--gold); font-size: 14px; font-weight: 600; }
.spec-bar #specLive { margin-left: auto; }
.watch-n { margin-left: 6px; padding: 1px 7px; border-radius: 9px; background: rgba(0,0,0,.3); font-size: 12px; font-weight: 700; }
.hand.spec .card { pointer-events: none; }
.chat-spec { display: none; margin: 8px 0 0; text-align: center; font-size: 13px; }
.chat.spec .chat-form { display: none; }
.chat.spec .chat-spec { display: block; }
@media (max-width: 899px) {
  .spec-bar { margin: 0 6px 2px; padding: 3px 4px 3px 10px; font-size: 13px; }
  .spec-bar button.small { padding: 5px 9px; font-size: 13px; }
}

/* skočni prozor "Što je novo" nakon updatea */
.whatsnew h2 { text-align: center; margin: 4px 0 8px; font-size: 26px; }
.whatsnew .wn-badge { display: block; width: max-content; margin: 0 auto; padding: 4px 12px; border-radius: 999px; background: linear-gradient(90deg, #f6c453, #f08a3c); color: #2a1600; font-weight: 700; font-size: 13px; }
.whatsnew ul.notes { max-height: 45vh; }

/* ---------- Šah ---------- */
.sah { --bs: min(96vw, calc(100vh - 300px), 600px); flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 0 4px 8px; }
@supports (height: 100dvh) { .sah { --bs: min(96vw, calc(100dvh - 300px), 600px); } }
.sah-main { display: flex; flex-direction: column; gap: 6px; width: var(--bs); }
.sah-pl { display: flex; align-items: center; gap: 8px; min-height: 42px; min-width: 0; }
.sah-pl .avw { flex: none; }
.sah-pi { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.sah-pi .nameplate { max-width: 100%; font-size: 15px; padding: 3px 10px; }
.sah-pi .nm { overflow: hidden; text-overflow: ellipsis; }
.sah-c { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: 0 0 0 1.5px rgba(0,0,0,.6); }
.sah-c.w { background: #fbf5e6; } .sah-c.b { background: #2b241c; box-shadow: 0 0 0 1.5px rgba(255,255,255,.7); }
.sah-caps { display: flex; align-items: center; min-height: 16px; flex-wrap: wrap; padding-left: 4px; }
.sah-caps i { width: 16px; height: 16px; margin-right: -5px; }
.sah-caps i .sp { width: 100%; height: 100%; }
.sah-caps b { margin-left: 9px; font-size: 12px; color: var(--gold); }
.sah-clk { flex: none; font: 700 20px/1 ui-monospace, Menlo, Consolas, monospace; padding: 6px 10px; border-radius: 8px; background: rgba(0,0,0,.35); color: rgba(255,255,255,.6); min-width: 74px; text-align: center; }
.sah-clk.run { background: var(--cream); color: var(--ink); box-shadow: 0 0 10px rgba(229,199,122,.6); }
.sah-clk.low { color: #fff; background: var(--red); }
.sah-clk.run.low { animation: pulse 1s infinite; }
.sah-bw { position: relative; width: var(--bs); height: var(--bs); }
.sah-board { display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); width: 100%; height: 100%; border-radius: 4px; overflow: hidden;
  box-shadow: 0 0 0 3px #5b4423, 0 6px 16px rgba(0,0,0,.5); user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.sah-board .sq { position: relative; display: flex; align-items: center; justify-content: center; }
.sah-board .sq.sl { background: #efe2c4; } .sah-board .sq.sd { background: #a97f52; }
.sah-board .sq.lm.sl { background: #e8d77e; } .sah-board .sq.lm.sd { background: #b9a149; }
.sah-board .sq.sel { background: #7fb46a !important; }
.sah-board .sq.chk { background: radial-gradient(circle, #ff4a3d 0%, #e0352b 35%, rgba(200,40,30,.0) 75%), #c99a6a; }
.sah-board.my .sq.mv { cursor: pointer; }
.sah-board.my { touch-action: none; } /* povlačenje figura prstom (bez pomicanja stranice) */
.sah-ghost { position: fixed; z-index: 60; pointer-events: none; transform: translate(-50%, -62%); filter: drop-shadow(0 4px 6px rgba(0,0,0,.45)); }
.sah-board .sq.tg { cursor: pointer; }
.sah-board .sq.tg::after { content: ''; position: absolute; width: 30%; height: 30%; border-radius: 50%; background: rgba(30,50,20,.38); }
.sah-board .sq.tgc { cursor: pointer; }
.sah-board .sq.tgc::after { content: ''; position: absolute; inset: 3%; border-radius: 50%; box-shadow: inset 0 0 0 calc(var(--bs) / 8 * .09) rgba(30,50,20,.42); }
.sah-board .sp { width: 92%; height: 92%; position: relative; z-index: 1; pointer-events: none; filter: drop-shadow(0 1px 1px rgba(0,0,0,.35)); }
.sah-board .rk, .sah-board .fl { position: absolute; font-size: calc(var(--bs) / 8 * .2); font-weight: 700; line-height: 1; opacity: .8; pointer-events: none; }
.sah-board .rk { left: 3px; top: 3px; } .sah-board .fl { right: 3px; bottom: 2px; }
.sah-board .sl .rk, .sah-board .sl .fl { color: #a97f52; } .sah-board .sd .rk, .sah-board .sd .fl { color: #efe2c4; }
/* figure */
.sp path, .sp circle { stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.sp.w path, .sp.w circle { fill: #fbf7ec; stroke: #1f1a14; }
.sp.b path, .sp.b circle { fill: #2b241c; stroke: #0d0a06; }
.sp .ln, .sp .cr { fill: none !important; }
.sp.w .ln { stroke: #1f1a14; stroke-width: 1.2; }
.sp.b .ln { stroke: #e5c77a; stroke-width: 1.2; }
.sp .cr { stroke-width: 2.4; }
.sp.w .dot { fill: #1f1a14 !important; stroke: none; } .sp.b .dot { fill: #e5c77a !important; stroke: none; }
/* promocija */
.sah-promo { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.45); z-index: 3; border-radius: 4px; }
.sah-promo > div { display: flex; gap: 6px; padding: 10px; background: var(--cream); border-radius: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.5); align-items: center; }
.sah-promo button[data-promo]:not(.small) { width: calc(var(--bs) / 7); height: calc(var(--bs) / 7); padding: 4px; background: #efe2c4; border-radius: 10px; }
.sah-promo button .sp { width: 100%; height: 100%; }
/* desno: status, potezi, gumbi */
.sah-side { display: flex; flex-direction: column; align-items: center; gap: 6px; width: var(--bs); min-width: 0; }
.sah-status { text-align: center; font-size: 15px; font-weight: 700; color: #fff; text-shadow: 0 1px 3px #000; min-height: 1.3em; }
.sah-offer { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px; padding: 6px 10px; border-radius: 12px; background: rgba(0,0,0,.35); font-weight: 700; color: var(--gold); }
.sah-offer.muted { color: rgba(255,255,255,.75); font-weight: 600; }
.sah-moves { display: flex; gap: 4px 6px; overflow-x: auto; white-space: nowrap; width: 100%; padding: 6px 8px; border-radius: 10px; background: rgba(0,0,0,.28); font-size: 14px; scrollbar-width: thin; min-height: 32px; align-items: center; }
.sah-moves .mn { color: rgba(255,255,255,.5); margin-left: 4px; }
.sah-moves .cur { background: var(--gold); color: #3a2a08; border-radius: 5px; padding: 0 4px; }
.sah-moves .fig { display: inline-block; width: 1.4em; height: 1.4em; vertical-align: -.36em; margin: 0 1px 0 -2px; }
.sah-moves .fig .sp { width: 100%; height: 100%; display: block; }
.sah-btns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.sah-side .signals { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; min-width: 0; }
.sah-pl.sah-up .av .bubble { bottom: auto; top: calc(100% + 9px); transform-origin: 12px 0; }
.sah-pl.sah-up .av .bubble::after { top: auto; bottom: 100%; border-top: 0; border-bottom: 7px solid var(--cream); }
/* povijest partije: zapis i završna pozicija */
.sah-moves.log { flex-wrap: wrap; white-space: normal; overflow: visible; }
.sah-board.mini { --bs: min(70vw, 260px); width: var(--bs); height: var(--bs); margin: 10px auto 0; }
@media (max-width: 899px) {
  .sah-clk { font-size: 17px; min-width: 64px; padding: 5px 8px; }
  .sah-side .signals button { padding: 5px 8px; }
}
/* PC: ploča lijevo, igrači iznad i ispod nje, desno popis poteza i gumbi */
@media (min-width: 900px) and (min-height: 520px) {
  .sah { --bs: min(calc(100vh - 190px), calc(100vw - 440px), 820px); flex-direction: row; align-items: center; gap: 22px; }
  .sah-side { width: 300px; align-self: stretch; justify-content: center; max-height: calc(var(--bs) + 110px); margin: auto 0; }
  .sah-moves { display: grid; grid-template-columns: 36px 1fr 1fr; flex: 1; max-height: 50vh; min-height: 120px; overflow-y: auto; white-space: normal; align-content: start; align-items: start; font-size: 15px; padding: 8px 10px; }
  .sah-moves .mn { margin: 0; }
  .sah-moves > span { padding: 1px 4px; }
  .sah-moves > .muted { grid-column: 1 / -1; }
  .sah-moves.log { display: flex; max-height: none; }
  .sah-status { font-size: 17px; }
  .sah-side .signals { display: flex; min-width: 0; }
  .sah-side .signals button { font-size: 15px; padding: 6px 10px; }
}
.sah-promo button.small { background: rgba(0,0,0,.12); color: var(--ink); align-self: stretch; }
