* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0a0e1a;
    color: #fff;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
}

/* ===== Hub topbar ===== */
.hub-topbar {
    position: sticky; top: 0; z-index: 100;
    background: rgba(10,14,26,.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255,255,255,.06);
    padding: 10px 16px;
}
.hub-home {
    display: inline-flex; align-items: center; gap: 8px;
    color: #fff; text-decoration: none;
    font-weight: 800; font-size: .85rem; letter-spacing: 2px;
}
.hub-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; border-radius: 8px;
    background: linear-gradient(135deg,#7c3aed,#6d28d9);
    font-size: .6rem;
}
body:has(#game-screen.active) .hub-topbar { display: none; }

/* ===== Screens ===== */
.screen { display: none; }
.screen.active { display: block; }
.container {
    max-width: 480px; margin: 0 auto; padding: 24px 20px 40px;
    text-align: center;
}

.title {
    font-size: 3rem; font-weight: 900; letter-spacing: 4px;
    background: linear-gradient(135deg,#a78bfa,#60a5fa);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 4px;
}
.subtitle { color: rgba(255,255,255,.5); margin-bottom: 28px; font-size: .95rem; }
h2 { margin-bottom: 20px; font-weight: 800; }

.menu-logo { position: relative; height: 110px; margin: 10px 0 6px; }
.ml-card {
    position: absolute; left: 50%; top: 0; width: 70px;
    border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,.5);
}
.ml-c1 { transform: translateX(-90%) rotate(-14deg); }
.ml-c2 { transform: translateX(-50%) translateY(-6px); z-index: 2; }
.ml-c3 { transform: translateX(-10%) rotate(14deg); }

.menu-buttons { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }

.btn-primary {
    width: 100%; padding: 16px; border: none; border-radius: 14px;
    background: linear-gradient(135deg,#7c3aed,#6d28d9);
    color: #fff; font-size: 1rem; font-weight: 800; letter-spacing: 1px;
    cursor: pointer; transition: transform .15s, box-shadow .15s;
    box-shadow: 0 6px 20px rgba(124,58,237,.35);
}
.btn-primary:active { transform: scale(.97); }
.btn-primary:disabled { opacity: .4; cursor: default; }

.btn-secondary {
    width: 100%; padding: 16px; border-radius: 14px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.12);
    color: #fff; font-size: 1rem; font-weight: 700; letter-spacing: 1px;
    cursor: pointer; transition: background .15s;
}
.btn-secondary:active { background: rgba(255,255,255,.12); }

.btn-back {
    margin-top: 14px; padding: 12px 24px; border: none; border-radius: 12px;
    background: transparent; color: rgba(255,255,255,.5);
    font-size: .9rem; cursor: pointer;
}

.btn-danger {
    width: 100%; padding: 14px; border: none; border-radius: 14px;
    background: rgba(239,68,68,.15); border: 1px solid rgba(239,68,68,.4);
    color: #f87171; font-weight: 700; cursor: pointer;
}

.rules-box {
    text-align: left;
    background: rgba(20,24,41,.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,.07);
    border-radius: 16px; padding: 18px;
}
.rules-title { font-weight: 800; margin-bottom: 10px; color: #a78bfa; font-size: .9rem; letter-spacing: 1px; }
.rules-box ul { list-style: none; }
.rules-box li {
    padding: 5px 0 5px 20px; position: relative;
    color: rgba(255,255,255,.65); font-size: .88rem;
}
.rules-box li::before { content: '\2660'; position: absolute; left: 0; color: #7c3aed; }

.input-group { text-align: left; margin-bottom: 16px; }
.input-group label {
    display: block; font-size: .75rem; letter-spacing: 1px;
    color: rgba(255,255,255,.45); margin-bottom: 6px; text-transform: uppercase;
}
.input-group input {
    width: 100%; padding: 15px; border-radius: 13px;
    background: rgba(20,24,41,.7);
    border: 1px solid rgba(255,255,255,.1);
    color: #fff; font-size: 1rem; outline: none;
}
.input-group input:focus { border-color: #7c3aed; }
.code-input {
    text-transform: uppercase; letter-spacing: 10px !important;
    text-align: center; font-size: 1.7rem !important; font-weight: 800;
}

/* ===== Lobby ===== */
.game-topbar { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.btn-quit {
    padding: 8px 16px; border-radius: 10px; border: 1px solid rgba(239,68,68,.4);
    background: rgba(239,68,68,.12); color: #f87171;
    font-size: .8rem; font-weight: 700; cursor: pointer;
}
.room-code-display {
    background: rgba(20,24,41,.6);
    border: 1px solid rgba(255,255,255,.07);
    border-radius: 16px; padding: 18px; margin-bottom: 12px;
}
.room-label { display: block; font-size: .7rem; letter-spacing: 2px; color: rgba(255,255,255,.4); text-transform: uppercase; }
.room-code { font-size: 2.6rem; font-weight: 900; letter-spacing: 12px; color: #a78bfa; }
.btn-invite {
    width: 100%; padding: 13px; border-radius: 12px;
    background: rgba(124,58,237,.15); border: 1px solid rgba(124,58,237,.4);
    color: #a78bfa; font-weight: 700; cursor: pointer; margin-bottom: 16px;
}
.players-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.player-item {
    display: flex; align-items: center; gap: 10px;
    background: rgba(20,24,41,.6);
    border: 1px solid rgba(255,255,255,.07);
    border-radius: 12px; padding: 13px 15px; text-align: left;
}
.player-item .p-name { font-weight: 700; flex: 1; }
.p-host-tag {
    font-size: .65rem; background: rgba(124,58,237,.25); color: #a78bfa;
    padding: 3px 8px; border-radius: 6px; font-weight: 800; letter-spacing: 1px;
}
.p-empty { color: rgba(255,255,255,.25); font-style: italic; }
.dot-online, .dot-offline {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.dot-online { background: #22C55E; box-shadow: 0 0 6px #22C55E; }
.dot-offline { background: #555; }
.lobby-info { color: rgba(255,255,255,.45); font-size: .9rem; margin-bottom: 14px; }

/* ===== Game screen ===== */
#game-screen.active {
    display: block; position: fixed; inset: 0; overflow: hidden;
}
.table-bg {
    position: absolute; inset: 0;
    background: radial-gradient(ellipse at 50% 42%, #14532d 0%, #0f3d22 45%, #0a2416 75%, #071a10 100%);
}
.table-bg::after {
    content: ''; position: absolute; inset: 0;
    box-shadow: inset 0 0 120px rgba(0,0,0,.6);
}

.game-hud {
    position: absolute; top: 0; left: 0; right: 0; z-index: 20;
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px;
    padding-top: calc(10px + env(safe-area-inset-top));
}
.hud-trickcount {
    font-size: .8rem; font-weight: 800; color: rgba(255,255,255,.85);
    background: rgba(0,0,0,.35); padding: 6px 12px; border-radius: 20px;
}
.hud-code {
    font-size: .8rem; font-weight: 800; letter-spacing: 3px; color: rgba(255,255,255,.55);
    background: rgba(0,0,0,.35); padding: 6px 12px; border-radius: 20px;
}

.seat { position: absolute; z-index: 10; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.seat-top { top: 52px; left: 50%; transform: translateX(-50%); padding-top: env(safe-area-inset-top); }
.seat-left { left: 10px; top: 38%; transform: translateY(-50%); }
.seat-right { right: 10px; top: 38%; transform: translateY(-50%); }

.seat-badge {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    background: rgba(0,0,0,.4); backdrop-filter: blur(6px);
    border: 2px solid rgba(255,255,255,.12);
    border-radius: 14px; padding: 8px 14px; min-width: 84px;
    transition: border-color .3s, box-shadow .3s;
}
.seat-badge.turn {
    border-color: #fbbf24;
    box-shadow: 0 0 18px rgba(251,191,36,.5);
    animation: turnPulse 1.6s ease-in-out infinite;
}
@keyframes turnPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(251,191,36,.35); transform: scale(1); }
    50% { box-shadow: 0 0 24px rgba(251,191,36,.75); transform: scale(1.04); }
}
.seat-badge.offline { opacity: .5; }
.seat-name { font-size: .8rem; font-weight: 800; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-tricks { font-size: .68rem; color: #fbbf24; font-weight: 700; }
.seat-cards { font-size: .65rem; color: rgba(255,255,255,.5); }

.trick-area {
    position: absolute; left: 50%; top: 42%;
    transform: translate(-50%, -50%);
    width: 220px; height: 190px; z-index: 5;
}
.trick-card {
    position: absolute; width: 62px; border-radius: 5px;
    box-shadow: 0 4px 14px rgba(0,0,0,.55);
    animation: playIn .25s ease-out;
}
@keyframes playIn { from { transform: scale(1.35) rotate(-8deg); opacity: 0; } to { transform: scale(1) rotate(0deg); opacity: 1; } }
.tc-bottom { left: 50%; bottom: 0; margin-left: -31px; }
.tc-top { left: 50%; top: 0; margin-left: -31px; }
.tc-left { left: 8px; top: 50%; margin-top: -44px; }
.tc-right { right: 8px; top: 50%; margin-top: -44px; }
.trick-card.won { filter: drop-shadow(0 0 10px #fbbf24); }

.turn-banner {
    position: absolute; left: 50%; top: 62%;
    transform: translateX(-50%); z-index: 6;
    font-size: .85rem; font-weight: 800; color: #fbbf24;
    background: rgba(0,0,0,.45); padding: 7px 16px; border-radius: 20px;
    white-space: nowrap;
}

.me-bar {
    position: absolute; left: 0; right: 0; bottom: 158px; z-index: 10;
    display: flex; justify-content: center;
}
.me-bar .seat-badge { flex-direction: row; gap: 10px; padding: 6px 16px; }

.hand {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 15;
    display: flex; justify-content: center; align-items: flex-end;
    padding: 10px 12px calc(14px + env(safe-area-inset-bottom));
    overflow-x: auto; overflow-y: hidden;
}
.hand-card {
    width: 72px; margin-left: -30px; flex-shrink: 0;
    border-radius: 6px;
    box-shadow: -3px 0 10px rgba(0,0,0,.45);
    transition: transform .15s, filter .15s;
    cursor: pointer;
}
.hand-card:first-child { margin-left: 0; }
.hand-card.legal { }
.hand-card.legal:active { transform: translateY(-18px) rotate(-2deg); }
.hand-card.illegal { filter: brightness(.45); cursor: default; }
.hand.my-turn .hand-card.legal { filter: drop-shadow(0 -2px 8px rgba(251,191,36,.35)); }

/* ===== Result overlay ===== */
.result-overlay {
    position: absolute; inset: 0; z-index: 50;
    background: rgba(5,8,15,.8); backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.result-box {
    width: 100%; max-width: 380px;
    background: rgba(20,24,41,.95);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 20px; padding: 26px; text-align: center;
}
.result-title {
    font-size: 1.4rem; font-weight: 900; letter-spacing: 3px;
    background: linear-gradient(135deg,#fbbf24,#f59e0b);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 18px;
}
.result-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.result-row {
    display: flex; align-items: center; gap: 10px;
    background: rgba(255,255,255,.04);
    border-radius: 12px; padding: 12px 14px;
}
.result-row.winner { background: rgba(251,191,36,.12); border: 1px solid rgba(251,191,36,.4); }
.result-rank { font-weight: 900; color: rgba(255,255,255,.4); width: 22px; }
.result-name { flex: 1; text-align: left; font-weight: 700; }
.result-tricks { font-size: .8rem; color: #fbbf24; font-weight: 800; }
.result-total { font-size: .75rem; color: rgba(255,255,255,.45); }

/* ===== Mode selector ===== */
.mode-row { display: flex; gap: 10px; }
.mode-btn {
    flex: 1; padding: 14px 10px; border-radius: 13px;
    background: rgba(20,24,41,.7);
    border: 2px solid rgba(255,255,255,.1);
    color: #fff; cursor: pointer; text-align: center;
    display: flex; flex-direction: column; gap: 4px;
    transition: border-color .15s, background .15s;
}
.mode-btn.active {
    border-color: #7c3aed;
    background: rgba(124,58,237,.15);
}
.mode-name { font-weight: 800; font-size: .85rem; letter-spacing: 1px; }
.mode-desc { font-size: .68rem; color: rgba(255,255,255,.5); }

/* ===== Bidding ===== */
.hud-trump {
    font-size: .9rem; font-weight: 800;
    background: rgba(0,0,0,.35); padding: 5px 12px; border-radius: 20px;
}
.bid-panel {
    position: absolute; left: 50%; top: 40%;
    transform: translate(-50%, -50%);
    width: 90%; max-width: 340px; z-index: 30;
    background: rgba(10,14,26,.92); backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 18px; padding: 18px; text-align: center;
}
.bid-title {
    font-size: 1rem; font-weight: 900; letter-spacing: 3px;
    color: #fbbf24; margin-bottom: 8px;
}
.bid-current { font-size: .9rem; color: rgba(255,255,255,.7); margin-bottom: 14px; }
.bid-buttons {
    display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
    margin-bottom: 12px;
}
.bid-btn {
    width: 46px; height: 46px; border-radius: 12px; border: none;
    background: linear-gradient(135deg,#7c3aed,#6d28d9);
    color: #fff; font-size: 1.1rem; font-weight: 900; cursor: pointer;
}
.bid-btn:active { transform: scale(.94); }
.btn-pass {
    padding: 11px 34px; border-radius: 12px;
    background: rgba(239,68,68,.15); border: 1px solid rgba(239,68,68,.45);
    color: #f87171; font-weight: 800; letter-spacing: 2px; cursor: pointer;
    transition: transform .12s;
}
.btn-pass:active { transform: scale(.96); }
.bid-wait { color: rgba(255,255,255,.55); font-size: .88rem; padding: 6px 0; }
.suit-buttons { display: flex; gap: 12px; justify-content: center; margin-bottom: 6px; }
.suit-btn {
    width: 62px; height: 62px; border-radius: 14px; border: none;
    background: #fff; font-size: 2rem; cursor: pointer;
    box-shadow: 0 4px 14px rgba(0,0,0,.4);
}
.suit-btn:active { transform: scale(.93); }
.suit-red { color: #dc2626; }
.suit-black { color: #111; }
.bid-result-line {
    margin-bottom: 14px; padding: 10px; border-radius: 10px;
    font-size: .88rem; font-weight: 700;
}
.bid-result-line.met { background: rgba(34,197,94,.12); color: #4ade80; }
.bid-result-line.failed { background: rgba(239,68,68,.12); color: #f87171; }

/* ===== Toast ===== */
.toast {
    position: fixed; bottom: 30px; left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(20,24,41,.95);
    border: 1px solid rgba(255,255,255,.15);
    color: #fff; padding: 12px 22px; border-radius: 14px;
    font-size: .9rem; font-weight: 600;
    opacity: 0; transition: all .3s; z-index: 999;
    pointer-events: none; white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ===== Efektler: dagitim animasyonu ===== */
.hand.dealt .hand-card { animation: dealIn .32s cubic-bezier(.22,.9,.32,1.15) backwards; }
.hand.dealt .hand-card:nth-child(1) { animation-delay: 0s; }
.hand.dealt .hand-card:nth-child(2) { animation-delay: .04s; }
.hand.dealt .hand-card:nth-child(3) { animation-delay: .08s; }
.hand.dealt .hand-card:nth-child(4) { animation-delay: .12s; }
.hand.dealt .hand-card:nth-child(5) { animation-delay: .16s; }
.hand.dealt .hand-card:nth-child(6) { animation-delay: .2s; }
.hand.dealt .hand-card:nth-child(7) { animation-delay: .24s; }
.hand.dealt .hand-card:nth-child(8) { animation-delay: .28s; }
.hand.dealt .hand-card:nth-child(9) { animation-delay: .32s; }
.hand.dealt .hand-card:nth-child(10) { animation-delay: .36s; }
.hand.dealt .hand-card:nth-child(11) { animation-delay: .4s; }
.hand.dealt .hand-card:nth-child(12) { animation-delay: .44s; }
.hand.dealt .hand-card:nth-child(13) { animation-delay: .48s; }
.hand.dealt .hand-card:nth-child(14) { animation-delay: .52s; }
@keyframes dealIn {
    from { transform: translateY(46px) scale(.92); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

/* ===== Efektler: el supurme (kazanan yonune) ===== */
.trick-card.sweep-top { animation: sweepTop .4s ease-in forwards; }
.trick-card.sweep-bottom { animation: sweepBottom .4s ease-in forwards; }
.trick-card.sweep-left { animation: sweepLeft .4s ease-in forwards; }
.trick-card.sweep-right { animation: sweepRight .4s ease-in forwards; }
@keyframes sweepTop { to { transform: translateY(-240px) scale(.4) rotate(-10deg); opacity: 0; } }
@keyframes sweepBottom { to { transform: translateY(240px) scale(.4) rotate(10deg); opacity: 0; } }
@keyframes sweepLeft { to { transform: translateX(-240px) scale(.4) rotate(-12deg); opacity: 0; } }
@keyframes sweepRight { to { transform: translateX(240px) scale(.4) rotate(12deg); opacity: 0; } }

/* ===== Efektler: konfeti ===== */
.confetti-layer { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.confetti-piece {
    position: absolute; top: -14px; width: 8px; height: 13px;
    border-radius: 2px; opacity: 0;
    animation: confettiFall 3s linear forwards;
}
@keyframes confettiFall {
    0% { opacity: 1; transform: translate3d(0, -10px, 0) rotate(0deg); }
    100% { opacity: .9; transform: translate3d(var(--dx, 0px), 105vh, 0) rotate(720deg); }
}

@media (max-width: 400px) {
    .hand-card { width: 62px; margin-left: -28px; }
    .trick-card { width: 54px; }
    .trick-area { width: 190px; height: 170px; }
}

/* Kick butonu (lobi) */
.kick-btn{width:26px;height:26px;border-radius:8px;border:1px solid rgba(239,68,68,.4);background:rgba(239,68,68,.12);color:#f87171;font-size:.75rem;font-weight:800;cursor:pointer;flex-shrink:0;margin-left:auto}
.kick-btn.confirm{background:rgba(239,68,68,.5);color:#fff}
