/* ============================================================ */
/* ======================== CSS VARIABLES ==================== */
/* ============================================================ */
:root {
    --bg: #080c16;
    --bg2: #0d1424;
    --card: #131d35;
    --card-h: #192542;
    --accent: #00d4aa;
    --accent-h: #00b894;
    --danger: #ff4757;
    --warn: #ffa502;
    --gold: #ffd700;
    --fg: #e8ecf1;
    --muted: #7b8ca8;
    --dim: #4a5568;
    --border: #1e2d4a;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg);
    color: var(--fg);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-user-select: none;
    user-select: none;
}

body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at 30% 20%, rgba(0, 212, 170, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 80%, rgba(255, 71, 87, 0.03) 0%, transparent 50%);
    animation: bgDrift 20s ease-in-out infinite alternate;
    z-index: 0;
    pointer-events: none;
}

@keyframes bgDrift {
    0% { transform: translate(0, 0); }
    100% { transform: translate(-3%, 2%); }
}

.view {
    display: none;
    position: relative;
    z-index: 1;
    min-height: 100vh;
}

.view.active { display: flex; }

.seo-hidden {
    position: absolute;
    left: -9999px;
    top: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ============================================================ */
/* ======================== TOAST ============================ */
/* ============================================================ */
#toast-box {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    transform: translateX(140%);
    transition: transform 0.35s cubic-bezier(.4, 0, .2, 1), opacity 0.35s;
    opacity: 0;
    max-width: 340px;
}

.toast.show { transform: translateX(0); opacity: 1; }
.toast-ok { background: rgba(0, 212, 170, 0.92); color: #000; }
.toast-err { background: rgba(255, 71, 87, 0.92); }
.toast-info { background: rgba(52, 152, 219, 0.92); }

/* ============================================================ */
/* ======================== BANNED =========================== */
/* ============================================================ */
.banned-notice {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px;
}

.banned-notice .ban-icon {
    font-size: 80px;
    margin-bottom: 20px;
    color: var(--danger);
    animation: banPulse 2s ease-in-out infinite;
}

@keyframes banPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.banned-notice h2 { color: var(--danger); font-size: 2rem; font-weight: 900; margin-bottom: 10px; }
.banned-notice p { color: var(--muted); font-size: 16px; max-width: 400px; line-height: 1.6; }

/* ============================================================ */
/* ======================== AUTH ============================= */
/* ============================================================ */
#view-auth { align-items: center; justify-content: center; padding: 20px; }

.auth-box {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 40px 32px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.auth-logo { text-align: center; margin-bottom: 30px; }
.auth-logo h1 { font-size: 2rem; font-weight: 900; color: var(--accent); letter-spacing: -1px; }
.auth-logo p { color: var(--muted); font-size: 14px; margin-top: 4px; }
.auth-tagline { color: var(--dim); font-size: 11px; margin-top: 8px; line-height: 1.5; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
.field input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--fg);
    font-size: 15px;
    font-family: inherit;
    transition: 0.2s;
    outline: none;
    -webkit-user-select: text;
    user-select: text;
}

.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0, 212, 170, 0.15); }

/* ============================================================ */
/* ======================== BUTTONS ========================== */
/* ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: 0.25s;
    width: 100%;
    touch-action: manipulation;
}

.btn:active { transform: scale(0.97); }
.btn-accent { background: var(--accent); color: #000; }
.btn-accent:hover { background: var(--accent-h); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warn { background: var(--warn); color: #000; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--card-h); color: var(--fg); }
.btn-sm { padding: 8px 16px; font-size: 13px; width: auto; }
.btn-ban { background: #8b0000; color: #fff; }
.btn-unban { background: #1a6b3c; color: #fff; }
.btn-del { background: rgba(255, 71, 87, 0.12); color: var(--danger); border: 1px solid rgba(255, 71, 87, 0.35); }
.btn-friends { background: rgba(0, 212, 170, 0.12); color: var(--accent); border: 1px solid rgba(0, 212, 170, 0.3); }
.btn-friends:hover { background: rgba(0, 212, 170, 0.22); }

.auth-btns { display: flex; gap: 10px; margin-top: 8px; }
.auth-btns .btn { flex: 1; }

/* ============================================================ */
/* ======================== HEADER =========================== */
/* ============================================================ */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

.app-header .logo { font-size: 1.2rem; font-weight: 900; color: var(--accent); }

.hdr-right { display: flex; align-items: center; gap: 8px; }

.hdr-user {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--card);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
}

.hdr-user .uname { font-weight: 600; max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hdr-user .urate { color: var(--accent); font-weight: 700; font-size: 12px; }

.hdr-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
    font-size: 14px;
    position: relative;
}

.hdr-btn:hover { background: var(--card-h); color: var(--fg); }
.hdr-btn.active { background: var(--accent); color: #000; border-color: var(--accent); }

/* Friends button notification badge */
.hdr-btn .notif-dot {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--danger);
    border: 2px solid var(--bg2);
    animation: notifPulse 1.5s ease-in-out infinite;
}

@keyframes notifPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.9); }
}

/* ============================================================ */
/* ======================== APP BODY ========================= */
/* ============================================================ */
.app-body {
    display: flex;
    gap: 16px;
    padding: 16px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.main-col { flex: 1; min-width: 0; }
.side-col { width: 280px; flex-shrink: 0; }

@media (max-width: 900px) {
    .app-body { flex-direction: column; padding: 12px; }
    .side-col { width: 100%; }
}

@media (max-width: 480px) {
    .app-body { padding: 8px; gap: 10px; }
}

/* ============================================================ */
/* ======================== GAME CARDS ======================= */
/* ============================================================ */
.game-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 20px; }

.g-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 28px 20px;
    text-align: center;
    cursor: pointer;
    transition: 0.3s;
    position: relative;
    overflow: hidden;
    touch-action: manipulation;
}

.g-card:hover, .g-card:active { border-color: var(--accent); transform: translateY(-3px); box-shadow: 0 10px 30px rgba(0, 212, 170, 0.1); }
.g-card .g-icon { font-size: 48px; margin-bottom: 12px; display: block; }
.g-card h3 { font-size: 1.2rem; font-weight: 700; margin-bottom: 4px; }
.g-card p { color: var(--muted); font-size: 13px; }

/* ============================================================ */
/* ======================== LOBBY ============================ */
/* ============================================================ */
.lobby-section { margin-top: 16px; }

.lobby-join-box {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px 20px;
    margin-bottom: 16px;
}

.lobby-join-box h4 { font-size: 14px; font-weight: 700; color: var(--accent); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }

.lobby-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.lobby-actions input {
    flex: 1;
    min-width: 120px;
    padding: 10px 14px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--fg);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    -webkit-user-select: text;
    user-select: text;
}

.lobby-actions input:focus { border-color: var(--accent); }

.bot-diff-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }

.bot-diff-btn {
    flex: 1;
    min-width: 90px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg2);
    color: var(--fg);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.bot-diff-btn:hover { border-color: var(--accent); background: var(--card-h); }
.bot-diff-btn.diff-easy { border-color: rgba(0, 212, 170, 0.4); }
.bot-diff-btn.diff-easy:hover { background: rgba(0, 212, 170, 0.1); }
.bot-diff-btn.diff-medium { border-color: rgba(255, 165, 2, 0.4); }
.bot-diff-btn.diff-medium:hover { background: rgba(255, 165, 2, 0.1); }
.bot-diff-btn.diff-hard { border-color: rgba(255, 71, 87, 0.4); }
.bot-diff-btn.diff-hard:hover { background: rgba(255, 71, 87, 0.1); }
.bot-diff-btn .diff-bonus { font-size: 10px; color: var(--gold); font-weight: 700; margin-left: 2px; }

/* ============================================================ */
/* ======================== PLAYER CARDS ===================== */
/* ============================================================ */
.player-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 14px;
    margin: 5px 0;
    width: 100%;
    max-width: 560px;
}

.player-card.is-turn { border-color: var(--accent); background: rgba(0, 212, 170, 0.07); box-shadow: 0 0 0 1px rgba(0, 212, 170, 0.2); }

.pc-avatar { font-size: 26px; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; background: var(--bg2); border-radius: 10px; flex-shrink: 0; }
.pc-info { flex: 1; min-width: 0; }
.pc-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-sub { font-size: 11px; color: var(--muted); margin-top: 2px; display: flex; align-items: center; gap: 6px; }
.pc-color-badge { padding: 1px 7px; border-radius: 5px; font-size: 10px; font-weight: 700; background: rgba(255, 255, 255, 0.07); }
.pc-you-tag { font-size: 10px; color: var(--accent); font-weight: 700; background: rgba(0, 212, 170, 0.12); padding: 1px 6px; border-radius: 5px; }
.pc-bot-tag { font-size: 10px; color: var(--warn); font-weight: 700; background: rgba(255, 165, 2, 0.12); padding: 1px 6px; border-radius: 5px; }
.pc-turn-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: tdot 1s ease-in-out infinite; display: none; }

@keyframes tdot { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

/* ============================================================ */
/* ======================== GAME INFO BAR ==================== */
/* ============================================================ */
.game-info-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 6px;
    max-width: 560px;
}

.gib-item { font-size: 12px; }
.gib-item span { font-weight: 700; color: var(--accent); }

.captured-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1px;
    min-height: 22px;
    padding: 2px 6px;
    background: var(--bg2);
    border-radius: 8px;
    margin: 3px 0;
    font-size: 13px;
    max-width: 560px;
    width: 100%;
}

/* ============================================================ */
/* ======================== BOARD ============================ */
/* ============================================================ */
#chess-board-container, #checkers-board-container { display: none; flex-direction: column; align-items: center; }
.board-zoom-bar { display: flex; align-items: center; gap: 8px; margin: 5px 0; }

.zoom-btn {
    height: 32px;
    padding: 0 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
    font-size: 12px;
    font-weight: 600;
    gap: 5px;
    font-family: inherit;
}

.zoom-btn:hover { background: var(--card-h); color: var(--fg); border-color: var(--accent); }

#chess-board-wrap, #checkers-board-wrap {
    position: relative;
    display: inline-block;
    padding: 14px;
    background: linear-gradient(145deg, #2a2018, #1a1410);
    border-radius: 12px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85), 0 0 0 2px rgba(255, 215, 150, 0.08), inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

#chess-board-wrap::before, #checkers-board-wrap::before {
    content: '';
    position: absolute;
    inset: 8px;
    border-radius: 6px;
    background: linear-gradient(135deg, rgba(255, 215, 150, 0.15), rgba(0, 0, 0, 0.3));
    pointer-events: none;
    z-index: 0;
}

#chess-canvas, #checkers-canvas, #chess-canvas-fs, #checkers-canvas-fs {
    display: block;
    border-radius: 4px;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    touch-action: none;
    position: relative;
    z-index: 1;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* ============================================================ */
/* ======================== FULLSCREEN ======================= */
/* ============================================================ */
.board-fullscreen-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 5000;
    background: rgba(0, 0, 0, 0.97);
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
}

.board-fullscreen-overlay.open { display: flex; }

.fs-close-btn {
    position: fixed;
    top: 14px;
    right: 14px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5100;
}

/* ============================================================ */
/* ======================== GAME STATUS ====================== */
/* ============================================================ */
.game-status {
    text-align: center;
    font-size: 0.95rem;
    font-weight: 700;
    padding: 9px 12px;
    margin: 6px 0;
    background: var(--card);
    border-radius: 10px;
    border: 1px solid var(--border);
    max-width: 560px;
    width: 100%;
}

.auto-return-bar {
    background: rgba(0, 212, 170, 0.1);
    border: 1px solid rgba(0, 212, 170, 0.3);
    border-radius: 10px;
    padding: 9px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    margin: 5px 0;
    display: none;
    max-width: 560px;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.replay-btn {
    padding: 5px 14px;
    border-radius: 8px;
    border: 1px solid var(--accent);
    background: rgba(0, 212, 170, 0.18);
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    transition: 0.2s;
    flex-shrink: 0;
}

.replay-btn:hover { background: rgba(0, 212, 170, 0.32); }

.game-controls { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; max-width: 560px; width: 100%; }

/* ============================================================ */
/* ======================== SIDE CARD ======================== */
/* ============================================================ */
.side-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 14px;
}

.side-card h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.side-card-body { overflow: hidden; transition: max-height 0.35s ease; }
.side-card-body.collapsed { max-height: 0 !important; }

/* ============================================================ */
/* ======================== RANKING ========================== */
/* ============================================================ */
.rank-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.rank-table th { text-align: left; padding: 5px; color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--border); font-size: 11px; }
.rank-table td { padding: 5px; border-bottom: 1px solid rgba(30, 45, 74, 0.5); vertical-align: middle; }
.rank-table tr:last-child td { border-bottom: none; }
.rank-num { font-weight: 800; color: var(--dim); width: 20px; }
.rank-1 { color: var(--gold); }
.rank-2 { color: #c0c0c0; }
.rank-3 { color: #cd7f32; }
.rank-score { font-weight: 700; color: var(--accent); text-align: right; }
.rank-me-row { background: rgba(0, 212, 170, 0.08); }
.rank-sep-row td { padding: 3px; color: var(--dim); font-size: 10px; text-align: center; border-bottom: none !important; }

/* ============================================================ */
/* ======================== BADGES =========================== */
/* ============================================================ */
.admin-badge { display: inline-block; background: linear-gradient(135deg, var(--gold), #ffaa00); color: #000; font-size: 9px; font-weight: 700; padding: 1px 5px; border-radius: 4px; margin-left: 3px; }
.admin-msg-tag { display: inline-block; background: rgba(255, 215, 0, 0.15); color: var(--gold); font-size: 9px; font-weight: 600; padding: 1px 5px; border-radius: 4px; margin-left: 3px; border: 1px solid rgba(255, 215, 0, 0.3); }
.banned-tag { display: inline-block; background: rgba(255, 71, 87, 0.15); color: var(--danger); font-size: 9px; font-weight: 700; padding: 1px 4px; border-radius: 3px; margin-left: 3px; }

/* ============================================================ */
/* ======================== MODALS =========================== */
/* ============================================================ */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9000;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(4px);
}

.modal-overlay.open { display: flex; }

.modal-box {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 24px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    animation: modalIn 0.3s ease;
    position: relative;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(16px) scale(0.97); }
    to { opacity: 1; transform: none; }
}

.modal-box h3 { font-size: 1.1rem; font-weight: 800; margin-bottom: 18px; color: var(--accent); }
.modal-close { position: absolute; top: 14px; right: 14px; background: none; border: none; color: var(--muted); font-size: 18px; cursor: pointer; padding: 4px; }

.modal-rating-box {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 24px;
    width: 100%;
    max-width: 420px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    animation: modalIn 0.3s ease;
    position: relative;
}

.avatar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 18px; }

.avatar-opt {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: var(--bg2);
    border: 2px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: 0.2s;
}

.avatar-opt.chosen { border-color: var(--accent); background: rgba(0, 212, 170, 0.1); }

.section-title { font-size: 12px; font-weight: 600; color: var(--muted); margin: 14px 0 8px; text-transform: uppercase; letter-spacing: 0.5px; }
.divider { height: 1px; background: var(--border); margin: 14px 0; }

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 14px;
    cursor: pointer;
    transition: 0.2s;
    margin-bottom: 14px;
    background: none;
    border: none;
    font-family: inherit;
}

.back-link:hover { color: var(--accent); }
.empty-state { text-align: center; padding: 20px; color: var(--dim); font-size: 13px; }
.waiting-pulse { animation: wPulse 1.5s ease-in-out infinite; }
@keyframes wPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ============================================================ */
/* ======================== ADMIN ============================ */
/* ============================================================ */
.admin-user-list { max-height: 200px; overflow-y: auto; margin-bottom: 10px; }

.admin-u-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 9px;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.15s;
    font-size: 13px;
    border: 1px solid transparent;
    gap: 8px;
}

.admin-u-item:hover { background: var(--bg2); }
.admin-u-item.sel { background: rgba(0, 212, 170, 0.1); border-color: var(--accent); }
.admin-u-item .au-name { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 4px; }
.admin-u-item .au-rate { color: var(--accent); font-weight: 700; flex-shrink: 0; }
.admin-u-item.is-banned { opacity: 0.45; }

.admin-search-wrap { margin-bottom: 8px; }

.admin-search {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--fg);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    -webkit-user-select: text;
    user-select: text;
    transition: 0.2s;
}

.admin-search:focus { border-color: var(--accent); }

.admin-online-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 212, 170, 0.1);
    color: var(--accent);
    border: 1px solid rgba(0, 212, 170, 0.25);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 10px;
}

.admin-online-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex-shrink: 0; animation: onlinePulse 1.5s ease-in-out infinite; }
@keyframes onlinePulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.admin-actions-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.admin-actions-row .btn { flex: 1; min-width: 70px; }

.confirm-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 71, 87, 0.08);
    border: 1px solid rgba(255, 71, 87, 0.25);
    border-radius: 10px;
    margin-top: 8px;
    font-size: 12px;
    color: var(--danger);
    font-weight: 600;
}

.confirm-bar .cb-text { flex: 1; }

.admin-u-online-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex-shrink: 0; animation: onlinePulse 1.5s ease-in-out infinite; display: inline-block; margin-left: 2px; vertical-align: middle; }

/* ============================================================ */
/* ======================== PROMOTION ======================== */
/* ============================================================ */
#modal-promotion {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9500;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

#modal-promotion.open { display: flex; }

.promo-box {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 24px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
    animation: modalIn 0.3s ease;
}

.promo-box h3 { font-size: 1rem; font-weight: 800; color: var(--accent); margin-bottom: 6px; }
.promo-pieces { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }

.promo-piece {
    width: 88px;
    height: 88px;
    background: var(--bg2);
    border: 2px solid var(--border);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
    flex-direction: column;
    gap: 4px;
}

.promo-piece:hover { border-color: var(--accent); background: rgba(0, 212, 170, 0.12); transform: scale(1.08); box-shadow: 0 6px 20px rgba(0, 212, 170, 0.2); }
.promo-piece span { font-size: 11px; color: var(--fg); font-weight: 700; }

/* ============================================================ */
/* ======================== DRAW OFFER ======================= */
/* ============================================================ */
#modal-draw-offer {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9400;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

#modal-draw-offer.open { display: flex; }

.draw-box {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 26px 22px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
    animation: modalIn 0.3s ease;
    max-width: 320px;
    width: 100%;
}

.draw-box h3 { font-size: 1rem; font-weight: 800; color: var(--warn); margin-bottom: 8px; }
.draw-box p { color: var(--muted); margin-bottom: 16px; font-size: 13px; }
.draw-btns { display: flex; gap: 10px; justify-content: center; }
.draw-btns .btn { flex: 1; }

#view-game .main-col { display: flex; flex-direction: column; align-items: center; }

/* ============================================================ */
/* ======================== FRIENDS MODAL ==================== */
/* ============================================================ */
.friends-modal-box {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 24px;
    width: 100%;
    max-width: 420px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    animation: modalIn 0.3s ease;
    position: relative;
}

.friends-modal-box h3 {
    font-size: 1.1rem;
    font-weight: 800;
    margin-bottom: 18px;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Tabs */
.friends-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg2);
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 16px;
}

.friends-tab {
    flex: 1;
    padding: 8px 12px;
    border-radius: 7px;
    border: none;
    background: transparent;
    color: var(--muted);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.friends-tab.active { background: var(--accent); color: #000; }
.friends-tab .tab-count {
    background: rgba(0,0,0,0.2);
    color: inherit;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Friend item */
.friend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg2);
    margin-bottom: 8px;
    transition: 0.2s;
    position: relative;
}

.friend-item:hover { border-color: rgba(0, 212, 170, 0.3); background: var(--card-h); }

.friend-avatar-wrap { position: relative; flex-shrink: 0; }
.friend-avatar { width: 40px; height: 40px; border-radius: 10px; background: var(--card); display: flex; align-items: center; justify-content: center; font-size: 22px; }

.friend-online-dot {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    border: 2px solid var(--bg2);
}

.friend-online-dot.online { background: #2ecc71; }
.friend-online-dot.offline { background: var(--dim); }
.friend-online-dot.in-game { background: var(--warn); }

.friend-info { flex: 1; min-width: 0; }
.friend-name { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.friend-status { font-size: 11px; margin-top: 2px; }
.friend-status.online { color: #2ecc71; }
.friend-status.offline { color: var(--dim); }
.friend-status.in-game { color: var(--warn); }

.friend-actions { display: flex; gap: 6px; flex-shrink: 0; }

.friend-action-btn {
    padding: 5px 10px;
    border-radius: 8px;
    border: none;
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.friend-action-btn:active { transform: scale(0.95); }

.fab-invite { background: var(--accent); color: #000; }
.fab-invite:hover { background: var(--accent-h); }
.fab-invite:disabled { background: var(--dim); color: var(--muted); cursor: not-allowed; }

.fab-remove { background: rgba(255, 71, 87, 0.12); color: var(--danger); border: 1px solid rgba(255, 71, 87, 0.25); }
.fab-remove:hover { background: rgba(255, 71, 87, 0.22); }

.fab-accept { background: rgba(0, 212, 170, 0.15); color: var(--accent); border: 1px solid rgba(0, 212, 170, 0.3); }
.fab-accept:hover { background: rgba(0, 212, 170, 0.28); }

.fab-reject { background: rgba(255, 71, 87, 0.12); color: var(--danger); border: 1px solid rgba(255, 71, 87, 0.25); }
.fab-reject:hover { background: rgba(255, 71, 87, 0.22); }

/* Add friend section */
.add-friend-row {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.add-friend-input {
    flex: 1;
    padding: 9px 12px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 9px;
    color: var(--fg);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    -webkit-user-select: text;
    user-select: text;
    transition: 0.2s;
}

.add-friend-input:focus { border-color: var(--accent); }
.add-friend-input::placeholder { color: var(--dim); }

/* Game invite modal */
#modal-game-invite {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9300;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

#modal-game-invite.open { display: flex; }

.invite-box {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 28px 24px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
    animation: modalIn 0.3s ease;
    max-width: 320px;
    width: 100%;
}

.invite-box .invite-avatar { font-size: 48px; margin-bottom: 8px; }
.invite-box h3 { font-size: 1rem; font-weight: 800; color: var(--fg); margin-bottom: 4px; }
.invite-box p { color: var(--muted); font-size: 13px; margin-bottom: 16px; line-height: 1.5; }

.invite-btn-row { display: flex; gap: 10px; justify-content: center; }
.invite-btn-row .btn { flex: 1; }

/* ============================================================ */
/* ======================== SCROLLBAR ======================== */
/* ============================================================ */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ============================================================ */
/* ======================== RESPONSIVE ======================= */
/* ============================================================ */
@media (max-width: 600px) {
    .game-controls .btn { padding: 8px 10px; font-size: 12px; }
    .auth-box { padding: 24px 18px; }
    #chess-board-wrap, #checkers-board-wrap { padding: 8px; }
}

@media (max-width: 480px) {
    .auth-btns { flex-direction: column; }
    .auth-box { padding: 20px 14px; }
    .auth-logo h1 { font-size: 1.6rem; }
    .app-header { padding: 8px 10px; }
    .hdr-user { padding: 5px 8px; gap: 5px; }
    .hdr-user .uname { max-width: 70px; }
    .hdr-btn { width: 32px; height: 32px; font-size: 12px; }
    .logo { font-size: 1rem !important; }
    .app-body { padding: 6px !important; gap: 8px; }
    .lobby-actions { flex-direction: column; }
    .lobby-actions input { min-width: unset; width: 100%; }
    .bot-diff-row { gap: 5px; }
    .bot-diff-btn { min-width: 60px; padding: 9px 6px; font-size: 11px; }
    .lobby-join-box { padding: 16px 14px; }
    .game-info-bar { font-size: 11px; padding: 6px 10px; }
    .player-card { padding: 8px 10px; }
    .pc-avatar { width: 32px; height: 32px; font-size: 18px; }
    .pc-name { font-size: 13px; }
    .side-card { padding: 10px; }
    .modal-box { padding: 18px 12px; }
    .promo-piece { width: 70px; height: 70px; }
    #chess-board-wrap, #checkers-board-wrap { padding: 6px; }
    .game-controls { gap: 6px; }
    .g-card { padding: 18px 12px; }
    .g-card .g-icon { font-size: 36px; }
    .g-card h3 { font-size: 1rem; }
    .board-zoom-bar { margin: 3px 0; }
    .zoom-btn { height: 28px; padding: 0 10px; font-size: 11px; }
    .game-cards { gap: 10px; }
    .friends-modal-box { padding: 18px 14px; }
    .friend-action-btn { padding: 4px 8px; font-size: 10px; }
}

@media (max-width: 360px) {
    .hdr-user .uname { max-width: 55px; }
    .hdr-right { gap: 4px; }
    .bot-diff-btn { padding: 8px 4px; font-size: 10px; }
}