.rankings-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: calc(100vh - 100px);
    padding: 120px 5% 2rem 5%;
}

.rankings-page-title {
    font-family: 'Chalkduster', 'Schoolbell', 'Comic Sans MS', cursive, sans-serif;
    font-size: 3rem;
    font-weight: bold;
    color: #F4E04D;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: 2rem;
    text-align: center;
}

.table-container {
    width: 100%;
    max-width: 1000px;
    overflow-x: auto;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
}

.rankings-table {
    width: 100%;
    border-collapse: collapse;
    color: #FFFFFF;
    font-family: 'Helvetica Neue', Arial, sans-serif;
}

.rankings-table thead th {
    background: rgba(255, 140, 0, 0.3);
    color: #FF8C00;
    font-size: 1.1rem;
    font-weight: bold;
    padding: 1rem;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.1rem;
    border-bottom: 2px solid rgba(255, 140, 0, 0.5);
}

.rankings-table tbody tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: background 0.2s;
}

.rankings-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

.rankings-table tbody tr:nth-child(1) {
    background: rgba(255, 215, 0, 0.15);
}

.rankings-table tbody tr:nth-child(2) {
    background: rgba(192, 192, 192, 0.15);
}

.rankings-table tbody tr:nth-child(3) {
    background: rgba(205, 127, 50, 0.15);
}

.rankings-table tbody td {
    padding: 1rem;
    font-size: 1rem;
}

.rankings-table tbody td:first-child {
    font-weight: bold;
    color: #FF8C00;
    font-size: 1.2rem;
}

.rankings-table tbody td:nth-child(2),
.rankings-table tbody td:nth-child(3) {
    font-weight: bold;
    font-size: 1.1rem;
}

.loading {
    text-align: center;
    padding: 2rem !important;
    color: rgba(255, 255, 255, 0.7);
    font-style: italic;
}

.username-section-inline {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.5rem 0;
}

.username-label {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.9);
}

.inline-name {
    margin: 0;
    padding: 0.5rem 0;
    font-size: 1.1rem;
    font-weight: 700;
}

.username-input-row {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    align-items: center;
}

.leaderboard-display {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    font-size: 1rem;
    padding: 0.5rem 0.25rem;
    border: none;
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
    background: transparent;
    color: #FFFFFF;
    border-radius: 8px;
    flex: 1;
    max-width: 250px;
    transition: border-color 0.2s, background 0.2s;
    cursor: pointer;
    text-align: left;
}

.leaderboard-display.is-placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.leaderboard-display:focus {
    outline: none;
    border-color: #6366f1;
}

.username-btn {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    font-size: 1rem;
    font-weight: bold;
    color: #FFFFFF;
    background: rgba(99, 102, 241, 0.8);
    border: none;
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    border-radius: 8px;
    transition: transform 0.2s, background 0.2s, opacity 0.2s;
}

.username-btn:hover:not(:disabled) {
    transform: scale(1.05);
    background: rgba(99, 102, 241, 1);
}

.username-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.username-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.username-btn.highlight-pulse {
    animation: pulse-glow 2s ease-in-out infinite;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.8);
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(99, 102, 241, 0.8), 0 0 40px rgba(99, 102, 241, 0.4);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 30px rgba(99, 102, 241, 1), 0 0 60px rgba(99, 102, 241, 0.6);
        transform: scale(1.02);
    }
}

.custom-keyboard {
    margin-top: 0.75rem;
    display: flex;
    justify-content: center;
}

.custom-keyboard-inner {
    width: 100%;
    max-width: 520px;
    background: #0b1120;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.custom-keyboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.custom-keyboard-title {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    color: #FFFFFF;
    font-size: 0.95rem;
    letter-spacing: 0.03em;
}

.custom-keyboard-keys {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.5rem;
}

.custom-keyboard-key {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #FFFFFF;
    border-radius: 8px;
    padding: 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    font-family: 'Helvetica Neue', Arial, sans-serif;
}

.custom-keyboard-key:hover {
    background: rgba(255, 255, 255, 0.15);
}

.custom-keyboard-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.custom-keyboard-action {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #FFFFFF;
    border-radius: 8px;
    padding: 0.65rem 0.75rem;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: 'Helvetica Neue', Arial, sans-serif;
}

.custom-keyboard-action.primary {
    background: rgba(99, 102, 241, 0.9);
    border-color: rgba(99, 102, 241, 0.8);
}

.custom-keyboard-action:hover {
    background: rgba(255, 255, 255, 0.15);
}

.custom-keyboard-action.primary:hover {
    background: rgba(99, 102, 241, 1);
}

@media (max-width: 768px) {
    .rankings-page-title {
        font-size: 2.25rem;
    }

    .table-container {
        padding: 1rem;
    }

    .rankings-table thead th {
        font-size: 0.9rem;
        padding: 0.75rem 0.5rem;
    }

    .rankings-table tbody td {
        font-size: 0.9rem;
        padding: 0.75rem 0.5rem;
    }

    .rankings-table tbody td:first-child {
        font-size: 1rem;
    }

    .rankings-table tbody td:nth-child(2),
    .rankings-table tbody td:nth-child(3) {
        font-size: 1rem;
    }

}

@media (max-width: 480px) {
    .custom-keyboard-keys {
        grid-template-columns: repeat(5, 1fr);
    }

    .rankings-page-title {
        font-size: 1.75rem;
    }

    .rankings-table thead th {
        font-size: 0.75rem;
        padding: 0.5rem 0.25rem;
    }

    .rankings-table tbody td {
        font-size: 0.75rem;
        padding: 0.5rem 0.25rem;
    }

    .rankings-table tbody td:first-child {
        font-size: 0.9rem;
    }

    .rankings-table tbody td:nth-child(2),
    .rankings-table tbody td:nth-child(3) {
        font-size: 0.85rem;
    }
}
