:root {
    --purple-color: #de4ca2;
    --purple-glow: rgba(222, 76, 162, 0.65);
    --yellow-color: #ff8fab;
    --yellow-glow: rgba(255, 143, 171, 0.65);
    --red-color: #ff3f66;
    --bg-primary: #1b0a14;
    --bg-secondary: #2a1020;
    --bg-card: rgba(39, 16, 31, 0.82);
    --border-color: rgba(255, 184, 206, 0.22);
    --text-primary: #ffeef5;
    --text-secondary: rgba(255, 219, 234, 0.72);
    --accent-gradient: linear-gradient(135deg, #ff5d8f, #ff8fab);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
   
    min-height: 100vh;
    background: radial-gradient(120% 140% at 50% 0%, #3d1428 0%, var(--bg-secondary) 45%, var(--bg-primary) 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 18% 18%, rgba(255, 125, 170, 0.18) 0%, transparent 55%),
        radial-gradient(ellipse at 80% 86%, rgba(226, 76, 134, 0.14) 0%, transparent 55%),
        radial-gradient(ellipse at 50% 50%, rgba(255, 255, 255, 0.03) 0%, transparent 65%);
    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(255, 77, 132, 0.18);
}

.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: #ffb2c8;
    font-weight: 600;
}

.game-container {
    position: relative;
    width: 100%;
    height: 75vh;
    max-height: 700px;
    background: linear-gradient(180deg, #220d1a 0%, #2c1222 50%, #1c0c15 100%);
    border-radius: 24px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow:
        0 0 0 1px rgba(255, 209, 225, 0.12),
        0 20px 50px rgba(30, 7, 20, 0.7),
        inset 0 1px 0 rgba(255, 209, 225, 0.08);

    @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: 20px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 32px;
    width: 80px;
    height: 80px;
    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: 70px;
        height: 70px;
        font-size: 28px;
        border-radius: 16px;
    }
}

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

.purple-btn:hover {
    background: rgba(222, 76, 162, 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(255, 143, 171, 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(20, 7, 14, 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(57, 22, 39, 0.96) 0%, rgba(30, 11, 22, 0.96) 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, 214, 229, 0.12),
        0 25px 60px rgba(25, 6, 17, 0.7);
}

.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(255, 156, 191, 0.08);
    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;
}

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

.pink-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, #ff5c8d 0%, #ef3f79 100%);
    box-shadow: 0 4px 20px rgba(239, 63, 121, 0.35);
}

.start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(239, 63, 121, 0.45);
}

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

.restart-btn {
    background: linear-gradient(135deg, #ff84a7 0%, #de4ca2 100%);
    box-shadow: 0 4px 20px rgba(222, 76, 162, 0.35);
}

.restart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(222, 76, 162, 0.45);
}

.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(255, 156, 191, 0.08);
    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); }
}
