/* Karata – izgled kazina: tamna čoja, zlato, staklo. Samo CSS, bez spoljnih fontova i slika (brzo učitavanje). */
:root {
  /* "Karata iz voza": drveni kupe, bordo sedišta, mesing */
  --wood:#5a3620; --wood2:#3b2213; --seat:#6e1f2a; --gold:#e0b15a; --gold2:#a8742a; --red:#c62828;
  --glass:rgba(40,16,12,.62); --glass2:rgba(255,236,200,.07); --line:rgba(224,177,90,.28);
  --text:#f6ecd9; --muted:rgba(246,236,217,.66); --neon:#e2483d;
}
* { box-sizing:border-box; }
html { -webkit-text-size-adjust:100%; }
body { margin:0; font-family:"Segoe UI",system-ui,-apple-system,Roboto,sans-serif; color:var(--text); min-height:100vh;
       background:
         radial-gradient(ellipse at 50% -10%, rgba(255,214,140,.18), transparent 55%),
         radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,.55) 100%),
         repeating-linear-gradient(90deg, rgba(0,0,0,.18) 0 2px, transparent 2px 120px),
         repeating-linear-gradient(90deg, rgba(255,255,255,.025) 0 1px, transparent 1px 9px),
         linear-gradient(180deg, var(--wood), var(--wood2));
       background-attachment:fixed; }
a { color:var(--gold); }

/* ---------- zaglavlje ---------- */
header { position:sticky; top:0; z-index:20; padding:8px 16px; border-top:3px solid var(--seat); display:flex; justify-content:space-between; align-items:center; gap:10px;
         background:linear-gradient(180deg, rgba(0,0,0,.85), rgba(0,0,0,.6)); backdrop-filter:blur(8px);
         border-bottom:1px solid var(--line); box-shadow:0 4px 20px rgba(0,0,0,.4); }
/* natpis kao mesingana pločica na vagonu */
h1 { margin:0; display:flex; align-items:baseline; gap:8px; cursor:default; padding:4px 14px 5px; border-radius:6px;
     font-family:Georgia,"Times New Roman",serif; font-size:23px; font-weight:700; letter-spacing:3px; text-transform:uppercase; color:#2b1a08;
     background:linear-gradient(180deg,#f7dc9c,var(--gold) 50%,var(--gold2)); border:1px solid #7a5418;
     box-shadow:inset 0 1px 0 rgba(255,255,255,.6), inset 0 -2px 0 rgba(0,0,0,.2), 0 2px 8px rgba(0,0,0,.5); }
h1 small { font-size:13px; letter-spacing:1px; text-transform:none; font-style:italic; font-weight:400; color:#4a2f0c; }
h2 { font-size:15px; text-transform:uppercase; letter-spacing:2px; color:var(--gold); margin:22px 0 10px; }
#userbar { display:flex; gap:8px; align-items:center; flex-wrap:wrap; justify-content:flex-end; }
#userInfo { display:flex; gap:8px; align-items:center; }
.pill { display:inline-flex; align-items:center; gap:6px; padding:6px 12px; border-radius:999px; background:var(--glass2);
        border:1px solid var(--line); font-weight:600; font-size:14px; white-space:nowrap; }
.chips { background:linear-gradient(180deg,#3a2c05,#1d1502); color:var(--gold); border-color:rgba(245,197,66,.5);
         box-shadow:inset 0 1px 0 rgba(255,255,255,.15), 0 0 12px rgba(245,197,66,.25); }
.chips.bump { animation:bump .6s ease; }
@keyframes bump { 30% { transform:scale(1.18); box-shadow:0 0 24px var(--gold); } }
#langSel, .iconbtn { padding:6px 8px; border-radius:999px; border:1px solid var(--line); background:var(--glass2); color:var(--text); font-size:14px; cursor:pointer; }
#langSel option { color:#111; }

/* ---------- raspored ---------- */
.view { display:none; padding:14px 16px 24px; max-width:1280px; margin:auto; animation:fade .25s ease; }
@keyframes fade { from { opacity:0; transform:translateY(6px); } }
.layout { display:grid; grid-template-columns:minmax(0,1fr) 310px; gap:18px; align-items:start; }
.side { position:sticky; top:70px; display:flex; flex-direction:column; gap:14px; }
.panel { background:var(--glass); border:1px solid var(--line); border-radius:16px; padding:20px; backdrop-filter:blur(6px);
         box-shadow:0 10px 30px rgba(0,0,0,.35); }
.narrow { max-width:400px; margin:60px auto; } .center { text-align:center; }
/* prozor kupea: pejzaž promiče (samo CSS) */
.hero { position:relative; overflow:hidden; border-radius:22px; padding:16px 18px 70px; margin-top:4px; min-height:190px;
        border:6px solid #2a160b; outline:2px solid var(--gold2); box-shadow:inset 0 0 30px rgba(0,0,0,.45), 0 8px 24px rgba(0,0,0,.5);
        background:
          radial-gradient(circle at 82% 30%, #fff3c4 0 22px, rgba(255,230,160,.5) 23px 34px, transparent 35px),
          linear-gradient(180deg, transparent 70%, #2f5d2a 70%, #24481f 100%),
          linear-gradient(180deg, #f6c27a 0%, #f3a76b 35%, #8fb7d8 100%);
        display:flex; justify-content:space-between; align-items:flex-start; gap:12px; flex-wrap:wrap; }
.hero::before { content:""; position:absolute; left:0; right:0; bottom:30%; height:34%; z-index:0;
        background:
          radial-gradient(ellipse 120px 60px at 60px 100%, #3f6e35 98%, transparent 100%) 0 0/260px 100% repeat-x,
          radial-gradient(ellipse 90px 40px at 50px 100%, #4f8442 98%, transparent 100%) 120px 0/200px 100% repeat-x;
        animation:ride 18s linear infinite; }
.hero::after { content:""; position:absolute; left:0; right:0; bottom:8%; height:8px; z-index:0;
        background:repeating-linear-gradient(90deg, #5b3a1f 0 18px, transparent 18px 46px); animation:ride2 1.6s linear infinite; }
@keyframes ride { from { background-position:0 0, 120px 0; } to { background-position:-520px 0, -280px 0; } }
@keyframes ride2 { from { background-position:0 0; } to { background-position:-46px 0; } }
.hero > * { position:relative; z-index:1; }
.hero > div:first-child { background:rgba(30,12,6,.72); padding:10px 14px; border-radius:12px; border:1px solid var(--line); max-width:640px; }
.hero b { font-size:20px; font-family:Georgia,serif; }
.hero .suits { font-size:30px; letter-spacing:6px; opacity:.55; white-space:nowrap; color:#2b1a08; }
@media (prefers-reduced-motion: reduce) { .hero::before, .hero::after { animation:none; } }

/* ---------- forme i dugmad ---------- */
input, #routeSel, #departSel { padding:12px 14px; font-size:16px; border-radius:10px; border:1px solid var(--line); width:100%; margin:6px 0;
        background:rgba(0,0,0,.35); color:var(--text); outline:none; }
input:focus { border-color:var(--gold); box-shadow:0 0 0 3px rgba(245,197,66,.2); }
button { padding:10px 18px; font-size:15px; border:none; border-radius:10px; cursor:pointer; font-weight:700; color:#1a1300;
         background:linear-gradient(180deg,#ececec,#bdbdbd); transition:transform .08s, filter .15s, box-shadow .15s; }
button:hover:not(:disabled) { filter:brightness(1.08); transform:translateY(-1px); }
button:active:not(:disabled) { transform:translateY(1px); }
button:disabled { opacity:.45; cursor:default; }
.primary { background:linear-gradient(180deg,#f7dc9c,var(--gold) 45%,var(--gold2)); box-shadow:0 4px 14px rgba(245,197,66,.3), inset 0 1px 0 rgba(255,255,255,.6); }
.ghost { background:var(--glass2); color:var(--text); border:1px solid var(--line); }
.wide { width:100%; margin-top:8px; }
.err { color:#ff8a80; min-height:20px; text-align:center; }
.muted { color:var(--muted); }

/* ---------- lobi ---------- */
.grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(230px,1fr)); gap:14px; }
.gcard { position:relative; overflow:hidden; background:linear-gradient(160deg, rgba(110,31,42,.55), rgba(40,12,10,.75));
         border:1px solid var(--line); border-radius:16px; padding:16px; display:flex; flex-direction:column; gap:8px;
         transition:transform .15s, box-shadow .15s, border-color .15s; }
.gcard:hover { transform:translateY(-4px); border-color:var(--gold); box-shadow:0 12px 30px rgba(0,0,0,.5), 0 0 18px rgba(245,197,66,.2); }
.gcard .icon { position:absolute; right:10px; top:2px; font-size:56px; font-weight:900; opacity:.13; pointer-events:none; }
.gcard h3 { margin:0; font-size:18px; } .gcard p { margin:0; color:var(--muted); font-size:14px; flex:1; }
.gcard.off { opacity:.45; filter:grayscale(.6); }
.gcard .fee { font-size:12px; color:var(--gold); }
.trow { display:flex; justify-content:space-between; align-items:center; gap:10px; background:var(--glass);
        border:1px solid var(--line); padding:10px 14px; border-radius:12px; margin-bottom:8px; flex-wrap:wrap; }
.trow.open { border-color:rgba(255,61,127,.55); box-shadow:0 0 14px rgba(255,61,127,.15); }
.tablebar { display:flex; justify-content:space-between; align-items:center; gap:10px; margin-bottom:8px; flex-wrap:wrap; }
.pot { color:var(--gold); font-weight:700; }

/* ---------- čet i rang lista ---------- */
.box { background:var(--glass); border:1px solid var(--line); border-radius:16px; padding:12px; backdrop-filter:blur(6px); }
.box h3 { margin:0 0 8px; font-size:13px; text-transform:uppercase; letter-spacing:1.5px; color:var(--gold); display:flex; justify-content:space-between; align-items:center; }
.chat-tabs { display:flex; gap:4px; }
.chat-tabs button { padding:3px 10px; font-size:12px; border-radius:999px; background:var(--glass2); color:var(--text); border:1px solid var(--line); }
.chat-tabs button.on { background:var(--gold); color:#1a1300; }
.chat-log { height:260px; overflow-y:auto; font-size:14px; display:flex; flex-direction:column; gap:4px; padding-right:4px; word-break:break-word; }
.chat-log .m b { color:var(--gold); } .chat-log .m.mine b { color:var(--neon); }
.chat-log .t { color:var(--muted); font-size:11px; margin-left:4px; }
.chat-form { display:flex; gap:6px; margin-top:8px; }
.chat-form input { margin:0; padding:9px 10px; font-size:14px; }
.chat-form button { padding:8px 12px; }
.top { margin:0; padding:0; list-style:none; font-size:14px; }
.top li { display:flex; justify-content:space-between; padding:4px 2px; border-bottom:1px solid rgba(255,255,255,.06); }
.top li:nth-child(1) b::before { content:"🥇 "; } .top li:nth-child(2) b::before { content:"🥈 "; } .top li:nth-child(3) b::before { content:"🥉 "; }
.top li.me { color:var(--gold); }

/* ---------- karte (zajedničko za sve igre) ---------- */
.card { width:70px; height:100px; color:#151515; border-radius:9px; display:inline-flex; flex-direction:column; justify-content:space-between;
        padding:5px 6px; font-weight:800; font-size:18px; user-select:none; position:relative;
        background:linear-gradient(160deg,#ffffff,#f1efe8); border:1px solid rgba(0,0,0,.15);
        box-shadow:0 3px 8px rgba(0,0,0,.45), inset 0 0 0 2px rgba(255,255,255,.7); transition:transform .12s, box-shadow .12s; }
.card .mid { text-align:center; font-size:30px; line-height:1; }
.card .br { align-self:flex-end; transform:rotate(180deg); }
.card.red { color:var(--red); }
.card.joker { color:#6a1b9a; background:linear-gradient(135deg,#fff,#f3e5f5); }
.card.back { background:repeating-linear-gradient(45deg,#6e1f2a 0 6px,#86283a 6px 12px); border:3px solid #f6ecd9; }
.card.ok:hover { box-shadow:0 10px 18px rgba(0,0,0,.5), 0 0 0 2px var(--gold); }

/* ---------- tvoj potez, poruke, konfete ---------- */
body.my-turn .g-status, body.my-turn .tk-status, body.my-turn .pf-status { animation:pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { text-shadow:0 0 14px var(--gold), 0 0 2px #fff; } }
#toast { position:fixed; bottom:24px; left:50%; transform:translateX(-50%); z-index:50; display:none; max-width:90%;
         background:linear-gradient(180deg,#2a2006,#140f02); color:var(--gold); border:1px solid var(--gold2);
         padding:12px 20px; border-radius:12px; font-weight:600; box-shadow:0 10px 30px rgba(0,0,0,.6); }
#confetti { position:fixed; inset:0; pointer-events:none; z-index:60; }

@media (max-width:900px) {
  .layout { grid-template-columns:1fr; }
  .side { position:static; }
  .chat-log { height:200px; }
}
@media (max-width:700px) {
  h1 { font-size:19px; letter-spacing:2px; }
  .card { width:52px; height:76px; font-size:14px; } .card .mid { font-size:22px; }
  .hero .suits { display:none; }
}

/* sto za igru: zelena čoja na preklopnom stočiću kupea */
#gameRoot, #soloRoot { background:radial-gradient(ellipse at center, #1d5a3a, #0f3523 80%); border:8px solid #3b2213; border-radius:20px;
        padding:12px; box-shadow:inset 0 0 40px rgba(0,0,0,.5), 0 10px 30px rgba(0,0,0,.5); }
#gameRoot:empty, #soloRoot:empty { display:none; }
.quick { background:linear-gradient(180deg,#e9594e,#b3261e); color:#fff; box-shadow:0 4px 12px rgba(198,40,40,.35); }

/* vožnja u zaglavlju */
.pill.trip { gap:8px; }
.tripbar { display:inline-block; width:70px; height:6px; border-radius:3px; background:rgba(255,255,255,.15); overflow:hidden; }
.tripbar i { display:block; height:100%; background:linear-gradient(90deg,var(--gold2),var(--gold)); }
@media (max-width:700px) { .pill.trip .tripbar { display:none; } .pill.trip { font-size:12px; } }

h1 { white-space:nowrap; flex-shrink:0; }
header { flex-wrap:wrap; }

/* =================== AKCIONI EKRAN (dok se igra) ===================
   Ceo ekran je sto: igrači gore, sto u sredini, ruka dole. Zone imaju stalne visine, pa se ništa ne pomera.
   Rezultat, dešavanja, pravila i čet iskaču preko dugmadi u traci stola. */
html.in-game, html.in-game body { height:100%; overflow:hidden; }
html.in-game header { padding:4px 12px; }
html.in-game h1 { font-size:17px; padding:2px 10px; }
html.in-game #mainLayout { display:block !important; max-width:none; padding:6px 10px 0; height:calc(100dvh - 52px); }
html.in-game .side { position:fixed; top:0; right:0; height:100dvh; width:min(380px, 94vw); z-index:70; padding:10px;
  background:linear-gradient(180deg,var(--wood),var(--wood2)); box-shadow:-10px 0 30px rgba(0,0,0,.6);
  transform:translateX(105%); transition:transform .2s ease; overflow-y:auto; }
html.in-game.pop-chat .side { transform:none; }
html.in-game .side .chat-log { height:calc(100dvh - 330px); min-height:160px; }
html.in-game #tableView { height:100%; display:flex !important; flex-direction:column; }
html.in-game .tablebar { flex:0 0 auto; margin:0 0 6px; }
.popbtns { display:none; gap:6px; align-items:center; }
html.in-game .popbtns { display:inline-flex; }
html.in-game .tablebar > #leaveBtn { display:none; }
.popbtns .ghost { padding:6px 10px; font-size:18px; position:relative; }
.popbtns .ghost.on { background:var(--gold); }
.popbtns .dot { display:none; position:absolute; top:3px; right:4px; width:9px; height:9px; border-radius:50%; background:var(--neon); box-shadow:0 0 6px var(--neon); }
html.chat-unread .popbtns .dot { display:block; }
#popShade { display:none; position:fixed; inset:0; z-index:60; background:rgba(0,0,0,.45); }
html.pop-score #popShade, html.pop-log #popShade, html.pop-rules #popShade, html.pop-chat #popShade { display:block; }

html.in-game #gameRoot { flex:1 1 auto; min-height:0; display:flex; flex-direction:column; overflow:hidden; padding:8px 10px; }
html.in-game #waiting { margin:auto; }
/* dno igara (paneli) ne zauzima mesto u igri */
html.in-game .g-bottom, html.in-game .tk-bottom, html.in-game .pf-bottom { display:contents; }
html.in-game .panel-log, html.in-game .panel-rules, html.in-game .panel-score {
  display:none; position:fixed; z-index:65; left:50%; top:54%; transform:translate(-50%,-50%) !important;
  width:min(560px, 94vw); max-height:76dvh; overflow-y:auto; margin:0; }
html.in-game .panel-log, html.in-game .panel-rules, html.in-game .g-box.panel-score {
  background:linear-gradient(180deg,#3a1a14,#24100c); border:1px solid var(--gold2); border-radius:14px; padding:14px 16px; font-size:15px; }
html.pop-log .panel-log, html.pop-rules .panel-rules, html.pop-score .panel-score { display:block; }
html.in-game .pf-wrap { grid-template-columns:1fr; flex:1 1 auto; min-height:0; display:flex; flex-direction:column; }
html.in-game .pf-wrap > div:first-child { flex:1 1 auto; min-height:0; display:flex; flex-direction:column; }
html.in-game .pf-paper.panel-score { width:min(400px, 94vw); font-size:16px; }

/* stalne zone: gore igrači, sredina sto (raste), dole status, ruka, dugmad */
html.in-game .g-players, html.in-game .tk-players, html.in-game .pf-top { flex:0 0 auto; }
html.in-game .g-pl, html.in-game .tk-pl, html.in-game .pf-pl { padding:5px 10px; font-size:13px; line-height:1.35; min-width:0; }
html.in-game .g-info, html.in-game .tk-trump, html.in-game .pf-info { flex:0 0 auto; margin:6px 0 0; height:26px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
html.in-game .tk-trump { height:auto; max-height:64px; display:flex; align-items:center; justify-content:center; gap:8px; }
html.in-game .tk-trump .card { width:calc(var(--card-w) * .6); height:calc(var(--card-h) * .6); font-size:calc(var(--card-w) * .15); padding:3px 4px; flex:0 0 auto; }
html.in-game .tk-trump .card .mid { font-size:calc(var(--card-w) * .26); }
html.in-game .g-table, html.in-game .tk-table, html.in-game .pf-table, html.in-game .rm-melds {
  flex:1 1 auto; min-height:0; overflow:auto; margin:6px 0; align-content:center; }
html.in-game .rm-piles { flex:0 0 auto; }
html.in-game .rm-melds { justify-content:center; }
html.in-game .g-status, html.in-game .tk-status, html.in-game .pf-status { flex:0 0 30px; height:30px; line-height:30px; min-height:0; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
html.in-game .rm-staged { flex:0 0 auto; max-height:70px; overflow:hidden; }
html.in-game .g-hand, html.in-game .tk-hand, html.in-game .pf-hand {
  flex:0 0 auto; height:calc(var(--card-h) + 26px); padding-top:20px; margin:0; flex-wrap:nowrap; justify-content:center; gap:0; overflow:visible; }
html.in-game .g-actions, html.in-game .tk-actions, html.in-game .pf-actions { flex:0 0 58px; height:58px; margin:4px 0 0; overflow:hidden; align-content:flex-start; }
html.in-game .g-actions .muted, html.in-game .pf-actions .muted { font-size:12px; }

/* velike karte u igri (na stolu i u ruci) */
html.in-game { --card-w:clamp(54px, 7.4vw, 104px); --card-h:calc(var(--card-w) * 1.42); }
html.in-game #gameRoot .card { width:var(--card-w); height:var(--card-h); font-size:calc(var(--card-w) * .24); padding:4px 6px; border-radius:calc(var(--card-w) * .11); flex:0 0 auto; }
html.in-game #gameRoot .card .mid { font-size:calc(var(--card-w) * .42); }
html.in-game #gameRoot .rm-meld .card { width:calc(var(--card-w) * .62); height:calc(var(--card-h) * .62); font-size:calc(var(--card-w) * .16); margin-right:calc(var(--card-w) * -.24); }
html.in-game #gameRoot .rm-meld .card .mid { font-size:calc(var(--card-w) * .26); }
html.in-game .g-hand .card.ok:hover, html.in-game .tk-hand .card.ok:hover, html.in-game .pf-hand .card.ok:hover { transform:translateY(-14px); }
html.in-game .card.sel { transform:translateY(-18px) !important; }

@media (max-height:560px) { html.in-game { --card-w:clamp(44px, 6vw, 80px); } }
@media (max-width:700px) {
  html.in-game { --card-w:clamp(44px, 12vw, 70px); }
  html.in-game .g-players, html.in-game .tk-players, html.in-game .pf-top { display:flex; flex-wrap:nowrap; overflow-x:auto; gap:6px; }
  html.in-game .g-pl, html.in-game .tk-pl, html.in-game .pf-pl { flex:0 0 auto; }
  html.in-game #tableTitle { font-size:13px; }
}
