:root {
    --purple-color: #a855f7;
    --purple-glow: rgba(168, 85, 247, 0.6);
    --yellow-color: #fbbf24;
    --yellow-glow: rgba(251, 191, 36, 0.6);
    --red-color: #ef4444;
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: rgba(20, 20, 30, 0.8);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.6);
    --accent-gradient: linear-gradient(135deg, var(--purple-color), var(--yellow-color));
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
   
    min-height: 100vh;
    background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-primary);
    overflow: hidden;
}



/* Animated background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(168, 85, 247, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(251, 191, 36, 0.08) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.game-wrapper {
    position: relative;
    width: 92%;
    max-width: 480px;
    padding-top: 60px;
    z-index: 1;
    margin: 0 auto;
}

.timer-container {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.timer {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--text-primary);
    padding: 10px 18px;
    border-radius: 12px;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 0.5px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.timer span {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.best-score {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid var(--border-color);
}

.best-score span {
    color: var(--yellow-color);
    font-weight: 600;
}

.game-container {
    position: relative;
    width: 100%;
    height: 75vh;
    max-height: 700px;
    background: linear-gradient(180deg, #08080c 0%, #0d0d14 50%, #08080c 100%);
    border-radius: 24px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.05),
        0 20px 50px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);

    @media (max-width: 768px) {
        height: 65vh;
        max-height: 550px;
        border-radius: 20px;
    }
}

#gameCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

.controls-outer {
    position: fixed;
    bottom: 24px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    z-index: 100;
    padding: 0 16px;
}

.thread-controls {
    display: flex;
    justify-content: center;
    margin-top: 0;
}

.control-columns {
    display: flex;
    justify-content: center;
    width: 100%;
    max-width: 420px;
    gap: 40px;

    @media (max-width: 768px) {
        gap: 24px;
    }
}

.purple-controls, .yellow-controls {
    display: flex;
    flex-direction: row;
    gap: 12px;
}

.purple-btn, .yellow-btn {
    padding: 0;
    border: none;
    border-radius: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 24px;
    width: 64px;
    height: 64px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);

    @media (max-width: 768px) {
        width: 56px;
        height: 56px;
        font-size: 20px;
        border-radius: 14px;
    }
}

.purple-btn {
    color: var(--purple-color);
}

.purple-btn:hover {
    background: rgba(168, 85, 247, 0.15);
    border-color: var(--purple-color);
    box-shadow: 0 0 25px var(--purple-glow);
    transform: translateY(-2px);
}

.purple-btn:active {
    transform: translateY(1px) scale(0.98);
    box-shadow: 0 0 15px var(--purple-glow);
}

.yellow-btn {
    color: var(--yellow-color);
}

.yellow-btn:hover {
    background: rgba(251, 191, 36, 0.15);
    border-color: var(--yellow-color);
    box-shadow: 0 0 25px var(--yellow-glow);
    transform: translateY(-2px);
}

.yellow-btn:active {
    transform: translateY(1px) scale(0.98);
    box-shadow: 0 0 15px var(--yellow-glow);
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 5, 10, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: linear-gradient(180deg, rgba(25, 25, 35, 0.95) 0%, rgba(15, 15, 22, 0.95) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 36px;
    border-radius: 28px;
    text-align: center;
    max-width: 400px;
    width: 100%;
    border: 1px solid var(--border-color);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.05),
        0 25px 60px rgba(0, 0, 0, 0.5);
}

.modal-content h2 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 12px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.modal-content p {
    margin-bottom: 16px;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-secondary);
}

.instructions {
    background: rgba(0, 0, 0, 0.3);
    padding: 20px;
    border-radius: 16px;
    margin: 24px 0;
    text-align: left;
    border: 1px solid var(--border-color);
}

.instructions p {
    margin-bottom: 12px;
    font-size: 14px;
    color: var(--text-secondary);
}

.instructions p:last-child {
    margin-bottom: 0;
}

.purple-text {
    color: var(--purple-color);
    font-weight: 600;
}

.yellow-text {
    color: var(--yellow-color);
    font-weight: 600;
}

.red-text {
    color: var(--red-color);
    font-weight: 600;
}

.start-btn, .restart-btn {
    padding: 14px 36px;
    color: white;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.3px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 8px;
}

.start-btn {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    box-shadow: 0 4px 20px rgba(34, 197, 94, 0.3);
}

.start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(34, 197, 94, 0.4);
}

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

.restart-btn {
    background: linear-gradient(135deg, var(--purple-color) 0%, #7c3aed 100%);
    box-shadow: 0 4px 20px rgba(168, 85, 247, 0.3);
}

.restart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(168, 85, 247, 0.4);
}

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

.final-score {
    font-size: 36px;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: block;
    margin: 8px 0;
}

.score-display {
    background: rgba(0, 0, 0, 0.3);
    padding: 20px;
    border-radius: 16px;
    margin: 24px 0;
    border: 1px solid var(--border-color);
}

.score-display p {
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.score-display p:last-child {
    margin-bottom: 0;
}

/* Animations */
@keyframes pulse-glow {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}
