/* ============================================
   101 Okey — Ultra Premium Design v2.0
   Modern Glassmorphism + Dynamic Animations
   ============================================ */

/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@500;700&display=swap');

/* ---------- Design Tokens ---------- */
:root {
    /* Masa Renkleri — Gerçekçi Keçe */
    --table-felt: #1a4a3a;
    --table-gradient: radial-gradient(ellipse at 50% 45%,
            #2d6b54 0%,
            #1f5443 40%,
            #153d31 70%,
            #0e2a22 100%);

    /* Istaka Ahşap */
    --wood-dark: #3e2723;
    --wood-light: #5d4037;
    --wood-border: #281a16;

    /* UI Glass */
    --glass-bg: rgba(10, 15, 28, 0.65);
    --glass-bg-hover: rgba(10, 15, 28, 0.85);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-border-hover: rgba(255, 255, 255, 0.2);
    --glass-blur: 20px;

    /* Renkler */
    --bg-deep: #0a0f1c;
    --bg-surface: #111827;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    /* Aksan Renkleri */
    --accent: #f59e0b;
    --accent-light: #fbbf24;
    --accent-glow: rgba(245, 158, 11, 0.35);
    --danger: #ef4444;
    --danger-glow: rgba(239, 68, 68, 0.3);
    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.3);
    --info: #3b82f6;
    --purple: #8b5cf6;

    /* Gradyanlar */
    --gradient-gold: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
    --gradient-emerald: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --gradient-danger: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    --gradient-purple: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    --gradient-surface: linear-gradient(145deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.02) 100%);

    /* Taş Boyutları */
    --tile-width: 70px;
    --tile-height: 100px;

    /* Istaka */
    --cue-height: 200px;
    --cue-depth: 20px;

    /* Gölgeler */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.4);
    --shadow-glow-gold: 0 0 30px var(--accent-glow);

    /* Yuvarlaklık */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --radius-pill: 50px;

    /* Geçişler */
    --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: 0.15s var(--ease-smooth);
    --transition-normal: 0.3s var(--ease-smooth);
    --transition-spring: 0.4s var(--ease-spring);
}

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

* {
    user-select: none;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-primary);
    overflow-x: hidden;
    overflow-y: auto;
    min-height: 100vh;
    background: var(--bg-deep);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Game sayfasında scroll kapansın */
body:has(.game-board) {
    overflow: hidden;
    height: 100vh;
}

/* ---------- Animated Background (Lobby) ---------- */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    background: 
        radial-gradient(ellipse at 20% 50%, rgba(16, 185, 129, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(245, 158, 11, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(139, 92, 246, 0.05) 0%, transparent 50%),
        var(--bg-deep);
    animation: bgShift 20s ease-in-out infinite alternate;
}

@keyframes bgShift {
    0% { background-position: 0% 0%; }
    100% { background-position: 100% 100%; }
}

/* ---------- Floating Particles ---------- */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 3px;
    height: 3px;
    background: rgba(245, 158, 11, 0.4);
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.3);
    animation: particleFloat 18s infinite linear;
}

.particle:nth-child(1) { left: 10%; animation-delay: 0s; animation-duration: 22s; width: 2px; height: 2px; }
.particle:nth-child(2) { left: 25%; animation-delay: 2s; animation-duration: 18s; }
.particle:nth-child(3) { left: 40%; animation-delay: 4s; animation-duration: 24s; width: 4px; height: 4px; }
.particle:nth-child(4) { left: 55%; animation-delay: 1s; animation-duration: 20s; }
.particle:nth-child(5) { left: 70%; animation-delay: 3s; animation-duration: 16s; width: 2px; height: 2px; }
.particle:nth-child(6) { left: 85%; animation-delay: 5s; animation-duration: 21s; }
.particle:nth-child(7) { left: 15%; animation-delay: 6s; animation-duration: 19s; width: 4px; height: 4px; background: rgba(16,185,129,0.3); }
.particle:nth-child(8) { left: 65%; animation-delay: 7s; animation-duration: 23s; background: rgba(139,92,246,0.3); }

@keyframes particleFloat {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% {
        transform: translateY(-10vh) rotate(720deg);
        opacity: 0;
    }
}

/* ============================================
   OYUN MASASI (Game Board)
   ============================================ */
.game-board {
    width: 100vw;
    height: 100vh;
    background: var(--table-gradient);
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* Keçe Dokusu */
.game-board::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='6' height='6' viewBox='0 0 6 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 5h1v1H1V5zm3-3h1v1H4V2z' fill='%23ffffff' fill-opacity='0.025' fill-rule='evenodd'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 1;
}

/* Vignette */
.game-board::after {
    content: '';
    position: absolute;
    inset: 0;
    box-shadow: inset 0 0 150px rgba(0, 0, 0, 0.7);
    pointer-events: none;
    z-index: 2;
}

/* ============================================
   MASA MERKEZİ (Table Center)
   ============================================ */
.table-center {
    position: absolute;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 300px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 15;
    pointer-events: none;
}

.center-content {
    pointer-events: auto;
    display: flex;
    gap: 40px;
    align-items: center;
}

/* Alan Etiketleri */
.area-label {
    display: block;
    text-align: center;
    margin-top: 10px;
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* Yığın (Draw Pile) */
.pile-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.pile-stack {
    position: relative;
    width: var(--tile-width);
    height: var(--tile-height);
    cursor: pointer;
    transition: transform var(--transition-spring);
}

.pile-stack:hover {
    transform: translateY(-6px) scale(1.03);
}

.pile-tile-back {
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(145deg, #e8e0d4, #d4cabb);
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    box-shadow: 1px 2px 6px rgba(0, 0, 0, 0.35);
}

.pile-tile-back:nth-child(1) { top: -6px; left: -1px; z-index: 3; }
.pile-tile-back:nth-child(2) { top: -3px; left: 0px; z-index: 2; }
.pile-tile-back:nth-child(3) { top: 0px; left: 1px; z-index: 1; }

.pile-count-badge {
    position: absolute;
    top: -12px;
    right: -12px;
    background: var(--gradient-gold);
    color: #000;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 0.75rem;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    box-shadow: 0 2px 8px var(--accent-glow);
    border: 2px solid rgba(0, 0, 0, 0.15);
}

/* Gösterge ve Okey Alanı */
.indicator-section {
    display: flex;
    gap: 30px;
    background: var(--glass-bg);
    padding: 22px 32px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    box-shadow:
        var(--shadow-lg),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    position: relative;
    transition: all var(--transition-normal);
}

.indicator-section:hover {
    transform: scale(1.03);
    border-color: var(--glass-border-hover);
    background: var(--glass-bg-hover);
}

/* Altın Parlama */
.indicator-section::after {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 20px;
    background: radial-gradient(ellipse, var(--accent-glow) 0%, transparent 70%);
    filter: blur(12px);
    pointer-events: none;
}

/* Okey Taşı Vurgusu */
#okeyTile .tile-sprite,
#okeyTile .tile-placeholder {
    box-shadow:
        0 0 20px var(--accent-glow),
        inset 0 0 10px rgba(255, 255, 0, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.5);
}

.indicator-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.slot-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 600;
}

.tile-placeholder {
    width: var(--tile-width);
    height: var(--tile-height);
    background: rgba(255, 255, 255, 0.04);
    border: 1px dashed rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Atılan Taşlar */
.discard-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.discard-stack {
    width: var(--tile-width);
    height: var(--tile-height);
    position: relative;
    cursor: pointer;
}

.discard-placeholder {
    width: 100%;
    height: 100%;
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.25);
    font-weight: 500;
    letter-spacing: 1px;
}

/* ============================================
   UI KATMANI (HUD)
   ============================================ */
.ui-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 90;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

/* Glass Paneller */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    color: #fff;
    pointer-events: auto;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
}

.glass-panel:hover {
    background: var(--glass-bg-hover);
    border-color: var(--glass-border-hover);
    transform: translateY(1px);
}

/* Skor Paneli */
.stats-panel {
    min-width: 200px;
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
}

.stats-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stats-panel.collapsed .stats-list {
    display: none;
}

.stats-panel.collapsed {
    min-width: 160px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    padding: 5px 8px;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.stat-row:hover {
    background: rgba(255, 255, 255, 0.05);
}

.stat-score {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    color: var(--accent);
    font-size: 0.95rem;
}

.stat-score.negative {
    color: var(--success);
}

/* Durum Paneli */
.game-status-panel {
    display: flex;
    align-items: center;
    gap: 20px;
}

.status-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
}

.status-item .label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 4px;
    font-weight: 600;
}

.status-item .value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.divider {
    width: 1px;
    height: 36px;
    background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.15), transparent);
}

/* ============================================
   AÇIK TAŞLAR (Opened Tiles Table)
   ============================================ */
.opened-tiles-table {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 500px;
    height: 300px;
    pointer-events: none;
    z-index: 5;
}

.opened-player-area {
    position: absolute;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 5px;
    pointer-events: auto;
    max-width: 400px;
}

.opened-player-area.top { top: -80px; left: 50%; transform: translateX(-50%); justify-content: center; }
.opened-player-area.bottom { bottom: -80px; left: 50%; transform: translateX(-50%); justify-content: center; }
.opened-player-area.left { left: -120px; top: 50%; transform: translateY(-50%); flex-direction: column; max-height: 250px; }
.opened-player-area.right { right: -120px; top: 50%; transform: translateY(-50%); flex-direction: column; max-height: 250px; }

.opened-group {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 5px 7px;
    background: rgba(0, 0, 0, 0.55);
    border-radius: var(--radius-sm);
    border: 2px solid rgba(16, 185, 129, 0.45);
    position: relative;
    backdrop-filter: blur(4px);
    transition: all var(--transition-normal);
}

.opened-group:hover {
    border-color: rgba(16, 185, 129, 0.8);
    box-shadow: 0 0 12px var(--success-glow);
}

.opened-group.pairs {
    border-color: rgba(139, 92, 246, 0.45);
}

.opened-group.pairs:hover {
    border-color: rgba(139, 92, 246, 0.8);
}

.opened-group .mini-tile {
    width: 28px;
    height: 40px;
    background: linear-gradient(145deg, #faf5e8, #e8dfca);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.8rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.opened-group .drop-zone {
    width: 24px;
    height: 36px;
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.opened-group:hover .drop-zone,
.opened-group.drag-over .drop-zone {
    opacity: 1;
}

.opened-group.drag-over {
    border-color: var(--success);
    box-shadow: 0 0 20px var(--success-glow);
}

/* ============================================
   OYUNCU ALANLARI (Player Areas)
   ============================================ */
.opponent-area {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    z-index: 5;
}

/* Player Info Card */
.player-info {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    background: var(--glass-bg);
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-sm);
}

.player-info.current-turn {
    border: 3px solid var(--accent);
    background: rgba(245, 158, 11, 0.15);
    box-shadow: 0 0 35px var(--accent-glow);
    transform: scale(1.15);
    z-index: 100;
    animation: turnPulse 1.5s ease-in-out infinite;
}

@keyframes turnPulse {
    0%, 100% { box-shadow: 0 0 15px var(--accent-glow); }
    50% { box-shadow: 0 0 30px var(--accent-glow); }
}

.avatar-wrapper {
    position: relative;
    width: 40px;
    height: 40px;
}

.player-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.6);
    object-fit: cover;
    transition: border-color var(--transition-fast);
}

.player-info.current-turn .player-avatar {
    border-color: var(--accent);
}

.turn-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 12px;
    height: 12px;
    background: var(--accent);
    border-radius: 50%;
    border: 2px solid var(--bg-deep);
    display: none;
    animation: badgePulse 1.5s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.player-info.current-turn .turn-badge {
    display: block;
}

.player-details {
    display: flex;
    flex-direction: column;
}

.player-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
}

.player-score {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* Kapalı Eller */
.opponent-hand {
    display: flex;
    gap: 2px;
}

.opponent-tile-back {
    width: 22px;
    height: 32px;
    background: linear-gradient(145deg, #e8e0d4, #d4cabb);
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 3px;
    box-shadow: -1px 1px 3px rgba(0, 0, 0, 0.25);
    display: block !important;
    z-index: 10;
    opacity: 1 !important;
}

/* Konumlar */
.opponent-area.top {
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    flex-direction: column-reverse;
}

.opponent-area.left {
    left: 20px;
    top: 45%;
    transform: translateY(-50%);
    flex-direction: row-reverse;
}

.opponent-hand.vertical {
    flex-direction: column;
}

.opponent-tile-back.vertical {
    width: 32px;
    height: 22px;
}

.opponent-area.right {
    right: 20px;
    top: 45%;
    transform: translateY(-50%);
    flex-direction: row;
}

/* BOTTOM (Oyuncu) */
.player-area.bottom {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    justify-content: center;
    gap: 15px;
    z-index: 20;
    padding: 0 20px;
}

.player-info.self {
    position: absolute;
    bottom: 270px;
    right: 20px;
    transform: none;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(12px);
}

.tile-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    background: var(--gradient-gold);
    color: #000;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 0.75rem;
    border-radius: 12px;
    padding: 0 6px;
}

/* ============================================
   ISTAKA (CUE)
   ============================================ */
.cue-container {
    width: 100%;
    max-width: 900px;
    min-height: var(--cue-height);
    position: relative;
    margin: 0 auto;
}

.cue-wood {
    width: 100%;
    height: 100%;
    background-image: url('../asset/istaka_new.png');
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 8px;
    box-shadow:
        0 -3px 15px rgba(0, 0, 0, 0.4),
        0 4px 20px rgba(0, 0, 0, 0.5);
    position: relative;
    padding: 8px 32px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}

.cue-row {
    position: relative;
    height: 78px;
    display: flex;
    align-items: flex-end;
    gap: 1px;
    padding: 0 8px 6px 8px;
    pointer-events: auto !important;
    z-index: 900 !important;
    overflow: hidden;
}

.cue-row.top-row {
    border-bottom: 2px solid rgba(0, 0, 0, 0.15);
    margin-bottom: 0;
}

.cue-row.bottom-row {
    border-bottom: none;
}

/* ============================================
   TAŞ (Tile) STİLLERİ
   ============================================ */
.tile-sprite {
    width: 48px;
    min-width: 28px;
    height: 68px;
    background-image: url('../asset/Taslar.png');
    background-size: 650px 350px;
    border-radius: 4px;
    position: relative;
    flex-shrink: 1;
    cursor: grab;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    box-shadow:
        1px 1px 0px #ccc,
        2px 2px 0px #aaa,
        2px 3px 6px rgba(0, 0, 0, 0.4);
    transform-origin: bottom center;
    pointer-events: auto !important;
    z-index: 1000 !important;
    touch-action: none;
    user-select: none;
}

.tile-sprite:hover {
    transform: translateY(-8px);
    z-index: 1010 !important;
    box-shadow:
        1px 1px 0px #ccc,
        2px 2px 0px #aaa,
        3px 5px 12px rgba(0, 0, 0, 0.5);
}

.tile-sprite.dragging {
    opacity: 0.8;
    cursor: grabbing;
    z-index: 9999 !important;
    transform: scale(1.12);
}

.tile-sprite.selected {
    transform: translateY(-12px);
    box-shadow:
        0 0 12px var(--accent),
        0 0 24px var(--accent-glow),
        1px 1px 0px #ccc;
    border: 2px solid var(--accent);
}

.tile-sprite.in-valid-group {
    border-width: 3px;
    border-style: solid;
}

.mini-tile-inner {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 1.2rem;
    background: linear-gradient(145deg, #fff, #f5f0e1);
    border-radius: 4px;
}

.mini-tile-inner.kirmizi { color: #c62828; }
.mini-tile-inner.yesil { color: #2e7d32; }
.mini-tile-inner.mavi { color: #1565c0; }
.mini-tile-inner.siyah { color: #212121; }
.mini-tile-inner.sahte { color: #6d28d9; }

.okey::after {
    content: '★';
    position: absolute;
    top: -5px;
    right: -5px;
    color: var(--accent);
    font-size: 12px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    animation: starGlow 2s ease-in-out infinite;
}

@keyframes starGlow {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; text-shadow: 0 0 8px var(--accent-glow); }
}

/* ============================================
   Slot Sistemi
   ============================================ */
.tile-slot {
    width: 50px;
    height: 70px;
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    transition: background-color var(--transition-fast), border-color var(--transition-fast);
    pointer-events: auto !important;
    z-index: 5;
}

.tile-slot.drag-over {
    background: linear-gradient(to bottom, rgba(245, 158, 11, 0.2), rgba(245, 158, 11, 0.05));
    border: 1px solid var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
}

.tile-slot .tile-sprite {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
}

/* ============================================
   AKSİYON BUTONLARI
   ============================================ */
.action-buttons {
    position: absolute;
    top: 55%;
    right: 15px;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 90;
}

.action-btn {
    padding: 8px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-spring);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2px;
    white-space: nowrap;
    min-width: 65px;
    text-align: center;
}

.action-btn:hover {
    background: var(--gradient-gold);
    color: #000;
    transform: scale(1.08);
    box-shadow: var(--shadow-glow-gold);
    border-color: transparent;
}

.action-btn.open-hand.ready {
    background: var(--gradient-emerald);
    border-color: transparent;
    animation: readyPulse 1.5s ease-in-out infinite;
}

@keyframes readyPulse {
    0%, 100% { box-shadow: 0 0 10px var(--success-glow); }
    50% { box-shadow: 0 0 25px var(--success-glow); }
}

.action-btn.finish {
    background: var(--gradient-danger);
    border-color: transparent;
}

.action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
}

/* ============================================
   SERİ DİZ / ÇİFT DİZ BUTONLARI
   ============================================ */
.sort-buttons {
    position: absolute;
    bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 950;
}

.sort-buttons.left-sort {
    left: 10px;
}

.sort-buttons.right-sort {
    right: 10px;
}

.sort-btn {
    padding: 8px 10px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(30, 41, 59, 0.85);
    backdrop-filter: blur(8px);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
    white-space: nowrap;
    line-height: 1.3;
}

.sort-btn:hover {
    background: var(--gradient-gold);
    color: #000;
    transform: scale(1.05);
    border-color: transparent;
}

.sort-btn .sort-icon {
    font-size: 1rem;
    display: block;
    margin-bottom: 2px;
}

/* ============================================
   MODALLER
   ============================================ */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: linear-gradient(145deg, #1e293b, #0f172a);
    padding: 32px;
    border-radius: var(--radius-xl);
    border: 1px solid var(--glass-border);
    max-width: 500px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    color: white;
    animation: modalSlideUp 0.4s var(--ease-spring);
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* El Açma Modalı */
.open-hand-modal {
    max-width: 900px !important;
    width: 95% !important;
    max-height: 90vh;
    overflow-y: auto;
}

.open-hand-info {
    color: var(--text-secondary);
    margin-bottom: 15px;
    font-size: 0.95rem;
}

.open-hand-score {
    background: rgba(0, 0, 0, 0.3);
    padding: 16px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.score-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    margin-top: 10px;
    overflow: hidden;
}

.score-progress {
    height: 100%;
    background: linear-gradient(90deg, var(--danger), var(--accent), var(--success));
    border-radius: 3px;
    transition: width var(--transition-normal);
    width: 0%;
}

.open-hand-tiles {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.open-hand-tiles .tile-sprite {
    transform: scale(0.6);
    transform-origin: top left;
    margin-right: -28px;
    margin-bottom: -40px;
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.open-hand-tiles .tile-sprite:hover {
    transform: scale(0.65);
    z-index: 10;
}

.open-hand-tiles .tile-sprite.selected-for-group {
    border: 2px solid var(--success);
    box-shadow: 0 0 12px var(--success-glow);
}

.open-hand-tiles .tile-sprite.used {
    opacity: 0.25;
    pointer-events: none;
}

.selected-groups-display {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    justify-content: center;
}

.selected-group {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 3px;
    padding: 8px 12px;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.4);
    border-radius: var(--radius-sm);
    position: relative;
    transition: all var(--transition-fast);
}

.selected-group:hover {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.25);
}

.selected-group .mini-tile {
    width: 30px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.selected-group .group-score {
    background: var(--gradient-emerald);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    margin-left: 5px;
}

.selected-group .remove-group {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    background: var(--danger);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: transform var(--transition-fast);
}

.selected-group .remove-group:hover {
    transform: scale(1.2);
}

.group-display {
    display: flex;
    gap: 3px;
    padding: 10px;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.4);
    border-radius: var(--radius-sm);
    position: relative;
}

.group-display .remove-group {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    background: var(--danger);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.open-hand-instructions {
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.2);
    padding: 14px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 0.85rem;
    color: #93c5fd;
    line-height: 1.6;
}

.open-hand-instructions p {
    margin: 4px 0;
}

.open-hand-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ============================================
   TOAST BİLDİRİMLERİ
   ============================================ */
.toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: white;
    padding: 14px 28px;
    border-radius: var(--radius-pill);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 2000;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lg);
    animation: toastSlideIn 0.4s var(--ease-spring);
    font-weight: 500;
    font-size: 0.9rem;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
}

.toast.hidden {
    display: none;
}

/* ============================================
   LOBİ / ANA MENÜ (index.html)
   ============================================ */
.container {
    width: 100%;
    max-width: 560px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
    z-index: 10;
    position: relative;
    margin: 0 auto;
}

/* Header & Logo */
.header {
    text-align: center;
    margin-bottom: 36px;
    animation: fadeInDown 0.8s var(--ease-spring);
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    font-size: 3.2rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.logo-icon {
    font-size: 3.8rem;
    animation: logoFloat 3s ease-in-out infinite;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0) rotate(-3deg); }
    50% { transform: translateY(-8px) rotate(3deg); }
}

.logo-text {
    background: linear-gradient(135deg, #fff 0%, var(--accent-light) 50%, #fff 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 4s ease-in-out infinite;
}

@keyframes shimmer {
    0% { background-position: 0% center; }
    50% { background-position: 200% center; }
    100% { background-position: 0% center; }
}

.tagline {
    color: var(--accent);
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 3px;
    margin-top: 10px;
    opacity: 0.85;
    text-transform: uppercase;
}

/* Kartlar */
.card {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 36px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.8s var(--ease-spring) 0.2s backwards;
    position: relative;
    overflow: hidden;
}

/* Kart üst parıltı */
.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.15) 50%, transparent 100%);
}

.card h2 {
    font-size: 1.8rem;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #fff, #cbd5e1);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.welcome-text {
    color: var(--text-secondary);
    margin-bottom: 28px;
    font-size: 1rem;
}

/* İsim Girişi */
.name-input-container {
    margin-bottom: 24px;
}

.name-input {
    width: 100%;
    padding: 14px 20px;
    font-size: 1rem;
    font-family: inherit;
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    color: #fff;
    text-align: center;
    transition: all var(--transition-normal);
    outline: none;
}

.name-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.name-input:focus {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 20px var(--accent-glow);
}

.section-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 12px;
    text-align: left;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Avatar Seçimi */
.avatar-selection {
    margin-bottom: 24px;
}

.avatar-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 0;
}

.avatar-option {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all var(--transition-spring);
}

.avatar-option img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-normal);
}

.avatar-option:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 255, 255, 0.2);
}

.avatar-option.selected {
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
}

.avatar-option.selected img {
    transform: scale(1.08);
}

/* Istaka Seçimi */
.istaka-selection {
    margin-bottom: 20px;
}

.istaka-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.istaka-option {
    position: relative;
    height: 48px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all var(--transition-spring);
}

.istaka-option img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.istaka-option:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: rgba(255, 255, 255, 0.15);
}

.istaka-option.selected {
    border-color: var(--accent);
    box-shadow: 0 0 15px var(--accent-glow);
}

.istaka-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: white;
    text-align: center;
    padding: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Butonlar */
.btn {
    border: none;
    outline: none;
    cursor: pointer;
    font-family: inherit;
    font-weight: 700;
    border-radius: var(--radius-md);
    transition: all var(--transition-spring);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: 0.5px;
}

.btn-large {
    width: 100%;
    padding: 16px;
    font-size: 1.1rem;
}

.btn-primary {
    background: var(--gradient-gold);
    color: var(--bg-deep);
    box-shadow: 0 4px 15px var(--accent-glow);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px var(--accent-glow);
}

.btn-primary:active {
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-danger {
    background: var(--gradient-danger);
    color: white;
}

.btn-danger:hover {
    box-shadow: 0 4px 15px var(--danger-glow);
}

/* Toggle Switch */
.team-mode-toggle {
    margin: 16px 0;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: all var(--transition-fast);
}

.team-mode-toggle:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
}

.toggle-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
}

.toggle-label input {
    display: none;
}

.toggle-slider {
    width: 44px;
    height: 22px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 11px;
    position: relative;
    transition: background var(--transition-normal);
    flex-shrink: 0;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: transform var(--transition-spring);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.toggle-label input:checked + .toggle-slider {
    background: var(--accent);
}

.toggle-label input:checked + .toggle-slider::before {
    transform: translateX(22px);
    background: var(--bg-deep);
}

.toggle-text {
    font-size: 1rem;
    font-weight: 600;
}

.toggle-info {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ============================================
   LOBİ OVERLAY (game.html)
   ============================================ */
.lobby-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 15, 28, 0.95);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.lobby-container {
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.95));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 40px;
    max-width: 480px;
    width: 90%;
    text-align: center;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
    animation: modalSlideUp 0.5s var(--ease-spring);
}

.lobby-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(245,158,11,0.3), transparent);
}

.lobby-header h1 {
    font-size: 2.2rem;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--accent-light), #fff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.lobby-header p {
    color: var(--text-secondary);
    font-size: 1rem;
}

.lobby-room-code {
    margin: 24px 0;
    padding: 20px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.lobby-room-code-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-bottom: 8px;
    font-weight: 700;
}

.lobby-room-code-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 6px;
    text-shadow: 0 0 20px var(--accent-glow);
}

.lobby-room-code-copy {
    margin-top: 14px;
    padding: 8px 20px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-sm);
    color: #fff;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
}

.lobby-room-code-copy:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.lobby-team-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    background: var(--gradient-purple);
    border-radius: var(--radius-pill);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 20px;
}

.lobby-players {
    margin: 20px 0;
}

.lobby-players h3 {
    margin-bottom: 14px;
    font-size: 1rem;
    font-weight: 600;
}

.lobby-players-count {
    color: var(--accent);
    font-family: 'JetBrains Mono', monospace;
}

.lobby-players-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.lobby-player-slot {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.04);
    transition: all var(--transition-normal);
}

.lobby-player-slot.filled {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.2);
    animation: slotFillIn 0.4s var(--ease-spring);
}

@keyframes slotFillIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.lobby-player-slot.empty {
    opacity: 0.4;
}

.lobby-player-slot .position-icon {
    font-size: 1.1rem;
}

.lobby-player-slot .player-name {
    flex: 1;
    text-align: left;
    font-size: 0.9rem;
    font-weight: 500;
}

.lobby-waiting {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin: 24px 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.spinner {
    width: 22px;
    height: 22px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.lobby-leave-btn {
    width: 100%;
    padding: 13px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: var(--radius-md);
    color: #f87171;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.lobby-leave-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    transform: translateY(-1px);
}

/* ============================================
   OYUNCU ATIK ALANLARI
   ============================================ */
.player-discard {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    min-width: 80px;
    max-width: 120px;
}

.discard-label {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 700;
}

.discard-tiles {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.35);
    border-radius: var(--radius-md);
    min-height: 80px;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: all var(--transition-fast);
}

.left-discard .discard-tiles {
    border-color: rgba(16, 185, 129, 0.3);
    cursor: pointer;
}

.left-discard .discard-tiles:hover {
    border-color: rgba(16, 185, 129, 0.6);
    background: rgba(16, 185, 129, 0.08);
    box-shadow: 0 0 12px var(--success-glow);
}

.right-discard .discard-tiles {
    border-color: rgba(239, 68, 68, 0.3);
}

.discard-tiles .mini-tile {
    width: 35px;
    height: 50px;
    transform: scale(0.5);
    transform-origin: center;
    margin: -12px 0;
}

/* Yeni Atık Cepleri Override */
.player-discard {
    width: 65px;
    height: 95px;
    background: linear-gradient(145deg, #4a3228, #3a2419);
    border: 2px solid #281a16;
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: absolute;
    bottom: 5px;
    box-shadow:
        inset 0 2px 6px rgba(0, 0, 0, 0.5),
        0 5px 15px rgba(0, 0, 0, 0.4);
    z-index: 260;
    transition: all var(--transition-normal);
}

.player-discard.left-discard {
    left: -80px;
    border-right: none;
    border-radius: 14px 0 0 14px;
}

.player-discard.right-discard {
    right: -52px;
    border-left: none;
    border-radius: 0 14px 14px 0;
}

.player-discard .discard-label {
    font-size: 0.65rem;
    color: #d1d5db;
    margin-bottom: 3px;
    text-transform: uppercase;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.player-discard .discard-tiles {
    width: 58px;
    height: 80px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.04);
    min-height: auto;
    max-height: none;
    padding: 0;
    overflow: visible;
}

.player-discard .discard-tiles .mini-tile {
    width: 58px;
    height: 80px;
    transform: scale(0.96);
    transform-origin: center;
    margin: 0;
}

.player-discard .discard-tiles .mini-tile-inner {
    font-size: 1.65rem;
}

.player-discard.left-discard .discard-tiles {
    border-bottom: 2px solid var(--success);
}

.player-discard.right-discard .discard-tiles {
    border-bottom: 2px solid var(--danger);
}

.player-discard.left-discard .discard-tiles::before {
    content: '📥';
    font-size: 1.1rem;
    opacity: 0.4;
}

.player-discard.right-discard .discard-tiles::before {
    content: '';
    display: none;
}

.last-discard-chip {
    position: absolute;
    right: -44px;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 48px;
    padding: 2px;
    border-radius: 7px;
    background: rgba(17, 24, 39, 0.72);
    border: 1px solid rgba(245, 158, 11, 0.35);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.32);
    pointer-events: none;
    z-index: 8;
}

.last-discard-chip .mini-tile-inner {
    font-size: 1rem;
    border-radius: 5px;
}

.player-discard:hover {
    transform: translateY(-3px);
    filter: brightness(1.15);
}

/* Orta atık section gizle */
.discard-section {
    display: none !important;
}

/* ============================================
   🍅 DOMATES FİRLATMA
   ============================================ */
.tomato-btn {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--gradient-danger);
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    box-shadow: 0 4px 15px var(--danger-glow);
    transition: all var(--transition-spring);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tomato-btn:hover {
    transform: scale(1.12);
    box-shadow: 0 6px 25px var(--danger-glow);
}

.tomato-btn:active {
    transform: scale(0.95);
}

.tomato-counter {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--gradient-gold);
    color: #000;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tomato-select-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.tomato-select-overlay.hidden {
    display: none;
}

.tomato-select-panel {
    background: linear-gradient(145deg, #1e293b, #0f172a);
    padding: 30px;
    border-radius: var(--radius-xl);
    text-align: center;
    color: white;
    max-width: 380px;
    width: 90%;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lg);
    animation: modalSlideUp 0.4s var(--ease-spring);
}

.tomato-select-panel h3 {
    font-size: 1.4rem;
    margin-bottom: 8px;
}

.target-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 20px 0;
}

.target-btn {
    padding: 13px 22px;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: var(--radius-md);
    color: white;
    font-size: 0.95rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    gap: 10px;
}

.target-btn:hover {
    background: rgba(239, 68, 68, 0.25);
    transform: translateX(4px);
    border-color: rgba(239, 68, 68, 0.5);
}

.cancel-throw-btn {
    padding: 10px 28px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.cancel-throw-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

/* Uçan Domates */
.flying-tomato {
    position: fixed;
    font-size: 3rem;
    pointer-events: none;
    z-index: 3000;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.tomato-splat {
    position: fixed;
    font-size: 4rem;
    pointer-events: none;
    z-index: 2999;
    animation: splatFade 1s forwards;
}

@keyframes splatFade {
    0% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1.5); }
}

.player-info.tomato-hit {
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    50% { transform: translateX(8px); }
    75% { transform: translateX(-8px); }
}

.tomato-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(239, 68, 68, 0.9);
    backdrop-filter: blur(8px);
    color: white;
    padding: 20px 40px;
    border-radius: var(--radius-lg);
    font-size: 1.4rem;
    font-weight: 700;
    z-index: 3001;
    animation: notifPop 2s forwards;
}

@keyframes notifPop {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
    30% { transform: translate(-50%, -50%) scale(1); }
    80% { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -100%); }
}

/* Açılmış Taşlar Paneli */
.opened-tiles-panel {
    display: none !important;
}

.opened-tiles-panel.hidden {
    display: none;
}

.opened-tiles-panel h4 {
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.opened-tiles-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Final Scores */
.final-scores {
    margin: 20px 0;
}

/* ============================================
   ANİMASYONLAR
   ============================================ */
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-24px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}

.hidden {
    display: none !important;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Tablet (max-width: 1024px) */
@media (max-width: 1024px) {
    .game-board { overflow: hidden; }

    .table-center {
        transform: translate(-50%, -50%) scale(0.85);
    }

    .cue-container {
        transform: scale(0.85);
        transform-origin: bottom center;
        margin-bottom: -20px;
    }

    .opponent-area {
        transform: scale(0.85);
    }

    .opponent-area.left { transform-origin: left center; left: 0; }
    .opponent-area.right { transform-origin: right center; right: 0; }
    .opponent-area.top { transform-origin: top center; top: 0; }
}

/* Mobile (max-width: 768px) */
@media (max-width: 768px) {
    /* Lobi Mobil */
    .container { padding: 10px; }
    .logo { font-size: 2.3rem; }
    .logo-icon { font-size: 2.8rem; }
    .card { padding: 24px; border-radius: var(--radius-lg); }
    .avatar-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .btn-large { padding: 14px; font-size: 1rem; }

    /* Oyun Masası Mobil */
    .table-center {
        transform: translate(-50%, -60%) scale(0.6);
    }

    .cue-container {
        transform: scale(0.55);
        transform-origin: bottom center;
        width: 120%;
        margin-bottom: -40px;
    }

    .opponent-area { gap: 5px; }
    .player-info { padding: 4px 10px; font-size: 0.85rem; }
    .avatar-wrapper { width: 32px; height: 32px; }

    .opponent-area.left { transform: scale(0.6); transform-origin: left center; left: -10px; }
    .opponent-area.right { transform: scale(0.6); transform-origin: right center; right: -10px; }
    .opponent-area.top { transform: translateX(-50%) scale(0.6); transform-origin: top center; top: 5px; }

    .action-buttons {
        transform: scale(0.6);
        transform-origin: bottom right;
        bottom: 100px;
        top: auto;
        right: 10px;
        flex-direction: row;
    }

    .ui-layer { padding: 8px; }
    .stats-panel { transform: scale(0.75); transform-origin: top left; min-width: 160px; }
    .game-status-panel { transform: scale(0.75); transform-origin: top right; gap: 8px; }

    /* Atık Cepleri Mobil */
    .player-discard { width: 68px; height: 92px; bottom: 24px; z-index: 320; }
    .player-discard.left-discard { left: -72px; }
    .player-discard.right-discard { right: -46px; }
    .player-discard .discard-label { display: none; }
    .player-discard .discard-tiles { width: 58px; height: 80px; }
    .player-discard .discard-tiles .mini-tile { width: 58px; height: 80px; transform: scale(1); }
    .last-discard-chip { right: -38px; width: 30px; height: 42px; }
    .cue-container { position: relative; z-index: 60; }
    .opened-tiles-table { transform: translate(-50%, -60%) scale(0.66); z-index: 2; }
    .opened-player-area.left { left: -90px; }
    .opened-player-area.right { right: -90px; }
    #fullscreenBtn { top: 70px !important; right: 10px !important; min-width: 94px !important; }
    #returnDiscardBtn { top: 118px !important; right: 10px !important; min-width: 112px !important; }
    #voteEndRoundBtn { right: 110px; top: 20px; transform: scale(0.8); transform-origin: top right; }
    #takeSeatBtn { top: 118px !important; right: 10px !important; min-width: 130px !important; }
}

/* Peyzaj Uyarısı */
@media (max-width: 500px) and (orientation: portrait) {
    body::after {
        content: "Lütfen daha iyi deneyim için telefonu yan çevirin 🔄";
        position: fixed;
        inset: 0;
        background: rgba(10, 15, 28, 0.95);
        backdrop-filter: blur(10px);
        color: white;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 9999;
        text-align: center;
        padding: 20px;
        font-size: 1.1rem;
        font-weight: 500;
        pointer-events: none;
        opacity: 0;
        animation: fadeIn 3s 1s forwards;
    }
}

@keyframes fadeIn {
    to { opacity: 1; pointer-events: auto; }
}

/* ============================================
   DRAGGING GHOST
   ============================================ */
.dragging-ghost {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.9;
    transform: scale(1.1);
    filter: drop-shadow(0 8px 20px rgba(0,0,0,0.4));
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ============================================
   🗳️ ELİ BİTİR OY BUTONU
   ============================================ */
.vote-end-btn {
    position: fixed;
    top: 20px;
    right: 300px;
    padding: 8px 16px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-pill);
    color: #f87171;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    z-index: 95;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(8px);
}

.vote-end-btn:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: rgba(239, 68, 68, 0.5);
    transform: translateY(-1px);
}

.vote-end-btn.voted {
    background: rgba(239, 68, 68, 0.4);
    border-color: var(--danger);
    color: white;
}

.return-discard-btn {
    position: fixed;
    top: 68px;
    right: 220px;
    z-index: 130;
    min-width: 120px;
    padding: 9px 14px;
    border: 1px solid rgba(16, 185, 129, 0.45);
    border-radius: var(--radius-pill);
    background: rgba(16, 185, 129, 0.18);
    color: #d1fae5;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.18);
    backdrop-filter: blur(8px);
}

.return-discard-btn:hover {
    background: rgba(16, 185, 129, 0.3);
}

.return-discard-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.vote-badge {
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 8px;
    border-radius: 10px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
}

/* ============================================
   👁️ İZLEYİCİ BADGE
   ============================================ */
.spectator-badge {
    position: fixed;
    bottom: 80px;
    left: 20px;
    padding: 6px 14px;
    background: var(--glass-bg);
    backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-pill);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    z-index: 95;
}

/* ============================================
   💬 SOHBET PANELİ
   ============================================ */
.chat-panel {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 280px;
    z-index: 200;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--glass-border);
    transition: all var(--transition-normal);
}

.chat-header {
    background: rgba(10, 15, 28, 0.85);
    backdrop-filter: blur(12px);
    padding: 10px 16px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
    transition: background var(--transition-fast);
}

.chat-header:hover {
    background: rgba(10, 15, 28, 0.95);
}

.chat-unread {
    background: var(--danger);
    color: white;
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    min-width: 18px;
    text-align: center;
}

.chat-body {
    background: rgba(10, 15, 28, 0.8);
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.chat-panel.open .chat-body {
    max-height: 300px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 220px;
    min-height: 150px;
}

.chat-msg {
    font-size: 0.8rem;
    padding: 5px 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    word-break: break-word;
    line-height: 1.4;
}

.chat-msg .chat-sender {
    font-weight: 700;
    color: var(--accent);
    margin-right: 6px;
    font-size: 0.75rem;
}

.chat-msg .chat-sender.spectator {
    color: var(--text-muted);
}

.chat-msg.system {
    color: var(--text-muted);
    font-style: italic;
    background: transparent;
    font-size: 0.75rem;
}

.chat-input-area {
    display: flex;
    padding: 8px;
    gap: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 6px 10px;
    color: white;
    font-family: inherit;
    font-size: 0.8rem;
    outline: none;
    transition: border-color var(--transition-fast);
}

.chat-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.chat-input:focus {
    border-color: var(--accent);
}

.chat-send-btn {
    background: var(--gradient-gold);
    border: none;
    border-radius: 6px;
    color: #000;
    width: 32px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: transform var(--transition-fast);
}

.chat-send-btn:hover {
    transform: scale(1.1);
}

/* ============================================
   ÇİFT SAYACI
   ============================================ */
.pair-count-display {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 2px;
}

/* ============================================
   İZLEYİCİ MODU OVERLAY
   ============================================ */
.spectator-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    pointer-events: none;
}

.spectator-bar {
    background: rgba(139, 92, 246, 0.9);
    backdrop-filter: blur(8px);
    padding: 10px 20px;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
    color: white;
    pointer-events: auto;
    z-index: 1001;
}

@media (max-width: 768px) {
    .chat-panel {
        width: 240px;
        bottom: 10px;
        right: 10px;
    }

    .vote-end-btn {
        right: 200px;
        font-size: 0.7rem;
        padding: 6px 12px;
    }
}

/* ============================================
   BUTON ALT YAZI STİLLERİ
   ============================================ */
.btn-label {
    font-size: 0.65rem;
    font-weight: 600;
}

.btn-sub {
    font-size: 0.55rem;
    font-weight: 500;
    opacity: 0.8;
    font-family: 'JetBrains Mono', monospace;
}

/* ============================================
   AKTİF ODALAR LİSTESİ (LOBİ)
   ============================================ */
.room-section {
    margin-top: 12px;
}

.active-rooms {
    margin-top: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-md);
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.rooms-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 8px;
}

.rooms-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 150px;
    overflow-y: auto;
}

.no-rooms {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-align: center;
    padding: 8px;
}

.room-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.room-card:hover {
    background: rgba(245, 158, 11, 0.1);
    border-color: var(--accent);
}

.room-card.full {
    opacity: 0.5;
    cursor: not-allowed;
}

.room-code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 1px;
}

.room-players {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.room-status {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.room-status.waiting {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
}

.room-status.playing {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

/* Earlier mobile overrides removed — see comprehensive block below */

/* Mobilde alt HUD elemanlari birbirinin ustune binmesin.
   Layout (bottom→top):
   - Row 1 (bottom): tomato-btn (sol), sort-buttons (sol orta + sağ)
   - Row 2 (above):  left-discard (sol), right-discard (sağ)
   
   Tomato: 44px tall  → gap 6px → sort aligns beside it
   Sort row bottom = 10px, height ~52px → top ~62px
   Discard bottom = 10 + 44 + 8 = 62px (above tomato)
*/
@media (max-width: 768px) {
    /* ---- DOMATES BUTONU: Sol alt köşe, en altta ---- */
    .tomato-btn {
        width: 44px;
        height: 44px;
        left: max(10px, env(safe-area-inset-left));
        bottom: max(10px, env(safe-area-inset-bottom));
        font-size: 1.3rem;
        z-index: 1320;
    }

    .tomato-counter {
        width: 18px;
        height: 18px;
        font-size: 0.6rem;
    }

    /* ---- SERİ/ÇİFT DİZ BUTONLARI ---- */
    .sort-buttons {
        position: fixed;
        bottom: max(10px, env(safe-area-inset-bottom));
        transform: none !important;
        z-index: 1310;
        flex-direction: row;
        gap: 5px;
    }

    /* Çift Diz: domatesin sağında */
    .sort-buttons.left-sort {
        left: calc(max(10px, env(safe-area-inset-left)) + 52px);
    }

    /* Seri Diz: sağ alt köşe */
    .sort-buttons.right-sort {
        right: max(10px, env(safe-area-inset-right));
    }

    .sort-btn {
        min-width: 48px;
        padding: 6px 8px;
        font-size: 0.55rem;
        line-height: 1.15;
        border-radius: 10px;
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    }

    .sort-btn .sort-icon {
        font-size: 0.8rem;
        margin-bottom: 1px;
    }

    /* ---- ATIK CEPLERİ: Domatesin üstünde ---- */
    .player-discard {
        position: fixed;
        width: 58px;
        height: 80px;
        /* Tomato 44px + 8px gap = 62px from bottom */
        bottom: calc(max(10px, env(safe-area-inset-bottom)) + 56px);
        z-index: 1290;
        transform: none !important;
    }

    .player-discard.left-discard {
        left: max(10px, env(safe-area-inset-left));
        border-right: 2px solid #281a16;
        border-radius: 12px;
    }

    .player-discard.right-discard {
        right: max(10px, env(safe-area-inset-right));
        border-left: 2px solid #281a16;
        border-radius: 12px;
    }

    .player-discard .discard-label {
        display: block;
        font-size: 0.52rem;
        line-height: 1;
        margin-bottom: 2px;
        letter-spacing: 0.5px;
    }

    .player-discard .discard-tiles {
        width: 50px;
        height: 64px;
        padding: 3px;
    }

    .player-discard .discard-tiles .mini-tile {
        width: 48px;
        height: 62px;
        transform: scale(1);
    }

    .player-discard .discard-tiles .mini-tile-inner {
        font-size: 1.4rem;
    }

    /* ---- AKSİYON BUTONLARI: Sağ kenar, dikey orta ---- */
    .action-buttons {
        position: fixed;
        top: 50%;
        right: max(8px, env(safe-area-inset-right));
        bottom: auto;
        transform: translateY(-50%) scale(0.78);
        transform-origin: right center;
        flex-direction: column;
        gap: 5px;
        z-index: 1180;
    }

    .action-btn {
        min-width: 54px;
        padding: 6px 8px;
        font-size: 0.62rem;
    }

    /* ---- SOHBET ---- */
    .chat-panel {
        right: calc(max(10px, env(safe-area-inset-right)) + 100px);
        bottom: max(10px, env(safe-area-inset-bottom));
        width: min(200px, calc(100vw - 220px));
        min-width: 110px;
        z-index: 260;
    }

    .chat-header {
        padding: 8px 10px;
        font-size: 0.75rem;
    }
}

@media (max-width: 768px) and (max-height: 650px) {
    .tomato-btn {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }

    .sort-buttons.left-sort {
        left: calc(max(8px, env(safe-area-inset-left)) + 48px);
    }

    .sort-buttons,
    .tomato-btn {
        bottom: max(8px, env(safe-area-inset-bottom));
    }

    .sort-btn {
        min-width: 44px;
        padding: 5px 6px;
        font-size: 0.5rem;
    }

    .player-discard {
        width: 52px;
        height: 72px;
        /* Tomato 40px + 6px gap */
        bottom: calc(max(8px, env(safe-area-inset-bottom)) + 48px);
    }

    .player-discard.right-discard {
        right: max(8px, env(safe-area-inset-right));
    }

    .player-discard .discard-tiles {
        width: 46px;
        height: 58px;
        padding: 2px;
    }

    .player-discard .discard-tiles .mini-tile {
        width: 44px;
        height: 56px;
    }

    .player-discard .discard-tiles .mini-tile-inner {
        font-size: 1.2rem;
    }

    .action-buttons {
        transform: translateY(-50%) scale(0.7);
    }
}
