/* ==================================================
   Tankogames - Roblox app dark teması (screenshot eşleşmesi)
   Renk paleti:
     --bg           #0f1014  (ana arka plan, near-black)
     --surface      #1a1b1f  (card, dropdown)
     --surface-2    #16171b  (input, search box)
     --surface-hover #25272d
     --border       #25272d  (çok hafif/görünmez)
     --primary      #00a2ff  (Roblox mavi — link/CTA)
     --primary-h    #1bb1ff
     --play-green   #00b06f  (Oyna butonu yeşil)
     --play-green-h #00cf85
     --danger       #ef4444
     --warning      #f59e0b
     --text         #ffffff
     --muted        #9a9da4
   ================================================== */

:root {
    --bg: #0f1014;
    --surface: #1a1b1f;
    --surface-2: #16171b;
    --surface-hover: #25272d;
    --border: #25272d;
    --primary: #00a2ff;
    --primary-h: #1bb1ff;
    --play-green: #00b06f;
    --play-green-h: #00cf85;
    --danger: #ef4444;
    --warning: #f59e0b;
    --text: #ffffff;
    --muted: #9a9da4;
    --sidebar-w: 240px;
    --topbar-h: 64px;
    --radius: 10px;
    --radius-lg: 14px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--surface-2); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--surface-hover); }

/* ==================== APP SHELL ==================== */
.app-shell {
    display: flex;
    min-height: 100vh;
}

/* ==================== SIDEBAR ==================== */
.sidebar {
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    box-shadow: 1px 0 3px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 200;
    overflow-y: auto;
}

.sidebar-logo {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-logo img {
    max-height: 60px;
    width: auto;
}

.sidebar-nav {
    padding: 12px 0;
    display: flex;
    flex-direction: column;
}

.sidebar-section-title {
    padding: 18px 20px 8px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    font-weight: 700;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 11px 20px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
    border-left: 3px solid transparent;
}

.sidebar-link i {
    width: 18px;
    text-align: center;
    font-size: 14px;
}

.sidebar-link:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.sidebar-link.active {
    background: var(--surface-hover);
    color: var(--text);
    border-left-color: var(--primary);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 150;
}

.sidebar-overlay.show {
    display: block;
}

/* ==================== MAIN AREA ==================== */
.main-area {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* ==================== TOPBAR ==================== */
.topbar {
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    font-size: 20px;
    padding: 8px;
    border-radius: 8px;
}

.topbar-menu-btn:hover {
    background: var(--surface-hover);
}

/* Topbar search */
.search-box {
    flex: 1;
    max-width: 480px;
    position: relative;
}

.search-box form {
    display: flex;
    align-items: center;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0 16px;
    height: 40px;
    transition: border-color 0.15s, background 0.15s;
}

.search-box form:focus-within {
    border-color: var(--primary);
    background: var(--bg);
}

.search-box-icon {
    color: var(--muted);
    font-size: 14px;
    margin-right: 10px;
}

.search-box input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    outline: none;
}

.search-box input::placeholder {
    color: var(--muted);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

/* Buttons (generic) */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 18px;
    height: 40px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid transparent;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
    white-space: nowrap;
}

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

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-h);
}

.btn-ghost {
    background: transparent;
    color: var(--text);
    border-color: var(--border);
}

.btn-ghost:hover {
    background: var(--surface-hover);
    border-color: var(--surface-hover);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* User menu */
.user-menu {
    position: relative;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 12px 4px 4px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    height: 40px;
}

.user-menu-btn:hover {
    background: var(--surface-hover);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: #fff;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-name {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-caret {
    font-size: 11px;
    color: var(--muted);
}

.user-menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 180px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px;
    display: none;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

.user-menu-dropdown.open {
    display: block;
}

.user-menu-dropdown a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 6px;
    color: var(--text);
    font-size: 14px;
}

.user-menu-dropdown a:hover {
    background: var(--surface-hover);
}

/* ==================== CONTENT ==================== */
.content {
    flex: 1;
    padding: 24px;
    max-width: 1500px;
    width: 100%;
    margin: 0 auto;
}

.section-title {
    font-size: 20px;
    font-weight: 700;
    margin: 28px 0 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title i {
    color: var(--primary);
}

/* Page lead/info */
.page-lead {
    color: var(--muted);
    margin: -8px 0 20px;
    font-size: 14px;
}

/* ==================== SLIDER ==================== */
.slider-container {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 24px;
    background: #000;
}

.slider {
    display: flex;
    transition: transform 0.5s ease;
}

.slide {
    min-width: 100%;
    position: relative;
}

.slide img {
    width: 100%;
    height: 380px;
    object-fit: cover;
}

.slide-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 30px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
}

.slide-content h2 {
    font-size: 1.8em;
    margin-bottom: 8px;
}

.slide-content p {
    color: rgba(255, 255, 255, 0.85);
}

.slider-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.55);
    border: none;
    color: #fff;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2em;
    transition: background 0.2s;
}

.slider-nav:hover {
    background: rgba(0, 0, 0, 0.75);
}

.slider-nav.prev { left: 14px; }
.slider-nav.next { right: 14px; }

.slider-dots {
    position: absolute;
    bottom: 14px;
    left: 0;
    right: 0;
    text-align: center;
    z-index: 2;
}

.slider-dots span {
    display: inline-block;
    width: 9px;
    height: 9px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    margin: 0 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.slider-dots span.active {
    background: var(--primary);
    transform: scale(1.4);
}

@media (max-width: 768px) {
    .slide img { height: 220px; }
    .slide-content { padding: 16px; }
    .slide-content h2 { font-size: 1.2em; }
}

/* ==================== GAMES GRID ==================== */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 18px;
}

.game-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: transform 0.18s ease, border-color 0.18s, box-shadow 0.18s;
    color: var(--text);
    display: flex;
    flex-direction: column;
}

.game-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: 0 12px 28px rgba(0, 162, 255, 0.18);
}

.game-card-image {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #000;
}

.game-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.game-card:hover .game-card-image img {
    transform: scale(1.06);
}

.platform-labels {
    position: absolute;
    top: 8px;
    left: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 5;
}

.platform-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
}

.platform-label.desktop { color: #5fb6ff; }
.platform-label.mobile  { color: #5fdfa1; }

.game-card:hover .platform-labels {
    opacity: 0.4;
    transition: opacity 0.2s;
}

.game-card-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.game-card:hover .game-card-overlay {
    opacity: 1;
}

.play-btn {
    background: var(--play-green);
    color: #fff;
    border: none;
    padding: 11px 24px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background 0.15s, transform 0.1s;
}

.play-btn:hover {
    background: var(--play-green-h);
    transform: scale(1.05);
}

.game-card-info {
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.game-card-info h3 {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
}

.game-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.game-card-info .category {
    font-size: 12px;
    color: var(--muted);
}

.game-card-info .new-badge {
    background: var(--danger);
    color: #fff;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.rating-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #ffc107;
    font-size: 12px;
    font-weight: 600;
}

@media (max-width: 768px) {
    .games-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }
    .game-card-info h3 { font-size: 13px; }
}

/* ==================== EMPTY STATE ==================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
}

.empty-state i {
    font-size: 3em;
    margin-bottom: 16px;
    opacity: 0.4;
    display: block;
}

.empty-state p {
    font-size: 1.1em;
    margin-bottom: 18px;
}

/* ==================== SEARCH RESULTS DROPDOWN ==================== */
.search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    z-index: 1000;
    display: none;
    max-height: 400px;
    overflow-y: auto;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
}

.search-results.active { display: block; }

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

.search-result-item:last-child { border-bottom: none; }

.search-result-item:hover {
    background: var(--surface-hover);
}

.search-result-item img {
    width: 50px;
    height: 32px;
    object-fit: cover;
    border-radius: 5px;
}

.search-result-info { flex: 1; }
.search-result-info h4 { font-size: 14px; margin-bottom: 2px; }
.search-result-info span { font-size: 12px; color: var(--muted); }

.search-no-results, .search-loading {
    padding: 18px;
    text-align: center;
    color: var(--muted);
    font-size: 14px;
}

.search-view-all {
    display: block;
    padding: 12px;
    text-align: center;
    background: var(--surface-2);
    color: var(--primary);
    font-weight: 600;
    border-radius: 0 0 var(--radius) var(--radius);
}

.search-view-all:hover { background: var(--surface-hover); }

.search-loading i { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ==================== PAGINATION ==================== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin: 32px 0 12px;
    flex-wrap: wrap;
}

.pagination a, .pagination span {
    min-width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-weight: 600;
    font-size: 14px;
    transition: background 0.15s, border-color 0.15s;
}

.pagination a:hover {
    background: var(--surface-hover);
    border-color: var(--primary);
}

.pagination span.current {
    background: var(--primary);
    border-color: var(--primary);
}

.pagination span.dots {
    background: transparent;
    border-color: transparent;
}

/* ==================== GAME PAGE ==================== */
.game-page { padding-top: 8px; }

/* Oyun sayfasında içerik bölgesini genişlet — sidebar dışında ne varsa kullan */
body.game-page-body .content {
    max-width: none;
    padding: 16px 20px;
}

.game-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.game-title-bar h1 {
    font-size: 1.2em;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.game-title-bar h1 i { color: var(--primary); }

.game-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.game-control-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.15s, transform 0.1s;
    text-decoration: none;
    font-family: inherit;
    color: #fff;
}

.fullscreen-btn { background: var(--play-green); }
.fullscreen-btn:hover { background: var(--play-green-h); }

.exit-btn { background: var(--danger); }
.exit-btn:hover { background: #ff5d5d; }

.game-frame-container {
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border);
    width: 100%;
}

.game-frame {
    width: 100%;
    height: calc(100vh - var(--topbar-h) - 140px);
    min-height: 540px;
    max-height: 900px;
    border: none;
    display: block;
    touch-action: none;
}

.game-info-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    margin: 18px 0;
}

.game-info-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 18px;
}

.game-meta h2 { margin-bottom: 8px; font-size: 1.4em; }

.category-badge {
    display: inline-block;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--primary);
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.platform-compat-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12px;
    margin-left: 6px;
    background: var(--surface-2);
    border: 1px solid var(--border);
}

.platform-compat-badge.desktop { color: #5fb6ff; }
.platform-compat-badge.mobile  { color: #5fdfa1; }

.platform-compat-badge i { margin-right: 5px; }

.platform-badges {
    display: inline-flex;
    gap: 6px;
    margin-left: 8px;
    vertical-align: middle;
}

.platform-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 11px;
    background: var(--surface-2);
}

.platform-badge.desktop { color: #5fb6ff; }
.platform-badge.mobile  { color: #5fdfa1; }

.play-count {
    margin-left: 12px;
    color: var(--muted);
    font-size: 13px;
}

/* Rating */
.rating-section { text-align: right; }

.current-rating {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.rating-value {
    font-size: 1.6em;
    font-weight: 800;
    color: #ffc107;
}

.rating-stars i {
    color: #444;
    font-size: 1.05em;
}

.rating-stars i.active { color: #ffc107; }

.rating-count {
    color: var(--muted);
    font-size: 13px;
}

.rate-game {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rate-game span {
    color: var(--muted);
    font-size: 13px;
}

.star-rating { display: flex; gap: 4px; }

.star-rating i {
    font-size: 1.3em;
    color: #444;
    cursor: pointer;
    transition: transform 0.15s, color 0.15s;
}

.star-rating i:hover, .star-rating i.hover, .star-rating i.selected {
    color: #ffc107;
}

.star-rating i:hover { transform: scale(1.15); }

/* Social share */
.social-share {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.social-share > span {
    color: var(--muted);
    font-weight: 500;
    font-size: 13px;
}

.share-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1em;
    transition: transform 0.15s;
    border: none;
}

.share-btn:hover { transform: scale(1.12); }

.share-btn.facebook { background: #1877f2; }
.share-btn.twitter  { background: #1da1f2; }
.share-btn.whatsapp { background: #25d366; }
.share-btn.telegram { background: #0088cc; }
.share-btn.copy-link { background: #6c757d; }

.game-description {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.game-description h3 {
    margin-bottom: 10px;
    color: var(--primary);
    font-size: 1.05em;
}

.game-description p {
    color: var(--muted);
    line-height: 1.7;
}

/* Platform warnings */
.platform-warning {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 12px;
}

.platform-warning.mobile-warning {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.35);
    color: var(--warning);
}

.platform-warning.desktop-warning {
    background: rgba(0, 162, 255, 0.12);
    border: 1px solid rgba(0, 162, 255, 0.35);
    color: var(--primary);
}

.platform-warning i:first-child { font-size: 1.4em; flex-shrink: 0; }
.platform-warning span { flex: 1; }

.platform-warning .dismiss-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
    padding: 5px;
}

.platform-warning .dismiss-btn:hover { opacity: 1; }

.mobile-fullscreen-btn {
    display: none;
    position: absolute;
    bottom: 14px;
    right: 14px;
    z-index: 100;
    background: var(--play-green);
    color: #fff;
    border: none;
    padding: 12px 22px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 6px 20px rgba(0, 176, 111, 0.45);
    animation: pulse-btn 2s ease-in-out infinite;
}

@keyframes pulse-btn {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@media (max-width: 1024px) {
    .mobile-fullscreen-btn {
        display: inline-flex;
        align-items: center;
        gap: 8px;
    }
}

/* ==================== COMMENTS ==================== */
.comments-section {
    margin: 32px 0;
}

.comment-form-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 22px;
}

.comment-form-box h3 {
    margin-bottom: 16px;
    color: var(--text);
    font-size: 1em;
    font-weight: 700;
}

.comment-form-box h3 i {
    color: var(--primary);
    margin-right: 10px;
}

.comment-form .form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.comment-form .form-group {
    flex: 1;
    margin-bottom: 12px;
    position: relative;
}

.comment-form input,
.comment-form textarea {
    width: 100%;
    padding: 11px 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    transition: border-color 0.15s, background 0.15s;
    resize: vertical;
}

.comment-form input:focus,
.comment-form textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg);
}

.comment-form input::placeholder,
.comment-form textarea::placeholder {
    color: var(--muted);
}

.comment-form .char-count {
    position: absolute;
    right: 8px;
    bottom: -18px;
    font-size: 11px;
    color: var(--muted);
}

.btn-comment-submit {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    background: var(--primary);
    border: none;
    border-radius: 999px;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    transition: background 0.15s;
    font-family: inherit;
}

.btn-comment-submit:hover { background: var(--primary-h); }
.btn-comment-submit:disabled { opacity: 0.6; cursor: not-allowed; }

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.no-comments {
    text-align: center;
    padding: 40px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--muted);
}

.no-comments i {
    font-size: 2.4em;
    margin-bottom: 12px;
    display: block;
    opacity: 0.5;
}

.comment-item {
    display: flex;
    gap: 14px;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.15s;
}

.comment-item:hover {
    border-color: var(--surface-hover);
}

.comment-item.new-comment {
    animation: slideIn 0.4s ease;
    border-color: var(--primary);
}

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

.comment-avatar {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #fff;
}

.comment-content { flex: 1; min-width: 0; }

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    flex-wrap: wrap;
    gap: 8px;
}

.comment-author {
    font-weight: 700;
    color: var(--text);
}

.comment-date {
    font-size: 12px;
    color: var(--muted);
}

.comment-text {
    line-height: 1.55;
    color: var(--muted);
    word-wrap: break-word;
    font-size: 14px;
}

.comment-pending-msg {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.35);
    color: var(--warning);
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 12px;
    text-align: center;
    font-size: 14px;
}

.comment-pending-msg i { margin-right: 8px; }

/* ==================== FOOTER ==================== */
.footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
    margin-top: auto;
    padding: 20px 24px;
}

.footer-inner {
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}

/* ==================== AUTH PAGES (login/register) ==================== */
.auth-shell {
    min-height: 100vh;
    display: flex;
    background: var(--bg);
}

.auth-side {
    flex: 1;
    background:
        linear-gradient(135deg, rgba(0, 162, 255, 0.5) 0%, rgba(25, 27, 31, 0.9) 100%),
        url('/uploads/tankogames_logo.png') center/contain no-repeat var(--surface);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 48px;
    color: #fff;
}

.auth-side-inner h1 {
    font-size: 2.4em;
    line-height: 1.1;
    margin-bottom: 16px;
}

.auth-side-inner p {
    font-size: 1.05em;
    color: rgba(255, 255, 255, 0.85);
    max-width: 420px;
}

.auth-card-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 36px 32px;
}

.auth-card h2 {
    font-size: 1.6em;
    margin-bottom: 6px;
}

.auth-card .auth-sub {
    color: var(--muted);
    margin-bottom: 24px;
    font-size: 14px;
}

.auth-form .form-group {
    margin-bottom: 16px;
}

.auth-form label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 6px;
}

.auth-form input {
    width: 100%;
    padding: 12px 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--primary);
}

.auth-error {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: var(--danger);
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 14px;
    font-size: 13px;
}

.auth-success {
    background: rgba(0, 176, 111, 0.12);
    border: 1px solid rgba(0, 176, 111, 0.35);
    color: var(--play-green-h);
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 14px;
    font-size: 13px;
}

.auth-foot {
    text-align: center;
    margin-top: 18px;
    color: var(--muted);
    font-size: 13px;
}

.auth-foot a {
    color: var(--primary);
    font-weight: 600;
}

@media (max-width: 800px) {
    .auth-side { display: none; }
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1024px) {
    .topbar-menu-btn { display: inline-flex; align-items: center; justify-content: center; }
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }
    .sidebar.open { transform: translateX(0); }
    .main-area { margin-left: 0; }
}

@media (max-width: 768px) {
    .content { padding: 16px; }
    .topbar { padding: 0 14px; gap: 10px; }
    .user-name { display: none; }
    .btn-ghost span,
    .btn-primary span { display: none; }
    .btn { padding: 0 12px; }
    .game-frame { height: 60vh; min-height: 320px; }
    .game-controls { padding: 12px; }
    .game-title-bar h1 { font-size: 1em; }
    .game-info-header { flex-direction: column; }
    .rating-section { text-align: left; width: 100%; }
}

@media (max-width: 480px) {
    .game-frame { height: 55vh; min-height: 280px; }
    .game-control-btn { padding: 8px 14px; font-size: 13px; }
}

/* Game page body — landscape full-screen experience */
body.game-page-body { overscroll-behavior: none; -webkit-overflow-scrolling: auto; }

@media (max-width: 1024px) and (orientation: landscape) {
    body.game-page-body .topbar,
    body.game-page-body .sidebar,
    body.game-page-body .footer,
    body.game-page-body .game-info-box,
    body.game-page-body .comments-section,
    body.game-page-body .section-title,
    body.game-page-body .games-grid {
        display: none;
    }
    body.game-page-body .main-area { margin-left: 0; }
    body.game-page-body .content { padding: 4px; }
    body.game-page-body .game-controls {
        position: fixed;
        top: 4px;
        left: 4px;
        right: 4px;
        z-index: 1000;
        background: rgba(0, 0, 0, 0.9);
        border-radius: 8px;
        padding: 6px 12px;
        margin: 0;
    }
    body.game-page-body .game-frame-container {
        position: fixed;
        top: 50px;
        left: 0;
        right: 0;
        bottom: 0;
        margin: 0;
        border-radius: 0;
        z-index: 100;
    }
    body.game-page-body .game-frame { height: 100%; min-height: auto; }
    body.game-page-body .mobile-fullscreen-btn { display: none; }
}

/* ==================================================
   Faz 2 — Arkadaş sistemi
   ================================================== */

/* Küçük buton varyantı */
.btn-sm {
    height: 32px;
    padding: 0 14px;
    font-size: 13px;
}

/* User menu — bekleyen istek bildirim noktası (avatar üstünde) */
.user-menu-btn { position: relative; }
.user-avatar-dot {
    position: absolute;
    top: 2px;
    left: 26px;
    width: 10px;
    height: 10px;
    background: var(--danger);
    border: 2px solid var(--surface-2);
    border-radius: 50%;
    pointer-events: none;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.3);
}

/* User menu dropdown — Arkadaşlarım badge'i */
.user-menu-dropdown a { position: relative; }
.friend-req-badge {
    margin-left: auto;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--danger);
    color: #fff;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* ==================== Profil sayfası ==================== */
.profile-header {
    display: flex;
    gap: 24px;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.profile-avatar-lg {
    width: 110px;
    height: 110px;
    flex-shrink: 0;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: #fff;
    font-size: 48px;
}

.profile-avatar-lg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-info { flex: 1; min-width: 220px; }

.profile-name {
    font-size: 28px;
    font-weight: 800;
    margin: 0 0 8px;
    color: var(--text);
}

.profile-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 14px;
}

.profile-meta i { margin-right: 6px; color: var(--primary); }

.profile-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ==================== Arkadaşlar sayfası ==================== */
.friends-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.friends-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
}

.friends-tab:hover { color: var(--text); }

.friends-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-count {
    background: var(--surface-hover);
    color: var(--text);
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 700;
    min-width: 22px;
    text-align: center;
}

.tab-count-warn {
    background: var(--danger);
    color: #fff;
}

.friends-content { min-height: 300px; }

.friends-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
}

.friends-empty i {
    font-size: 56px;
    color: var(--surface-hover);
    margin-bottom: 14px;
    display: block;
}

.friends-empty p {
    font-size: 16px;
    margin-bottom: 18px;
}

.friends-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}

.friend-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: border-color 0.15s, transform 0.1s;
}

.friend-card:hover {
    border-color: var(--surface-hover);
}

.friend-card-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin-bottom: 12px;
}

.friend-avatar {
    width: 64px;
    height: 64px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: #fff;
    font-size: 28px;
}

.friend-avatar img { width: 100%; height: 100%; object-fit: cover; }

.friend-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    word-break: break-word;
    line-height: 1.3;
}

.friend-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
}

.friend-actions .btn { flex: 1; min-width: 0; }

.friends-search-form {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
}

.friends-search-form input[type="text"] {
    flex: 1;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text);
    padding: 10px 18px;
    font-size: 14px;
    font-family: inherit;
}

.friends-search-form input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
}

@media (max-width: 600px) {
    .profile-header { padding: 18px; gap: 14px; }
    .profile-avatar-lg { width: 80px; height: 80px; font-size: 36px; }
    .profile-name { font-size: 22px; }
    .friends-tab { padding: 10px 12px; font-size: 13px; }
    .friends-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
    .friend-avatar { width: 54px; height: 54px; font-size: 22px; }
}

/* ==================================================
   Faz 4 — Online presence + Ana sayfa arkadaş şeridi
   ================================================== */

/* Reusable presence dot — bottom-right of any circular avatar */
.presence-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 14px;
    height: 14px;
    background: var(--play-green);
    border: 2px solid var(--surface);
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.25);
    pointer-events: none;
    z-index: 2;
}

.presence-dot-lg {
    width: 22px;
    height: 22px;
    border-width: 3px;
    bottom: 4px;
    right: 4px;
}

/* Inline dot — text içinde küçük yeşil nokta */
.presence-dot-mini {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--play-green);
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
    box-shadow: 0 0 6px rgba(0, 176, 111, 0.6);
}

/* ==================== Friend card — online ring ==================== */
.friend-avatar-wrap {
    position: relative;
    display: inline-block;
}

.friend-card-link.online .friend-avatar {
    border: 3px solid var(--play-green);
    box-sizing: border-box;
}

.presence-label {
    color: var(--play-green);
    font-size: 11px;
    font-weight: 600;
    margin-left: 4px;
}

/* ==================== Profil avatar — online ring ==================== */
.profile-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.profile-avatar-wrap.online .profile-avatar-lg {
    border: 4px solid var(--play-green);
    box-sizing: border-box;
}

.profile-online-badge {
    display: inline-flex;
    align-items: center;
    margin-left: 12px;
    padding: 4px 10px;
    background: rgba(0, 176, 111, 0.15);
    color: var(--play-green);
    font-size: 13px;
    font-weight: 600;
    border-radius: 999px;
    vertical-align: middle;
}

.profile-online-badge .presence-dot-mini {
    margin-right: 6px;
    box-shadow: 0 0 8px rgba(0, 176, 111, 0.8);
}

/* ==================== Ana sayfa arkadaş şeridi ==================== */
.friends-strip {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    margin-bottom: 24px;
}

.friends-strip-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.friends-strip-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.friends-strip-title i { color: var(--primary); }

.friends-strip-online {
    display: inline-flex;
    align-items: center;
    color: var(--play-green);
    font-size: 13px;
    font-weight: 500;
    margin-left: 8px;
}

.friends-strip-more {
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color 0.15s;
}

.friends-strip-more:hover { color: var(--primary); }

.friends-strip-list {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 4px 2px 8px;
    scrollbar-width: thin;
}

.friends-strip-list::-webkit-scrollbar { height: 6px; }
.friends-strip-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.friend-circle {
    flex-shrink: 0;
    width: 76px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.friend-circle-wrap {
    position: relative;
    width: 64px;
    height: 64px;
}

.friend-circle-img {
    width: 100%;
    height: 100%;
    background: var(--primary);
    border-radius: 50%;
    border: 3px solid transparent;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 26px;
    box-sizing: border-box;
    transition: border-color 0.15s, transform 0.1s;
}

.friend-circle-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.friend-circle:hover .friend-circle-img {
    transform: scale(1.05);
}

.friend-circle.online .friend-circle-img {
    border-color: var(--play-green);
}

.friend-circle-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
    text-align: center;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.2;
}

.friend-circle.online .friend-circle-name {
    color: var(--play-green);
}

.friend-circle-more-img {
    background: var(--surface-hover);
    color: var(--muted);
    font-size: 18px;
}

.friends-strip-empty {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 0 6px;
    color: var(--muted);
    flex-wrap: wrap;
}

.friends-strip-empty i {
    font-size: 28px;
    color: var(--surface-hover);
}

.friends-strip-empty span {
    font-size: 14px;
    flex: 1;
    min-width: 200px;
}

@media (max-width: 600px) {
    .friends-strip { padding: 14px; }
    .friend-circle { width: 70px; }
    .friend-circle-wrap { width: 56px; height: 56px; }
    .friend-circle-img { font-size: 22px; }
    .presence-dot { width: 12px; height: 12px; }
}

/* ==================================================
   Faz 3 — Avatar (default initial circle + upload)
   ================================================== */

/* Default avatar — kullanıcı adının ilk harfi + deterministik renk */
.av-initial {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    text-transform: uppercase;
    line-height: 1;
    /* font-size dış kapsayıcının font-size'ından gelir;
       containers: .user-avatar 14px, .friend-avatar 28px, .friend-circle-img 26px,
                   .profile-avatar-lg 48px, .account-avatar-preview 56px */
}

/* Top-bar kendi avatara online yeşil çerçeve (giriş yapmış = çevrimiçi) */
.user-avatar {
    font-size: 14px;
    font-weight: 700;
    box-sizing: border-box;
}

.user-avatar.online {
    border: 2px solid var(--play-green);
    box-shadow: 0 0 0 1px rgba(0, 176, 111, 0.25);
}

/* Dropdown'da kendi mini profil bloğu */
.user-menu-self {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 12px !important;
    background: var(--surface-2);
    border-radius: 6px;
    margin-bottom: 4px;
}

.user-menu-self:hover {
    background: var(--surface-hover) !important;
}

.user-menu-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--play-green);
    box-sizing: border-box;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
}

.user-menu-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-menu-self small {
    color: var(--muted);
    font-size: 11px;
}

.user-menu-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

/* ==================== Account avatar kartı ==================== */
.account-avatar-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 4px;
}

.account-avatar-preview {
    width: 88px;
    height: 88px;
    flex-shrink: 0;
    border-radius: 50%;
    overflow: hidden;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 36px;
    font-weight: 700;
    border: 3px solid var(--play-green);
    box-sizing: border-box;
}

.account-avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.account-avatar-info {
    flex: 1;
    min-width: 0;
}

.account-avatar-info p {
    margin-bottom: 4px;
    word-break: break-word;
}

/* ==================================================
   Faz 5 — Mesajlar + Oyun-İçi Durum
   ================================================== */
:root {
    --ingame: #a855f7;        /* mor — "oyunda" durumu (Discord-like rich presence) */
    --ingame-soft: rgba(168, 85, 247, 0.15);
    --ingame-glow: rgba(168, 85, 247, 0.55);
    --dm-sidebar-w: 320px;
}

/* ===== "Şu an X oynuyor" — friend-circle (ana sayfa şeridi) ===== */
.friend-circle {
    position: relative;
}
.friend-circle-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 100%;
    text-decoration: none;
    color: inherit;
}
.friend-circle.ingame .friend-circle-img {
    border-color: var(--ingame);
    box-shadow: 0 0 12px var(--ingame-glow);
}
.friend-circle.ingame .friend-circle-name { color: var(--ingame); }

.friend-circle-game-name {
    font-size: 10px;
    font-weight: 600;
    color: var(--ingame);
    text-align: center;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: -2px;
    padding: 0 2px;
}
.friend-circle-game-name i { margin-right: 3px; font-size: 9px; }

.friend-circle-join {
    position: absolute;
    top: -4px;
    right: 4px;
    width: 26px;
    height: 26px;
    background: var(--ingame);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.35);
    transition: transform 0.12s, background 0.15s;
    z-index: 3;
}
.friend-circle-join:hover {
    background: #c084fc;
    transform: scale(1.12);
}

/* ===== friend-card içinde "oynuyor" + Katıl + Mesaj ===== */
.friend-card.in-game .friend-card-link.online .friend-avatar {
    border-color: var(--ingame);
    box-shadow: 0 0 10px var(--ingame-glow);
}
.friend-ingame-label {
    color: var(--ingame);
    font-size: 11px;
    font-weight: 600;
    margin-left: 4px;
    white-space: nowrap;
}
.friend-ingame-label i { margin-right: 3px; }

.friend-join-btn,
.friend-msg-btn {
    margin-top: 8px;
    width: 100%;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* ===== profile.php — "X oynuyor" ===== */
.profile-ingame-badge {
    display: inline-flex;
    align-items: center;
    margin-left: 12px;
    padding: 4px 10px;
    background: var(--ingame-soft);
    color: var(--ingame);
    font-size: 13px;
    font-weight: 600;
    border-radius: 999px;
    vertical-align: middle;
    gap: 6px;
}
.profile-avatar-wrap.online .profile-avatar-lg { /* override yok — yeşil önceliği */ }

/* ===== Header dropdown — Mesajlar badge ===== */
.dm-nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ==================================================
   Mesajlaşma sayfası (/messages.php) — 2-panel
   ================================================== */
body.messages-page-body .content { padding: 0; }
.dm-page {
    display: flex;
    height: calc(100vh - var(--topbar-h));
    background: var(--bg);
    overflow: hidden;
}

/* ===== Sol panel — inbox ===== */
.dm-sidebar {
    width: var(--dm-sidebar-w);
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.dm-sidebar-head {
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--border);
}
.dm-sidebar-head h2 {
    font-size: 18px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}
.dm-sidebar-head i { color: var(--primary); }

.dm-inbox {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
}
.dm-inbox::-webkit-scrollbar { width: 6px; }
.dm-inbox::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.dm-inbox-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-left: 3px solid transparent;
    transition: background 0.12s;
    cursor: pointer;
}
.dm-inbox-item:hover { background: var(--surface-hover); }
.dm-inbox-item.active {
    background: var(--surface-hover);
    border-left-color: var(--primary);
}
.dm-inbox-item.unread .dm-inbox-name { font-weight: 700; color: var(--text); }
.dm-inbox-item.unread .dm-inbox-preview { color: var(--text); font-weight: 500; }

.dm-inbox-avatar-wrap {
    position: relative;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
}
.dm-inbox-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid transparent;
    box-sizing: border-box;
}
.dm-inbox-avatar img { width: 100%; height: 100%; object-fit: cover; }
.dm-inbox-avatar-wrap.online .dm-inbox-avatar { border-color: var(--play-green); }
.dm-inbox-avatar-wrap .presence-dot { bottom: -1px; right: -1px; width: 12px; height: 12px; }

.dm-inbox-meta {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}
.dm-inbox-name-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}
.dm-inbox-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dm-inbox-time {
    font-size: 11px;
    color: var(--muted);
    flex-shrink: 0;
}
.dm-inbox-preview-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 2px;
}
.dm-inbox-preview {
    font-size: 12px;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}
.dm-inbox-preview-empty { color: var(--muted); font-style: italic; }

.dm-inbox-ingame {
    font-size: 12px;
    color: var(--ingame);
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}
.dm-inbox-ingame i { margin-right: 4px; }

.dm-unread-badge {
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dm-empty {
    padding: 32px 18px;
    text-align: center;
    color: var(--muted);
}
.dm-empty i { font-size: 36px; color: var(--surface-hover); margin-bottom: 10px; display: block; }
.dm-empty p { font-size: 13px; margin-bottom: 12px; }

/* ===== Sağ panel — sohbet ===== */
.dm-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    min-width: 0;
}

.dm-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    text-align: center;
    padding: 40px 20px;
}
.dm-placeholder i { font-size: 64px; color: var(--surface-hover); margin-bottom: 16px; }
.dm-placeholder h3 { color: var(--text); font-size: 18px; margin-bottom: 6px; }
.dm-placeholder p { font-size: 14px; }

.dm-thread-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}
.dm-thread-user {
    display: flex;
    align-items: center;
    gap: 12px;
    color: inherit;
    text-decoration: none;
    min-width: 0;
}
.dm-thread-avatar-wrap {
    position: relative;
    width: 42px;
    height: 42px;
    flex-shrink: 0;
}
.dm-thread-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid transparent;
    box-sizing: border-box;
}
.dm-thread-user.online .dm-thread-avatar { border-color: var(--play-green); }
.dm-thread-avatar img { width: 100%; height: 100%; object-fit: cover; }
.dm-thread-avatar-wrap .presence-dot { bottom: -1px; right: -1px; width: 12px; height: 12px; }
.dm-thread-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}
.dm-thread-status { font-size: 12px; margin-top: 2px; }
.dm-thread-online { color: var(--play-green); font-weight: 600; }
.dm-thread-offline { color: var(--muted); }
.dm-thread-ingame { color: var(--ingame); font-weight: 600; }
.dm-thread-ingame i { margin-right: 4px; }
.dm-join-btn { white-space: nowrap; flex-shrink: 0; }

/* ===== Mesaj balonları ===== */
.dm-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.dm-messages::-webkit-scrollbar { width: 6px; }
.dm-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.dm-msg {
    display: flex;
    flex-direction: column;
    max-width: 70%;
}
.dm-msg.mine { align-self: flex-end; align-items: flex-end; }
.dm-msg.theirs { align-self: flex-start; align-items: flex-start; }

.dm-msg-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.45;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}
.dm-msg.mine .dm-msg-bubble {
    background: var(--primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.dm-msg.theirs .dm-msg-bubble {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}
.dm-msg-time {
    font-size: 10px;
    color: var(--muted);
    margin-top: 3px;
    padding: 0 6px;
}

/* ===== Kompozisyon ===== */
.dm-compose {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}
.dm-compose textarea {
    flex: 1;
    min-height: 42px;
    max-height: 160px;
    padding: 10px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 22px;
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    resize: none;
    outline: none;
    transition: border-color 0.15s;
}
.dm-compose textarea:focus { border-color: var(--primary); }

.dm-send-btn {
    width: 42px;
    height: 42px;
    border: none;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background 0.15s, transform 0.1s;
    flex-shrink: 0;
}
.dm-send-btn:hover { background: var(--primary-h); }
.dm-send-btn:active { transform: scale(0.95); }
.dm-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== Mobil — yığılmış layout ===== */
@media (max-width: 768px) {
    .dm-page { flex-direction: column; height: calc(100vh - var(--topbar-h)); }
    .dm-sidebar {
        width: 100%;
        max-height: 240px;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .dm-msg { max-width: 85%; }
    .dm-thread-head { padding: 10px 14px; }
    .dm-thread-name { font-size: 15px; }
    .dm-messages { padding: 12px; }
    .dm-compose { padding: 10px; }
    .friend-join-btn, .friend-msg-btn { font-size: 12px; }
}

/* ==================================================
   Topbar mesaj ikonu (search yanı)
   ================================================== */
.topbar-icon-btn {
    position: relative;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 16px;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    flex-shrink: 0;
}
.topbar-icon-btn:hover {
    background: var(--surface-hover);
    border-color: var(--primary);
    color: var(--primary);
}
.topbar-icon-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg);
    box-sizing: content-box;
}

/* ==================================================
   Real-time toggle visibility (data-role'lar)
   JS [data-friend-id] wrapper'a online/ingame/in-game class atar; içerideki
   role'lu öğeler bu class'lara göre görünür/gizlenir — refresh gerekmez.
   ================================================== */

/* friend-circle (ana sayfa şeridi) */
.friend-circle:not(.online) [data-role="presence-dot"] { display: none; }
.friend-circle:not(.ingame) [data-role="ingame-label"] { display: none; }
.friend-circle:not(.ingame) [data-role="join"] { display: none; }

/* friend-card (friends.php) */
.friend-card:not(.online) [data-role="presence-dot"] { display: none; }
.friend-card:not(.in-game) [data-role="ingame-label"] { display: none; }
.friend-card.in-game [data-role="online-label"] { display: none; }
.friend-card:not(.online) [data-role="online-label"] { display: none; }
.friend-card:not(.in-game) [data-role="join"] { display: none; }

/* JS wrapper'a online class'ı toggle ettiğinde inner link de senkron olsun
   (ilk render'da inner link'te online class'ı PHP veriyor; poll sırasında JS hem
   wrapper hem inner'a toggle eder). Aşağıdaki kurallar wrapper-bazlı yedek. */
.friend-card.online .friend-avatar { border: 3px solid var(--play-green); box-sizing: border-box; }
.friend-card.in-game.online .friend-avatar {
    border-color: var(--ingame);
    box-shadow: 0 0 10px var(--ingame-glow);
}
