* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Lexend Deca', 'Roboto Mono', monospace;
    background: #323437;
    color: #d1d0c5;
    min-height: 100vh;
    padding-top: 72px;
}

/* ═══ FIXED HEADER ══════════════════════════════════════════════ */
#siteHeader {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    height: 64px;
    background: #323437;
    border-bottom: 1px solid #3a3c3f;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    gap: 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.logo i {
    font-size: 1.6em;
    color: #e2b714;
}

.logo h1 {
    color: #d1d0c5;
    font-size: 1.6em;
    font-weight: 500;
    letter-spacing: -0.5px;
}

.multiplayer-badge {
    background: #e2b714;
    color: #323437;
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: lowercase;
}

.mode-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #2c2e31;
    border-radius: 10px;
    padding: 4px;
}

.nav-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    background: transparent;
    border: none;
    border-radius: 7px;
    color: #646669;
    font-size: 14px;
    font-family: 'Lexend Deca', sans-serif;
    cursor: pointer;
    transition: all 0.15s;
    text-transform: lowercase;
}

.nav-tab:hover {
    color: #d1d0c5;
    background: #3a3c3f;
}

.nav-tab.nav-tab-active {
    background: #e2b714;
    color: #323437;
    font-weight: 600;
}

.nav-tab i {
    font-size: 0.85em;
}

.header-right-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.friends-nav-btn,
.leaderboard-nav-btn {
    position: relative;
    background: transparent;
    border: none;
    color: #646669;
    font-size: 17px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 8px;
    transition: color 0.15s;
    display: flex;
    align-items: center;
}

.friends-nav-btn:hover,
.leaderboard-nav-btn:hover {
    color: #e2b714;
}

.friends-nav-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #e2b714;
    color: #323437;
    font-size: 10px;
    font-weight: 700;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ═══ CONTENT CONTAINER ═════════════════════════════════════════ */
.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 40px;
}

.game-screen {
    width: 100%;
}

.screen {
    background: #2c2e31;
    border-radius: 15px;
    padding: 48px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    border: 1px solid #3a3c3f;
}

.hidden {
    display: none !important;
}

/* Lobby */
.lobby-content {
    text-align: center;
    max-width: 500px;
    margin: 0 auto;
}

.lobby-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 40px;
}

.lobby-header i {
    font-size: 1.8em;
    color: #e2b714;
}

.lobby-header h2 {
    color: #d1d0c5;
    font-weight: 500;
    font-size: 1.8em;
    text-transform: lowercase;
}

.input-group {
    position: relative;
    margin: 20px 0;
}

.input-group i {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #646669;
    font-size: 1.1em;
}

.input-group input {
    width: 100%;
    padding: 18px 24px 18px 55px;
    border: 2px solid #3a3c3f;
    border-radius: 10px;
    font-size: 17px;
    background: #323437;
    color: #d1d0c5;
    transition: all 0.3s;
    font-family: 'Lexend Deca', sans-serif;
}

.input-group input:focus {
    outline: none;
    border-color: #e2b714;
    background: #2c2e31;
}

.input-group input:focus + i {
    color: #e2b714;
}

.input-group input::placeholder {
    color: #646669;
    text-transform: lowercase;
}

.btn-primary {
    padding: 16px 48px;
    margin-top: 30px;
    border: none;
    border-radius: 10px;
    font-size: 17px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Lexend Deca', sans-serif;
    background: #e2b714;
    color: #323437;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-transform: lowercase;
}

.btn-primary:hover {
    background: #f5c842;
    transform: translateY(-2px);
}

.btn-primary:active {
    transform: translateY(0);
}

.icon-btn {
    background: transparent;
    color: #646669;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    cursor: pointer;
    transition: color 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.icon-btn:hover {
    color: #e2b714;
    background: transparent;
    transform: none;
    box-shadow: none;
}

.icon-btn:active {
    transform: none;
}

/* Game */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
}

.game-info {
    display: flex;
    gap: 28px;
    align-items: baseline;
}

.info-item {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-size: 14px;
    color: #646669;
    padding: 0;
    background: transparent;
    border-radius: 0;
    transition: none;
    font-family: 'Roboto Mono', monospace;
}

.info-item:hover {
    background: transparent;
}

.info-item i {
    color: #646669;
    font-size: 0.85em;
}

.wpm-display {
    font-size: 14px;
    font-weight: 400;
    color: #646669;
    padding: 0;
    background: transparent;
    border: none;
    align-items: baseline;
}

.wpm-display i {
    color: #646669;
}

.wpm-display span:first-of-type {
    font-size: 42px;
    font-weight: 700;
    color: #e2b714;
    font-family: 'Roboto Mono', monospace;
    line-height: 1;
}

.wpm-label {
    font-size: 13px;
    color: #646669;
    font-weight: 400;
    text-transform: lowercase;
    margin-left: 3px;
}

.game-actions {
    display: flex;
    gap: 12px;
}

.players-section {
    margin-bottom: 35px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    color: #646669;
    font-size: 13px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 1px;
}

.section-title i {
    font-size: 1em;
    color: #e2b714;
}

.players-list {
    max-height: 220px;
    overflow-y: auto;
    padding-right: 8px;
}

.players-list::-webkit-scrollbar {
    width: 6px;
}

.players-list::-webkit-scrollbar-track {
    background: transparent;
}

.players-list::-webkit-scrollbar-thumb {
    background: #3a3c3f;
    border-radius: 3px;
}

.players-list::-webkit-scrollbar-thumb:hover {
    background: #4a4c4f;
}

.player-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    margin: 10px 0;
    background: linear-gradient(135deg, #2c2e31 0%, #323437 100%);
    border-radius: 10px;
    border: 1px solid #3a3c3f;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.player-card:hover {
    border-color: #4a4c4f;
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.player-card.finished {
    border-color: #e2b714;
    background: linear-gradient(135deg, rgba(226, 183, 20, 0.08) 0%, rgba(226, 183, 20, 0.05) 100%);
    box-shadow: 0 4px 16px rgba(226, 183, 20, 0.15);
}

.player-card.finished:hover {
    transform: translateX(6px);
    box-shadow: 0 6px 20px rgba(226, 183, 20, 0.25);
}

.player-info {
    flex: 1;
}

.player-name {
    font-weight: 500;
    color: #d1d0c5;
    font-size: 15px;
    text-transform: lowercase;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.position-badge {
    background: linear-gradient(135deg, #e2b714 0%, #f5c842 100%);
    color: #323437;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(226, 183, 20, 0.3);
}

.you-badge {
    background: linear-gradient(135deg, #3a3c3f 0%, #4a4c4f 100%);
    color: #e2b714;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid #e2b714;
}

.player-stats {
    display: flex;
    gap: 18px;
    font-size: 14px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #646669;
    padding: 6px 10px;
    background: rgba(58, 60, 63, 0.3);
    border-radius: 6px;
    transition: all 0.2s;
}

.stat-item:hover {
    background: rgba(58, 60, 63, 0.5);
    transform: scale(1.05);
}

.stat-item i {
    font-size: 0.95em;
}

.stat-item span {
    font-weight: 600;
    color: #d1d0c5;
}

.error-stat {
    color: #ca4754;
    background: rgba(202, 71, 84, 0.15);
}

.error-stat:hover {
    background: rgba(202, 71, 84, 0.25);
}

.error-stat i,
.error-stat span {
    color: #ca4754;
}

.progress-bar {
    width: 100%;
    height: 5px;
    background: #3a3c3f;
    border-radius: 3px;
    margin-top: 10px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #e2b714 0%, #f5c842 100%);
    transition: width 0.3s ease;
    box-shadow: 0 0 8px rgba(226, 183, 20, 0.5);
}

.typing-section {
    margin-top: 0;
    position: relative;
    cursor: text;
}

.text-container {
    position: relative;
    height: 162px;
    overflow: hidden;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    cursor: text;
    -webkit-mask-image: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(0,0,0,1) 18%,
        rgba(0,0,0,1) 82%,
        transparent 100%
    );
    mask-image: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(0,0,0,1) 18%,
        rgba(0,0,0,1) 82%,
        transparent 100%
    );
}

.text-container:hover { border: none; }
.text-container::before { display: none; }
.text-container.active { border: none; box-shadow: none; }
.text-container.active::before { display: none; }

.text-display {
    font-size: 22px;
    line-height: 54px;
    color: #646669;
    letter-spacing: 0.04em;
    font-family: 'Roboto Mono', monospace;
    font-weight: 400;
    text-align: left;
    width: 100%;
    word-break: break-word;
    overflow-wrap: break-word;
    transition: transform 0.2s ease;
    user-select: none;
}

.char {
    position: relative;
}

.char.correct {
    color: #d1d0c5;
}

.char.incorrect {
    color: #ca4754;
    border-bottom: 2px solid #ca4754;
}

.char.current {
    color: #646669;
    position: relative;
}

.char.current::before {
    content: '';
    position: absolute;
    left: -2px;
    top: 6px;
    bottom: 6px;
    width: 3px;
    background: #e2b714;
    border-radius: 1px;
    animation: caretBlink 1s step-end infinite;
}

@keyframes caretBlink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0; }
}

.input-container {
    margin-top: 20px;
    position: relative;
}

.caps-warn {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 4px 10px;
    background: rgba(226, 183, 20, 0.12);
    border: 1px solid rgba(226, 183, 20, 0.35);
    border-radius: 6px;
    color: #e2b714;
    font-size: 11px;
    font-weight: 500;
    width: fit-content;
}
.caps-warn.hidden { display: none; }

.input-hint {
    text-align: center;
    color: #3a3c3f;
    font-size: 13px;
    margin-bottom: 0;
    padding: 6px;
    background: transparent;
    border-radius: 0;
    transition: color 0.3s;
    font-family: 'Lexend Deca', sans-serif;
    letter-spacing: 0.02em;
}

.text-container.active ~ .input-container .input-hint,
.input-hint.hidden-hint {
    color: transparent;
}

.input-hint i {
    display: none;
}

.text-input {
    width: 100%;
    padding: 0;
    border: none;
    font-size: 28px;
    background: transparent;
    color: transparent;
    caret-color: transparent;
    transition: all 0.3s;
    font-family: 'Roboto Mono', monospace;
    text-align: center;
    opacity: 0;
    height: 0;
    position: absolute;
}

.text-input:focus {
    outline: none;
}

.text-input:disabled {
    cursor: not-allowed;
}

/* Scroll animatsiyasi */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.player-card {
    animation: fadeIn 0.3s ease;
}

/* Responsive */
@media (max-width: 768px) {
    .logo h1 {
        font-size: 2em;
    }

    .logo i {
        font-size: 2em;
    }

    .multiplayer-badge {
        font-size: 0.8em;
        padding: 3px 10px;
    }

    .screen {
        padding: 30px 20px;
    }

    .text-display {
        font-size: 18px;
        line-height: 48px;
    }

    .text-container {
        height: 144px;
    }
    
    .game-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .game-info {
        gap: 20px;
    }
    
    .player-stats {
        gap: 16px;
    }
    
    .btn-primary {
        padding: 14px 32px;
        font-size: 16px;
    }

    .hmr-name {
        font-size: 1.5em;
        min-width: 160px;
    }

    .hmr-desc {
        display: none;
    }

    .home-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
    }

    .hp-stats {
        gap: 16px;
    }
}

/* Fokus effektlari */
.text-input:focus,
.lobby-content input:focus {
    box-shadow: 0 0 0 3px rgba(226, 183, 20, 0.1);
}

/* Tugma bosilganda */
.btn-primary:active,
.btn-secondary:active {
    transform: translateY(0);
}

/* O'yin tugaganda */
.player-card.finished .player-name {
    color: #e2b714;
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}


/* Mode Selection */
/* ─── Home Page (Mode Selection) ───────────────────────────── */

.home-page {
    width: 100%;
    max-width: 860px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Profile strip */
.home-profile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0 28px;
    border-bottom: 1px solid #2c2e31;
    margin-bottom: 16px;
}

.hp-left {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.hp-name {
    font-size: 1.05em;
    font-weight: 600;
    color: #d1d0c5;
    text-transform: lowercase;
}

.hp-since {
    font-size: 0.76em;
    color: #646669;
}

.hp-stats {
    display: flex;
    gap: 24px;
    align-items: center;
}

.hp-stat {
    text-align: center;
}

.hp-stat span {
    display: block;
    font-size: 1.25em;
    font-weight: 700;
    color: #d1d0c5;
    font-family: 'Roboto Mono', monospace;
}

.hp-stat.hp-stat-hl span {
    color: #e2b714;
}

.hp-stat small {
    font-size: 0.68em;
    color: #646669;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Mode rows */
.home-modes {
    display: flex;
    flex-direction: column;
    margin: 16px 0;
}

.home-mode-row {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 22px 0;
    border-bottom: 1px solid #2c2e31;
    cursor: pointer;
    transition: padding-left 0.2s ease;
    position: relative;
}

.home-mode-row::before {
    content: '';
    position: absolute;
    left: -4px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: #e2b714;
    border-radius: 2px;
    transition: height 0.2s ease;
}

.home-mode-row:hover {
    padding-left: 12px;
}

.home-mode-row:hover::before {
    height: 60%;
}

.home-mode-row:hover .hmr-name {
    color: #e2b714;
}

.home-mode-row:hover .hmr-arrow {
    color: #e2b714;
    transform: translateX(4px);
}

.hmr-left {
    display: flex;
    align-items: baseline;
    gap: 16px;
    flex: 0 0 auto;
}

.hmr-num {
    font-size: 0.75em;
    color: #3a3c3f;
    font-family: 'Roboto Mono', monospace;
    font-weight: 600;
    letter-spacing: 1px;
    width: 20px;
}

.hmr-name {
    font-size: 2em;
    font-weight: 500;
    color: #d1d0c5;
    text-transform: lowercase;
    letter-spacing: -0.5px;
    transition: color 0.2s;
    font-family: 'Lexend Deca', sans-serif;
    min-width: 220px;
}

.hmr-desc {
    color: #646669;
    font-size: 0.88em;
    flex: 1;
}

.hmr-arrow {
    color: #3a3c3f;
    font-size: 0.85em;
    margin-left: auto;
    transition: color 0.2s, transform 0.2s;
}

/* Footer */
.home-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.home-server-stats {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8em;
    color: #3a3c3f;
    font-family: 'Roboto Mono', monospace;
}

.home-dot {
    color: #3a3c3f;
}

.home-links {
    display: flex;
    gap: 8px;
}

.home-link-btn {
    background: transparent;
    border: 1px solid #3a3c3f;
    border-radius: 8px;
    color: #646669;
    padding: 7px 14px;
    font-size: 0.82em;
    cursor: pointer;
    font-family: 'Lexend Deca', sans-serif;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    text-transform: lowercase;
}

.home-link-btn:hover {
    color: #e2b714;
    border-color: #e2b714;
}

.home-link-btn i {
    font-size: 0.9em;
}

/* Results Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #2c2e31;
    border-radius: 15px;
    padding: 50px;
    max-width: 700px;
    width: 90%;
    border: 2px solid #3a3c3f;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
}

.modal-content h2 {
    color: #e2b714;
    font-size: 2em;
    margin-bottom: 40px;
    text-align: center;
    text-transform: lowercase;
}

.modal-content h2 i {
    margin-right: 10px;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.result-item {
    background: #323437;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    border: 2px solid #3a3c3f;
}

.result-label {
    color: #646669;
    font-size: 0.9em;
    margin-bottom: 10px;
    text-transform: lowercase;
}

.result-value {
    color: #e2b714;
    font-size: 2.5em;
    font-weight: 600;
}

.result-value.error {
    color: #ca4754;
}

.modal-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.btn-secondary {
    background: #3a3c3f;
    color: #d1d0c5;
    padding: 16px 48px;
    border: none;
    border-radius: 10px;
    font-size: 17px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Lexend Deca', sans-serif;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-transform: lowercase;
}

.btn-secondary:hover {
    background: #4a4c4f;
    transform: translateY(-2px);
}

.btn-secondary:active {
    transform: translateY(0);
}

/* Responsive for mode selection */
@media (max-width: 768px) {
    .mode-cards {
        grid-template-columns: 1fr;
    }
    
    .mode-card {
        padding: 40px 20px;
    }
    
    .mode-card i {
        font-size: 3em;
    }
    
    .modal-content {
        padding: 30px 20px;
    }
    
    .results-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .result-value {
        font-size: 2em;
    }
}


/* Results enhancements */
.result-item.highlight {
    background: linear-gradient(135deg, rgba(226, 183, 20, 0.2) 0%, rgba(226, 183, 20, 0.1) 100%);
    border: 2px solid #e2b714;
}

.result-item.highlight .result-value {
    font-size: 3em;
}

.result-item.full-width {
    grid-column: 1 / -1;
}

.error-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.error-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: #323437;
    border-radius: 8px;
    font-family: 'Roboto Mono', monospace;
}

.error-expected {
    color: #28a745;
    font-size: 1.2em;
    font-weight: 600;
    min-width: 30px;
    text-align: center;
}

.error-typed {
    color: #ca4754;
    font-size: 1.2em;
    font-weight: 600;
    min-width: 30px;
    text-align: center;
}

.error-item i {
    color: #646669;
    font-size: 0.8em;
}

.error-count {
    margin-left: auto;
    color: #e2b714;
    font-weight: 600;
    background: rgba(226, 183, 20, 0.2);
    padding: 4px 10px;
    border-radius: 6px;
}

.wpm-chart {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 100px;
    margin-top: 15px;
    padding: 10px;
    background: #323437;
    border-radius: 8px;
}

.chart-bar {
    flex: 1;
    background: linear-gradient(to top, #e2b714, #f5c842);
    border-radius: 3px 3px 0 0;
    min-height: 5px;
    transition: all 0.3s;
    cursor: pointer;
}

.chart-bar:hover {
    background: linear-gradient(to top, #f5c842, #e2b714);
    transform: scaleY(1.05);
}

/* Responsive results */
@media (max-width: 768px) {
    .result-item.highlight .result-value {
        font-size: 2.5em;
    }
    
    .error-item {
        font-size: 0.9em;
    }
    
    .wpm-chart {
        height: 80px;
    }
}


/* Stats banner */
.stats-banner {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #2c2e31 0%, #323437 100%);
    border-radius: 10px;
    border: 2px solid #3a3c3f;
}

.stat-box {
    text-align: center;
    padding: 15px;
    background: #323437;
    border-radius: 8px;
    border: 1px solid #3a3c3f;
}

.stat-box .stat-label {
    color: #646669;
    font-size: 0.85em;
    margin-bottom: 8px;
    text-transform: lowercase;
}

.stat-box .stat-value {
    color: #d1d0c5;
    font-size: 1.8em;
    font-weight: 600;
}

.stat-box.positive .stat-value {
    color: #28a745;
}

.stat-box.negative .stat-value {
    color: #ca4754;
}

.stat-box .stat-value i {
    font-size: 0.8em;
    margin-right: 5px;
}

/* Chart improvements */
.wpm-chart {
    position: relative;
}

.wpm-chart::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: #3a3c3f;
}

.chart-bar {
    position: relative;
}

.chart-bar::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #2c2e31;
    color: #d1d0c5;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    margin-bottom: 5px;
}

.chart-bar:hover::after {
    opacity: 1;
}

/* Modal improvements */
.modal-content {
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: #323437;
}

.modal-content::-webkit-scrollbar-thumb {
    background: #3a3c3f;
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: #4a4c4f;
}

@media (max-width: 768px) {
    .stats-banner {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stat-box .stat-value {
        font-size: 1.5em;
    }
}

/* ─── Multiplayer Leaderboard ─────────────────────────────── */

#multiLeaderboard h2 {
    color: #e2b714;
    font-size: 1.8em;
    text-align: center;
    margin-bottom: 30px;
    text-transform: lowercase;
    position: relative;
    z-index: 2;
}

#multiLeaderboard h2 i {
    margin-right: 10px;
}

/* Podium */
.podium-section {
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

.podium {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 16px;
    min-height: 260px;
    padding-bottom: 0;
    padding-top: 10px;
}

.podium-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    flex: 1;
    max-width: 180px;
    position: relative;
}

.podium-medal {
    font-size: 2.2em;
    margin-bottom: 8px;
    order: 1;
}

.podium-name {
    font-size: 0.95em;
    font-weight: 600;
    color: #d1d0c5;
    text-align: center;
    margin-bottom: 6px;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    order: 2;
}

.podium-wpm {
    font-size: 1.4em;
    font-weight: 700;
    color: #e2b714;
    margin-bottom: 10px;
    order: 3;
}

.podium-wpm span {
    font-size: 0.6em;
    color: #646669;
    font-weight: 400;
}

.podium-block {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px 10px 0 0;
    border: 2px solid transparent;
    order: 5;
}

.podium-rank {
    font-size: 1.1em;
    font-weight: 700;
    color: #323437;
}

/* Sertifikat tugmasi podium ustida */
.btn-get-cert {
    margin-top: 8px;
    margin-bottom: 4px;
    background: rgba(226, 183, 20, 0.12);
    color: #e2b714;
    border: 1px solid rgba(226, 183, 20, 0.3);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.78em;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    font-family: 'Lexend Deca', sans-serif;
    white-space: nowrap;
    order: 4;
}

.btn-get-cert:hover {
    background: rgba(226, 183, 20, 0.28);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(226, 183, 20, 0.2);
}

/* 1st place */
.podium-1st .podium-block {
    height: 110px;
    background: linear-gradient(135deg, #e2b714, #f5c842);
    border-color: #e2b714;
    box-shadow: 0 0 20px rgba(226, 183, 20, 0.4);
}

/* 2nd place */
.podium-2nd .podium-block {
    height: 80px;
    background: linear-gradient(135deg, #9e9e9e, #bdbdbd);
    border-color: #9e9e9e;
}

/* 3rd place */
.podium-3rd .podium-block {
    height: 60px;
    background: linear-gradient(135deg, #cd7f32, #e8a04a);
    border-color: #cd7f32;
}

/* "You" highlight */
.podium-me .podium-name {
    color: #e2b714;
}

.podium-me .podium-block {
    box-shadow: 0 0 16px rgba(226, 183, 20, 0.5);
}

.podium-empty {
    opacity: 0;
    pointer-events: none;
}

/* Full ranking (4th place and below) */
.ranking-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.ranking-row {
    display: grid;
    grid-template-columns: 36px 1fr 80px 60px 60px;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #323437;
    border-radius: 8px;
    border: 1px solid #3a3c3f;
    font-size: 0.9em;
    transition: background 0.2s;
}

.ranking-row:hover {
    background: #3a3c3f;
}

.ranking-me {
    border-color: #e2b714 !important;
    background: rgba(226, 183, 20, 0.07) !important;
}

.ranking-pos {
    color: #646669;
    font-weight: 700;
    font-size: 0.95em;
}

.ranking-name {
    color: #d1d0c5;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ranking-wpm {
    color: #e2b714;
    font-weight: 700;
    text-align: right;
}

.ranking-acc {
    color: #646669;
    text-align: right;
}

.ranking-time {
    color: #646669;
    text-align: right;
}

/* Divider between leaderboard and personal stats */
.section-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0 16px;
    color: #646669;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.section-divider::before,
.section-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #3a3c3f;
}

.section-divider i {
    color: #e2b714;
    margin-right: 4px;
}

/* Modal wider for multiplayer */
.modal-content.multi-modal {
    max-width: 860px;
}

@media (max-width: 768px) {
    .podium {
        height: 160px;
        gap: 8px;
    }
    .podium-1st .podium-block { height: 80px; }
    .podium-2nd .podium-block { height: 60px; }
    .podium-3rd .podium-block { height: 45px; }
    .podium-wpm { font-size: 1.1em; }
    .ranking-row {
        grid-template-columns: 30px 1fr 70px 50px;
    }
    .ranking-time { display: none; }
}

/* ─── Certificate Modal ───────────────────────────────────── */

.cert-modal-content {
    max-width: 1040px !important;
    width: 96% !important;
    padding: 0 !important;
    overflow: hidden;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
}

.cert-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid #3a3c3f;
    flex-shrink: 0;
}

.cert-modal-header h3 {
    color: #e2b714;
    font-size: 1.1em;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cert-close-btn {
    background: none;
    border: none;
    color: #646669;
    font-size: 1.2em;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

.cert-close-btn:hover {
    color: #d1d0c5;
    background: #3a3c3f;
}

.cert-canvas-wrap {
    padding: 16px 20px;
    background: #1a1b1e;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.cert-canvas-wrap canvas {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.6);
}

.cert-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 12px 20px;
    border-top: 1px solid #3a3c3f;
    flex-shrink: 0;
    background: #2c2e31;
    flex-wrap: wrap;
}

.btn-cert-dl {
    background: rgba(226, 183, 20, 0.12);
    color: #e2b714;
    border: 1px solid rgba(226, 183, 20, 0.35);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    font-family: 'Lexend Deca', sans-serif;
}

.btn-cert-dl:hover {
    background: rgba(226, 183, 20, 0.25);
    transform: translateY(-1px);
}

.btn-cert-pdf {
    background: rgba(202, 71, 84, 0.12);
    color: #ca4754;
    border-color: rgba(202, 71, 84, 0.35);
}

.btn-cert-pdf:hover {
    background: rgba(202, 71, 84, 0.25);
}

/* Podium sertifikat tugmasi — yuqorida .podium-slot ichida ta'riflangan */

@media (max-width: 768px) {
    .cert-modal-actions {
        justify-content: center;
    }
    .btn-cert-dl {
        font-size: 0.82em;
        padding: 8px 14px;
    }
}

/* ─── Timer display ───────────────────────────────────────────── */

.timer-display {
    font-size: 20px;
    font-weight: 600;
    font-family: 'Roboto Mono', monospace;
    color: #d1d0c5;
    padding: 8px 16px;
    background: rgba(58, 60, 63, 0.4);
    border: 1px solid #3a3c3f;
}

.timer-display i {
    color: #646669 !important;
}

/* ─── Toast notifications ─────────────────────────────────────── */

.toast-container {
    position: fixed;
    bottom: 32px;
    right: 32px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: #2c2e31;
    border: 1px solid #3a3c3f;
    border-radius: 10px;
    color: #d1d0c5;
    font-size: 15px;
    font-family: 'Lexend Deca', sans-serif;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    transform: translateX(120%);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    pointer-events: auto;
    max-width: 360px;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast-info { border-left: 3px solid #646669; }
.toast-info i { color: #646669; }

.toast-success { border-left: 3px solid #4caf50; }
.toast-success i { color: #4caf50; }

.toast-error { border-left: 3px solid #ca4754; }
.toast-error i { color: #ca4754; }

.toast-warn { border-left: 3px solid #e2b714; }
.toast-warn i { color: #e2b714; }

@media (max-width: 768px) {
    .toast-container {
        bottom: 16px;
        right: 16px;
        left: 16px;
    }
    .toast {
        max-width: 100%;
    }
}

/* ─── Countdown overlay ───────────────────────────────────────── */

.countdown-overlay {
    position: fixed;
    inset: 0;
    z-index: 5000;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.countdown-number {
    font-size: 12rem;
    font-weight: 700;
    color: #e2b714;
    font-family: 'Roboto Mono', monospace;
    text-shadow: 0 0 60px rgba(226, 183, 20, 0.6);
    line-height: 1;
}

.countdown-go {
    font-size: 7rem;
    font-weight: 700;
    color: #4caf50;
    font-family: 'Lexend Deca', sans-serif;
    text-shadow: 0 0 60px rgba(76, 175, 80, 0.6);
    line-height: 1;
    letter-spacing: 4px;
}

.countdown-number.animate,
.countdown-go.animate {
    animation: countPop 0.85s ease-out forwards;
}

@keyframes countPop {
    0%   { transform: scale(1.4); opacity: 0; }
    20%  { transform: scale(1.0); opacity: 1; }
    80%  { transform: scale(1.0); opacity: 1; }
    100% { transform: scale(0.8); opacity: 0; }
}

/* ─── Leaderboard view ────────────────────────────────────────── */

.leaderboard-content {
    max-width: 700px;
    margin: 0 auto;
}

.btn-leaderboard {
    margin-top: 30px;
    background: transparent;
    color: #646669;
    border: 1px solid #3a3c3f;
    padding: 10px 28px;
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
    font-family: 'Lexend Deca', sans-serif;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-leaderboard:hover {
    color: #e2b714;
    border-color: #e2b714;
    background: rgba(226, 183, 20, 0.08);
}

.leaderboard-list {
    margin-top: 10px;
}

.lb-loading,
.lb-empty {
    text-align: center;
    color: #646669;
    padding: 40px;
    font-size: 15px;
}

.lb-header-row {
    display: grid;
    grid-template-columns: 50px 1fr 70px 60px 90px;
    gap: 10px;
    padding: 8px 14px;
    color: #646669;
    font-size: 0.82em;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    border-bottom: 1px solid #3a3c3f;
    margin-bottom: 6px;
}

.lb-row {
    display: grid;
    grid-template-columns: 50px 1fr 70px 60px 90px;
    gap: 10px;
    padding: 12px 14px;
    background: #323437;
    border-radius: 8px;
    border: 1px solid #3a3c3f;
    margin-bottom: 6px;
    transition: background 0.2s;
    font-size: 0.95em;
    align-items: center;
}

.lb-row:hover {
    background: #3a3c3f;
}

.lb-top {
    border-color: rgba(226, 183, 20, 0.3);
    background: rgba(226, 183, 20, 0.04);
}

.lb-rank { font-size: 1.2em; text-align: center; }
.lb-name { color: #d1d0c5; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-wpm  { color: #e2b714; font-weight: 700; text-align: right; }
.lb-acc  { color: #646669; text-align: right; }
.lb-date { color: #646669; font-size: 0.85em; text-align: right; }

@media (max-width: 600px) {
    .lb-header-row,
    .lb-row { grid-template-columns: 40px 1fr 60px 50px; }
    .lb-date { display: none; }
}

/* ─── Multiplayer options ─────────────────────────────────────── */

.mp-options {
    width: 100%;
    margin: 12px 0;
}

/* O'yin turi (race / timed) */
.gm-section-label {
    font-size: 11px;
    color: #646669;
    text-transform: lowercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
    font-family: 'Lexend Deca', sans-serif;
}

.gm-type-btns {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.gm-type-btn {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: #323437;
    border: 1px solid #3a3c3f;
    border-radius: 10px;
    color: #646669;
    cursor: pointer;
    transition: all 0.15s;
    text-align: left;
    font-family: 'Lexend Deca', sans-serif;
}

.gm-type-btn:hover { border-color: #646669; color: #d1d0c5; }
.gm-type-btn.active {
    background: rgba(226,183,20,0.08);
    border-color: #e2b714;
    color: #d1d0c5;
}
.gm-type-btn > i { font-size: 1.2em; width: 20px; color: #646669; }
.gm-type-btn.active > i { color: #e2b714; }
.gm-btn-text { display: flex; flex-direction: column; gap: 2px; }
.gm-btn-text span { font-size: 13px; font-weight: 500; }
.gm-btn-text small { font-size: 11px; color: #646669; }

/* Vaqt tanlash */
.tl-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    padding: 8px 12px;
    background: #2c2e31;
    border-radius: 8px;
    border: 1px solid #3a3c3f;
}

.tl-label {
    font-size: 12px;
    color: #646669;
    font-family: 'Lexend Deca', sans-serif;
    flex-shrink: 0;
}

.tl-btns { display: flex; gap: 6px; }

.tl-btn {
    padding: 5px 14px;
    background: transparent;
    border: 1px solid #3a3c3f;
    border-radius: 6px;
    color: #646669;
    font-size: 12px;
    font-family: 'Lexend Deca', sans-serif;
    cursor: pointer;
    transition: all 0.15s;
}
.tl-btn:hover { border-color: #646669; color: #d1d0c5; }
.tl-btn.active { border-color: #e2b714; color: #e2b714; background: rgba(226,183,20,0.08); }

/* Waiting room timed info */
.wr-timed-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: rgba(226,183,20,0.08);
    border: 1px solid rgba(226,183,20,0.25);
    border-radius: 8px;
    color: #e2b714;
    font-size: 14px;
    font-family: 'Lexend Deca', sans-serif;
    margin-bottom: 12px;
}

/* Timed countdown in game header */
.timed-countdown {
    font-size: 20px;
    font-weight: 700;
    font-family: 'Roboto Mono', monospace;
    color: #e2b714;
}

.timed-countdown.warning { color: #ca4754; }

.mp-mode-btns {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.mp-mode-btn {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: rgba(58, 60, 63, 0.3);
    border: 1px solid #3a3c3f;
    border-radius: 10px;
    color: #646669;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
}

.mp-mode-btn:hover {
    border-color: #646669;
    color: #d1d0c5;
}

.mp-mode-btn.active {
    background: rgba(226, 183, 20, 0.1);
    border-color: #e2b714;
    color: #d1d0c5;
}

.mp-mode-btn > i {
    font-size: 1.3em;
    width: 22px;
    text-align: center;
    color: #646669;
    transition: color 0.2s;
}

.mp-mode-btn.active > i { color: #e2b714; }

.mp-btn-text { display: flex; flex-direction: column; gap: 2px; }
.mp-btn-text span { font-size: 14px; font-weight: 500; }
.mp-btn-text small { font-size: 11px; color: #646669; }
.mp-mode-btn.active .mp-btn-text small { color: #999; }

.private-room-panel {
    background: rgba(58, 60, 63, 0.2);
    border: 1px solid #3a3c3f;
    border-radius: 10px;
    padding: 16px;
    margin-top: 2px;
}

.private-code-box {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.private-code-label {
    font-size: 13px;
    color: #646669;
    white-space: nowrap;
}

.private-code-value {
    font-family: 'Roboto Mono', monospace;
    font-size: 1.5em;
    font-weight: 600;
    color: #e2b714;
    letter-spacing: 4px;
    flex: 1;
}

/* ─── Auth Screen ─────────────────────────────────────────────── */

#authScreen {
    width: 100%;
    padding: 40px 0 60px;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    background: #2c2e31;
    border-radius: 16px;
    padding: 40px 40px 36px;
    border: 1px solid #3a3c3f;
    box-shadow: 0 8px 32px rgba(0,0,0,0.35);
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 32px;
}

.auth-logo i {
    font-size: 1.7em;
    color: #e2b714;
}

.auth-logo span {
    color: #d1d0c5;
    font-size: 1.8em;
    font-weight: 500;
    letter-spacing: -0.5px;
    font-family: 'Lexend Deca', sans-serif;
}

.auth-tabs {
    display: flex;
    gap: 3px;
    background: #323437;
    border-radius: 10px;
    padding: 3px;
    margin-bottom: 28px;
}

.auth-tab {
    flex: 1;
    padding: 9px 12px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #646669;
    font-size: 13px;
    font-family: 'Lexend Deca', sans-serif;
    cursor: pointer;
    transition: all 0.15s;
    text-transform: lowercase;
    font-weight: 500;
}

.auth-tab.active {
    background: #3a3c3f;
    color: #e2b714;
}

.auth-tab:hover:not(.active) {
    color: #d1d0c5;
}

/* Auth form fields */
.auth-field {
    margin-bottom: 16px;
}

.auth-label {
    display: block;
    font-size: 12px;
    color: #646669;
    margin-bottom: 6px;
    text-transform: lowercase;
    letter-spacing: 0.03em;
    font-family: 'Lexend Deca', sans-serif;
}

.auth-input {
    width: 100%;
    padding: 12px 16px;
    background: #323437;
    border: 1px solid #3a3c3f;
    border-radius: 8px;
    color: #d1d0c5;
    font-size: 15px;
    font-family: 'Lexend Deca', sans-serif;
    outline: none;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

.auth-input:focus {
    border-color: #e2b714;
    background: #2c2e31;
}

.auth-input::placeholder {
    color: #3a3c3f;
}

.auth-btn {
    width: 100%;
    margin-top: 20px;
    padding: 13px 16px;
    background: #e2b714;
    color: #323437;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    font-family: 'Lexend Deca', sans-serif;
    cursor: pointer;
    transition: background 0.15s;
    text-transform: lowercase;
    letter-spacing: 0.02em;
}

.auth-btn:hover { background: #cca50f; }
.auth-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.auth-divider {
    text-align: center;
    position: relative;
    margin: 24px 0 16px;
    color: #3a3c3f;
    font-size: 12px;
    font-family: 'Lexend Deca', sans-serif;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: calc(50% - 24px);
    height: 1px;
    background: #3a3c3f;
}

.auth-divider::before { left: 0; }
.auth-divider::after  { right: 0; }

.auth-guest-btn {
    width: 100%;
    padding: 11px 16px;
    background: transparent;
    border: 1px solid #3a3c3f;
    border-radius: 8px;
    color: #646669;
    font-size: 13px;
    font-family: 'Lexend Deca', sans-serif;
    cursor: pointer;
    transition: all 0.15s;
    text-transform: lowercase;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.auth-guest-btn:hover {
    border-color: #646669;
    color: #d1d0c5;
}

/* Solo Settings Bar */
.solo-settings-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0 24px;
    flex-wrap: wrap;
}

.ssb-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.ssb-toggle {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.ssb-label {
    font-size: 13px;
    color: #646669;
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

.ssb-label i {
    font-size: 0.9em;
}

.ssb-sub {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.ssb-input {
    background: #2c2e31;
    border: 1px solid #3a3c3f;
    border-radius: 6px;
    color: #d1d0c5;
    padding: 4px 10px;
    font-size: 13px;
    font-family: 'Lexend Deca', sans-serif;
    width: 140px;
    outline: none;
}

.ssb-input:focus {
    border-color: #e2b714;
}

.ssb-sep {
    width: 1px;
    height: 20px;
    background: #3a3c3f;
    margin: 0 4px;
}

.ssb-stats {
    margin-left: auto;
    font-size: 12px;
    color: #646669;
    font-family: 'Roboto Mono', monospace;
}

/* Friends Overlay */
.friends-overlay {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 500;
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
    padding-top: 70px;
    padding-right: 20px;
}

.friends-overlay.hidden {
    display: none !important;
}

.friends-overlay-panel {
    background: #2c2e31;
    border: 1px solid #3a3c3f;
    border-radius: 14px;
    width: 360px;
    max-height: 540px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    overflow: hidden;
}

.friends-overlay-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid #3a3c3f;
    color: #d1d0c5;
    font-size: 14px;
    font-weight: 500;
}

.friends-overlay-header i {
    color: #e2b714;
    margin-right: 6px;
}

.friends-overlay-close {
    background: transparent;
    border: none;
    color: #646669;
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.15s;
}

.friends-overlay-close:hover {
    color: #ca4754;
}

.friends-section-inner {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

/* Challenge notif — fixed bottom */
.challenge-notif {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 600;
    max-width: 480px;
    width: 90%;
    background: linear-gradient(135deg, rgba(226, 183, 20, 0.1), rgba(226, 183, 20, 0.04));
    border: 1px solid rgba(226, 183, 20, 0.38);
    border-radius: 12px;
    padding: 14px 18px;
    text-align: left;
    animation: challengePulse 2.5s ease-in-out infinite;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #2c2e31;
    border: 1px solid #3a3c3f;
    border-radius: 10px;
    padding: 8px 16px;
    color: #d1d0c5;
    font-size: 14px;
}

.user-info i.fa-user-circle {
    color: #e2b714;
    font-size: 1.2em;
}

#headerUsername {
    color: #e2b714;
    font-weight: 500;
}

.btn-logout {
    background: transparent;
    border: 1px solid #3a3c3f;
    border-radius: 6px;
    color: #646669;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    font-family: 'Lexend Deca', sans-serif;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    margin-left: 4px;
}

.btn-logout:hover {
    color: #ca4754;
    border-color: #ca4754;
}

.btn-icon-sm {
    background: rgba(58, 60, 63, 0.5);
    border: 1px solid #3a3c3f;
    border-radius: 6px;
    color: #646669;
    padding: 5px 8px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.15s;
}

.btn-icon-sm:hover { color: #d1d0c5; border-color: #646669; }

.private-code-hint {
    font-size: 11px;
    color: #646669;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.or-text {
    text-align: center;
    font-size: 11px;
    color: #3a3c3f;
    margin: 10px 0 8px;
    letter-spacing: 1px;
}

/* ─── AI Panel (lobby) ────────────────────────────────────────── */

.ai-panel {
    width: 100%;
    margin: 16px 0 4px;
    border-radius: 10px;
    border: 1px solid #3a3c3f;
    overflow: hidden;
}

.ai-key-section {
    padding: 14px 18px;
    background: rgba(226, 183, 20, 0.05);
    border-bottom: 1px solid #3a3c3f;
}

.ai-key-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-key-row > i {
    color: #e2b714;
    font-size: 0.9em;
    width: 16px;
    flex-shrink: 0;
}

.ai-key-row input[type="password"] {
    flex: 1;
    background: #2c2e31;
    border: 1px solid #3a3c3f;
    border-radius: 6px;
    padding: 7px 12px;
    color: #d1d0c5;
    font-family: 'Roboto Mono', monospace;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

.ai-key-row input[type="password"]:focus {
    border-color: #e2b714;
}

.btn-save-key {
    background: rgba(226, 183, 20, 0.15);
    border: 1px solid rgba(226, 183, 20, 0.3);
    border-radius: 6px;
    color: #e2b714;
    padding: 7px 10px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
    flex-shrink: 0;
}

.btn-save-key:hover {
    background: rgba(226, 183, 20, 0.25);
}

.ai-key-hint {
    margin-top: 6px;
    font-size: 11px;
    color: #646669;
    display: flex;
    align-items: center;
    gap: 5px;
}

.ai-key-hint a {
    color: #e2b714;
    text-decoration: none;
}

.ai-key-hint a:hover {
    text-decoration: underline;
}

.ai-panel-row {
    padding: 14px 18px;
    background: rgba(58, 60, 63, 0.2);
    border-bottom: 1px solid #3a3c3f;
}

.ai-panel-row:last-child { border-bottom: none; }

.ai-toggle-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #d1d0c5;
}

.ai-toggle-row i {
    color: #e2b714;
    font-size: 1em;
    width: 16px;
    text-align: center;
}

.ai-toggle-row span { flex: 1; text-align: left; }

/* Toggle switch — .ssb-toggle va .toggle-switch ikkisi ham ishlaydi */
.toggle-switch,
.ssb-toggle {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}

.toggle-switch input,
.ssb-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }

.toggle-slider {
    position: absolute;
    inset: 0;
    background: #3a3c3f;
    border-radius: 22px;
    cursor: pointer;
    transition: background 0.2s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    top: 3px;
    background: #646669;
    border-radius: 50%;
    transition: transform 0.2s, background 0.2s;
}

.toggle-switch input:checked + .toggle-slider,
.ssb-toggle input:checked + .toggle-slider { background: rgba(226,183,20,0.25); }

.toggle-switch input:checked + .toggle-slider::before,
.ssb-toggle input:checked + .toggle-slider::before {
    transform: translateX(18px);
    background: #e2b714;
}

.toggle-switch input:disabled + .toggle-slider,
.ssb-toggle input:disabled + .toggle-slider { opacity: 0.4; cursor: not-allowed; }

.ai-sub-options { margin-top: 10px; }

/* Difficulty / Bot WPM buttons */
.diff-btns {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.diff-btn {
    padding: 6px 16px;
    border-radius: 6px;
    border: 1px solid #3a3c3f;
    background: #323437;
    color: #646669;
    font-size: 13px;
    cursor: pointer;
    font-family: 'Lexend Deca', sans-serif;
    transition: all 0.2s;
}

.diff-btn:hover { border-color: #e2b714; color: #d1d0c5; }

.diff-btn.active {
    border-color: #e2b714;
    color: #e2b714;
    background: rgba(226,183,20,0.1);
}

.bot-wpm-row {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: #646669;
    flex-wrap: wrap;
}

/* ─── Bot player card ─────────────────────────────────────────── */

.bot-badge {
    background: linear-gradient(135deg, rgba(100,102,105,0.3), rgba(100,102,105,0.2));
    color: #646669;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid #4a4c4f;
}

.bot-progress-fill {
    background: linear-gradient(90deg, #646669 0%, #9e9e9e 100%) !important;
    box-shadow: 0 0 6px rgba(100,100,100,0.3) !important;
}

/* ─── AI Coach (results modal) ────────────────────────────────── */

.ai-coach-section {
    margin: 20px 0 8px;
    padding: 18px 20px;
    background: linear-gradient(135deg, rgba(226,183,20,0.06), rgba(226,183,20,0.03));
    border: 1px solid rgba(226,183,20,0.25);
    border-radius: 10px;
}

.ai-coach-header {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #e2b714;
    font-size: 0.85em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.ai-coach-text p {
    color: #d1d0c5;
    font-size: 14px;
    line-height: 1.7;
    margin-bottom: 10px;
}

.ai-coach-text p:last-child { margin-bottom: 0; }

.coach-loading { color: #646669; font-size: 14px; font-style: italic; }

.coach-error { color: #ca4754 !important; }

/* AI Coach button */
.btn-coach {
    padding: 16px 32px;
    border: 1px solid rgba(226,183,20,0.4);
    border-radius: 10px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Lexend Deca', sans-serif;
    background: rgba(226,183,20,0.08);
    color: #e2b714;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-transform: lowercase;
}

.btn-coach:hover:not(:disabled) {
    background: rgba(226,183,20,0.2);
    transform: translateY(-2px);
}

.btn-coach:disabled { opacity: 0.6; cursor: not-allowed; }

@media (max-width: 768px) {
    .btn-coach { padding: 12px 20px; font-size: 14px; }
    .ai-panel { margin: 10px 0 0; }
}

.sstat {
    color: inherit;
}

/* ─── Leaderboard Mode Tabs ─────────────────────────────────── */

/* ─── Leaderboard Mode Tabs ─────────────────────────────────── */

.lb-mode-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    background: #323437;
    padding: 4px;
    border-radius: 10px;
}

.lb-mode-tab {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: #646669;
    font-family: 'Lexend Deca', sans-serif;
    font-size: 0.88em;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-transform: lowercase;
}

.lb-mode-tab.active {
    background: #2c2e31;
    color: #e2b714;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.lb-mode-tab:hover:not(.active) {
    color: #d1d0c5;
}

/* ─── Active Rooms ──────────────────────────────────────────── */

.active-rooms-section {
    width: 100%;
    margin: 8px 0 4px;
    text-align: left;
}

.rooms-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #646669;
    font-size: 0.78em;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
    padding: 0 2px;
}

.rooms-section-title i {
    color: rgba(226, 183, 20, 0.6);
}

.rooms-section-title span {
    flex: 1;
}

.btn-refresh-rooms {
    background: transparent;
    border: none;
    color: #646669;
    cursor: pointer;
    font-size: 0.9em;
    padding: 2px 6px;
    border-radius: 4px;
    transition: color 0.2s;
}

.btn-refresh-rooms:hover { color: #e2b714; }

.active-rooms-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
    max-height: 160px;
    overflow-y: auto;
}

.active-room-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 14px;
    background: #323437;
    border: 1px solid #3a3c3f;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.88em;
}

.active-room-item:hover {
    border-color: rgba(226, 183, 20, 0.4);
    background: #2c2e31;
}

.room-code {
    flex: 1;
    font-family: 'Roboto Mono', monospace;
    font-weight: 600;
    color: #d1d0c5;
}

.room-players {
    color: #646669;
    font-size: 0.88em;
}

.room-status {
    font-size: 0.75em;
    padding: 3px 8px;
    border-radius: 5px;
    font-weight: 500;
}

.room-waiting {
    background: rgba(226, 183, 20, 0.12);
    color: #e2b714;
}

.room-started {
    background: rgba(255, 107, 107, 0.12);
    color: #ff6b6b;
}

/* ─── AI Server Status ──────────────────────────────────────── */

.ai-server-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-radius: 7px;
    font-size: 0.8em;
    margin-top: 8px;
}

.ai-status-ok {
    background: rgba(76, 175, 80, 0.1);
    color: #4caf50;
    border: 1px solid rgba(76, 175, 80, 0.25);
}

.ai-status-off {
    background: rgba(255, 152, 0, 0.1);
    color: #ff9800;
    border: 1px solid rgba(255, 152, 0, 0.25);
}

/* ─── Texts Management Modal ────────────────────────────────── */

.texts-modal-content {
    max-width: 700px;
    max-height: 85vh;
    overflow-y: auto;
    text-align: left;
}

.texts-add-form {
    margin-bottom: 16px;
}

.texts-input-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.btn-add-text {
    height: 58px;
    width: 58px;
    background: #e2b714;
    color: #323437;
    border: none;
    border-radius: 10px;
    font-size: 1.15em;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-add-text:hover {
    background: #f5c842;
    transform: translateY(-1px);
}

.texts-list {
    max-height: 420px;
    overflow-y: auto;
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.texts-list::-webkit-scrollbar { width: 5px; }
.texts-list::-webkit-scrollbar-track { background: transparent; }
.texts-list::-webkit-scrollbar-thumb { background: #3a3c3f; border-radius: 3px; }

.texts-count {
    font-size: 0.8em;
    color: #646669;
    margin-bottom: 8px;
    text-align: right;
}

.text-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: #323437;
    border: 1px solid #3a3c3f;
    border-radius: 8px;
    transition: border-color 0.2s;
}

.text-item:hover {
    border-color: #646669;
}

.text-content {
    flex: 1;
    font-size: 0.85em;
    color: #d1d0c5;
    line-height: 1.5;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.btn-delete-text {
    background: transparent;
    color: #646669;
    border: 1px solid #3a3c3f;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.8em;
}

.btn-delete-text:hover {
    background: rgba(255, 107, 107, 0.12);
    color: #ff6b6b;
    border-color: rgba(255, 107, 107, 0.3);
}

/* ─── Tournament ────────────────────────────────────────────── */

.tournament-content {
    max-width: 480px;
    margin: 0 auto;
    text-align: center;
}

.t-tabs {
    display: flex;
    gap: 0;
    border: 1px solid #3a3c3f;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 28px;
}
.t-tab {
    flex: 1;
    padding: 11px 10px;
    background: none;
    border: none;
    color: #646669;
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
}
.t-tab:hover { color: #d1d0c5; background: rgba(58, 60, 63, 0.4); }
.t-tab-active { color: #e2b714 !important; background: rgba(226, 183, 20, 0.1) !important; }

.t-form {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
}
.t-form .btn-primary { margin-top: 8px; }

/* ── Waiting room ── */

.t-waiting-content {
    max-width: 520px;
    margin: 0 auto;
    text-align: center;
}

.t-wait-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 28px;
}
.t-trophy-icon {
    width: 64px; height: 64px;
    background: rgba(226, 183, 20, 0.12);
    border: 2px solid rgba(226, 183, 20, 0.3);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.6rem;
    color: #e2b714;
}
.t-wait-header h2 {
    color: #d1d0c5;
    font-size: 1.5em;
    margin: 0;
}
.t-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}
.t-status-waiting { background: rgba(100, 102, 105, 0.2); color: #646669; }
.t-status-running { background: rgba(226, 183, 20, 0.15); color: #e2b714; }
.t-status-finished { background: rgba(102, 187, 106, 0.15); color: #66bb6a; }

.t-participants-box {
    background: #2c2e31;
    border: 1px solid #3a3c3f;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
}
.t-part-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid #3a3c3f;
    color: #d1d0c5;
    font-size: 0.88rem;
    font-weight: 500;
    text-align: left;
}
.t-count-badge {
    margin-left: auto;
    background: rgba(226, 183, 20, 0.15);
    color: #e2b714;
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: 8px;
    padding: 2px 8px;
}
.t-part-list {
    padding: 8px 12px;
    max-height: 240px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: left;
}
.t-part-list::-webkit-scrollbar { width: 3px; }
.t-part-list::-webkit-scrollbar-thumb { background: #3a3c3f; border-radius: 2px; }

.t-part-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 8px;
    border-radius: 8px;
    transition: background 0.12s;
}
.t-part-item:hover { background: rgba(58, 60, 63, 0.4); }
.t-part-name {
    flex: 1;
    color: #d1d0c5;
    font-size: 0.85rem;
}
.t-owner-badge {
    color: #e2b714;
    font-size: 0.78rem;
}
.t-part-status {
    font-size: 0.72rem;
    padding: 2px 7px;
    border-radius: 5px;
}
.t-part-done { background: rgba(102, 187, 106, 0.12); color: #66bb6a; }
.t-part-wait { background: rgba(100, 102, 105, 0.15); color: #646669; }

.btn-t-start {
    min-width: 220px;
    font-size: 1rem;
    padding: 16px 32px;
}
.t-start-hint {
    color: #646669;
    font-size: 0.78rem;
    margin-top: 8px;
}
.t-wait-msg {
    color: #646669;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 0;
}

/* ── Results ── */

.t-results-content {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}
.t-res-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-bottom: 32px;
}
.t-res-header > i { font-size: 2.4rem; color: #e2b714; }
.t-res-header h2 { color: #d1d0c5; font-size: 1.6em; margin: 0; }
.t-res-subtitle { color: #646669; font-size: 0.85rem; margin: 0; }

.t-podium {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 28px;
}
.t-podium-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.t-podium-avatar {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem;
    font-weight: 800;
    color: #1a1b1e;
    text-transform: uppercase;
}
.t-podium-medal { font-size: 1.6rem; line-height: 1; }
.t-podium-name { color: #d1d0c5; font-size: 0.82rem; font-weight: 600; max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-podium-wpm { color: #e2b714; font-size: 1rem; font-weight: 700; }
.t-podium-wpm span { font-size: 0.7rem; color: #646669; font-weight: 400; }
.t-podium-block {
    border-radius: 8px 8px 0 0;
    width: 80px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
    font-weight: 800;
    color: #1a1b1e;
}
.t-podium-1st .t-podium-block { height: 70px; background: linear-gradient(180deg, #e2b714, #c4970e); }
.t-podium-2nd .t-podium-block { height: 50px; background: linear-gradient(180deg, #9e9e9e, #757575); }
.t-podium-3rd .t-podium-block { height: 38px; background: linear-gradient(180deg, #cd7f32, #a0522d); }

.t-res-ranking {
    background: #2c2e31;
    border: 1px solid #3a3c3f;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
    text-align: left;
}
.t-rank-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(58, 60, 63, 0.5);
    transition: background 0.12s;
}
.t-rank-row:last-child { border-bottom: none; }
.t-rank-row:hover { background: rgba(58, 60, 63, 0.4); }
.t-rank-pos {
    width: 28px;
    font-size: 0.85rem;
    font-weight: 700;
    color: #646669;
    text-align: center;
    flex-shrink: 0;
}
.t-rank-pos.gold   { color: #e2b714; }
.t-rank-pos.silver { color: #9e9e9e; }
.t-rank-pos.bronze { color: #cd7f32; }
.t-rank-name {
    flex: 1;
    color: #d1d0c5;
    font-size: 0.88rem;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.t-rank-wpm {
    font-size: 0.88rem;
    font-weight: 700;
    color: #e2b714;
    flex-shrink: 0;
}
.t-rank-acc {
    font-size: 0.78rem;
    color: #646669;
    flex-shrink: 0;
    min-width: 44px;
    text-align: right;
}
.t-rank-me { background: rgba(226, 183, 20, 0.06) !important; }

.t-cert-section {
    background: linear-gradient(135deg, rgba(226, 183, 20, 0.08), rgba(226, 183, 20, 0.03));
    border: 1px solid rgba(226, 183, 20, 0.3);
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.t-cert-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #e2b714;
    font-size: 0.88rem;
    font-weight: 500;
}
.btn-t-cert {
    padding: 12px 28px;
    background: #e2b714;
    border: none;
    border-radius: 8px;
    color: #1a1b1e;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.15s, transform 0.1s;
}
.btn-t-cert:hover { background: #d4a512; transform: translateY(-1px); }

/* ─── Friends System ────────────────────────────────────────── */

.friends-section {
    margin-top: 24px;
    width: 100%;
    max-width: 460px;
    margin-left: auto;
    margin-right: auto;
    text-align: left;
}

.friends-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    background: linear-gradient(135deg, #2c2e31, #323437);
    border: 1px solid #3a3c3f;
    border-radius: 10px;
    color: #d1d0c5;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.friends-header:hover {
    border-color: rgba(226, 183, 20, 0.35);
    box-shadow: 0 0 14px rgba(226, 183, 20, 0.07);
}
.fh-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.fh-icon {
    width: 30px;
    height: 30px;
    background: rgba(226, 183, 20, 0.12);
    border: 1px solid rgba(226, 183, 20, 0.22);
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #e2b714;
    font-size: 0.8rem;
}
.fh-title {
    font-size: 0.9rem;
    color: #d1d0c5;
    font-weight: 500;
}
.fh-right {
    display: flex;
    align-items: center;
    gap: 8px;
}
.friends-badge {
    background: #ef5350;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    border-radius: 10px;
    padding: 2px 7px;
    min-width: 18px;
    text-align: center;
}
.fh-chevron {
    color: #646669;
    font-size: 0.75rem;
    transition: transform 0.2s;
}

.friends-panel {
    margin-top: 5px;
    background: #2c2e31;
    border: 1px solid #3a3c3f;
    border-radius: 10px;
    overflow: hidden;
}

/* Tabs */
.f-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-bottom: 1px solid #3a3c3f;
}
.f-tab {
    padding: 11px 6px;
    background: none;
    border: none;
    color: #646669;
    font-size: 0.78rem;
    font-family: inherit;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    position: relative;
}
.f-tab span { display: none; }
@media (min-width: 480px) { .f-tab span { display: inline; } }
.f-tab:hover { color: #d1d0c5; background: rgba(58, 60, 63, 0.35); }
.f-tab-active { color: #e2b714 !important; }
.f-tab-active::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 2px;
    background: #e2b714;
    border-radius: 2px 2px 0 0;
}
.f-req-badge {
    background: #ef5350;
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    border-radius: 8px;
    padding: 1px 5px;
    min-width: 15px;
    text-align: center;
    line-height: 1.4;
}

/* Content panes */
.f-content {
    padding: 10px 12px;
    max-height: 260px;
    overflow-y: auto;
}
.f-content::-webkit-scrollbar { width: 3px; }
.f-content::-webkit-scrollbar-track { background: transparent; }
.f-content::-webkit-scrollbar-thumb { background: #3a3c3f; border-radius: 2px; }

.f-list { display: flex; flex-direction: column; gap: 4px; }

.f-empty {
    text-align: center;
    color: #646669;
    font-size: 0.82rem;
    padding: 26px 0 22px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
}
.f-empty > i { font-size: 1.8rem; color: #3a3c3f; }
.f-empty > div { color: #646669; }
.f-empty > small { color: #4a4c4f; font-size: 0.74rem; }

/* User rows */
.f-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    transition: background 0.12s;
}
.f-row:hover { background: rgba(58, 60, 63, 0.45); }

.f-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: #1a1b1e;
    flex-shrink: 0;
    text-transform: uppercase;
}

.f-uname {
    flex: 1;
    color: #d1d0c5;
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    text-align: left;
}

.f-actions { display: flex; gap: 5px; flex-shrink: 0; }

/* Buttons */
.btn-f-challenge {
    padding: 5px 10px;
    background: rgba(226, 183, 20, 0.1);
    border: 1px solid rgba(226, 183, 20, 0.28);
    border-radius: 6px;
    color: #e2b714;
    font-size: 0.74rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: inherit;
    transition: background 0.15s;
}
.btn-f-challenge:hover { background: rgba(226, 183, 20, 0.22); }

.btn-f-remove {
    width: 28px; height: 28px;
    background: transparent;
    border: 1px solid #3a3c3f;
    border-radius: 6px;
    color: #646669;
    font-size: 0.75rem;
    cursor: pointer;
    font-family: inherit;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    display: flex; align-items: center; justify-content: center;
}
.btn-f-remove:hover { color: #ef5350; border-color: rgba(239, 83, 80, 0.3); background: rgba(239, 83, 80, 0.06); }

.btn-f-accept {
    padding: 5px 10px;
    background: rgba(102, 187, 106, 0.1);
    border: 1px solid rgba(102, 187, 106, 0.28);
    border-radius: 6px;
    color: #66bb6a;
    font-size: 0.74rem;
    cursor: pointer;
    display: flex; align-items: center; gap: 4px;
    font-family: inherit;
    transition: background 0.15s;
}
.btn-f-accept:hover { background: rgba(102, 187, 106, 0.22); }

.btn-f-decline {
    width: 28px; height: 28px;
    background: transparent;
    border: 1px solid #3a3c3f;
    border-radius: 6px;
    color: #646669;
    font-size: 0.75rem;
    cursor: pointer;
    font-family: inherit;
    transition: color 0.15s;
    display: flex; align-items: center; justify-content: center;
}
.btn-f-decline:hover { color: #ef5350; }

.btn-f-add {
    padding: 5px 10px;
    background: rgba(79, 195, 247, 0.08);
    border: 1px solid rgba(79, 195, 247, 0.22);
    border-radius: 6px;
    color: #4fc3f7;
    font-size: 0.74rem;
    cursor: pointer;
    display: flex; align-items: center; gap: 4px;
    font-family: inherit;
    transition: background 0.15s;
}
.btn-f-add:hover { background: rgba(79, 195, 247, 0.18); }

.f-status-badge {
    font-size: 0.72rem;
    padding: 4px 8px;
    border-radius: 5px;
    display: flex; align-items: center; gap: 4px;
    white-space: nowrap;
}
.f-status-friend { background: rgba(102, 187, 106, 0.1); color: #66bb6a; }
.f-status-sent { background: rgba(100, 102, 105, 0.18); color: #646669; }

/* Search */
.f-search-box {
    position: relative;
    margin-bottom: 10px;
}
.f-search-box > i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #646669;
    font-size: 0.78rem;
    pointer-events: none;
}
.f-search-box input {
    width: 100%;
    background: #323437;
    border: 1px solid #3a3c3f;
    border-radius: 8px;
    padding: 10px 12px 10px 34px;
    color: #d1d0c5;
    font-family: inherit;
    font-size: 0.85rem;
    transition: border-color 0.15s;
    box-sizing: border-box;
}
.f-search-box input:focus { outline: none; border-color: rgba(226, 183, 20, 0.5); }
.f-search-box input::placeholder { color: #646669; }

.f-hint {
    color: #4a4c4f;
    font-size: 0.75rem;
    padding: 4px 2px;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* ─── Challenge notification ─────────────────────────────────── */

@keyframes challengePulse {
    0%, 100% { border-color: rgba(226, 183, 20, 0.38); box-shadow: none; }
    50% { border-color: rgba(226, 183, 20, 0.65); box-shadow: 0 0 18px rgba(226, 183, 20, 0.1); }
}
.ch-inner {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}
.ch-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 180px;
}
.ch-icon-wrap {
    width: 42px; height: 42px;
    background: rgba(226, 183, 20, 0.14);
    border: 1px solid rgba(226, 183, 20, 0.28);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: #e2b714;
    font-size: 1.15rem;
    flex-shrink: 0;
}
.ch-info { display: flex; flex-direction: column; gap: 2px; }
.ch-title { font-size: 0.86rem; font-weight: 600; color: #e2b714; }
.ch-from { color: #888; font-size: 0.8rem; }
.ch-btns { display: flex; gap: 8px; flex-shrink: 0; }

.btn-ch-accept {
    padding: 8px 16px;
    background: rgba(102, 187, 106, 0.14);
    border: 1px solid rgba(102, 187, 106, 0.38);
    border-radius: 8px;
    color: #66bb6a;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    display: flex; align-items: center; gap: 6px;
    transition: background 0.15s;
}
.btn-ch-accept:hover { background: rgba(102, 187, 106, 0.26); }
.btn-ch-decline {
    padding: 8px 12px;
    background: transparent;
    border: 1px solid #3a3c3f;
    border-radius: 8px;
    color: #646669;
    font-size: 0.8rem;
    cursor: pointer;
    font-family: inherit;
    display: flex; align-items: center; gap: 5px;
    transition: color 0.15s, border-color 0.15s;
}
.btn-ch-decline:hover { color: #ef5350; border-color: rgba(239, 83, 80, 0.3); }

/* ─── Waiting Room ──────────────────────────────────────────── */

.wr-content {
    max-width: 580px;
    margin: 0 auto;
    text-align: center;
}

.wr-room-row {
    display: flex;
    justify-content: center;
    margin-bottom: 28px;
}

.wr-room-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: rgba(226, 183, 20, 0.08);
    border: 1px solid rgba(226, 183, 20, 0.3);
    border-radius: 10px;
    padding: 10px 20px;
}

.wr-room-badge i { color: #646669; }

.wr-room-code {
    font-family: 'Roboto Mono', monospace;
    font-size: 1.5em;
    font-weight: 700;
    color: #e2b714;
    letter-spacing: 5px;
}

.wr-icon-row {
    margin-bottom: 36px;
}

.wr-icon-wrap {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(226, 183, 20, 0.08);
    border: 2px solid rgba(226, 183, 20, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 18px;
    animation: wrPulse 2.5s ease-in-out infinite;
}

.wr-icon-wrap i {
    font-size: 2em;
    color: #e2b714;
}

@keyframes wrPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(226, 183, 20, 0.15); }
    50% { box-shadow: 0 0 0 12px rgba(226, 183, 20, 0); }
}

.wr-icon-row h2 {
    font-size: 1.7em;
    color: #d1d0c5;
    font-weight: 500;
    text-transform: lowercase;
    margin-bottom: 8px;
}

.wr-subtitle {
    font-size: 0.9em;
    color: #646669;
}

/* Waiting room player slots */
.wr-players-grid {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.wr-player-slot {
    flex: 1;
    min-width: 180px;
    max-width: 240px;
    background: #2c2e31;
    border: 2px solid #3a3c3f;
    border-radius: 14px;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    transition: all 0.3s;
    animation: fadeIn 0.3s ease;
}

.wr-player-slot.wr-slot-me {
    border-color: rgba(226, 183, 20, 0.5);
    background: rgba(226, 183, 20, 0.05);
}

.wr-player-slot.wr-slot-empty {
    border-style: dashed;
    opacity: 0.45;
}

.wr-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4em;
    border: 2px solid;
}

.wr-avatar-empty {
    border-color: #3a3c3f !important;
    color: #3a3c3f !important;
    background: rgba(58, 60, 63, 0.3);
}

.wr-player-name {
    font-size: 0.95em;
    font-weight: 600;
    color: #d1d0c5;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
    text-align: center;
}

.wr-name-empty {
    color: #646669 !important;
    font-weight: 400;
    font-style: italic;
}

.wr-ready-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75em;
    color: #4caf50;
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.25);
    border-radius: 20px;
    padding: 4px 12px;
}

.host-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72em;
    color: #e2b714;
    background: rgba(226, 183, 20, 0.12);
    border: 1px solid rgba(226, 183, 20, 0.35);
    border-radius: 20px;
    padding: 3px 9px;
    font-weight: 600;
}

.wr-waiting-dots span {
    animation: dotBlink 1.4s infinite;
    color: #646669;
    font-size: 1.4em;
}
.wr-waiting-dots span:nth-child(2) { animation-delay: 0.2s; }
.wr-waiting-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotBlink {
    0%, 80%, 100% { opacity: 0.15; }
    40% { opacity: 1; }
}

/* Countdown bar */
.wr-countdown {
    margin-bottom: 24px;
    padding: 16px 22px;
    background: rgba(58, 60, 63, 0.2);
    border-radius: 10px;
    border: 1px solid #3a3c3f;
}

.wr-countdown-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.88em;
    color: #646669;
    margin-bottom: 10px;
}

.wr-countdown-label i { color: #e2b714; }

.wr-countdown-sec {
    font-family: 'Roboto Mono', monospace;
    font-weight: 700;
    color: #e2b714;
    min-width: 32px;
}

.wr-progress-track {
    height: 6px;
    background: #3a3c3f;
    border-radius: 3px;
    overflow: hidden;
}

.wr-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #e2b714, #f5c842);
    transition: width 1s linear;
    border-radius: 3px;
}

/* Start race button */
.btn-start-race {
    font-size: 18px !important;
    padding: 18px 52px !important;
    box-shadow: 0 4px 24px rgba(226, 183, 20, 0.35) !important;
    letter-spacing: 0.5px;
}

.btn-start-race:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 8px 32px rgba(226, 183, 20, 0.5) !important;
}

.wr-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 8px;
}

@media (max-width: 600px) {
    .wr-players-grid { flex-direction: column; align-items: center; }
    .wr-player-slot { min-width: 260px; }
}

/* ─── Race Lanes (game screen) ──────────────────────────────── */

.race-lane {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    margin: 8px 0;
    background: #2c2e31;
    border-radius: 10px;
    border: 1px solid #3a3c3f;
    transition: border-color 0.3s, background 0.3s;
    animation: fadeIn 0.3s ease;
}

.race-lane.lane-me {
    border-color: rgba(226, 183, 20, 0.35);
    background: rgba(226, 183, 20, 0.04);
}

.race-lane.lane-finished {
    border-color: var(--lane-color, #e2b714);
    opacity: 0.9;
}

.lane-info {
    flex: 1;
    min-width: 0;
}

.lane-name {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 7px;
    flex-wrap: wrap;
}

.lane-username {
    font-weight: 600;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 130px;
}

.lane-you {
    font-size: 10px;
    background: rgba(226, 183, 20, 0.12);
    color: #e2b714;
    border: 1px solid rgba(226, 183, 20, 0.3);
    border-radius: 4px;
    padding: 1px 6px;
    flex-shrink: 0;
}

.lane-pos-badge {
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.lane-track {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lane-track-bar {
    flex: 1;
    height: 8px;
    background: #3a3c3f;
    border-radius: 4px;
    overflow: visible;
    position: relative;
    min-width: 80px;
}

.lane-fill {
    height: 100%;
    border-radius: 4px;
    position: relative;
    transition: width 0.25s ease;
    min-width: 4px;
}

.lane-cursor-icon {
    position: absolute;
    right: -9px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #323437;
    font-size: 7px;
    flex-shrink: 0;
    transition: right 0.25s ease;
}

.lane-pct {
    font-size: 11px;
    font-weight: 700;
    font-family: 'Roboto Mono', monospace;
    min-width: 32px;
    text-align: right;
    flex-shrink: 0;
}

.lane-stats {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.lane-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 44px;
    padding: 5px 8px;
    background: rgba(58, 60, 63, 0.4);
    border-radius: 6px;
}

.lane-stat-val {
    font-size: 14px;
    font-weight: 700;
    color: #d1d0c5;
    font-family: 'Roboto Mono', monospace;
    line-height: 1.2;
}

.lane-stat-lbl {
    font-size: 9px;
    color: #646669;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Opponent cursor marker in the text display */
.char.opp-cursor {
    border-bottom: 2.5px solid var(--opp-color, #4fc3f7);
    position: relative;
}

.char.opp-cursor::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2.5px;
    height: 100%;
    background: var(--opp-color, #4fc3f7);
    opacity: 0.4;
    pointer-events: none;
}

@media (max-width: 768px) {
    .race-lane { flex-wrap: wrap; }
    .lane-stats { width: 100%; justify-content: flex-end; }
    .lane-track-bar { min-width: 60px; }
}
