*, *::before, *::after { 
    box-sizing: border-box; 
}

body {
    background: #020617;
    color: #fff;
    font-family: 'Inter', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
    text-align: center;
    overflow: hidden;
    user-select: none;
}

#particles { 
    position: fixed; 
    inset: 0; 
    z-index: 0; 
    pointer-events: none; 
}

.bg-glow { 
    position: fixed; 
    inset: 0; 
    background: radial-gradient(ellipse 80% 60% at 50% 40%, rgba(30, 58, 138, 0.27) 0%, transparent 70%); 
    z-index: 0; 
    pointer-events: none; 
}

.back-home { 
    position: fixed; 
    top: 20px; 
    left: 24px; 
    font-size: 0.85rem; 
    color: #475569; 
    text-decoration: none; 
    transition: color 0.2s; 
    z-index: 10; 
}

.back-home:hover { 
    color: #fff; 
}

.container {
    position: relative; 
    z-index: 1;
    display: flex; 
    flex-direction: column; 
    align-items: center;
    padding: 40px 24px; 
    max-width: 640px; 
    width: 100%;
}

h1 { 
    font-family: 'Syne', sans-serif; 
    font-size: clamp(2rem, 8vw, 3rem); 
    font-weight: 900; 
    margin: 0 0 6px; 
    letter-spacing: -2px; 
}

.subtitle { 
    font-size: 0.95rem; 
    color: #64748b; 
    margin-bottom: 40px; 
}

/* Big Timer */
.timer-display {
    font-family: 'Syne', sans-serif;
    font-size: clamp(4.5rem, 18vw, 8rem);
    font-weight: 900;
    line-height: 1;
    margin-bottom: 10px;
    transition: color 0.3s ease;
    color: #f8fafc;
    letter-spacing: -4px;
}

.timer-display.holding { 
    color: #60a5fa; 
}

.timer-display.new-best { 
    color: #10b981; 
}

.timer-label { 
    font-size: 0.8rem; 
    color: #475569; 
    text-transform: uppercase; 
    letter-spacing: 2px; 
    margin-bottom: 40px; 
}

/* Key Visual */
.key-visual {
    width: 220px; 
    height: 64px;
    background: rgba(30, 58, 138, 0.3);
    border: 2px solid rgba(96, 165, 250, 0.3);
    border-radius: 12px;
    display: flex; 
    align-items: center; 
    justify-content: center;
    font-family: 'Syne', sans-serif; 
    font-size: 1rem; 
    font-weight: 700;
    color: #64748b;
    transition: all 0.1s ease;
    margin-bottom: 40px;
    position: relative;
    overflow: hidden;
}

.key-visual.pressed {
    background: rgba(37, 99, 235, 0.4);
    border-color: #60a5fa;
    color: #fff;
    box-shadow: 0 0 30px rgba(96, 165, 250, 0.25);
    transform: translateY(2px);
}

.key-fill {
    position: absolute; 
    inset: 0;
    background: rgba(96, 165, 250, 0.1);
    transform: scaleX(0); 
    transform-origin: left;
    transition: transform 0.1s linear;
}

.key-label { 
    position: relative; 
    z-index: 1; 
}

/* Status Message */
.status { 
    font-size: 1rem; 
    color: #64748b; 
    min-height: 24px; 
    margin-bottom: 36px; 
    transition: color 0.3s; 
}

.status.good { 
    color: #10b981; 
}

.status.fail { 
    color: #f87171; 
}

/* Leaderboard */
.leaderboard {
    width: 100%;
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid rgba(51, 65, 85, 0.7);
    border-radius: 18px;
    padding: 22px 24px;
    backdrop-filter: blur(14px);
}

.lb-title {
    font-family: 'Syne', sans-serif;
    font-size: 0.85rem; 
    font-weight: 700;
    text-transform: uppercase; 
    letter-spacing: 2px;
    color: #94a3b8; 
    margin-bottom: 16px;
}

.lb-row {
    display: flex; 
    align-items: center; 
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(51, 65, 85, 0.4);
    font-size: 0.9rem;
}

.lb-row:last-child { 
    border-bottom: none; 
}

.lb-rank { 
    font-family: 'Syne', sans-serif; 
    font-weight: 700; 
    color: #475569; 
    min-width: 24px; 
}

.lb-rank.gold { color: #fbbf24; }
.lb-rank.silver { color: #94a3b8; }
.lb-rank.bronze { color: #b45309; }

.lb-name { 
    flex: 1; 
    text-align: left; 
    color: #cbd5e1; 
}

.lb-time { 
    font-family: 'Syne', sans-serif; 
    font-weight: 700; 
    color: #60a5fa; 
}

.lb-empty { 
    color: #334155; 
    font-size: 0.85rem; 
    padding: 12px 0; 
}

/* Name Input Modal */
.modal-bg {
    position: fixed; 
    inset: 0;
    background: rgba(2, 6, 23, 0.85);
    display: flex; 
    align-items: center; 
    justify-content: center;
    z-index: 100; 
    opacity: 0; 
    pointer-events: none;
    transition: opacity 0.3s;
    backdrop-filter: blur(6px);
}

.modal-bg.show { 
    opacity: 1; 
    pointer-events: all; 
}

.modal {
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(96, 165, 250, 0.3);
    border-radius: 20px;
    padding: 32px 36px;
    max-width: 360px; 
    width: 90%;
    text-align: center;
}

.modal h2 { 
    font-family: 'Syne', sans-serif; 
    font-size: 1.5rem; 
    font-weight: 900; 
    margin: 0 0 6px; 
}

.modal p { 
    color: #64748b; 
    font-size: 0.9rem; 
    margin: 0 0 20px; 
}

.modal input {
    width: 100%; 
    padding: 12px 16px;
    background: rgba(30, 58, 138, 0.3);
    border: 1px solid rgba(96, 165, 250, 0.3);
    border-radius: 10px; 
    color: #fff;
    font-family: 'Inter', sans-serif; 
    font-size: 1rem;
    outline: none; 
    margin-bottom: 14px;
    transition: border-color 0.2s;
}

.modal input:focus { 
    border-color: #60a5fa; 
}

.modal button {
    width: 100%; 
    padding: 12px;
    background: rgba(37, 99, 235, 0.35);
    border: 1.5px solid rgba(96, 165, 250, 0.45);
    border-radius: 10px; 
    color: #fff;
    font-family: 'Syne', sans-serif; 
    font-size: 1rem; 
    font-weight: 700;
    cursor: pointer; 
    transition: background 0.2s, transform 0.1s;
}

.modal button:hover { 
    background: rgba(37, 99, 235, 0.55); 
}

.modal button:active { 
    transform: scale(0.98); 
}

/* Mobile Tap Zone */
.tap-hint { 
    display: none; 
    font-size: 0.8rem; 
    color: #334155; 
    margin-top: -28px; 
    margin-bottom: 28px; 
}

@media (hover: none) { 
    .tap-hint { 
        display: block; 
    } 
}
