/* ==========================================================================
   game.css — Oyun ekranı: HUD, masa, eller, desteler
   Kart genişliği --cw JS tarafından ekran boyutuna göre ayarlanır (bkz. game.js -> layout()).
   ========================================================================== */

#screen-game {
    --cw: 70px;
    color: #fff;
    touch-action: none;
}

/* ---------- Üst çubuk ---------- */
.g-top {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px 4px;
    flex: 0 0 auto;
}

.g-info {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.36);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    font-size: 13px;
    color: rgba(255, 255, 255, 0.78);
    white-space: nowrap;
    overflow: hidden;
}
.g-info b { color: #fff; }
.dotsep { opacity: 0.4; }

#screen-game .icon-btn {
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}
#screen-game .icon-btn.is-off { opacity: 0.55; }

/* ---------- Oyuncu panelleri ---------- */
.player-panel {
    --prog: 0;
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 4px 10px;
    padding: 6px 12px 8px;
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.4);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1), 0 6px 14px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    flex: 0 0 auto;
    transition: box-shadow 0.25s;
}
.player-panel::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    height: 4px;
    width: calc(var(--prog) * 100%);
    background: linear-gradient(90deg, #fbbf24, #f97316);
    transition: width 0.6s ease;
}
.player-panel.is-turn {
    box-shadow: inset 0 0 0 2px rgba(251, 191, 36, 0.85), 0 0 18px rgba(251, 191, 36, 0.35);
}

.pp-avatar {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    border-radius: 50%;
    padding: 2px;
    background: rgba(255, 255, 255, 0.18);
    font-size: 20px;
}
.player-panel.is-turn .pp-avatar { animation: turnPulse 1.2s ease-in-out infinite; }
@keyframes turnPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.7); }
    50% { box-shadow: 0 0 0 7px rgba(251, 191, 36, 0); }
}

.pp-meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.pp-meta b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp-level { display: flex; align-items: center; gap: 6px; }
.pp-status { font-size: 12px; color: #fde68a; min-height: 14px; }
.pp-status.dots::after { content: ""; animation: dots 1.2s steps(4) infinite; }
@keyframes dots {
    0% { content: ""; }
    25% { content: "."; }
    50% { content: ".."; }
    75% { content: "..."; }
}

.pp-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 44px;
    line-height: 1;
}
.pp-score b { font-size: 26px; font-weight: 900; color: #fde047; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.4); }
.pp-score small { font-size: 10px; opacity: 0.65; margin-top: 2px; letter-spacing: 0.1em; text-transform: uppercase; }

.pp-pile {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    padding-left: 4px;
}
.pp-pile .pcard {
    --cw: 26px;
    border-width: 2px;
    box-shadow: 2px 2px 0 rgba(255, 255, 255, 0.3), 4px 4px 0 rgba(255, 255, 255, 0.18);
}
.pp-pile b { font-size: 15px; min-width: 20px; }

/* ---------- Eller ---------- */
.hand {
    position: relative;
    display: flex;
    justify-content: center;
    flex: 0 0 auto;
}

.hand-bot {
    height: calc(var(--cw) * 0.8);
    align-items: flex-start;
    margin-top: 2px;
    overflow: visible;
    z-index: 2;
}
.hand-bot .pcard {
    margin: 0 calc(var(--cw) * -0.12);
    transform: rotate(var(--fan-angle, 0deg));
    transform-origin: 50% 0;
}

.hand-player {
    height: calc(var(--cw) * 1.42 + 26px);
    align-items: flex-end;
    padding-bottom: 6px;
    z-index: 20;
}
.hand-player .pcard {
    margin: 0 calc(var(--cw) * -0.09);
    transform-origin: 50% 130%;
    transform: translateY(calc(var(--fan-y, 0px) + var(--lift, 0px))) rotate(var(--fan-angle, 0deg));
    transition: transform 0.22s cubic-bezier(0.25, 1, 0.5, 1), margin 0.22s, box-shadow 0.2s;
    cursor: pointer;
    z-index: var(--z, 1);
}
.hand-player .pcard.is-selected {
    --lift: calc(var(--cw) * -0.38);
    z-index: 60;
}
.hand-player .pcard.is-dragging {
    transition: none;
    z-index: 80;
}
.hand-player.is-locked .pcard { filter: brightness(0.82); cursor: default; }

/* ---------- Masa ---------- */
.g-table {
    position: relative;
    flex: 1 1 auto;
    min-height: calc(var(--cw) * 1.6);
}

.board {
    position: absolute;
    left: 50%;
    top: 50%;
    width: var(--cw);
    height: calc(var(--cw) * 1.42);
    transform: translate(-50%, -50%);
}
.board .pcard {
    position: absolute;
    left: 0;
    top: 0;
    transform: translate(calc(var(--cw) * var(--dx, 0)), calc(var(--cw) * var(--dy, 0))) rotate(var(--rot, 0deg));
}

.deck-wrap {
    position: absolute;
    left: 14px;
    top: 50%;
    width: var(--cw);
    transform: translateY(-50%);
}
.deck {
    position: relative;
    width: var(--cw);
    height: calc(var(--cw) * 1.42);
}
.deck .pcard { position: absolute; left: 0; top: 0; }
.deck.is-empty { opacity: 0.25; }
.deck-count {
    position: absolute;
    left: 50%;
    top: 50%;
    min-width: 34px;
    height: 34px;
    padding: 0 6px;
    transform: translate(-50%, -50%);
    border-radius: 17px;
    background: rgba(0, 0, 0, 0.72);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
    font-weight: 900;
    font-size: 15px;
    line-height: 34px;
    text-align: center;
    pointer-events: none;
}

.table-toast {
    position: absolute;
    left: 50%;
    top: 6px;
    transform: translateX(-50%);
    padding: 5px 14px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.25s;
    pointer-events: none;
}
.table-toast.is-on { opacity: 1; }

/* Çok kısa ekranlarda kartları biraz sıkıştır */
@media (max-height: 560px) {
    .pp-avatar { width: 34px; height: 34px; }
    .pp-score b { font-size: 21px; }
    .g-top { padding-top: 4px; }
}


/* ---------- Online: etiket, ifade, masa mesajı ---------- */
.g-tag { padding: 1px 7px; border-radius: 6px; background: #16a34a; color: #fff; font-size: 10px; font-weight: 800; letter-spacing: 0.08em; }
.g-tag.ranked { background: #d97706; }
.emote-layer { position: absolute; inset: 0; pointer-events: none; z-index: 60; }
.emote-pop { position: absolute; font-size: 34px; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.5)); animation: emotePop 2s ease-out forwards; }
@keyframes emotePop { 0% { opacity: 0; transform: translate(-50%, 0) scale(0.4); } 15% { opacity: 1; transform: translate(-50%, -10px) scale(1.2); } 80% { opacity: 1; transform: translate(-50%, -26px) scale(1); } 100% { opacity: 0; transform: translate(-50%, -40px) scale(1); } }
.table-msg {
    position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); z-index: 30;
    max-width: 78%; padding: 8px 18px; border-radius: 999px; background: rgba(0, 0, 0, 0.72); font-size: 15px; font-weight: 800;
    text-align: center; opacity: 0; transition: opacity 0.25s; pointer-events: none; color: #fff;
}
.table-msg.is-on { opacity: 1; }
.pp-status button { margin-left: 6px; }
