/* Extracted from index.html */

:root {
    /* ── FREE PLAN: "Neon Cyan & Black" — standalone, NOT shared with premium plans ── */
    --bg-color: #000000;
    --bg-gradient-start: #050a0e;
    --bg-gradient-end: #000000;
    --board-border: #1a2028;
    --text-primary: #f0f4f8;
    --text-secondary: #94a3b8;
    /* Secondary colour = Soft Slate (visible in dark mode) */
    --accent-color: #00e5ff;
    /* Primary accent: Neon Cyan */
    --accent-hover: #00b8d4;
    --accent-glow: rgba(0, 229, 255, 0.35);
    --danger-color: #ef4444;
    --panel-bg: rgba(0, 0, 0, 0.92);
    --panel-shadow: 0 0 50px rgba(0, 229, 255, 0.06);
    --board-shadow: 0 20px 80px rgba(0, 0, 0, 0.98), 0 0 20px rgba(0, 229, 255, 0.07);
    --status-bg: rgba(0, 0, 0, 0.85);
    --h1-gradient-start: #67e8f9;
    --h1-gradient-end: #00e5ff;
    --h1-shadow: rgba(0, 229, 255, 0.2);
    --toggle-bg: rgba(0, 229, 255, 0.04);
    --toggle-hover: rgba(0, 229, 255, 0.10);
    --border-subtle: rgba(0, 229, 255, 0.18);
    --border-light: rgba(255, 255, 255, 0.04);

    /* Chessboard Colors (Free Plan) */
    --white-sq: #d8eef5;
    --black-sq: #1a3344;
    --move-hint: rgba(0, 229, 255, 0.45);
}

.light-theme {
    /* "Honey & Stone" Light Theme - No Blue */
    --bg-color: #fafaf9;
    --bg-gradient-start: #fffcf0;
    --bg-gradient-end: #f5f5f4;
    --board-border: #e7e5e4;
    --text-primary: #1c1917;
    --text-secondary: #57534e;
    --panel-bg: rgba(255, 255, 255, 0.9);
    --panel-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
    /* neutral drop shadows */
    --board-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    --status-bg: rgba(245, 245, 244, 0.8);
    --toggle-bg: rgba(0, 0, 0, 0.03);
    --toggle-hover: rgba(0, 0, 0, 0.06);
    --border-subtle: rgba(0, 0, 0, 0.1);
    --border-light: rgba(0, 0, 0, 0.02);

    --white-sq: #ffffff;
    --black-sq: #d6d3d1;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

body {
    font-family: 'Inter', sans-serif;
    background: radial-gradient(circle at top, var(--bg-gradient-start), var(--bg-gradient-end));
    color: var(--text-primary);
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    text-align: left;
}

.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-width: 0;
    /* Prevents overflow-x in flexbox */
    height: 100vh;
    padding: 20px;
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
}

@media (max-width: 1024px) {
    body {
        flex-direction: column !important;
        height: auto;
        overflow-y: auto;
    }
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 7500;
    display: none;
    backdrop-filter: blur(4px);
}

.app-sidebar.active~.sidebar-overlay,
.sidebar-overlay.active {
    display: block;
}

.hamburger-btn {
    position: fixed;
    top: 20px;
    left: 12px;
    z-index: 10000;
    width: 40px;
    height: 40px;
    border-radius: 14px;
    background: var(--panel-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 10px;
}

.hamburger-btn svg {
    width: 32px;
    height: 32px;
    stroke-width: 2.8;
}

.hamburger-btn:hover {
    background: var(--accent-color);
    color: #000;
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 12px 40px rgba(245, 158, 11, 0.3);
    border-color: var(--accent-color);
}

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

.sidebar-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.1);
    border: none;
    color: var(--text-secondary);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    display: none;
    /* Only for mobile */
}

@media (max-width: 1024px) {
    .sidebar-close-btn {
        display: flex;
    }
}

/* ──── Permanent Left Sidebar ──── */
.app-sidebar {
    width: 280px;
    height: 100vh;
    background: var(--panel-bg);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    padding: 18px 16px;
    box-sizing: border-box;
    flex-shrink: 0;
    position: relative;
    /* Back to flex flow */
    transition: transform 0.4s ease, margin-left 0.4s ease;
    z-index: 8000;
    overflow-y: auto;
}

@media (max-width: 1024px) {
    .app-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        z-index: 9999;
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        height: 100vh;
        width: 280px;
        box-shadow: none;
    }

    .app-sidebar.active {
        transform: translateX(0);
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.8);
    }

    .sidebar-close-btn {
        display: flex;
    }
}

.app-sidebar.collapsed {
    margin-left: -280px;
}

.container {
    transition: margin-left 0.4s cubic-bezier(0.4, 0, 0.2, 1), width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
    /* Increased for gap */
    padding: 0px 6px 0 6px;
    /* Restored to match hamburger top: 20px */
    transition: padding-left 0.4s ease;
}

@media (min-width: 1025px) {
    .app-sidebar:not(.collapsed) .sidebar-logo-area {
        padding-left: 42px;
    }
}

.nav-logo {
    height: 44px;
    width: auto;
    mix-blend-mode: screen;
    /* Seamlessly blurs logo background with sidebar */
    filter: drop-shadow(0 0 12px var(--accent-glow));
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.light-theme .nav-logo {
    filter: none;
    mix-blend-mode: normal;
    opacity: 1;
}

.nav-brand {
    font-size: 1.15rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent-color);
    transition: color 0.3s ease;
}

/* Sidebar User Profile */
.sidebar-user {
    margin-top: 10px;
    /* Extra gap from logo */
    margin-bottom: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 12px 14px;
    /* Balanced padding */
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sidebar-user:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent-color);
}

.user-avatar {
    width: 44px;
    height: 44px;
    background: var(--accent-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.2rem;
    color: #fff;
    /* Solid White - No Blend */
    box-shadow: 0 4px 15px var(--accent-glow);
    transition: background 0.3s ease;
}

.user-info-sidebar {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.sidebar-name {
    font-weight: 800;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-stats {
    font-size: 0.7rem;
    opacity: 0.6;
}

/* Sidebar Sections */
.sidebar-section {
    margin-bottom: 14px;
}

.sidebar-section h4 {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent-color);
    margin-bottom: 12px;
    padding-left: 10px;
    font-weight: 800;
    opacity: 0.9;
}

.sidebar-item {
    background: var(--toggle-bg);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 10px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mode-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #ffffff;
    text-transform: uppercase;
}

.sidebar-item select {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    color: white;
    border: 1px solid var(--border-subtle);
    padding: 10px;
    border-radius: 8px;
    font-weight: 600;
    outline: none;
    cursor: pointer;
}

/* Logout Button at Bottom */
.sidebar-footer {
    margin-top: auto;
    padding-top: 20px;
}

.nav-item-btn.sidebar-btn {
    width: 100%;
    margin-bottom: 10px;
    justify-content: flex-start;
    padding: 0 15px;
    gap: 12px;
    height: 48px;
}


/* Unified Mobile Sidebar Logic Merged Above */
@media (max-width: 1024px) {
    body {
        flex-direction: column !important;
    }

    .container {
        padding-top: 70px;
    }
}

/* ──── Leaderboard ──── */
.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 220px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--border-subtle) transparent;
    transition: max-height 0.35s ease, opacity 0.3s ease;
    opacity: 1;
}

.leaderboard-list.collapsed {
    max-height: 0;
    opacity: 0;
    pointer-events: none;
}

.lb-loading {
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding: 6px 4px;
    text-align: center;
}

.lb-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-light);
    transition: background 0.2s;
    font-size: 0.78rem;
}

.lb-row:hover {
    background: rgba(255, 255, 255, 0.06);
}

.lb-row.lb-me {
    border-color: var(--accent-color);
    background: rgba(245, 158, 11, 0.08);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.15);
}

.lb-rank {
    font-size: 0.85rem;
    min-width: 22px;
    text-align: center;
    font-weight: 800;
}

.lb-name {
    flex: 1;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.lb-wins {
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--accent-color);
    background: rgba(0, 229, 255, 0.10);
    padding: 2px 6px;
    border-radius: 6px;
    white-space: nowrap;
}


@media (max-width: 600px) {
    .nav-center {
        transform: scale(0.7);
        /* Scale more on mobile */
    }

    .user-bar {
        display: none !important;
        /* Total removal of user bar on mobile */
    }
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Redefine floating buttons as nav items */
.nav-item-btn {
    background: var(--toggle-bg);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 1px solid var(--border-subtle);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
    padding: 0;
}

.nav-item-btn:hover {
    background: var(--toggle-hover);
    border-color: var(--accent-color);
    transform: translateY(-2px);
    color: var(--accent-color);
    box-shadow: 0 4px 12px var(--accent-glow);
}

.nav-item-btn svg {
    width: 20px;
    height: 20px;
}


.logo-container {
    margin: 0;
    padding: 0;
}

.logo {
    max-width: 240px;
    height: auto;
    transition: transform 0.3s ease;
    mix-blend-mode: normal;
    filter: drop-shadow(0 0 10px rgba(245, 158, 11, 0.2));
}

.light-theme .logo {
    filter: none;
    mix-blend-mode: normal;
    opacity: 1;
}

.logo:hover {
    transform: scale(1.05);
}

body:not(.light-theme) .logo {
    filter: drop-shadow(0 0 15px rgba(245, 158, 11, 0.3));
    mix-blend-mode: normal;
}

.game-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 6px 14px 8px;
    box-shadow: var(--panel-shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    max-height: 100%;
    width: auto;
    box-sizing: border-box;
}

.board-chat-wrapper {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    justify-content: center;
    width: 100%;
}

/* ── 3-Column Board Layout ── */
.board-main-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    flex: 1;
    min-height: 0;
}

.board-center-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
}

.side-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    width: 240px;
    flex-shrink: 0;
    height: 100%;
    overflow: visible;
}

.left-controls {
    width: 0;
    /* Minimize left space since controls moved right */
    gap: 0;
}

.side-btn-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
    margin-top: auto;
}

.side-btn {
    width: 100%;
    justify-content: center;
    flex-direction: row;
    padding: 10px 4px;
    font-size: 0.8rem;
    gap: 5px;
    border-radius: 12px;
    min-height: 44px;
}

.side-btn svg {
    flex-shrink: 0;
}

/* Board: side-panels(240) + gaps(48) + panel-pad(28) + container-pad(24) = 340px horizontal overhead
   Vertical overhead: nav(70) + container-pad(8) + panel-pad(14) + captured(40) = 132px */
#board {
    width: min(calc(100vh - 80px), calc(100vw - 200px));
    aspect-ratio: 1 / 1;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: var(--board-shadow);
    border: 6px solid var(--board-border);
}

/* Controls hidden (now in side panels) */
.controls {
    display: none;
}

#status {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-primary);
    background: var(--status-bg);
    padding: 8px 10px;
    border-radius: 10px;
    width: 100%;
    text-align: center;
    border: 1px solid var(--border-light);
    line-height: 1.4;
    word-break: break-word;
}

button {
    background: var(--accent-color);
    color: #000;
    /* Secondary = black — button text is black on cyan */
    padding: 8px 18px;
    font-size: 0.88rem;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 14px var(--accent-glow);
    display: flex;
    align-items: center;
    gap: 6px;
}

button:hover {
    background: var(--accent-hover);
    color: #000;
    transform: scale(1.05);
    box-shadow: 0 6px 20px var(--accent-glow);
}

button:active {
    transform: scale(0.95);
}

.btn-group {
    display: flex;
    gap: 8px;
}

.btn-mini {
    padding: 4px 10px;
    font-size: 0.75rem;
    height: auto;
    width: max-content;
    min-height: unset;
}

.btn-secondary {
    background: var(--toggle-bg);
    color: var(--text-primary);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
    background: var(--toggle-hover);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--toggle-bg);
    color: var(--text-primary);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 1px solid var(--border-subtle);
    backdrop-filter: blur(8px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.theme-toggle:hover {
    background: var(--toggle-hover);
    transform: rotate(15deg);
}

.theme-toggle .icon-sun {
    display: none;
}

.theme-toggle .icon-moon {
    display: block;
}

.light-theme .theme-toggle .icon-sun {
    display: block;
}

.light-theme .theme-toggle .icon-moon {
    display: none;
}

/* Existing #board definitions handled above */

/* ───── Responsive Styles ───── */
@media (max-width: 900px) {
    .container {
        height: auto;
        min-height: calc(100vh - 60px);
        overflow: visible;
        padding: 12px 16px 60px;
    }

    .board-main-wrapper {
        flex-direction: column;
        align-items: center;
        width: 100%;
        gap: 0;
    }

    .left-controls {
        display: none;
    }

    .side-controls {
        flex-direction: row;
        flex-wrap: wrap;
        width: 100%;
        max-width: 480px;
        justify-content: center;
        gap: 8px;
        margin-top: 12px;
        order: 2;
    }

    .side-btn-group {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        width: 100%;
    }

    .game-panel {
        width: 100%;
        max-width: 480px;
        padding: 12px;
        margin-top: 12px;
        order: 3;
    }

    #board {
        width: min(calc(100vw - 16px), calc(100vh - 60px));
    }

    .board-center-col {
        width: 100%;
        align-items: center;
        order: 1;
    }

    .nav-logo {
        margin-left: 0;
    }

    .friends-list-panel,
    .settings-panel {
        right: 10px;
        width: calc(100% - 20px);
        max-width: 340px;
    }

    .coach-window {
        right: 10px;
        width: calc(100% - 20px);
        max-width: 320px;
        bottom: 80px;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 8px 12px 70px;
    }

    #board {
        width: min(calc(100vw - 12px), calc(100vh - 40px));
    }

    .side-btn {
        padding: 8px 6px;
        font-size: 0.75rem;
    }

    .side-btn-group {
        grid-template-columns: repeat(3, 1fr);
    }

    .game-panel {
        padding: 10px;
    }

    .nav-bar {
        padding: 8px 12px;
    }

    .nav-actions {
        gap: 6px;
    }

    .nav-item-btn {
        width: 34px;
        height: 34px;
    }
}

@media (max-width: 400px) {
    #board {
        width: calc(100vw - 16px);
    }

    .side-btn-group {
        grid-template-columns: repeat(2, 1fr);
    }

    .coach-window {
        width: calc(100vw - 16px);
        right: 8px;
    }
}

/* Custom Chessboard Colors */
.white-1e1d7 {
    background-color: var(--white-sq) !important;
    background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.06) 0%, rgba(0, 0, 0, 0.03) 100%) !important;
    color: var(--black-sq) !important;
}

.black-3c85d {
    background-color: var(--black-sq) !important;
    background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0%, rgba(0, 0, 0, 0.2) 100%) !important;
    color: var(--white-sq) !important;
}

/* Strict Amber & Onyx Piece Styling matching the new 3D logo */

/* White pieces -> AMBER side (vibrant glowing gold outline) */
img[data-piece^="w"],
img[src*="/w"] {
    filter: sepia(100%) saturate(600%) brightness(1.3) contrast(1.2) drop-shadow(0 0 12px rgba(245, 158, 11, 0.8)) drop-shadow(0 0 4px rgba(255, 255, 255, 0.5)) !important;
}

/* Black pieces -> ONYX side (dark obsidian with glowing amber ring) */
img[data-piece^="b"],
img[src*="/b"] {
    filter: brightness(22%) contrast(160%) sepia(50%) drop-shadow(0 0 10px rgba(245, 158, 11, 0.7)) drop-shadow(0 0 3px rgba(255, 255, 255, 0.2)) !important;
}

/* Light theme piece adjustments for visibility */
.light-theme img[data-piece^="w"] {
    filter: sepia(100%) saturate(600%) hue-rotate(5deg) brightness(0.9) contrast(1.2);
}

.light-theme img[data-piece^="b"] {
    filter: brightness(15%) contrast(200%);
}

/* ──── Silver Specific: Metallic Knight Piece Skin ──── */
body.premium-silver img[data-piece^="w"],
body.premium-silver img[src*="/w"] {
    filter: grayscale(100%) brightness(1.5) contrast(1.1) drop-shadow(0 0 10px rgba(148, 163, 184, 0.7)) !important;
}

body.premium-silver img[data-piece^="b"],
body.premium-silver img[src*="/b"] {
    filter: grayscale(100%) brightness(0.6) contrast(1.4) drop-shadow(0 0 8px rgba(100, 116, 139, 0.6)) !important;
}

.highlight-square {
    box-shadow: inset 0 0 0 5px var(--accent-color) !important;
    border-radius: 2px;
}

/* board sizing defined above */

.board-wrapper {
    position: relative;
    display: inline-block;
    border-radius: 4px;
    box-shadow: 0 0 30px var(--accent-glow);
}

.board-wrapper::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    box-shadow: inset 0 0 25px rgba(0, 0, 0, 0.7);
    border: 2px solid var(--border-subtle);
    border-radius: 4px;
    z-index: 9;
}


#arrowOverlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    filter: drop-shadow(0 0 5px var(--accent-color));
}

.hint-square {
    box-shadow: inset 0 0 0 5px var(--move-hint) !important;
    border-radius: 2px;
}

.hint-count {
    font-size: 0.75rem;
    background: var(--accent-color);
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 4px;
}

.timer-display {
    font-size: 1.4rem;
    font-weight: 800;
    font-family: 'Inter', monospace;
    color: var(--accent-color);
    background: rgba(245, 158, 11, 0.1);
    padding: 6px 14px;
    border-radius: 10px;
    margin-bottom: 4px;
    border: 1px solid var(--border-light);
    display: inline-block;
    width: 100%;
    text-align: center;
    box-sizing: border-box;
}

.timer-danger {
    color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.1) !important;
    border-color: #ef4444 !important;
    animation: pulse-red 0.5s infinite;
}

@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5);
    }

    50% {
        box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

@keyframes matchmaking-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }

    70% {
        box-shadow: 0 0 0 12px rgba(239, 68, 68, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

.matchmaking-active {
    animation: matchmaking-pulse 1.5s infinite !important;
    background: #ef4444 !important;
}

.mode-container {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    background: transparent;
    padding: 0;
    border-radius: 0;
    border: none;
}

.settings-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mode-label {
    font-size: 0.75rem;
    font-weight: 800;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    white-space: nowrap;
}

.light-theme .mode-label {
    color: var(--text-secondary);
}

#modeSelector,
#difficultySelector,
#timeControlSelector {
    background: rgba(0, 0, 0, 0.2);
    color: var(--accent-color);
    border: 1px solid var(--border-subtle);
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    outline: none;
    padding: 8px 16px;
    border-radius: 10px;
    transition: all 0.3s ease;
}

#modeSelector option,
#difficultySelector option,
#timeControlSelector option {
    background: #1a1a1a;
    color: #f5f5f5;
}

.light-theme #modeSelector,
.light-theme #difficultySelector,
.light-theme #timeControlSelector {
    background: #ffffff;
    color: var(--accent-color);
    border-color: #e7e5e4;
}

.light-theme #modeSelector option,
.light-theme #difficultySelector option,
.light-theme #timeControlSelector option {
    background: #ffffff;
    color: #1c1917;
}

#modeSelector:hover,
#difficultySelector:hover,
#timeControlSelector:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--accent-color);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.2);
}


.active-mode-display {
    font-size: 0.75rem;
    font-weight: 900;
    color: white;
    background: var(--accent-color);
    padding: 6px 14px;
    border-radius: 12px;
    margin-left: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 10px rgba(245, 158, 11, 0.2);
}

/* Career & Rank Styles */
.career-breakdown {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 15px;
    margin: 15px 0;
    width: 100%;
}

.career-breakdown h4 {
    margin: 0 0 10px 0;
    font-size: 0.85rem;
    color: var(--accent-color);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.progress-bar-container {
    background: rgba(255, 255, 255, 0.05);
    height: 10px;
    border-radius: 5px;
    width: 100%;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), #fbbf24);
    width: 0%;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}

/* Tutorial & Challenges (Sidebar Integration) */
.tutorial-controls,
.challenges-controls {
    display: none;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    background: rgba(245, 158, 11, 0.05);
    border-radius: 12px;
    border: 1px solid var(--accent-color);
    width: 100%;
    margin-top: 10px;
}

.footer {
    margin-top: 40px;
    margin-bottom: 20px;
    padding: 20px;
    border-top: 1px solid var(--border-light);
    width: 100%;
    max-width: 400px;
}

.credit-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.credit-name {
    color: var(--accent-color);
    font-weight: 800;
}

.highlight-selected {
    box-shadow: inset 0 0 10px 3px rgba(251, 191, 36, 0.9), 0 0 15px rgba(251, 191, 36, 0.5) !important;
    background-color: rgba(251, 191, 36, 0.2) !important;
    border: 2px solid rgba(251, 191, 36, 0.6) !important;
    box-sizing: border-box;
}

/* Online Controls (Amber/Onyx) */
.online-controls {
    display: none;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
    padding: 24px;
    background: rgba(245, 158, 11, 0.05);
    border-radius: 16px;
    border: 2px dashed var(--accent-color);
    width: 100%;
}

.room-input {
    background: var(--bg-color);
    border: 2px solid var(--border-subtle);
    color: var(--text-primary);
    padding: 10px 15px;
    border-radius: 8px;
    text-align: center;
    font-weight: 700;
}

/* Chat & History */
.chat-container {
    display: none;
    flex-direction: column;
    background: var(--panel-bg);
    border-radius: 16px;
    border: 1px solid var(--border-subtle);
    overflow: hidden;
}

/* The sidebar-chat-integrated class is no longer used — see .online-chat-panel */

/* === Online Chat Panel (fixed, bottom of sidebar area) === */
.online-chat-panel {
    /* Override .chat-container's display:none — this panel is always rendered but
       hidden via transform when not in use, so JS inline display:flex works. */
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 280px;
    height: 240px;
    background: rgba(10, 10, 15, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-subtle);
    border-right: 1px solid var(--border-subtle);
    border-radius: 0 16px 0 0;
    z-index: 7999;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.4s ease, opacity 0.4s ease;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.4);
    /* Hidden by default until online mode active */
    transform: translateY(100%);
    pointer-events: none;
    opacity: 0;
}

/* Active state — shown during online match */
.online-chat-panel.chat-active {
    transform: translateY(0);
    pointer-events: all;
    opacity: 1;
}


/* Room Chat Styling */
.chat-messages-compact {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(0, 0, 0, 0.2);
}

.chat-entry {
    max-width: 85%;
    align-self: flex-start;
}

.chat-username {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 2px;
    opacity: 0.9;
    padding-left: 2px;
}

.chat-text {
    background: rgba(255, 255, 255, 0.06);
    padding: 8px 12px;
    border-radius: 12px;
    border-top-left-radius: 4px;
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.4;
    word-break: break-word;
}

.local-entry {
    align-self: flex-end;
}

.local-entry .chat-username {
    text-align: right;
    color: var(--text-secondary);
    padding-right: 2px;
}

.local-entry .chat-text {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(245, 158, 11, 0.08));
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-top-left-radius: 12px;
    border-top-right-radius: 4px;
}

.board-chat-wrapper {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 40px;
    width: 100%;
    margin-top: 5px;
}


/* AI Coach */
.coach-trigger {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 56px;
    height: 56px;
    background: var(--accent-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 5000;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.coach-trigger:hover {
    transform: scale(1.1) rotate(5deg);
    background: #f59e0b;
}

.coach-trigger.hidden {
    opacity: 0;
    transform: scale(0);
    pointer-events: none;
}

.coach-window {
    position: fixed;
    bottom: 95px;
    right: 0px;
    width: 270px;
    height: 500px;
    max-height: calc(100vh - 200px);
    background: var(--panel-bg);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 12px 60px rgba(0, 0, 0, 0.7);
    z-index: 5000;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0;
    transform: translateY(30px) scale(0.95);
    pointer-events: none;
}

.coach-window.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

.coach-header {
    padding: 10px 16px;
    background: var(--accent-color);
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
}

.coach-avatar {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.coach-name {
    font-weight: 800;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.coach-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
}

.coach-msg {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.82rem;
    line-height: 1.5;
    max-width: 85%;
    word-break: break-word;
}

.msg-ai {
    align-self: flex-start;
    background: var(--toggle-bg);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border-light);
}

.msg-user {
    align-self: flex-end;
    background: #4f46e5;
    color: white;
    font-weight: 500;
    border-bottom-right-radius: 4px;
}

.coach-input-area {
    padding: 16px;
    background: var(--toggle-bg);
    display: flex;
    gap: 12px;
    align-items: center;
    border-top: 1px solid var(--border-subtle);
}

.coach-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
}

.coach-input::placeholder {
    color: var(--text-secondary);
}

.coach-send {
    width: 32px;
    height: 32px;
    background: #4f46e5;
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    flex-shrink: 0;
    font-size: 1.1rem;
    line-height: 1;
}

.coach-send:hover {
    transform: scale(1.1);
    background: #6366f1;
}

/* User Info in Nav */
.user-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    padding: 6px 16px;
    border-radius: 12px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent-color), #f59e0b);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.9rem;
    color: white;
    box-shadow: 0 4px 10px rgba(245, 158, 11, 0.3);
}

.user-name {
    font-size: 0.9rem;
    font-weight: 700;
}


/* Toggles removed from fixed positions as they move to nav */
.theme-toggle,
.friends-toggle,
.settings-toggle {
    display: none;
    /* Inherited by .nav-item-btn style in nav */
}


/* Notifications */
.notification-toast {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--panel-bg);
    backdrop-filter: blur(25px);
    border: 1px solid var(--accent-color);
    padding: 20px 30px;
    border-radius: 20px;
    display: none;
    align-items: center;
    gap: 15px;
    z-index: 9000;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.8), 0 0 20px var(--accent-glow);
    animation: toastScaleIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes toastScaleIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
}

.notification-actions {
    display: flex;
    gap: 8px;
}

.btn-success {
    background: #10b981;
}

.btn-danger {
    background: #ef4444;
}

/* Friends List Panel */
.friends-list-panel {
    position: fixed;
    top: 75px;
    right: 80px;
    width: 320px;
    background: var(--panel-bg);
    backdrop-filter: blur(25px);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    display: none;
    flex-direction: column;
    z-index: 8500;
    /* Higher than sidebar and overlay */
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}


.friends-header {
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-light);
}

.friends-header h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--accent-color);
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0;
}

.friends-add-area {
    padding: 12px;
    display: flex;
    gap: 8px;
    background: rgba(0, 0, 0, 0.2);
}

.friend-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
}

.friends-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-light);
}

.friend-tab {
    flex: 1;
    padding: 10px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    border-radius: 0;
    box-shadow: none;
}

.friend-tab.active {
    color: var(--accent-color);
    border-bottom: 2px solid var(--accent-color);
    background: rgba(245, 158, 11, 0.05);
}

.friends-content-area {
    max-height: 400px;
    overflow-y: auto;
    padding: 10px;
}

.friend-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 5px;
    background: rgba(255, 255, 255, 0.02);
}

.friend-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.friend-name {
    font-weight: 700;
    font-size: 0.9rem;
}

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

.friend-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.btn-small {
    padding: 6px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-play {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.btn-play:hover {
    background: #10b981;
    color: white;
}

.btn-reject {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-reject:hover {
    background: #ef4444;
    color: white;
}

.btn-spectate {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.btn-spectate:hover {
    background: #3b82f6;
    color: white;
}

/* Promotion Modal */
.promotion-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.promotion-modal {
    background: var(--panel-bg);
    padding: 24px;
    border-radius: 20px;
    border: 1px solid var(--accent-color);
    text-align: center;
}

.promotion-options {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.promotion-piece {
    width: 60px;
    height: 60px;
    cursor: pointer;
    transition: transform 0.2s;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.promotion-piece:hover {
    transform: scale(1.1);
    background: var(--accent-color);
}

.promotion-piece img {
    width: 45px;
    height: 45px;
}

/* Board Decorations */
.captured-container {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    height: 18px;
    margin: 2px 0;
    min-width: 100%;
}

.captured-container img {
    width: 20px;
    height: 20px;
    opacity: 0.8;
}

.captured-container.bottom {
    justify-content: flex-end;
}

.move-list {
    padding: 10px;
    font-size: 0.85rem;
    font-family: monospace;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
}

.move-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 8px;
    border-radius: 4px;
}

.history-title {
    padding: 12px;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--accent-color);
    background: rgba(0, 0, 0, 0.2);
}

/* Settings Panel */
.settings-panel {
    position: fixed;
    top: 85px;
    right: 30px;
    width: 280px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    background: var(--panel-bg);
    backdrop-filter: blur(25px);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    z-index: 7000;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-20px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) transparent;
}

.settings-panel.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.settings-header {
    padding: 20px 20px 10px 20px;
    border-bottom: 1px solid var(--border-light);
}

.settings-header h3 {
    font-size: 1.1rem;
    color: var(--accent-color);
    font-weight: 800;
}

.settings-header button:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    transform: scale(1.1);
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-light);
}

.setting-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: left;
}

.setting-title {
    font-weight: 700;
    font-size: 0.85rem;
}

.setting-desc {
    font-size: 0.72rem;
    color: var(--text-secondary);
}

/* Switch Styles */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
    border-radius: 24px;
    border: 1px solid var(--border-subtle);
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

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

input:checked+.slider:before {
    transform: translateX(20px);
}

.logout-btn-settings {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: none;
    margin-left: 10px;
}

.logout-btn-settings:hover {
    background: #ef4444;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.logout-btn-settings svg {
    width: 14px;
    height: 14px;
}

.material-score {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--accent-color);
    margin-left: 10px;
    opacity: 0.9;
}

/* Floating Overlays (Outside Container) */

.chat-header-mini {
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid var(--border-light);
    text-align: left;
}

.sidebar-integrated {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 4px;
    display: none;
    flex-direction: column;
    gap: 12px;
    box-sizing: border-box;
}

.room-actions-compact {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.join-area {
    display: flex;
    gap: 4px;
}

.room-input-mini {
    width: 50px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-subtle);
    color: var(--accent-color);
    padding: 4px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-align: center;
}

.btn-mini {
    padding: 4px 8px !important;
    font-size: 0.7rem !important;
    flex: 1;
}

.room-display-compact {
    border-top: 1px solid var(--border-light);
    padding-top: 6px;
    margin-top: 4px;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.code-highlight {
    color: var(--accent-color);
    font-weight: 800;
}

/* Integrated Chat */
.chat-container.sidebar-integrated {
    height: 220px;
}

.emoji-bar-mini {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 4px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 6px;
}

.emoji-btn-mini {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 2px;
    transition: transform 0.2s;
}

.emoji-btn-mini:hover {
    transform: scale(1.3);
}

.chat-messages-compact {
    flex: 1;
    overflow-y: auto;
    padding: 4px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    scrollbar-width: thin;
}

.chat-input-area-compact {
    display: flex;
    gap: 4px;
    padding-top: 4px;
    border-top: 1px solid var(--border-light);
}

.chat-input-mini {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    padding: 4px 8px;
    color: white;
    font-size: 0.75rem;
}

.chat-send-btn-mini {
    padding: 4px 8px !important;
    min-width: 32px;
}

.status-thinking {
    color: var(--accent-color) !important;
    animation: blink 1s infinite;
    font-weight: 800;
}

@keyframes blink {
    0% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.6;
    }
}

.chat-header {
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-light);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
}

.chat-message {
    padding: 8px 14px;
    border-radius: 12px;
    max-width: 85%;
    font-size: 0.85rem;
    line-height: 1.4;
}

.message-sent {
    align-self: flex-end;
    background: var(--accent-color);
    color: white;
}

.message-received {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

.emoji-bar {
    padding: 8px;
    display: flex;
    justify-content: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.1);
}

.chat-input-area {
    padding: 12px;
    display: flex;
    gap: 8px;
    background: rgba(0, 0, 0, 0.2);
}

.chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 8px 12px;
    color: white;
    font-size: 0.85rem;
}

.chat-send-btn {
    padding: 8px 15px !important;
    font-size: 0.8rem !important;
}

/* Challenge Cards */
.challenge-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.challenge-card:hover {
    background: rgba(245, 158, 11, 0.05);
    border-color: var(--accent-color);
    transform: translateX(4px);
}

.challenge-card.completed {
    border-left: 4px solid #10b981;
}

.challenges-header,
.tutorial-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.challenges-title,
.tutorial-title {
    font-weight: 800;
    color: var(--accent-color);
}

.room-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.room-input {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-subtle);
    color: var(--accent-color);
    padding: 8px;
    border-radius: 8px;
    width: 80px;
    text-align: center;
    font-weight: 700;
}

/* History Box & Move List */
.history-box {
    width: 100%;
    height: 110px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    margin: 4px 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.move-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    scrollbar-width: thin;
}

.move-row {
    display: grid;
    grid-template-columns: 30px 1fr 1fr;
    gap: 8px;
    font-size: 0.8rem;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    align-items: center;
}

.move-number {
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 0.75rem;
}

.move-cell {
    color: var(--text-primary);
    font-weight: 600;
    text-align: left;
}

.white-cell {
    color: var(--accent-color);
}

.room-info-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
}

.copy-mini-btn {
    background: var(--toggle-bg);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    padding: 4px;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.copy-mini-btn:hover {
    background: var(--toggle-hover);
    color: var(--accent-color);
    border-color: var(--accent-color);
}

/* Career Page Styling */
.career-page {
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    padding: 30px;
    width: 90%;
    max-width: 500px;
    backdrop-filter: blur(12px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s ease-out;
}

.career-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 15px;
}

.career-header h2 {
    font-size: 1.5rem;
    color: var(--accent-color);
    margin-bottom: 4px;
}

.career-header p {
    font-size: 0.85rem;
    opacity: 0.6;
}

.career-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
    margin-bottom: 30px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 15px 10px;
    text-align: center;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.06);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.6;
}

.win-card .stat-value {
    color: var(--success-color);
}

.loss-card .stat-value {
    color: var(--danger-color);
}

.draw-card .stat-value {
    color: #94a3b8;
}

.career-breakdown {
    background: rgba(0, 0, 0, 0.2);
    padding: 20px;
    border-radius: 15px;
}

.career-breakdown h4 {
    margin-bottom: 15px;
    font-size: 0.9rem;
    text-align: center;
}

.progress-bar-container {
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--accent-color);
    width: 0%;
    transition: width 1s ease-in-out;
    box-shadow: 0 0 10px var(--accent-color);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse-cyan {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 229, 255, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(0, 229, 255, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(0, 229, 255, 0);
    }
}

.matchmaking-active {
    background: #00b8d4 !important;
    color: #000 !important;
    animation: pulse-cyan 1.5s infinite;
}

/* Board Coordinates Styling */
.notation-322f9 {
    font-size: 11px;
    /* Smaller labels */
    font-weight: 800;
    user-select: none;
    pointer-events: none;
    padding: 2px;
}

/* Numeric coordinates (1-8) at the left of ranks */
.numeric-fc9cc {
    color: var(--accent-color);
}

/* Alphabetic coordinates (a-h) at the bottom of files */
.alpha-d2270 {
    color: var(--accent-color);
    text-align: right;
    width: 100%;
}

/* Specific contrast for squares */
.square-55d63.white-1e1d7 .notation-322f9 {
    color: #444;
    /* Dark for light squares */
}

.square-55d63.black-3c85d .notation-322f9 {
    color: #eee;
    /* Light for dark squares */
}

/* Reduce piece size slightly to show coordinates */
.square-55d63 img {
    width: 88% !important;
    height: 88% !important;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* ---- Leaderboard Premium Styles ---- */
.lb-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 10px;
    margin-bottom: 8px;
    border: 1px solid var(--border-light);
    transition: all 0.2s ease;
}

.lb-row:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border-subtle);
    transform: translateX(2px);
}

.lb-me {
    background: rgba(0, 229, 255, 0.06) !important;
    border: 1px solid var(--accent-color) !important;
    box-shadow: 0 0 15px var(--accent-glow);
}

.lb-rank {
    font-weight: 800;
    font-size: 0.9rem;
    min-width: 25px;
}

.lb-name {
    flex: 1;
    padding: 0 10px;
    font-weight: 600;
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lb-wins {
    font-weight: 900;
    font-size: 0.75rem;
    color: var(--accent-color);
    background: rgba(0, 229, 255, 0.08);
    padding: 4px 10px;
    border-radius: 20px;
}

/* ──── Inbox & Direct Messaging ──── */
#inboxModal {
    z-index: 15000 !important;
    /* Above everything */
}

.inbox-icon-btn {
    transition: all 0.2s;
}

.inbox-icon-btn:hover {
    color: var(--accent-color) !important;
    transform: scale(1.1);
    filter: drop-shadow(0 0 8px var(--accent-color));
}

.direct-msg {
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    max-width: 80%;
    margin-bottom: 4px;
    animation: slideInMsg 0.2s ease-out;
}

@keyframes slideInMsg {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hint Highlighting */
.highlight-hint {
    box-shadow: inset 0 0 3px 3px rgba(245, 158, 11, 0.7);
    background: rgba(245, 158, 11, 0.15) !important;
}

.highlight-selected {
    box-shadow: inset 0 0 3px 3px rgba(79, 70, 229, 0.7);
    background: rgba(79, 70, 229, 0.15) !important;
}

.highlight-legal {
    position: relative;
}

.highlight-legal::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 25%;
    height: 25%;
    background: rgba(79, 70, 229, 0.4);
    border-radius: 50%;
    pointer-events: none;
}

/* Premium Plans Styling */
.plans-grid {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: stretch;
    gap: 15px;
    padding: 20px 0;
    width: 100%;
}

@media (max-width: 900px) {
    .plans-grid {
        flex-wrap: wrap;
    }
}

.slider-toggle {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.05);
    transition: .4s;
    border-radius: 34px;
    border: 1px solid var(--border-subtle);
}

.slider-toggle:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: var(--accent-color);
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 0 10px var(--accent-glow);
}

input:checked+.slider-toggle {
    background-color: rgba(0, 229, 255, 0.1);
    border-color: var(--accent-color);
}

input:checked+.slider-toggle:before {
    transform: translateX(22px);
    background-color: #f59e0b;
    /* Turns amber when yearly */
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.6);
}

.premium-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    border-radius: 24px;
    padding: 30px;
    flex: 1;
    min-width: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.premium-card:hover {
    transform: translateY(-12px) scale(1.02);
    border-color: var(--accent-color);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 20px rgba(245, 158, 11, 0.1);
}

.featured-gold {
    border: 2px solid var(--accent-color);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.05), rgba(0, 0, 0, 0.4));
    box-shadow: 0 0 30px rgba(245, 158, 11, 0.1);
}

.p-tier-badge {
    font-size: 0.75rem;
    font-weight: 800;
    padding: 6px 14px;
    border-radius: 20px;
    margin-bottom: 20px;
    letter-spacing: 1.5px;
}

.p-price {
    font-size: 3.8rem;
    font-weight: 900;
    margin-bottom: 25px;
    color: #ffffff !important;
}

.p-price span {
    font-size: 1rem;
    opacity: 0.8;
    font-weight: 600;
    color: #ffffff !important;
}

.p-features {
    list-style: none;
    padding: 0;
    margin: 0 0 30px 0;
    text-align: left;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.p-features li {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.p-buy-btn {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    color: white;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
    margin-top: auto;
}

.p-buy-btn:hover {
    background: white;
    color: black;
}

.gold-btn {
    background: var(--accent-color);
    border: none;
    color: black;
}

.gold-btn:hover {
    background: white;
    color: black;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.diamond-btn {
    background: #3b82f6;
    border: none;
}

.diamond-btn:hover {
    background: white;
    color: black;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.4);
}

.premium-glow-btn {
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.premium-glow-btn::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(from 0deg, transparent, var(--accent-color), transparent 30%);
    animation: rotateGlow 4s linear infinite;
    opacity: 0.3;
    z-index: -1;
}

@keyframes rotateGlow {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.animate-room-ready {
    animation: roomReadyPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes roomReadyPop {
    0% {
        opacity: 0;
        transform: translateY(10px) scale(0.9);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ── Winning Moment Impact ── */
@keyframes king-glow {
    0% {
        filter: drop-shadow(0 0 2px rgba(239, 68, 68, 0.8));
    }

    50% {
        filter: drop-shadow(0 0 25px rgba(239, 68, 68, 1)) brightness(1.5);
    }

    100% {
        filter: drop-shadow(0 0 5px rgba(239, 68, 68, 0.8));
    }
}

.king-checkmate {
    animation: king-glow 1.5s infinite alternate ease-in-out !important;
    z-index: 15;
}

@keyframes screen-pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
    }

    100% {
        transform: scale(1);
    }
}

.game-over-pulse {
    animation: screen-pulse 0.4s ease-out forwards;
}

/* ── Button Polish ── */
.btn-primary,
.btn-secondary,
.side-btn {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn-primary:hover,
.btn-secondary:hover,
.side-btn:hover {
    box-shadow: 0 0 20px var(--accent-glow);
    filter: brightness(1.1);
    transform: translateY(-2px);
}

.btn-primary:active,
.btn-secondary:active,
.side-btn:active {
    transform: scale(0.96) translateY(0);
}

.play-again-btn {
    margin-top: 10px;
    padding: 10px 24px;
    background: var(--accent-color);
    color: #000;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 15px var(--accent-glow);
    animation: cta-float 2s infinite ease-in-out;
    display: inline-block;
    transition: all 0.2s;
}

@keyframes cta-float {
    0% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }

    100% {
        transform: translateY(0);
    }
}

/* ──── Opponent Left Victory Banner Animations ──── */
@keyframes bannerPop {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.7);
    }

    70% {
        transform: translate(-50%, -50%) scale(1.04);
    }

    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes trophyBounce {
    0% {
        transform: scale(0) rotate(-15deg);
    }

    60% {
        transform: scale(1.2) rotate(8deg);
    }

    80% {
        transform: scale(0.9) rotate(-4deg);
    }

    100% {
        transform: scale(1) rotate(0deg);
    }
}

.bot-thinking-dots::after {
    content: '.';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {

    0%,
    20% {
        content: '.';
    }

    40% {
        content: '..';
    }

    60% {
        content: '...';
    }

    80%,
    100% {
        content: '';
    }
}

/* --- Free Plan Board Overrides (Neon Cyan) --- */
body:not(.premium-silver):not(.premium-gold):not(.premium-diamond) .white-1e1d7 {
    background-color: #d8eef5 !important;
    background-image: none !important;
}

body:not(.premium-silver):not(.premium-gold):not(.premium-diamond) .black-3c85d {
    background-color: #1a3344 !important;
    background-image: none !important;
}

body:not(.premium-silver):not(.premium-gold):not(.premium-diamond) #board {
    border: 4px solid #006d80;
    box-shadow: 0 0 30px rgba(0, 229, 255, 0.15), 0 20px 80px rgba(0, 0, 0, 0.95);
}

body:not(.premium-silver):not(.premium-gold):not(.premium-diamond) .highlight-selected {
    background: rgba(0, 229, 255, 0.35) !important;
    box-shadow: inset 0 0 14px rgba(0, 229, 255, 0.6);
}

/* --- Premium Theme Overrides --- */
body.premium-silver {
    --accent-color: #94a3b8;
    --accent-hover: #cbd5e1;
    --accent-glow: rgba(148, 163, 184, 0.4);
    --border-subtle: rgba(148, 163, 184, 0.3);
    --panel-shadow: 0 0 50px rgba(148, 163, 184, 0.1);
    --h1-gradient-start: #f8fafc;
    --h1-gradient-end: #94a3b8;
    --move-hint: rgba(148, 163, 184, 0.5);
}

body.premium-silver .white-1e1d7 {
    background-color: #cbd5e1 !important;
    background-image: none !important;
}

body.premium-silver .black-3c85d {
    background-color: #475569 !important;
    background-image: none !important;
}

body.premium-silver #board {
    border: 4px solid #94a3b8;
    box-shadow: 0 0 25px rgba(148, 163, 184, 0.4);
}

body.premium-silver .highlight-selected {
    background: rgba(56, 189, 248, 0.4) !important;
    box-shadow: inset 0 0 10px #38bdf8;
}

body.premium-gold {
    --accent-color: #f59e0b;
    --accent-hover: #fbbf24;
    --accent-glow: rgba(245, 158, 11, 0.5);
    --h1-gradient-start: #fffbeb;
    --h1-gradient-end: #f59e0b;
}

body.premium-gold .white-1e1d7 {
    background-color: #fcefb4 !important;
    background-image: none !important;
}

body.premium-gold .black-3c85d {
    background-color: #78350f !important;
    background-image: none !important;
}

body.premium-gold #board {
    border: 4px solid #f59e0b;
    box-shadow: 0 0 35px rgba(245, 158, 11, 0.5);
}

body.premium-gold .highlight-selected {
    background: rgba(251, 191, 36, 0.5) !important;
    box-shadow: inset 0 0 15px #fbbf24;
}

body.premium-diamond {
    --accent-color: #3b82f6;
    --accent-hover: #60a5fa;
    --accent-glow: rgba(59, 130, 246, 0.5);
    --border-subtle: rgba(59, 130, 246, 0.3);
    --panel-shadow: 0 0 50px rgba(59, 130, 246, 0.2);
    --h1-gradient-start: #dbeafe;
    --h1-gradient-end: #3b82f6;
    --move-hint: rgba(59, 130, 246, 0.5);
}

body.premium-diamond .white-1e1d7 {
    background-color: #f0f9ff !important;
    background-image: none !important;
}

body.premium-diamond .black-3c85d {
    background-color: #0c4a6e !important;
    background-image: none !important;
}

body.premium-diamond #board {
    border: 4px solid #0ea5e9;
    box-shadow: 0 0 50px rgba(14, 165, 233, 0.6);
}

body.premium-diamond .highlight-selected {
    background: rgba(96, 165, 250, 0.6) !important;
    box-shadow: inset 0 0 20px #60a5fa;
}

/* ──── Per-Player Chess Timers ──── */
.player-chess-timer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1.5px solid var(--border-subtle);
    width: 100%;
    transition: all 0.3s ease;
}

.player-chess-timer.timer-active {
    background: rgba(0, 229, 255, 0.07);
    border-color: var(--accent-color);
    box-shadow: 0 0 12px var(--accent-glow);
}

.player-chess-timer.timer-danger {
    background: rgba(239, 68, 68, 0.12);
    border-color: #ef4444;
    animation: timerPulse 0.7s ease-in-out infinite;
}

@keyframes timerPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.55;
    }
}

.timer-clock-val {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: 2px;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    transition: color 0.3s;
}

.player-chess-timer.timer-active .timer-clock-val {
    color: var(--accent-color);
}

.player-chess-timer.timer-danger .timer-clock-val {
    color: #ef4444;
}

/* ──── Match History Entries ──── */
.history-entry {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 4px;
    border-bottom: 1px solid var(--border-subtle);
}

.history-result-badge {
    font-weight: 800;
    font-size: 0.8rem;
    padding: 5px 10px;
    border-radius: 8px;
    flex-shrink: 0;
}

/* ──── Inbox Button Premium Glow ──── */
.inbox-icon-btn {
    border-radius: 10px !important;
    padding: 6px !important;
    box-shadow: 0 0 8px rgba(0, 229, 255, 0.4),
        0 0 18px rgba(0, 229, 255, 0.15);
    border: 1px solid rgba(0, 229, 255, 0.25) !important;
    transition: box-shadow 0.3s ease, border-color 0.3s ease !important;
    animation: inboxGlowPulse 2.5s ease-in-out infinite;
}

.inbox-icon-btn:hover {
    box-shadow: 0 0 14px rgba(0, 229, 255, 0.7),
        0 0 30px rgba(0, 229, 255, 0.3) !important;
    color: #00e5ff !important;
}

@keyframes inboxGlowPulse {

    0%,
    100% {
        box-shadow: 0 0 8px rgba(0, 229, 255, 0.4), 0 0 18px rgba(0, 229, 255, 0.15);
    }

    50% {
        box-shadow: 0 0 14px rgba(0, 229, 255, 0.65), 0 0 28px rgba(0, 229, 255, 0.28);
    }
}

/* Silver plan — cool silver/slate glow */
body.premium-silver .inbox-icon-btn {
    box-shadow: 0 0 8px rgba(148, 163, 184, 0.55),
        0 0 18px rgba(148, 163, 184, 0.25);
    border-color: rgba(148, 163, 184, 0.4) !important;
    animation: inboxGlowPulseSilver 2.5s ease-in-out infinite;
}

body.premium-silver .inbox-icon-btn:hover {
    box-shadow: 0 0 14px rgba(148, 163, 184, 0.8),
        0 0 30px rgba(148, 163, 184, 0.4) !important;
    color: #94a3b8 !important;
}

@keyframes inboxGlowPulseSilver {

    0%,
    100% {
        box-shadow: 0 0 8px rgba(148, 163, 184, 0.55), 0 0 18px rgba(148, 163, 184, 0.25);
    }

    50% {
        box-shadow: 0 0 14px rgba(148, 163, 184, 0.8), 0 0 28px rgba(148, 163, 184, 0.4);
    }
}

/* Gold plan — rich warm gold glow */
body.premium-gold .inbox-icon-btn {
    box-shadow: 0 0 8px rgba(251, 191, 36, 0.6),
        0 0 18px rgba(251, 191, 36, 0.3);
    border-color: rgba(251, 191, 36, 0.45) !important;
    animation: inboxGlowPulseGold 2.5s ease-in-out infinite;
}

body.premium-gold .inbox-icon-btn:hover {
    box-shadow: 0 0 16px rgba(251, 191, 36, 0.85),
        0 0 36px rgba(251, 191, 36, 0.45) !important;
    color: #fbbf24 !important;
}

@keyframes inboxGlowPulseGold {

    0%,
    100% {
        box-shadow: 0 0 8px rgba(251, 191, 36, 0.6), 0 0 18px rgba(251, 191, 36, 0.3);
    }

    50% {
        box-shadow: 0 0 16px rgba(251, 191, 36, 0.85), 0 0 32px rgba(251, 191, 36, 0.45);
    }
}

/* Diamond plan — electric blue glow */
body.premium-diamond .inbox-icon-btn {
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.6),
        0 0 20px rgba(59, 130, 246, 0.3);
    border-color: rgba(59, 130, 246, 0.45) !important;
    animation: inboxGlowPulseDiamond 2s ease-in-out infinite;
}

body.premium-diamond .inbox-icon-btn:hover {
    box-shadow: 0 0 16px rgba(59, 130, 246, 0.9),
        0 0 40px rgba(59, 130, 246, 0.5) !important;
    color: #3b82f6 !important;
}

@keyframes inboxGlowPulseDiamond {

    0%,
    100% {
        box-shadow: 0 0 8px rgba(59, 130, 246, 0.6), 0 0 20px rgba(59, 130, 246, 0.3);
    }

    50% {
        box-shadow: 0 0 18px rgba(59, 130, 246, 0.9), 0 0 40px rgba(59, 130, 246, 0.5);
    }
}

/* ──── Diamond Exclusive: Orbital Border Dots ──── */
.diamond-dot {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 12px #3b82f6, 0 0 24px rgba(59, 130, 246, 0.8), 0 0 4px #fff;
    z-index: 200;
    /* Above all other board elements */
    pointer-events: none;
    display: none;
}

body.premium-diamond .diamond-dot {
    display: block;
}

/* Toggle support for Diamond Energy Dots */
body.hide-energy-dots .diamond-dot {
    display: none !important;
}

/* Hide diamond settings from non-diamond users */
.diamond-only-setting {
    display: none !important;
}

body.premium-diamond .diamond-only-setting {
    display: flex !important;
}

/* Individual dots with staggered animations to cover each corner */
.d-dot-1 {
    animation: moveAroundBorder 12s linear infinite;
}

.d-dot-2 {
    animation: moveAroundBorder 12s linear -0.6s infinite;
}

.d-dot-3 {
    animation: moveAroundBorder 12s linear -1.2s infinite;
}

.d-dot-4 {
    animation: moveAroundBorder 12s linear -1.8s infinite;
}

.d-dot-5 {
    animation: moveAroundBorder 12s linear -2.4s infinite;
}

.d-dot-6 {
    animation: moveAroundBorder 12s linear -3s infinite;
}

.d-dot-7 {
    animation: moveAroundBorder 12s linear -3.6s infinite;
}

.d-dot-8 {
    animation: moveAroundBorder 12s linear -4.2s infinite;
}

.d-dot-9 {
    animation: moveAroundBorder 12s linear -4.8s infinite;
}

.d-dot-10 {
    animation: moveAroundBorder 12s linear -5.4s infinite;
}

.d-dot-11 {
    animation: moveAroundBorder 12s linear -6s infinite;
}

.d-dot-12 {
    animation: moveAroundBorder 12s linear -6.6s infinite;
}

.d-dot-13 {
    animation: moveAroundBorder 12s linear -7.2s infinite;
}

.d-dot-14 {
    animation: moveAroundBorder 12s linear -7.8s infinite;
}

.d-dot-15 {
    animation: moveAroundBorder 12s linear -8.4s infinite;
}

.d-dot-16 {
    animation: moveAroundBorder 12s linear -9s infinite;
}

.d-dot-17 {
    animation: moveAroundBorder 12s linear -9.6s infinite;
}

.d-dot-18 {
    animation: moveAroundBorder 12s linear -10.2s infinite;
}

.d-dot-19 {
    animation: moveAroundBorder 12s linear -10.8s infinite;
}

.d-dot-20 {
    animation: moveAroundBorder 12s linear -11.4s infinite;
}

@keyframes moveAroundBorder {
    0% {
        top: -4px;
        left: -4px;
    }

    25% {
        top: -4px;
        left: calc(100% - 4px);
    }

    50% {
        top: calc(100% - 4px);
        left: calc(100% - 4px);
    }

    75% {
        top: calc(100% - 4px);
        left: -4px;
    }

    100% {
        top: -4px;
        left: -4px;
    }
}

/* Tighten overlap for smaller screens */
@media (max-width: 900px) {
    .diamond-dot {
        width: 6px;
        height: 6px;
    }

    @keyframes moveAroundBorder {
        0% {
            top: -3px;
            left: -3px;
        }

        25% {
            top: -3px;
            left: calc(100% - 3px);
        }

        50% {
            top: calc(100% - 3px);
            left: calc(100% - 3px);
        }

        75% {
            top: calc(100% - 3px);
            left: -3px;
        }

        100% {
            top: -3px;
            left: -3px;
        }
    }
}

/* Responsive adjustment for the orbital effect */
@media (max-width: 900px) {
    body.premium-diamond .board-wrapper::before {
        inset: -3px;
        padding: 2.5px;
    }
}