:root {
    /* Premium Color Palette */
    --bg-deep: #080812;
    --bg-parliament: #12122b;
    --bg-premium-panel: rgba(26, 26, 46, 0.6);
    --primary: #ff3333;
    --primary-glow: rgba(255, 51, 51, 0.4);
    --accent-gold: #ffcc00;
    --text-pure: #ffffff;
    --text-dim: #94a3b8;
    --glass-border: rgba(255, 255, 255, 0.1);
    
    /* Typography Scaling (Clamp for stability) */
    --fs-h1: clamp(2rem, 8vw, 3rem);
    --fs-h2: clamp(1.4rem, 5vw, 2rem);
    --fs-body: clamp(0.9rem, 3vw, 1.1rem);
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    --shadow-premium: 0 20px 50px rgba(0, 0, 0, 0.6);
    --transition-smooth: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@media screen and (min-width: 1024px) {
    :root {
        --fs-h1: 4rem;
        --fs-h2: 2.5rem;
        --fs-body: 1.2rem;
    }
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    font-family: var(--font-body);
}

html, body {
    width: 100%;
    height: 100dvh;
    overflow: hidden !important;
    position: fixed;
    background-color: var(--bg-deep);
}

body {
    background: radial-gradient(circle at top center, #1a1a3a 0%, #080812 100%);
    color: var(--text-pure);
    display: flex;
    justify-content: center;
    align-items: center;
}

#app {
    width: 100%;
    max-width: 480px;
    height: 100dvh;
    padding: clamp(12px, 4vw, 24px);
    padding-bottom: clamp(85px, 12dvh, 110px); /* Adjusted safe area for bottom ad banner */
    display: flex;
    flex-direction: column;
    position: relative;
    contain: content;
    transition: max-width 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@media screen and (min-width: 1024px) {
    #app {
        max-width: 1200px;
        align-items: center; /* Center the layout on desktop */
    }
    
    .screen {
        width: 100%;
        max-width: 600px; /* Limit width of panels on desktop for better readability */
    }
    
    #game-screen {
        max-width: 1200px; /* Game screen should be able to go wider */
    }
}

.screen {
    display: none;
    flex-direction: column;
    height: 100%;
    justify-content: center; /* Dikeyde ortala */
    animation: screenEnter 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

#game-screen {
    justify-content: flex-start; /* Move everything to the top */
    gap: 15px; /* Controlled gap instead of spreading */
    padding-bottom: env(safe-area-inset-bottom, 20px);
}

.screen.active {
    display: flex;
}

@keyframes screenEnter {
    from { opacity: 0; transform: scale(0.98) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Language Selector */
.lang-selector {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 20px;
}

.btn-lang {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-dim);
    padding: 6px 12px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-lang.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

.btn-lang:hover:not(.active) {
    background: rgba(255, 255, 255, 0.1);
}

/* Typography */
.game-title {
    text-align: center;
    font-size: var(--fs-h1);
    font-family: var(--font-heading);
    margin: 30px 0;
    font-weight: 800;
    letter-spacing: -1.5px;
    background: linear-gradient(180deg, #fff 30%, #94a3b8 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 10px rgba(255,255,255,0.1));
}

.game-title span {
    color: var(--primary);
    -webkit-text-fill-color: var(--primary);
}

/* Premium Panels */
.panel {
    background: var(--bg-premium-panel);
    backdrop-filter: blur(35px);
    -webkit-backdrop-filter: blur(35px);
    border: 1px solid var(--glass-border);
    border-radius: 32px;
    padding: 28px;
    box-shadow: var(--shadow-premium);
    display: flex;
    flex-direction: column;
    padding: 0; 
    max-height: 70dvh; /* Slightly reduced for stability */
    overflow: hidden; 
    position: relative;
    align-items: stretch;
}

.panel-scroll {
    padding: 28px;
    overflow-y: auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

.panel::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, transparent 100%);
    pointer-events: none;
}

/* Navigation/Info Bars */
.room-info {
    background: rgba(26, 26, 46, 0.8);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    padding: 14px 24px;
    border-radius: 50px;
    margin-bottom: 12px;
    width: 100%;
    display: flex;
    justify-content: center; 
    align-items: center;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.lobby-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    width: 100%;
    margin-bottom: 10px;
}

.lobby-actions .btn {
    flex: 1;
}

.lobby-chat-btn {
    width: 54px !important;
    height: 54px !important;
    min-width: 54px !important;
    font-size: 1.4rem !important;
}

.game-header {
    background: rgba(26, 26, 46, 0.8);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    padding: 10px 20px;
    border-radius: 50px;
    width: 100%;
    margin: 0 auto 10px auto;
    max-width: 600px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    min-height: 60px;
    cursor: default;
    transition: var(--transition-smooth);
}

@media screen and (min-width: 1024px) {
    .game-header {
        margin: 0 auto 30px auto;
        max-width: 800px;
    }
}

.room-info:active {
    transform: scale(0.98);
}

.room-info .highlight { color: var(--primary); font-weight: 800; font-family: var(--font-heading); }
.phase-info { 
    color: var(--accent-gold); 
    font-weight: 700; 
    font-family: var(--font-heading); 
    font-size: 1rem; 
    white-space: nowrap;
}
.timer { 
    color: var(--primary); 
    font-family: monospace; 
    font-size: 1.8rem; 
    font-weight: 800; 
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    line-height: 1;
}

.btn-anon {
    justify-self: end;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: white;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-size: 1.2rem;
    padding: 0;
    line-height: 0;
}

.btn-anon:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.btn-anon.active {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(255, 51, 51, 0.4);
}

.game-message {
    text-align: center;
    margin: 5px auto 5px auto; 
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dim);
    max-width: 600px;
    letter-spacing: 0.5px;
    line-height: 1.2;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    animation: fadeIn 0.5s ease-out;
}

@media screen and (min-width: 1024px) {
    .game-message {
        font-size: 1.3rem;
        margin: 20px auto 35px auto;
    }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Interactive Components */
.actions, .setting-group {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
}

.my-info {
    width: 100%;
    display: flex;
    flex-direction: row;
    gap: 15px;
    align-items: center; 
    justify-content: center; 
    margin-top: 5px; 
    max-width: 100%;
}

@media screen and (min-width: 1024px) {
    .my-info {
        margin: 20px auto 0 auto; 
        width: 450px;
    }
}

.my-info .btn {
    flex: 1;
    padding: 12px 10px;
    font-size: 0.9rem;
    height: 48px; 
    border-radius: 14px;
}

#btnToggleFullscreen {
    background: rgba(255, 255, 255, 0.04);
}

.btn-icon-round {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    border-radius: 50% !important;
    padding: 0 !important;
    flex: none !important;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    display: flex !important;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.btn-icon-round .icon {
    font-size: 1.1rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

#btnAction {
    width: auto !important;
    min-width: 120px !important;
    max-width: 160px !important;
    height: 44px !important;
    padding: 0 20px !important;
    border-radius: 22px !important;
    font-size: 0.9rem !important;
    flex: none !important;
}

label { font-size: 0.85rem; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px; padding-left: 5px; }

input {
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid var(--glass-border);
    border-radius: 20px;
    padding: 16px;
    color: white;
    font-size: 1.1rem;
    text-align: center;
    outline: none;
    transition: var(--transition-smooth);
    font-family: inherit;
}

input:focus {
    border-color: var(--primary);
    background: rgba(0, 0, 0, 0.6);
    box-shadow: 0 0 20px var(--primary-glow);
}

/* Number Input (Spin Buttons) Styling */
input[type="number"] {
    -moz-appearance: textfield; 
    appearance: none; 
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.setting-group input[type="number"] {
    padding: 12px;
    font-size: 1.2rem;
    font-weight: 700;
    color: white; 
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
}

/* Buttons (Gartic-style feel, Premium look) */
.btn {
    width: 100%;
    padding: 18px;
    border-radius: 20px;
    font-size: 1rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s;
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn.primary {
    background: linear-gradient(135deg, #cc0000 0%, #ff3333 100%);
    color: white;
    box-shadow: 0 4px 0 #880000, 0 8px 16px var(--primary-glow);
}

.btn.primary:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #880000, 0 4px 8px var(--primary-glow);
}

.btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

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

.btn.secondary {
    background: #1a1a2e;
    color: white;
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 0 #0f0f1d;
}

.btn.secondary:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #0f0f1d;
}

.divider {
    display: flex;
    align-items: center;
    gap: 15px;
    color: var(--text-dim);
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    margin: 10px 0;
}

.divider::before, .divider::after { content: ''; flex: 1; height: 2px; background: var(--glass-border); }

.game-content-layout {
    display: flex;
    flex-direction: column;
    flex: 1;
    width: 100%;
    min-height: 0;
}

.game-board {
    flex-shrink: 0;
}

/* In-Game Players Grid */
.ingame-players {
    display: flex;
    flex-wrap: nowrap; 
    justify-content: flex-start; /* Fix for clipping on overflow */
    gap: 12px;
    margin: 5px 0; 
    max-height: none; 
    overflow-x: auto; 
    overflow-y: hidden;
    padding: 10px 20px; /* Increased side padding for safe scrolling */
    width: 100%;
    scrollbar-width: none; 
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch; /* Smoother mobile scrolling */
}

.ingame-players::after {
    content: '';
    flex: 0 0 10px; /* Extra spacer at the end for padding simulation */
}

@media screen and (min-width: 1024px) {
    .game-content-layout {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 20px;
        width: 100%;
        max-width: 800px;
        margin: 0 auto;
        flex: 1;
    }

    .ingame-players {
        width: 100%;
        gap: 15px;
    }

    .my-card-container {
        padding-bottom: 20px;
    }
}

.player-card {
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid transparent;
    border-radius: 20px;
    padding: 12px 6px;
    min-width: 90px; 
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: var(--transition-smooth);
    flex-shrink: 0; 
    position: relative;
}

.vote-count {
    position: absolute;
    top: -10px;
    right: -10px;
    background: var(--primary);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 800;
    box-shadow: 0 4px 10px rgba(255, 51, 51, 0.4);
    border: 2px solid #0f0f1d;
    z-index: 10;
    animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.player-card.selected {
    background: rgba(255, 51, 51, 0.15);
    border-color: var(--primary);
    transform: scale(1.05) translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.4);
}

.player-card.is-anon .player-avatar {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--primary);
}

.player-card.is-anon .player-name {
    color: var(--text-dim);
    font-weight: 400;
    opacity: 0.8;
}

.player-avatar {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    background: var(--bg-parliament);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.2rem;
    margin-bottom: 8px;
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.05);
}

.player-name { 
    font-size: 0.7rem; 
    font-weight: 700; 
    color: var(--text-dim); 
    text-align: center; 
    max-width: 100%;
    overflow-wrap: break-word;
}

@media screen and (min-width: 1024px) {
    .player-name {
        font-size: 0.9rem;
    }
    
    .player-avatar {
        width: 54px;
        height: 54px;
        min-width: 54px;
        min-height: 54px;
    }
}
.player-card.selected .player-name { color: white; }

.player-card.dead {
    filter: grayscale(1) opacity(0.6);
    pointer-events: none;
}

.player-card.dead .player-name {
    text-decoration: line-through;
    color: var(--primary);
}

.player-card.disconnected {
    filter: grayscale(0.5) opacity(0.8);
    border-style: dashed;
    border-color: var(--text-dim);
}

.player-card.disconnected .player-name {
    font-style: italic;
    color: var(--text-dim);
}

.player-card.disconnected::after {
    content: '⚡';
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 0.6rem;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* In-game Player List (Lobby) */
.player-list { width: 100%; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.player-list li {
    background: rgba(255, 255, 255, 0.05);
    padding: 16px 20px;
    border-radius: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--glass-border);
}

.dim { color: var(--text-dim); font-size: 0.8rem; margin-left: 5px; }
.host-badge { color: var(--accent-gold); font-size: 0.8rem; font-weight: 700; }

/* Ana Kart Alanı */
.my-card-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center; /* Center vertically inside the expanded layout container */
    min-height: 0;
    gap: 15px; 
    padding-bottom: 5px;
}

@media screen and (min-width: 1024px) {
    .my-card-container {
        gap: 20px; 
    }
    
    .flip-card {
        width: 350px; 
        height: 500px; 
    }
}

.flip-card {
    width: min(260px, 60vw); /* JS yüklenene kadar fallback */
    aspect-ratio: 220 / 310;
    height: auto;
    perspective: 2000px;
    cursor: pointer;
    will-change: transform, opacity;
    flex-shrink: 0;
}

/* For shorter screens, shrink everything aggressively to ensure a stable fit */
@media screen and (max-height: 750px) {
    #game-screen { gap: 8px; }
    .my-card-container { gap: 10px; }
    .game-message { margin: 2px auto; font-size: 0.9rem; }
    .ingame-players { gap: 10px; margin: 2px 0; padding: 5px; }
    .player-avatar { width: 38px; height: 38px; min-width: 38px; min-height: 38px; font-size: 1rem; margin-bottom: 4px; }
    .player-card { min-width: 80px; padding: 8px 4px; }
    
    .flip-card {
        width: min(240px, 55vw, calc(45dvh * 0.71));
    }
    
    .game-header { padding: 6px 18px; min-height: 50px; margin-bottom: 5px; }
    .timer { font-size: 1.6rem; }
    .phase-info { font-size: 0.9rem; }
}

@media screen and (max-height: 600px) {
    .flip-card {
        width: min(180px, 45vw, calc(45dvh * 0.71));
    }
    .game-title { margin: 10px 0; font-size: 1.5rem; }
    .panel { padding: 15px; }
}

.flip-card.dealing {
    animation: dealCard 1s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes dealCard {
    0% {
        opacity: 0;
        transform: scale(0.3) translateY(400px) rotateX(-30deg) rotateZ(-10deg);
    }
    60% {
        opacity: 1;
        transform: scale(1.05) translateY(-20px) rotateX(0) rotateZ(0);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-style: preserve-3d;
}

.flip-card.flipped .flip-card-inner { transform: rotateY(180deg); }

.flip-card-front, .flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 24px;
    border: 8px solid #0f0f1d;
    overflow: hidden;
    box-shadow: var(--shadow-premium);
}

.flip-card-back { transform: rotateY(180deg); }
.flip-card img { width: 100%; height: 100%; object-fit: cover; }

/* Fullscreen Portal */
.fullscreen-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(5, 5, 15, 0.98);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    z-index: 9000;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 30px;
}

/* Kapatma Butonu Tasarımı */
#btnToggleFullscreen.close-btn {
    position: absolute;
    top: 30px;
    right: 30px;
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 9001;
    transition: all 0.3s ease;
}

#btnToggleFullscreen.close-btn .icon {
    font-size: 1.4rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

#btnToggleFullscreen.close-btn:hover {
    background: rgba(255, 51, 51, 0.2);
    border-color: var(--primary);
    transform: scale(1.1) rotate(90deg);
}

.fullscreen-overlay.active { display: flex; }

.flip-card.fullscreen {
    aspect-ratio: 220 / 310;
    height: auto;
    max-width: none;
}

/* Modals */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(8, 8, 18, 0.92); 
    backdrop-filter: blur(50px) saturate(180%); 
    -webkit-backdrop-filter: blur(50px) saturate(180%);
    display: none;
    z-index: 10000;
    padding: 24px;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex; 
}

.modal-content {
    background: var(--bg-parliament);
    border: 2px solid var(--primary);
    border-radius: 40px;
    padding: 60px 40px; 
    text-align: center;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 0 100px rgba(255, 51, 51, 0.3); 
    animation: modalPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    gap: 25px; 
}

.modal-content h2 {
    color: var(--primary);
    font-size: 1.8rem;
    font-family: var(--font-heading);
    margin: 0;
    line-height: 1.2;
}

.modal-content p {
    color: white;
    font-size: 1.1rem;
    line-height: 1.6;
    margin: 0;
    opacity: 0.9;
}

.modal-content .actions {
    margin-top: 10px;
}

@keyframes modalPop {
    from { transform: scale(0.85); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-content h2 { font-size: 1.8rem; margin-bottom: 15px; color: var(--primary); }
.modal-content p { color: var(--text-dim); margin-bottom: 25px; line-height: 1.6; }

.hidden { display: none !important; }
.error { color: var(--primary); font-weight: 700; font-size: 0.9rem; margin-top: 10px; text-align: center; }

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-thumb { background: var(--glass-border); border-radius: 10px; }

/* Advertisement Banners */
.ad-banner {
    background: var(--bg-premium-panel);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    color: var(--text-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 2px;
    z-index: 100;
    pointer-events: none; 
    text-transform: uppercase;
}

/* Desktop Sidebar Ads */
@media screen and (min-width: 1024px) {
    .ad-left, .ad-right {
        position: fixed;
        top: 50%;
        transform: translateY(-50%);
        width: 160px;
        height: 600px;
        border-radius: 16px;
        box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    }
    
    .ad-left { left: 40px; } 
    .ad-right { right: 40px; } 
    .ad-mobile { display: none; }
}

/* Mobile Bottom Banner Ad */
@media screen and (max-width: 1023px) {
    .ad-left, .ad-right { display: none; }
    
    .ad-mobile {
        position: fixed;
        bottom: 12px; 
        left: 12px;
        width: calc(100% - 24px);
        height: 60px;
        border-radius: 16px;
        box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    }
    
    @media (max-height: 750px) {
        .ad-mobile {
            height: 42px;
            bottom: 6px;
            left: 6px;
            width: calc(100% - 12px);
            font-size: 0.65rem;
            letter-spacing: 1px;
        }
    }
}

/* --- PREMIUM CHAT & VOICE DESIGN --- */

.chat-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 350px;
    height: 500px;
    background: rgba(18, 18, 43, 0.9); /* Deep parliament glass */
    backdrop-filter: blur(25px) saturate(160%);
    -webkit-backdrop-filter: blur(25px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: 1px solid rgba(255, 255, 255, 0.2); 
    border-radius: 28px;
    display: flex;
    flex-direction: column;
    z-index: 5000;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6), inset 0 0 20px rgba(255,255,255,0.02);
    transform: scale(0.9) translateY(20px);
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
}

.chat-container.active {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: all;
    box-shadow: 0 30px 100px rgba(0, 0, 0, 0.8);
}

.chat-header {
    height: 60px;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(to right, rgba(255,255,255,0.05), transparent);
    border-bottom: 1px solid var(--glass-border);
    cursor: default;
    user-select: none;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-voice-tools {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-chat-tool.system-muted, .btn-chat-tool.system-deafened {
    color: var(--primary);
    background: rgba(255, 51, 51, 0.1);
    border-color: var(--primary);
    position: relative;
}

.btn-chat-tool.system-muted::after, .btn-chat-tool.system-deafened::after {
    content: '!';
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--primary);
    color: white;
    font-size: 10px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border: 2px solid var(--bg-parliament);
}

.btn-chat-tool {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.1rem;
    position: relative; /* slash için */
}

.btn-chat-tool:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.btn-chat-tool.muted, .btn-chat-tool.active {
    background: rgba(255, 51, 51, 0.15);
    color: var(--primary);
    border-color: rgba(255, 51, 51, 0.3);
}

.btn-chat-tool.muted::after, .btn-chat-tool.active::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 2px;
    background: var(--primary);
    transform: translate(-50%, -50%) rotate(-45deg);
    box-shadow: 0 0 5px var(--primary-glow);
}

#btnCloseChat {
    background: transparent;
    border: none;
    font-size: 0.8rem;
    color: var(--text-dim);
}

.btn-floating-chat {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    text-indent: 0; 
    line-height: 1;
}

.btn-floating-chat:active {
    transform: scale(0.9);
}

.chat-header span {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--accent-gold);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    text-shadow: 0 2px 10px rgba(255, 204, 0, 0.3);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.chat-messages::-webkit-scrollbar { width: 5px; }
.chat-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 20px;
    font-size: 0.95rem;
    line-height: 1.5;
    position: relative;
    animation: msgIn 0.4s var(--transition-smooth);
}

@keyframes msgIn {
    from { opacity: 0; transform: scale(0.9) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.message.self {
    align-self: flex-end;
    background: linear-gradient(135deg, #ff3333 0%, #aa0000 100%);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 5px 15px rgba(255, 51, 51, 0.2);
}

.message.other {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.07);
    color: var(--text-pure);
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(255,255,255,0.05);
}

.message.private {
    background: linear-gradient(135deg, #1e1e2f 0%, #2d2d44 100%);
    border-color: var(--accent-gold);
    box-shadow: 0 0 10px rgba(255, 204, 0, 0.1);
}

.message.private.self {
    align-self: flex-end;
    border-right: 3px solid var(--accent-gold);
}

.message.private.other {
    align-self: flex-start;
    border-left: 3px solid var(--accent-gold);
}

.message.system {
    align-self: center;
    background: transparent;
    color: var(--text-dim);
    font-size: 0.8rem;
    font-style: italic;
    border: none;
    padding: 5px;
    opacity: 0.7;
}

.message .sender {
    font-size: 0.75rem;
    font-weight: 800;
    margin-bottom: 4px;
    display: block;
    color: var(--accent-gold);
    opacity: 0.9;
}

.message.self .sender { color: rgba(255,255,255,0.8); }

.chat-input-area {
    padding: 16px 20px;
    display: flex;
    gap: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid var(--glass-border);
}

.chat-recipient-info {
    padding: 8px 20px;
    background: rgba(255, 204, 0, 0.1);
    border-top: 1px solid rgba(255, 204, 0, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--accent-gold);
}

.chat-recipient-info span strong {
    color: white;
}

.chat-recipient-info .btn-chat-tool {
    font-size: 1rem;
    padding: 0 5px;
}

.chat-input-area input {
    flex: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    padding: 12px 18px;
    font-size: 1rem;
    border-radius: 16px;
    color: white;
    outline: none;
    transition: all 0.3s;
    text-align: left;
}

.chat-input-area input:focus {
    background: rgba(255, 255, 255, 0.07);
    border-color: var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
}

.btn-icon {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    width: 42px;
    height: 42px;
    border-radius: 12px;
    color: white;
    font-size: 1.4rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover { 
    background: var(--primary);
    border-color: var(--primary);
    transform: scale(1.1) rotate(5deg); 
    box-shadow: 0 0 15px var(--primary-glow);
}
.btn-icon:active { transform: scale(0.9); }

/* Indicators on Player Cards */
.player-card {
    position: relative;
}

.voice-indicator {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 12px;
    height: 12px;
    background: #4ade80;
    border-radius: 50%;
    display: none;
    box-shadow: 0 0 10px #4ade80;
    border: 2px solid var(--bg-deep);
}

.player-card.is-speaking .voice-indicator {
    display: block;
    animation: voicePulse 1s infinite alternate;
}

.status-icons {
    position: absolute;
    bottom: -10px;
    right: -10px;
    display: flex;
    gap: 4px;
    z-index: 10;
}

.status-icon {
    font-size: 0.9rem;
    background: var(--bg-deep);
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    pointer-events: none;
    position: relative; /* Line positioning */
    overflow: hidden;   /* Clip the line to the icon circle */
}

.status-icon::after {
    content: "";
    position: absolute;
    width: 140%;
    height: 2px;
    background: #ff3333;
    transform: rotate(45deg);
    box-shadow: 0 0 5px rgba(255,51,51,0.5);
}

.status-icon.mic { color: #888; }
.status-icon.speaker { color: #888; }

@keyframes voicePulse {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(1.4); opacity: 1; box-shadow: 0 0 15px #4ade80; }
}

@media screen and (max-width: 480px) {
    .chat-container {
        width: 100vw;
        height: 75dvh;
        bottom: 0;
        right: 0;
        left: 0;
        border-radius: 32px 32px 0 0;
        transform: translateY(50px);
    }
    
    .chat-container.active {
        transform: translateY(0);
    }
    
    .btn-floating-chat, .btn-icon-round {
        width: 54px !important;
        height: 54px !important;
        min-width: 54px !important;
        font-size: 1.5rem;
    }
}

.disclaimer-modal {
    z-index: 10000; /* Always on top */
    background: rgba(5, 5, 15, 0.95);
    backdrop-filter: blur(20px);
}

.disclaimer-modal .modal-content {
    max-width: 400px;
    border: 1px solid var(--primary);
    box-shadow: 0 0 30px var(--primary-glow);
}

.disclaimer-modal h2 {
    color: var(--primary);
    margin-bottom: 15px;
}

.disclaimer-modal p {
    font-size: 1rem;
    line-height: 1.5;
    margin-bottom: 25px;
    color: var(--text-pure);
}
/* --- SES AYARLARI MODALI --- */
.sound-settings-modal {
    z-index: 9500;
    background: rgba(5, 5, 15, 0.92);
    backdrop-filter: blur(20px);
}

.sound-settings-content {
    max-width: 360px;
    width: 90%;
    padding: 36px 32px;
    gap: 20px;
    text-align: left;
}

.sound-settings-content h2 {
    font-size: 1.4rem;
    color: var(--accent-gold);
    margin-bottom: 4px;
    text-align: center;
}

.sound-setting-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
}

.sound-setting-row label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
    color: var(--text-pure);
    font-weight: 600;
}

.sound-value-label {
    color: var(--accent-gold);
    font-size: 0.85rem;
    min-width: 38px;
    text-align: right;
}

.sound-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 10px;
    background: rgba(255,255,255,0.12);
    outline: none;
    cursor: pointer;
    transition: background 0.2s;
}

.sound-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-gold);
    cursor: pointer;
    box-shadow: 0 0 8px rgba(255,204,0,0.5);
    transition: transform 0.15s;
}

.sound-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.sound-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-gold);
    cursor: pointer;
    border: none;
    box-shadow: 0 0 8px rgba(255,204,0,0.5);
}