/* ================= GGGL Rummy (përdor edhe stilet e hollit nga chess.css) ================= */
.tc-grid.tc-3 { grid-template-columns: repeat(3, 1fr); }
.howto { margin-top: 32px; }
.howto h2 { font: 700 20px/1.2 var(--display); margin: 0 0 12px; }
.howto-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.howto-grid div { padding: 14px 16px; border-radius: var(--r-sm); background: var(--deck); border: 1px solid var(--rail); }
.howto-grid p { margin: 6px 0 0; color: var(--haze); font-size: 14px; line-height: 1.5; }
.lobby-fan { display: flex; justify-content: center; padding: 6px 0 0; --w: 58px; }
.lobby-fan .card { margin-left: -22px; }
.lobby-fan .card:first-child { margin-left: 0; }
.lobby-fan .card:nth-child(1) { transform: rotate(-12deg) translateY(8px); }
.lobby-fan .card:nth-child(2) { transform: rotate(-4deg); }
.lobby-fan .card:nth-child(3) { transform: rotate(4deg); }
.lobby-fan .card:nth-child(4) { transform: rotate(12deg) translateY(8px); }

/* ---------- Letrat ---------- */
.rummy-page { --w: 72px; }
.card {
  --red: #D6263B; --blk: #161A2B; --dia: var(--red); --clb: var(--blk);
  position: relative; flex: none; width: var(--w); height: calc(var(--w) * 1.4);
  border-radius: calc(var(--w) * .1);
  background: linear-gradient(160deg, #FFFFFF 0%, #FBFBFE 55%, #EEF0F7 100%);
  box-shadow: 0 1px 0 rgba(255,255,255,.9) inset, 0 0 0 1px rgba(14,20,51,.16), 0 4px 10px -3px rgba(0,0,0,.45);
  color: var(--blk); user-select: none; -webkit-user-select: none; overflow: hidden;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
}
.card.s1 { color: var(--red); } .card.s2 { color: var(--dia); } .card.s3 { color: var(--clb); } .card.s0 { color: var(--blk); }
.four .card { --dia: #1E63D6; --clb: #138A3E; }
.card .ix {
  position: absolute; left: 6%; top: 3.5%; display: flex; flex-direction: column; align-items: center;
  line-height: .9; width: calc(var(--w) * .3);
}
.card .ix b { font-weight: 800; font-size: calc(var(--w) * .3); letter-spacing: -.04em; }
.card .ix i { font-style: normal; font-size: calc(var(--w) * .24); margin-top: calc(var(--w) * .01); }
.card .ix.br { left: auto; top: auto; right: 6%; bottom: 3.5%; transform: rotate(180deg); }
.card .pip {
  position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%);
  font-size: calc(var(--w) * .62); line-height: 1;
}
.card .face {
  position: absolute; inset: 21% 20% 17%; border-radius: calc(var(--w) * .06);
  border: 1.5px solid #C9A227; box-shadow: inset 0 0 0 2px #FFF6DD, inset 0 0 0 3px rgba(201,162,39,.5);
  background: radial-gradient(circle at 50% 35%, #FFFBEA, #F6E6B4 75%);
  display: grid; place-items: center; font: 800 calc(var(--w) * .46)/1 var(--display);
}
.card .face small { position: absolute; bottom: 6%; font-size: calc(var(--w) * .2); }
.card.joker { color: #6C3CE0; background: linear-gradient(160deg, #FFFFFF, #F4EEFF 60%, #E7DDFF); }
.card.joker .ix b { font-size: calc(var(--w) * .2); writing-mode: vertical-rl; text-orientation: upright; letter-spacing: -.1em; }
.card.joker .pip { font-size: calc(var(--w) * .58); background: linear-gradient(135deg, #FF5A6E, #FFC24B 35%, #53E08A 60%, #4D7CFF); -webkit-background-clip: text; background-clip: text; color: transparent; }

.back {
  --w: 44px; flex: none; width: var(--w); height: calc(var(--w) * 1.4); border-radius: calc(var(--w) * .1);
  background:
    radial-gradient(circle at 50% 50%, rgba(255,194,75,.9) 0 12%, transparent 13%),
    repeating-linear-gradient(45deg, rgba(255,255,255,.1) 0 3px, transparent 3px 8px),
    repeating-linear-gradient(-45deg, rgba(255,255,255,.1) 0 3px, transparent 3px 8px),
    linear-gradient(160deg, #3752C4, #1B2A7A);
  box-shadow: 0 0 0 2px #fff inset, 0 0 0 1px rgba(0,0,0,.35), 0 3px 8px -2px rgba(0,0,0,.5);
}

/* ---------- Tavolina ---------- */
.rummy-page { max-width: 1320px; }
.rplay { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.felt {
  position: relative; display: flex; flex-direction: column; gap: 14px; min-height: min(calc(100dvh - 120px), 860px);
  padding: 16px; border-radius: 26px;
  background:
    radial-gradient(120% 90% at 50% 45%, rgba(255,255,255,.07), transparent 60%),
    radial-gradient(160% 120% at 50% 50%, #14704F 0%, #0D5A3F 45%, #083826 100%);
  box-shadow: 0 0 0 8px #2A1D12, 0 0 0 10px #4A3320, 0 30px 60px -25px rgba(0,0,0,.9), inset 0 0 60px rgba(0,0,0,.45);
}
.felt::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: .25;
  background-image: radial-gradient(rgba(255,255,255,.15) 1px, transparent 1px); background-size: 4px 4px;
}

.opps { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; position: relative; }
.opp {
  position: relative; display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 8px; border-radius: 16px; overflow: hidden;
  background: rgba(8,24,18,.55); border: 1px solid rgba(255,255,255,.12); min-width: 200px;
}
.opp.turn { border-color: #FFC24B; box-shadow: 0 0 0 1px #FFC24B, 0 0 24px rgba(255,194,75,.35); }
.opp .avatar, .opp .bot { width: 34px; height: 34px; flex: none; }
.opp .bot { display: grid; place-items: center; font-size: 24px; }
.opp .who { min-width: 0; }
.opp .nm { display: block; font-weight: 800; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.opp .sub { font-size: 12px; color: rgba(255,255,255,.7); font-weight: 700; }
.opp .open-b { color: #FFC24B; }
.opp .backs { display: flex; margin-left: auto; padding-left: 8px; }
.opp .backs .back { --w: 22px; margin-left: -14px; }
.opp .cnt { font: 800 18px/1 var(--display); color: #fff; margin-left: 8px; min-width: 22px; text-align: right; }
.timer { position: absolute; left: 0; bottom: 0; height: 3px; background: #FFC24B; width: 0; }

.middle { flex: 1; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 18px; align-items: start; position: relative; }
.piles { display: flex; flex-direction: column; gap: 40px; align-items: center; padding-top: 6px; }
.pile {
  position: relative; border: 0; padding: 0; background: none; cursor: default; border-radius: 10px;
  width: 78px; height: calc(78px * 1.4); display: grid; place-items: center;
}
.pile.stock .back { --w: 78px; position: absolute; }
.pile .lbl {
  position: absolute; bottom: -22px; left: 50%; transform: translateX(-50%); white-space: nowrap;
  font: 700 11px/1 var(--body); letter-spacing: .08em; text-transform: uppercase; color: rgba(255,255,255,.75);
}
.pile .empty { width: 100%; height: 100%; border-radius: 10px; border: 2px dashed rgba(255,255,255,.3); }
.pile .card { --w: 78px; position: absolute; }
.pile.can { cursor: pointer; }
.pile.can::after { content: ''; position: absolute; inset: -6px; border-radius: 14px; border: 3px solid #FFC24B; animation: glow 1.2s ease-in-out infinite; pointer-events: none; }
@keyframes glow { 50% { opacity: .35; } }
.pile.flash .card, .pile.flash .back:last-child { animation: pop .5s ease-out; }
@keyframes pop { 0% { transform: scale(1.15) translateY(-6px); } 100% { transform: none; } }

.melds { display: flex; flex-wrap: wrap; gap: 14px 18px; align-content: flex-start; min-height: 150px; padding: 4px; }
.melds .empty-t { color: rgba(255,255,255,.55); font-weight: 600; margin: auto; text-align: center; }
.meld {
  --w: 58px; display: flex; padding: 6px 8px 6px 6px; border-radius: 12px; position: relative;
  background: rgba(0,0,0,.14); border: 1px solid transparent; transition: background .15s, border-color .15s;
}
.meld .card { margin-left: calc(var(--w) * -.5); box-shadow: 0 0 0 1px rgba(14,20,51,.18), -2px 2px 5px -2px rgba(0,0,0,.4); }
.meld .card:first-child { margin-left: 0; }
.meld .card .pip, .meld .card .face, .meld .card .ix.br { display: none; }
.meld .card:last-child .pip { display: block; font-size: calc(var(--w) * .5); top: 60%; }
.meld .card:last-child .face { display: grid; inset: 34% 18% 12%; font-size: calc(var(--w) * .34); }
.meld .card:last-child .face small { display: none; }
.meld .card .ix b { font-size: calc(var(--w) * .34); }
.card .ix b.t { letter-spacing: -.09em; margin-left: -.06em; }
.meld .card .ix b.t { font-size: calc(var(--w) * .27); }
.meld .card .ix i { font-size: calc(var(--w) * .3); }
.meld.staged { border: 2px dashed #FFC24B; background: rgba(255,194,75,.12); }
.meld.fit { cursor: pointer; border-color: #53E08A; background: rgba(83,224,138,.18); }
.meld.fit::after { content: '+'; position: absolute; right: -10px; top: -10px; width: 22px; height: 22px; border-radius: 50%; background: #53E08A; color: #06301F; font: 800 17px/22px var(--display); text-align: center; }
.meld.grew .card.new, .melds .meld.fresh { animation: pop .5s ease-out; }
.meld .card.new { box-shadow: 0 0 0 2px #FFC24B, -2px 2px 5px -2px rgba(0,0,0,.4); }

/* dora ime */
.mine { display: flex; flex-direction: column; gap: 10px; position: relative; min-width: 0; }
.felt, .middle, .melds { min-width: 0; }
.mine-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.me-tag { display: flex; align-items: center; gap: 8px; color: #fff; font-weight: 800; padding: 6px 12px 6px 6px; border-radius: 999px; background: rgba(8,24,18,.55); border: 1px solid rgba(255,255,255,.12); position: relative; overflow: hidden; }
.me-tag.turn { border-color: #FFC24B; box-shadow: 0 0 0 1px #FFC24B; }
.me-tag .avatar { width: 26px; height: 26px; }
.hint { color: #fff; font-weight: 700; font-size: 15px; }
.hint small { display: inline-block; margin-left: 6px; color: rgba(255,255,255,.72); font-weight: 600; }
.hint .pts { color: #FFC24B; }
.hint .pts.ok { color: #53E08A; }

.hand { --w: clamp(62px, 6.4vw, 92px); --ov: 0px; min-width: 0; display: flex; justify-content: center; padding: 22px 6px 6px; min-height: calc(var(--w) * 1.4 + 28px); touch-action: pan-y; }
.hand .card { margin-left: var(--ov); cursor: pointer; transition: transform .14s ease, box-shadow .14s; }
.hand .card:first-child { margin-left: 0; }
.hand .card:hover { transform: translateY(-6px); }
.hand .card.sel { transform: translateY(-20px); box-shadow: 0 0 0 3px #FFC24B, 0 12px 20px -6px rgba(0,0,0,.6); }
.hand .card.new::before { content: 'NEW'; position: absolute; right: 6%; top: 4%; font: 800 9px/1 var(--body); letter-spacing: .06em; padding: 3px 5px; border-radius: 6px; background: #FFC24B; color: #0B1026; }
.hand .card.drag { transition: none; z-index: 5; box-shadow: 0 0 0 3px #4D7CFF, 0 20px 30px -8px rgba(0,0,0,.7); }
.hand.off .card { cursor: default; }

.bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.bar .btn { padding: 10px 16px; font-size: 14px; }
.bar .btn:disabled { opacity: .4; cursor: default; }
.bar .grow { flex: 1; }
.bar .btn.quiet { color: #fff; }

/* paneli anësor */
.rplay .side { width: auto; display: flex; flex-direction: column; gap: 12px; }
.rplayers { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rplayers li {
  position: relative; display: flex; align-items: center; gap: 10px; min-height: 52px; overflow: hidden;
  padding: 8px 12px 8px 10px; border-radius: 12px; background: var(--deck); border: 1px solid var(--rail);
}
.rplayers li.turn { border-color: var(--gold); }
.rplayers li.out { opacity: .55; }
.rplayers .avatar, .rplayers .bot { width: 28px; height: 28px; flex: none; }
.rplayers .bot { display: grid; place-items: center; font-size: 20px; }
.rplayers .who { min-width: 0; flex: 1; }
.rplayers .nm { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.rplayers .rt { color: var(--haze); font-size: 12px; font-weight: 700; }
.rplayers .cc { font: 700 13px/1 var(--body); color: var(--haze); white-space: nowrap; }
.rplayers .cc b { color: var(--chalk); font: 800 16px/1 var(--display); }
.rules-mini { padding: 10px 14px; border-radius: var(--r-sm); background: var(--deck); border: 1px solid var(--rail); color: var(--haze); font-size: 14px; }
.rules-mini summary { cursor: pointer; font-weight: 700; color: var(--chalk); }
.rules-mini p { margin: 8px 0 0; line-height: 1.5; }

.lobby-players { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; text-align: left; }
.lobby-players li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--r-sm); background: var(--ink); border: 1px solid var(--rail); font-weight: 700; }
.lobby-players li.empty { color: var(--haze); font-weight: 500; border-style: dashed; }
.lobby-players .avatar { width: 24px; height: 24px; }
.standings { list-style: none; margin: 4px 0; padding: 0; display: grid; gap: 6px; text-align: left; }
.standings li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--r-sm); background: var(--ink); }
.standings li.me { outline: 1px solid var(--gold); }
.standings .pl { font: 700 16px var(--display); width: 26px; color: var(--haze); }
.standings li:first-child .pl { color: var(--gold); }
.standings .nm { flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.standings .sc { color: var(--haze); font-size: 13px; font-weight: 700; }
.standings .dl { font: 700 14px var(--display); min-width: 34px; text-align: right; }
.standings .dl.up { color: var(--ok); } .standings .dl.down { color: var(--danger); }
.recent .res-badge.place { background: rgba(141,149,201,.2); color: var(--chalk); }

@media (max-width: 1100px) {
  .rplay { grid-template-columns: minmax(0, 1fr); }
  .rplay .side { max-width: 640px; width: 100%; margin: 0 auto; }
  .rplayers { grid-template-columns: 1fr 1fr; }
  .felt { min-height: 0; }
}
@media (max-width: 1000px) { .howto-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 620px) {
  .howto-grid { grid-template-columns: 1fr; }
  .felt { padding: 10px; border-radius: 18px; gap: 10px; box-shadow: 0 0 0 5px #2A1D12, 0 0 0 6px #4A3320, inset 0 0 40px rgba(0,0,0,.45); }
  .opp { min-width: 0; padding: 6px 10px 6px 6px; gap: 6px; }
  .opp .avatar, .opp .bot { width: 26px; height: 26px; font-size: 18px; }
  .opp .nm { max-width: 72px; font-size: 13px; }
  .opp .backs { display: none; }
  .middle { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .piles { flex-direction: row; justify-content: center; gap: 22px; padding-bottom: 18px; }
  .pile, .pile .card, .pile.stock .back { width: 60px; height: 84px; --w: 60px; }
  .melds { min-height: 90px; gap: 10px 12px; justify-content: center; }
  .meld { --w: 40px; padding: 4px 6px 4px 4px; }
  .hand { --w: 58px; padding-top: 20px; }
  .bar .btn { padding: 9px 12px; font-size: 13px; }
}

.toast { width: max-content; max-width: min(520px, calc(100vw - 32px)); border-radius: 16px; text-align: center; }
body:has(#play:not([hidden])) .toast { top: 84px; bottom: auto; transform: translate(-50%, -20px); }
body:has(#play:not([hidden])) .toast.show { transform: translate(-50%, 0); }
.mine-head .react-btn { margin-left: auto; width: 42px; height: 42px; font-size: 23px; }

/* ---------- Tavolina 3D (Remi dhe Gin) ---------- */
.t3d .felt {
  transform: perspective(1600px) rotateX(6deg); transform-origin: 50% 100%;
  box-shadow: 0 0 0 8px #2A1D12, 0 0 0 10px #4A3320, 0 16px 0 10px #24170C, 0 44px 70px -20px rgba(0,0,0,.95), inset 0 0 70px rgba(0,0,0,.5);
}
.t3d .card {
  box-shadow: 0 1px 0 rgba(255,255,255,.9) inset, 0 0 0 1px rgba(14,20,51,.16),
    0 1px 0 #D9DDEA, 0 2px 0 #C3C8DA, 0 3px 0 #AEB4C9, 0 10px 16px -6px rgba(0,0,0,.6);
}
.t3d .hand { perspective: 900px; padding-top: 30px; padding-bottom: 22px; }
.t3d .hand .card { transform-origin: 50% 100%; transform: translateY(var(--y, 0px)) rotate(var(--a, 0deg)); }
.t3d .hand .card:hover { transform: translateY(calc(var(--y, 0px) - 10px)) rotate(var(--a, 0deg)); }
.t3d .hand .card.sel { transform: translateY(calc(var(--y, 0px) - 26px)) rotate(var(--a, 0deg)) scale(1.05); }
.t3d .hand .card.new { animation: flipIn .65s cubic-bezier(.2, .8, .3, 1.1); }
@keyframes flipIn {
  0% { transform: translateY(-140px) rotateY(95deg) scale(.7); filter: brightness(.6); }
  60% { transform: translateY(-10px) rotateY(-12deg) scale(1.04); filter: none; }
  100% { transform: translateY(var(--y, 0px)) rotate(var(--a, 0deg)); }
}
.t3d .hand .card.drag { transition: none; }
.t3d .meld, .t3d .grp { box-shadow: 0 14px 20px -12px rgba(0,0,0,.75); }
.t3d .pile.stock .back:last-child { box-shadow: 0 0 0 2px #fff inset, 0 1px 0 #1B2A7A, 0 2px 0 #fff, 0 3px 0 #1B2A7A, 0 4px 0 #fff, 0 12px 18px -6px rgba(0,0,0,.7); }
.t3d .pile .card { transform: rotate(-4deg); }
.t3d .pile.flash .card { animation: toss .55s cubic-bezier(.2, .8, .3, 1.2); }
@keyframes toss { 0% { transform: translateY(-60px) rotate(-30deg) rotateX(40deg) scale(1.15); } 100% { transform: rotate(-4deg); } }
.t3d .opp .backs { transform: perspective(300px) rotateX(20deg); }
@media (prefers-reduced-motion: reduce) { .t3d .felt { transform: none; } .t3d .hand .card.new, .t3d .pile.flash .card { animation: none; } }
