:root {
    --bg-color: #010a13;
    /* LOL Deep Blue */
    --accent-color: #c89b3c;
    /* LOL Gold */
    --accent-secondary: #005a82;
    /* Hextech Blue */
    --accent-glow: rgba(200, 155, 60, 0.4);
    --text-primary: #f0e6d2;
    /* LOL Ivory */
    --text-secondary: #a09b8c;
    --card-bg: rgba(255, 255, 255, 0.03);
    --font-main: 'Outfit', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: radial-gradient(circle at center, #005a82 0%, #010a13 70%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: var(--font-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
}

#app {
    width: 100%;
    max-width: 450px;
    height: 90vh;
    max-height: 850px;
    position: relative;
    background: rgba(1, 10, 19, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid var(--accent-color);
    border-radius: 20px;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(200, 155, 60, 0.1);
    margin: 20px;
}

@media (max-width: 500px) {
    #app {
        height: 100vh;
        max-height: none;
        width: 100%;
        margin: 0;
        border-radius: 0;
        border: none;
    }
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 100%;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 40px 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.screen.active {
    display: flex;
    opacity: 1;
}

/* Typography */
h1 {
    font-size: clamp(3rem, 12vw, 4.5rem);
    font-weight: 900;
    letter-spacing: 4px;
    margin-bottom: 5px;
    text-shadow: 0 0 20px var(--accent-glow);
    color: var(--accent-color);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 30px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Buttons */
.main-btn {
    background: var(--text-primary);
    color: var(--bg-color);
    border: none;
    padding: 20px 60px;
    font-size: 1.5rem;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    width: 100%;
    max-width: 300px;
    margin-bottom: 30px;
}

.main-btn:active {
    transform: scale(0.95);
}

.secondary-btn {
    background: transparent;
    color: var(--accent-color);
    border: 2px solid var(--accent-color);
    padding: 12px 30px;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 12px;
    cursor: pointer;
    margin-top: 15px;
}

/* Leaderboard Preview */
.leaderboard-preview {
    background: var(--card-bg);
    width: 100%;
    border-radius: 20px;
    padding: 20px;
    flex-grow: 1;
    margin-bottom: 30px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
}

.lb-header {
    display: flex;
    justify-content: space-between;
    padding: 0 0 10px 0;
    border-bottom: 2px solid var(--accent-color);
    margin-bottom: 10px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 1px;
}

.lb-header span:nth-child(2),
.lb-header span:nth-child(3) {
    width: 80px;
    text-align: right;
}

.lb-header span:nth-child(1) {
    flex-grow: 1;
}

.leaderboard-preview h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 15px;
    text-align: center;
}

#top-10-list {
    list-style: none;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.rank {
    color: var(--accent-color);
    font-weight: 700;
    width: 25px;
    font-size: 0.8rem;
}

.name {
    flex-grow: 1;
    font-weight: 700;
    font-size: 0.95rem;
}

.cps-stat {
    width: 80px;
    text-align: right;
    font-size: 0.85rem;
    color: var(--accent-secondary);
    font-weight: 700;
}

.score {
    width: 80px;
    text-align: right;
    font-weight: 700;
    color: var(--text-primary);
}

/* Game Screen */
.stats-header {
    display: flex;
    justify-content: space-around;
    width: 100%;
}

.stat-box {
    text-align: center;
}

.stat-box .label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    letter-spacing: 1px;
}

.stat-box .value {
    font-size: 2.5rem;
    font-weight: 700;
}

.tap-area {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.tap-trigger {
    width: 250px;
    height: 250px;
    border-radius: 50%;
    border: 8px solid var(--text-primary);
    background: transparent;
    color: var(--text-primary);
    font-size: 2.5rem;
    font-weight: 900;
    cursor: pointer;
    transition: transform 0.05s;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.1);
}

.tap-trigger:active {
    transform: scale(0.92);
    background: var(--text-primary);
    color: var(--bg-color);
}

/* Result Card */
.result-card {
    background: var(--card-bg);
    width: 100%;
    border-radius: 30px;
    padding: 30px 20px 20px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Removed duplicate .final-score */

#result-taps {
    font-size: 5rem;
    font-weight: 900;
}

.unit {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-left: 10px;
}

.rank-badge {
    display: inline-block;
    padding: 8px 20px;
    background: var(--accent-color);
    color: var(--bg-color);
    font-weight: 900;
    border-radius: 8px;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.rank-desc {
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.global-rank-pos {
    background: rgba(200, 155, 60, 0.1);
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    padding: 8px 15px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.champ-rank-bg {
    background: rgba(200, 155, 60, 0.2);
    border: 2px solid var(--accent-color);
    box-shadow: 0 0 15px rgba(200, 155, 60, 0.2);
    margin-bottom: 25px;
}

.result-leaderboard {
    max-height: 200px;
    margin-bottom: 20px;
}

.final-score {
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.final-score .unit.small {
    font-size: 0.9rem;
}

.cps-row {
    color: var(--accent-secondary);
    font-weight: 700;
    font-size: 1.5rem;
}

.leaderboard-item .cps-stat {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-right: 15px;
}

#save-score-section {
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
}

#nickname {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    text-align: center;
    outline: none;
}

#nickname:focus {
    border-color: var(--accent-color);
}

/* Animations */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 var(--accent-glow);
    }

    70% {
        box-shadow: 0 0 0 20px rgba(0, 242, 255, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(0, 242, 255, 0);
    }
}

.tap-trigger.ready {
    animation: pulse 2s infinite;
    border-color: var(--accent-color);
    color: var(--accent-color);
}