:root {
  --bg: #08110d;
  --bg2: #0d1b15;
  --panel: #111d17;
  --panel2: #172a21;
  --line: #24382d;
  --text: #e8efe9;
  --muted: #8ba296;
  --gold: #f2b134;
  --gold2: #ffd87a;
  --felt: #1e6b4a;
  --felt2: #134632;
  --red: #e5484d;
  --green: #2fb170;
  --blue: #3b82f6;
  --radius: 12px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: radial-gradient(1200px 700px at 50% -10%, #12301f 0%, var(--bg) 60%) fixed;
  color: var(--text);
  font: 15px/1.4 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
button, input, select { font: inherit; color: inherit; }
b { font-weight: 700; }
code { background: #0003; padding: 1px 6px; border-radius: 6px; color: var(--gold2); letter-spacing: .08em; }
.muted { color: var(--muted); }
small { color: var(--muted); }

/* ---------- dugmad i polja ---------- */
.btn {
  border: 1px solid var(--line); background: var(--panel2); color: var(--text);
  padding: .55em 1em; border-radius: 10px; cursor: pointer; font-weight: 600;
  transition: transform .06s, background .15s, border-color .15s, filter .15s;
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
}
.btn:hover:not(:disabled) { filter: brightness(1.15); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(#f6bf4a, #e1a021); color: #2a1c00; border-color: #b9801a; }
.btn.danger { background: #5a1f22; border-color: #8a2d31; }
.btn.ghost { background: transparent; }
.btn.big { padding: .8em 1.4em; font-size: 1.05em; }
.btn.mini { padding: .25em .6em; font-size: .85em; border-radius: 8px; }
.btn kbd { opacity: .55; font: 600 .7em ui-monospace, monospace; border: 1px solid currentColor; border-radius: 4px; padding: 0 .35em; margin-left: .2em; }
.icon-btn { background: transparent; border: 1px solid var(--line); border-radius: 8px; padding: .25em .55em; cursor: pointer; }
.icon-btn:hover { background: var(--panel2); }
input[type=text], input[type=number], select {
  background: #0b1612; border: 1px solid var(--line); border-radius: 9px; padding: .5em .7em; width: 100%;
}
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
input:disabled, select:disabled { opacity: .6; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.field .lbl { font-size: .8em; color: var(--muted); }
.check { display: flex; align-items: center; gap: 8px; margin: 8px 0; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--gold); }
.row { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.row.wrap { flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
h2, h3, h4 { margin: 0 0 8px; }
h4 { margin-top: 16px; color: var(--gold2); font-size: .9em; text-transform: uppercase; letter-spacing: .06em; }

/* ---------- lobi ---------- */
.lobby { max-width: 1040px; margin: 0 auto; padding: 32px 20px 60px; }
.hero { text-align: center; margin-bottom: 28px; }
.logo { font-size: clamp(34px, 6vw, 56px); font-weight: 300; letter-spacing: -.02em; display: inline-flex; align-items: center; gap: 12px; }
.logo b { color: var(--gold); font-weight: 800; }
.logo-mark {
  display: inline-grid; place-items: center; width: 1.1em; height: 1.1em; border-radius: 22%;
  background: linear-gradient(145deg, var(--felt), var(--felt2)); color: var(--gold); font-size: .85em;
  box-shadow: 0 6px 24px #0008, inset 0 0 0 2px #ffffff18;
}
.tagline { color: var(--muted); font-size: 1.1em; margin: 10px auto; max-width: 560px; }
.features { list-style: none; padding: 0; margin: 14px auto 0; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 820px; }
.features li { background: #ffffff0a; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: .85em; color: var(--muted); }
.lobby-cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; align-items: start; }
.box { background: linear-gradient(var(--panel), var(--bg2)); border: 1px solid var(--line); border-radius: 16px; padding: 20px; box-shadow: 0 10px 40px #0006; }
.lobby-side { display: flex; flex-direction: column; gap: 18px; }
.lobby-form .big { width: 100%; margin-top: 16px; }
.preview { display: block; margin: -4px 0 8px; }
@media (max-width: 800px) { .lobby-cols { grid-template-columns: 1fr; } .grid2 { grid-template-columns: 1fr; } }

/* ---------- okvir igre ---------- */
.game { height: 100vh; height: 100dvh; display: grid; grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
.game > .topbar { grid-column: 1 / -1; }
body.panel-open .game { grid-template-columns: 1fr 340px; }
.stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 14px; background: #0a1511; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 1.15em; font-weight: 300; }
.brand .logo-mark { font-size: 1em; width: 1.5em; height: 1.5em; }
.brand-name b { color: var(--gold); }
.room-name { color: var(--muted); font-size: .8em; margin-left: 6px; max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.blinds { text-align: center; line-height: 1.25; }
.blinds-main b { color: var(--gold2); }
.blinds .next, .pending { font-size: .8em; color: var(--muted); display: block; }
.pending { display: inline; color: var(--gold); }
.top-right { display: flex; gap: 8px; align-items: center; }
.badge { background: var(--panel2); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; font-size: .8em; color: var(--muted); }
.badge.pause { color: var(--gold); border-color: var(--gold); }

/* ---------- sto ---------- */
.table-root { flex: 1; min-height: 0; position: relative; container-type: size; }
.table-wrap {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(96cqw, 178cqh); height: min(54cqw, 96cqh);
  font-size: clamp(8px, min(1.55cqw, 2.9cqh), 17px);
}
.felt {
  position: absolute; inset: 7% 4%; border-radius: 50% / 50%;
  background: radial-gradient(ellipse at 50% 40%, var(--felt) 0%, var(--felt2) 75%);
  border: .9em solid #2a1d12;
  box-shadow: 0 0 0 .18em #7a5a2e, inset 0 0 6em #0008, 0 20px 60px #000a;
}
.felt::after {
  content: 'PickPoker100'; position: absolute; left: 0; right: 0; bottom: 20%; text-align: center;
  font-size: 2.2em; font-weight: 800; letter-spacing: .25em; color: #ffffff0d; text-transform: uppercase; pointer-events: none;
}
.center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .9em; }
.pot { height: 2.2em; display: flex; align-items: center; gap: .5em; font-size: 1.25em; font-weight: 700; background: #0006; border-radius: 999px; padding: 0 1em; min-width: 1px; }
.pot:empty { visibility: hidden; }
.chip-ico {
  display: inline-block; width: 1.2em; height: 1.2em; border-radius: 50%; background: var(--red);
  border: .22em dashed #fff9; box-shadow: 0 1px 2px #0008; flex: none;
}
.board { display: flex; gap: .55em; }
.board .card { width: 4.4em; height: 6.2em; }
.card.slot { background: #00000026; border: .12em dashed #ffffff22; box-shadow: none; }
.banner { min-height: 3.2em; display: flex; align-items: flex-start; justify-content: center; }
.hint { color: #ffffffa0; background: #0005; padding: .4em 1em; border-radius: 999px; font-size: 1.05em; }
.win-banner { background: #000a; border: .12em solid var(--gold); border-radius: .9em; padding: .5em 1.1em; text-align: center; animation: pop .35s ease-out; }
.win-line { font-size: 1.1em; }
.win-line b { color: var(--gold2); }
.win-line .hand { color: #fff; }

/* ---------- karte ---------- */
.card {
  width: 3.3em; height: 4.7em; background: #fafaf7; color: #14171a; border-radius: .45em;
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1;
  font-weight: 800; box-shadow: 0 .15em .5em #0008; position: relative; flex: none; user-select: none;
}
.card .r { font-size: 1.75em; letter-spacing: -.05em; }
.card .s { font-size: 1.65em; margin-top: .05em; }
.card.s-h, .card.s-d { color: #d3202c; }
.mini.s-h, .mini.s-d { color: #ff6b73; }
.mini { font-weight: 700; }
body.four .card.s-d, body.four .mini.s-d { color: #1565c0; }
body.four .card.s-c, body.four .mini.s-c { color: #1b8a3a; }
body.four .mini.s-d { color: #5aa2ff; }
body.four .mini.s-c { color: #55d27a; }
.card.back {
  background: repeating-linear-gradient(45deg, #1d4ed8 0 .35em, #1e40af .35em .7em);
  border: .22em solid #f4f4f4;
}
.card.dim { opacity: .38; filter: grayscale(.4); }
.card.dealt { animation: dealIn .38s cubic-bezier(.2, .8, .3, 1) both; }
@keyframes dealIn { from { transform: translateY(-2.5em) scale(.6) rotate(-8deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pop { from { transform: scale(.8); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- sedista ---------- */
.seat { position: absolute; transform: translate(-50%, -50%); width: 11.5em; z-index: 3; text-align: center; }
.seat.empty { width: auto; }
.sit-btn {
  background: #0007; border: .1em dashed #ffffff55; color: #ffffffcc; border-radius: 999px; cursor: pointer;
  padding: .55em 1.2em; display: flex; gap: .4em; align-items: center; font-size: 1em;
}
.sit-btn:hover { background: #000b; border-color: var(--gold); color: var(--gold2); }
.plate {
  position: relative; z-index: 2; display: flex; align-items: center; gap: .6em; text-align: left;
  background: linear-gradient(#1a2a22, #0f1a15); border: .12em solid #3a5446; border-radius: 999px; padding: .35em 1em .35em .35em;
  box-shadow: 0 .3em 1em #000a; overflow: hidden; min-width: 9.2em;
}
.avatar { width: 2.7em; height: 2.7em; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 1.1em; flex: none; box-shadow: inset 0 0 0 .12em #ffffff30; }
.info { min-width: 0; line-height: 1.2; }
.name { font-weight: 700; font-size: 1.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 7.2em; }
.stack { color: var(--gold2); font-weight: 700; }
.seat.me .plate { border-color: var(--gold); }
.seat.acting .plate { border-color: var(--gold); box-shadow: 0 0 0 .22em #f2b13455, 0 0 1.6em #f2b134aa; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 .35em #f2b13422, 0 0 2.2em #f2b134cc; } }
.seat.folded .plate { opacity: .55; }
.seat.folded .hole { opacity: .35; }
.seat.out .plate { opacity: .5; filter: grayscale(.6); }
.seat.winner .plate { border-color: #5fe0a0; box-shadow: 0 0 0 .25em #5fe0a066, 0 0 2em #5fe0a0aa; }
.timer { position: absolute; left: 0; right: 0; bottom: 0; height: .35em; background: #0008; }
.timer i { display: block; height: 100%; width: 100%; background: var(--gold); transition: width .25s linear; }
.timer.low i { background: var(--red); }
.cards-wrap { position: relative; display: flex; justify-content: center; height: 4.1em; margin-bottom: -.3em; z-index: 1; pointer-events: none; }
.cards-wrap > * { pointer-events: auto; }
.hole { display: flex; gap: .15em; }
.hole .card { width: 3em; height: 4.2em; }
.hole .card .r { font-size: 1.5em; }
.hole .card .s { font-size: 1.4em; }
.hole .card:first-child { transform: rotate(-6deg); }
.hole .card.second { transform: rotate(6deg) translateY(.1em); }
.hole .card.dealt:first-child { animation-name: dealIn; }
.seat.me .hole .card { width: 3.6em; height: 5em; }
.seat.me .cards-wrap { height: 4.9em; }
.peek {
  position: absolute; right: -1.6em; top: 1em; background: #000b; border: .1em solid #ffffff55; color: #fff;
  border-radius: 50%; width: 2.4em; height: 2.4em; cursor: pointer; font-size: 1em; touch-action: none;
}
.peek:active { background: var(--gold); }
.tags { display: flex; gap: .3em; justify-content: center; margin-top: .35em; }
.tag { font-size: .72em; font-weight: 800; padding: .1em .5em; border-radius: 999px; background: #ffffff1a; letter-spacing: .04em; }
.tag.sb { background: #3b82f655; }
.tag.bb { background: #e5484d66; }
.tag.strength { background: #000b; color: var(--gold2); font-size: .8em; }
.tag.allin { background: var(--red); }
.tag.out { background: #555; }
.bubble { position: absolute; left: 50%; top: -3.4em; transform: translateX(-50%); z-index: 5; font-size: .9em; font-weight: 800; padding: .2em .8em; border-radius: 999px; background: #000c; border: .1em solid #ffffff44; white-space: nowrap; animation: pop .25s ease-out; }
.bubble.fold { color: #ff8a8e; }
.bubble.raise, .bubble.bet { color: var(--gold2); border-color: var(--gold); }
.bubble.call, .bubble.check { color: #8ee6b8; }
.bubble.win { background: #134d33; border-color: #5fe0a0; color: #bffbd9; font-size: 1.05em; display: flex; flex-direction: column; align-items: center; line-height: 1.1; top: -4.2em; }
.bubble small { color: #d8ffe9; font-size: .75em; font-weight: 600; }
.bet { position: absolute; transform: translate(-50%, -50%); display: flex; align-items: center; gap: .35em; font-weight: 800; background: #0008; border-radius: 999px; padding: .15em .7em .15em .3em; z-index: 2; animation: pop .2s ease-out; }
.dealer-btn { position: absolute; transform: translate(-50%, -50%); width: 2.1em; height: 2.1em; border-radius: 50%; background: #fff; color: #111; font-weight: 900; display: grid; place-items: center; z-index: 2; box-shadow: 0 .15em .4em #000a; border: .15em solid #d9d9d9; }

/* ---------- akcije ---------- */
.actionbar {
  min-height: 92px; padding: 10px 14px 14px; background: linear-gradient(#0a1511, #070e0b); border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center;
}
.status { color: var(--muted); font-size: 1.05em; }
.status b { color: var(--text); }
.who { width: 100%; text-align: center; margin-bottom: 2px; }
.peek-big { margin-left: 10px; background: var(--panel2); border: 1px solid var(--gold); color: var(--gold2); border-radius: 999px; padding: .25em 1em; cursor: pointer; touch-action: none; }
.peek-big:active { background: var(--gold); color: #000; }
.act-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: stretch; justify-content: center; width: 100%; }
.act-row .btn:not(.mini) { min-width: 110px; min-height: 52px; font-size: 1.05em; }
.btn.fold { background: #4a1a1d; border-color: #7a2a2f; }
.btn.call { background: #134d33; border-color: #1f7a52; }
.btn.raise { background: linear-gradient(#f6bf4a, #e1a021); color: #2a1c00; border-color: #b9801a; min-width: 150px; }
.raise-box { display: flex; flex-direction: column; gap: 6px; min-width: min(340px, 100%); flex: 1; max-width: 520px; justify-content: center; }
.presets { display: flex; gap: 6px; flex-wrap: nowrap; }
.btn.mini.allin { border-color: var(--red); color: #ff9a9d; }
.slider-row { display: flex; gap: 10px; align-items: center; }
.raise-slider { flex: 1; accent-color: var(--gold); }
.raise-input { width: 8.5em; text-align: right; font-weight: 700; }
.turn-line { width: 100%; text-align: center; color: var(--muted); font-size: .85em; }

/* ---------- panel ---------- */
.panel { display: none; flex-direction: column; background: var(--panel); border-left: 1px solid var(--line); min-height: 0; overflow: hidden; }
body.panel-open .panel { display: flex; }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tab { flex: 1; background: transparent; border: 0; padding: 10px; color: var(--muted); cursor: pointer; font-weight: 700; border-bottom: 2px solid transparent; }
.tab.on { color: var(--gold2); border-bottom-color: var(--gold); }
.panel-body { flex: 1; min-height: 0; overflow: auto; padding: 10px 12px 18px; display: flex; flex-direction: column; }
.log-list { flex: 1; overflow-y: auto; font-size: .88em; display: flex; flex-direction: column; gap: 2px; }
.log-row { padding: 2px 6px; border-radius: 6px; }
.log-row.sys { color: var(--muted); }
.log-row.fold { color: #c98b8d; }
.log-row.raise { color: var(--gold2); }
.log-row.win { color: #8ee6b8; font-weight: 700; }
.log-row.level { color: #7db4ff; }
.log-row.street { color: #fff; background: #ffffff0d; margin-top: 4px; }
.mini { padding: 0 2px; }
.ledger { width: 100%; border-collapse: collapse; font-size: .9em; }
.ledger th { text-align: left; color: var(--muted); font-weight: 600; padding: 4px 4px; border-bottom: 1px solid var(--line); }
.ledger td { padding: 6px 4px; border-bottom: 1px solid #ffffff0a; }
.ledger .num { text-align: right; font-variant-numeric: tabular-nums; }
.ledger .pos { color: #6fe3a4; } .ledger .neg { color: #ff8a8e; }
.ledger tr.gone { opacity: .6; }
.row-actions { white-space: nowrap; text-align: right; }
.icon { background: transparent; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; padding: 1px 6px; margin-left: 3px; }
.icon:hover { background: var(--panel2); }
.icon.danger:hover { background: #5a1f22; }
.code-chip { background: var(--panel2); border: 1px dashed var(--gold); color: var(--gold2); border-radius: 8px; padding: 4px 12px; font-weight: 800; letter-spacing: .15em; cursor: pointer; }

/* ---------- modal i toast ---------- */
.backdrop { position: fixed; inset: 0; background: #000a; display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px; width: min(420px, 100%); box-shadow: 0 30px 80px #000c; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
#toast-root { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #2a1214; border: 1px solid var(--red); color: #ffd6d8; padding: 8px 16px; border-radius: 10px; box-shadow: 0 10px 30px #000a; animation: pop .2s; }

/* ---------- mali ekrani ---------- */
@media (max-width: 980px) {
  body.panel-open .game { grid-template-columns: 1fr; }
  .panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(92vw, 380px); z-index: 20; box-shadow: -20px 0 60px #000c; }
  .room-name { display: none; }
}
@media (max-width: 760px) {
  .table-wrap { width: min(98cqw, 100cqh); height: min(98cqw, 100cqh); font-size: clamp(7px, min(2.3cqw, 1.9cqh), 14px); }
  .felt { inset: 8% 6%; }
  .seat { width: 9.6em; }
  .plate { min-width: 7.6em; }
  .name { max-width: 5.4em; }
  .act-row .btn:not(.mini) { min-width: 90px; min-height: 48px; }
  .topbar { padding: 6px 10px; }
  .blinds { order: 3; width: 100%; }
}

/* ---------- online ---------- */
.spectator { width: 100%; text-align: center; color: var(--gold2); background: #f2b13414; border: 1px solid #f2b13444; border-radius: 10px; padding: 6px 10px; font-size: .92em; }
.self-actions { width: 100%; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.log-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.chat-form { display: flex; gap: 6px; }
.log-row.chat { color: var(--text); background: #ffffff0a; }
.log-row.chat b { color: var(--gold2); }
.conn-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 70; background: #7a2a2f; color: #fff; text-align: center; padding: 6px; font-weight: 700; }
.connecting { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: var(--muted); }
.spinner { width: 40px; height: 40px; border: 4px solid var(--line); border-top-color: var(--gold); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.code-badge { cursor: pointer; color: var(--gold2); border-color: var(--gold); font-weight: 700; letter-spacing: .08em; }
.invite { margin: 8px 0; }
.invite input { font-size: .85em; }

/* ---------- run it twice, zahtevi, dead button ---------- */
.boards { display: flex; flex-direction: column; align-items: center; gap: .15em; }
.board-label { font-size: .8em; color: #ffffffb0; letter-spacing: .08em; text-transform: uppercase; line-height: 1; }
.center.twice { gap: .35em; }
.center.twice .board .card { width: 3.3em; height: 4.6em; }
.center.twice .card .r { font-size: 1.35em; }
.center.twice .card .s { font-size: 1.25em; }
.center.twice .banner { min-height: 0; }
.center.twice .win-banner { padding: .3em .9em; }
.center.twice .win-line { font-size: .95em; }
.dealer-btn.dead { opacity: .55; background: #bbb; }
.rit { width: 100%; text-align: center; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.rit-title { font-weight: 800; font-size: 1.15em; color: var(--gold2); }
.rit-row { display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; }
.rit-row .btn { min-width: 140px; min-height: 46px; }
.small { font-size: .8em; }
.request { width: 100%; display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; background: #f2b1341c; border: 1px solid #f2b13466; border-radius: 10px; padding: 6px 10px; }
.dot { display: inline-grid; place-items: center; min-width: 1.4em; height: 1.4em; margin-left: 6px; padding: 0 4px; border-radius: 999px; background: var(--red); color: #fff; font-size: .75em; font-weight: 800; }
.req-box { background: #f2b13412; border: 1px solid #f2b13444; border-radius: 10px; padding: 6px 10px; margin-bottom: 10px; }
.req-box h4 { margin-top: 4px; }
.req-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 4px 0; }
.req-row .btn { margin-left: 4px; }
