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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #020617 0%, #1e1b4b 50%, #0f172a 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

.game-wrapper {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid #1e293b;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.1), 0 8px 32px rgba(0, 0, 0, 0.4);
}

canvas {
    display: block;
}

/* Overlays */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    z-index: 10;
    animation: fadeIn 0.5s ease-out;
}

.overlay.hidden {
    display: none;
}

.overlay-start {
    background: rgba(2, 6, 23, 0.95);
    backdrop-filter: blur(12px);
}

.overlay-gameover {
    background: rgba(2, 6, 23, 0.95);
    backdrop-filter: blur(12px);
}

.overlay-victory {
    background: linear-gradient(135deg, rgba(69, 26, 3, 0.95), rgba(5, 46, 22, 0.95), rgba(6, 78, 59, 0.95));
    backdrop-filter: blur(12px);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulseSubtle {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.game-title {
    font-size: 72px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.02em;
    margin-bottom: 16px;
}

.title-line {
    height: 4px;
    width: 128px;
    margin: 0 auto 48px;
    background: linear-gradient(to right, #22d3ee, #a855f7);
    border-radius: 4px;
}

.btn-play {
    background: linear-gradient(to right, #06b6d4, #2563eb);
    color: #fff;
    border: 1px solid rgba(34, 211, 238, 0.3);
    padding: 20px 48px;
    border-radius: 12px;
    font-family: 'Inter', sans-serif;
    font-size: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(6, 182, 212, 0.3);
}

.btn-play:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(6, 182, 212, 0.5);
}

/* Game Over */
.go-emoji {
    font-size: 64px;
    margin-bottom: 16px;
}

.go-title {
    font-size: 40px;
    font-weight: 700;
    color: #f87171;
    margin-bottom: 8px;
}

.go-line {
    height: 4px;
    width: 128px;
    margin: 0 auto 32px;
    background: linear-gradient(to right, #f87171, #ec4899);
    border-radius: 4px;
}

.score-box {
    background: rgba(15, 23, 42, 0.5);
    padding: 24px 40px;
    border-radius: 16px;
    border: 1px solid #1e293b;
    margin-bottom: 24px;
}

.score-label {
    font-size: 11px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 8px;
}

.score-value {
    font-size: 56px;
    font-weight: 700;
    background: linear-gradient(to right, #22d3ee, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.new-record {
    background: linear-gradient(to right, rgba(234, 179, 8, 0.2), rgba(249, 115, 22, 0.2));
    border: 1px solid rgba(234, 179, 8, 0.3);
    padding: 12px 24px;
    border-radius: 8px;
    margin-bottom: 24px;
    display: none;
}

.new-record.show {
    display: block;
}

.new-record span {
    color: #fbbf24;
    font-weight: 600;
    font-size: 16px;
}

/* Victory */
.victory-trophy {
    font-size: 80px;
    animation: pulseSubtle 3s ease-in-out infinite;
    margin-bottom: 16px;
}

.victory-title {
    font-size: 56px;
    font-weight: 800;
    background: linear-gradient(to right, #fde047, #facc15, #eab308);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.victory-line {
    height: 4px;
    width: 192px;
    margin: 0 auto 12px;
    background: linear-gradient(to right, #facc15, #4ade80, #34d399);
    border-radius: 4px;
}

.victory-subtitle {
    color: #86efac;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 32px;
}

.victory-box {
    background: rgba(15, 23, 42, 0.5);
    padding: 32px;
    border-radius: 16px;
    border: 2px solid rgba(234, 179, 8, 0.5);
    margin-bottom: 24px;
}

.victory-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 16px;
}

.stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 8px;
}

.stat-label-yellow { color: #fde047; }
.stat-label-green { color: #86efac; }

.stat-value-yellow {
    font-size: 48px;
    font-weight: 700;
    background: linear-gradient(to right, #fde047, #eab308);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-value-green {
    font-size: 48px;
    font-weight: 700;
    background: linear-gradient(to right, #86efac, #10b981);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.perfect-badge {
    background: linear-gradient(to right, rgba(234, 179, 8, 0.2), rgba(34, 197, 94, 0.2));
    border: 1px solid rgba(234, 179, 8, 0.4);
    padding: 16px 24px;
    border-radius: 8px;
}

.perfect-badge span {
    color: #fef9c3;
    font-weight: 600;
    font-size: 18px;
}

.btn-victory {
    background: linear-gradient(to right, #eab308, #22c55e, #10b981);
    color: #0f172a;
    border: 2px solid #facc15;
    padding: 20px 48px;
    border-radius: 12px;
    font-family: 'Inter', sans-serif;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 8px 25px rgba(234, 179, 8, 0.3);
    margin-bottom: 16px;
}

.btn-victory:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 35px rgba(234, 179, 8, 0.5);
}

.victory-footer {
    font-size: 14px;
    color: #bbf7d0;
    opacity: 0.8;
}

/* Back button */
.btn-back {
    position: fixed;
    top: 20px;
    left: 20px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid #334155;
    color: #94a3b8;
    padding: 10px 18px;
    border-radius: 10px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    z-index: 50;
    backdrop-filter: blur(8px);
}

.btn-back:hover {
    background: rgba(30, 41, 59, 0.9);
    color: #e2e8f0;
    border-color: #475569;
}

/* Responsive */
@media (max-width: 540px) {
    canvas {
        width: 100vw !important;
        height: 100vw !important;
    }

    .game-wrapper {
        border-radius: 0;
        border: none;
    }

    .game-title {
        font-size: 48px;
    }

    .btn-play, .btn-victory {
        padding: 16px 36px;
        font-size: 18px;
    }

    .go-title {
        font-size: 32px;
    }

    .score-value {
        font-size: 40px;
    }

    .victory-title {
        font-size: 40px;
    }

    .stat-value-yellow, .stat-value-green {
        font-size: 36px;
    }

    .btn-back {
        top: 10px;
        left: 10px;
        padding: 8px 14px;
        font-size: 13px;
    }
}
