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

body {
    background-color: #000000;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 1080px;
    padding: 40px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#main-header {
    text-align: center;
    margin-bottom: 56px;
    transition: opacity 0.3s ease;
}

#main-header.hidden {
    display: none;
}

.brand-name {
    color: #4ade80;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 12px;
}

header h1 {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

header p {
    font-size: 18px;
    color: #9ca3af;
    font-weight: 400;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    width: 100%;
}

.hidden {
    display: none !important;
}

.card {
    background-color: #1a1a1a;
    border-radius: 16px;
    padding: 32px 28px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    transition: transform 0.2s ease-in-out, background-color 0.2s ease;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.card:hover {
    transform: translateY(-4px);
    background-color: #222222;
}

.card:active {
    transform: translateY(0);
}

.icon-wrapper {
    background-color: #27272a;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 24px;
}

.card h2 {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 16px;
    line-height: 1.2;
}

.card p {
    font-size: 15px;
    color: #9ca3af;
    line-height: 1.6;
    flex-grow: 1;
    /* Help balance button placement */
}

.leaderboard-btn {
    margin-top: 24px;
    padding: 10px 16px;
    background-color: #2a2a2a;
    border: 1px solid #333;
    color: #d4d4d8;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    width: 100%;
    justify-content: center;
}

.leaderboard-btn:hover {
    background-color: #333333;
    color: #4ade80;
    border-color: #4ade80;
    transform: translateY(-2px);
}

.logo-container {
    margin-bottom: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.app-logo {
    width: 120px;
    height: 120px;
    object-fit: contain;
    border-radius: 50%;
    filter: drop-shadow(0 0 10px rgba(74, 222, 128, 0.3));
    animation: pulse-logo 3s infinite ease-in-out;
}

@keyframes pulse-logo {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 10px rgba(74, 222, 128, 0.3)); }
    50% { transform: scale(1.05); filter: drop-shadow(0 0 15px rgba(74, 222, 128, 0.5)); }
}

/* Login Page Styles */
#login-page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(74, 222, 128, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(74, 222, 128, 0.05) 0%, transparent 40%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

#login-page.hidden {
    opacity: 0;
    visibility: hidden;
}

.login-card {
    background: rgba(26, 26, 26, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 48px;
    width: 100%;
    max-width: 440px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.login-card h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.login-card p {
    color: #9ca3af;
    margin-bottom: 32px;
}

.login-card .brand-name {
    margin-bottom: 24px;
}

#login-form {
    text-align: left;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #e5e7eb;
    margin-bottom: 8px;
}

.input-group input {
    width: 100%;
    padding: 12px 16px;
    background: #27272a;
    border: 1px solid #3f3f46;
    border-radius: 10px;
    color: #fff;
    font-family: inherit;
    font-size: 16px;
    outline: none;
    transition: all 0.2s ease;
}

.input-group input:focus {
    border-color: #4ade80;
    box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.2);
}

.login-btn {
    width: 100%;
    padding: 14px;
    background: #4ade80;
    color: #000;
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 12px;
    transition: all 0.2s ease;
}

.login-btn:hover {
    background: #22c55e;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.2);
}

.login-btn:active {
    transform: translateY(0);
}

@media (max-width: 900px) {
    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .cards-grid {
        grid-template-columns: 1fr;
    }

    header h1 {
        font-size: 28px;
    }

    header p {
        font-size: 16px;
    }

    .login-card {
        padding: 32px 24px;
        max-width: 90%;
    }
}

/* We are preserving .custom-modal for the Name Input, but removing the leaderboard-item logic since we are recreating it! */

/* Name Input Modal (kept isolated from other modals) */
.custom-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.custom-modal.visible {
    opacity: 1;
    visibility: visible;
}

.custom-modal-content {
    background: #1c1c1e;
    border-radius: 20px;
    padding: 32px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.custom-modal.visible .custom-modal-content {
    transform: translateY(0);
}

/* Fullscreen Leaderboard UI */
.fullscreen-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #111111;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s;
}

.fullscreen-modal.visible {
    opacity: 1;
    visibility: visible;
}

.leaderboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #222;
}

.back-btn {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 24px;
    cursor: pointer;
}

.leaderboard-header h2 {
    font-size: 20px;
    color: #fff;
    font-weight: 600;
}

.leaderboard-content-wrapper {
    display: flex;
    flex: 1;
    overflow: hidden;
    padding: 32px 40px;
    gap: 40px;
}

.podium-container {
    flex: 1;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 20px;
}

.podium-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.podium-block {
    width: 120px;
    background: #3f3f46;
    border-top: 10px solid #52525b;
    /* faux 3d */
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 20px;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.5);
    position: relative;
}

.podium-rank-2 .podium-block {
    height: 160px;
    background: #3f3f46;
    z-index: 1;
}

.podium-rank-1 .podium-block {
    height: 220px;
    background: #4b4b53;
    border-top-color: #60606b;
    z-index: 2;
    transform: translateZ(10px);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.7);
}

.podium-rank-3 .podium-block {
    height: 120px;
    background: #333338;
    border-top-color: #44444a;
    z-index: 0;
}

.podium-avatar {
    margin-bottom: -15px;
    /* Pull into block */
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 5;
    position: relative;
}

.podium-ring {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 8px;
    position: relative;
    background: #111;
}

.rank-1-ring {
    border-color: #fbbf24;
    width: 100px;
    height: 100px;
}

.rank-2-ring {
    border-color: #cbd5e1;
}

.rank-3-ring {
    border-color: #b45309;
}

.podium-badge {
    position: absolute;
    bottom: -10px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    color: #fff;
    font-size: 12px;
}

.badge-1 {
    background: #fbbf24;
    color: #000;
}

.badge-2 {
    background: #cbd5e1;
    color: #000;
}

.badge-3 {
    background: #b45309;
    color: #fff;
}

.podium-name {
    color: #fff;
    font-weight: 500;
    font-size: 14px;
    text-align: center;
    max-width: 100px;
    word-break: break-all;
    margin-bottom: 20px;
}

.podium-score {
    font-size: 28px;
    color: #fff;
    font-weight: bold;
}

.podium-label {
    font-size: 14px;
    color: #9ca3af;
    margin-top: 4px;
}

.list-container {
    flex: 1;
    overflow-y: auto;
    padding-right: 12px;
}

.list-item {
    background: #27272a;
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.list-rank-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 600;
    font-size: 14px;
    margin-right: 16px;
    color: #fff;
    background: #3f3f46;
}

.list-rank-1 {
    background: #fbbf24;
    color: #000;
}

.list-rank-2 {
    background: #cbd5e1;
    color: #000;
}

.list-rank-3 {
    background: #b45309;
    color: #fff;
}

.list-info {
    flex: 1;
}

.list-name {
    font-size: 16px;
    color: #fff;
    font-weight: 500;
}

.list-date {
    font-size: 13px;
    color: #9ca3af;
    margin-top: 2px;
}

.list-score-area {
    text-align: right;
}

.list-score {
    font-size: 18px;
    color: #fff;
    font-weight: 600;
}

.list-accuracy {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 2px;
}

.leaderboard-footer {
    padding: 24px;
    display: flex;
    justify-content: center;
    border-top: 1px solid #222;
}

.kinestex-btn-green {
    background: #15803d;
    color: #fff;
    font-weight: 600;
    padding: 14px 40px;
    border-radius: 8px;
    border: none;
    font-size: 16px;
    cursor: pointer;
    min-width: 300px;
    transition: background 0.2s;
}

.kinestex-btn-green:hover {
    background: #166534;
}

@media (max-width: 900px) {
    .leaderboard-content-wrapper {
        flex-direction: column;
        overflow-y: auto;
    }

    .podium-container {
        min-height: 400px;
        flex: none;
    }

    .list-container {
        flex: none;
        overflow-y: visible;
    }
}