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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.game-container {
    width: 100%;
    max-width: 600px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.score-panel {
    display: flex;
    gap: 30px;
}

.score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.score-item .label {
    font-size: 14px;
    color: #a0a0a0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.score-item .value {
    font-size: 28px;
    font-weight: bold;
    color: #00ff88;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

.controls {
    display: flex;
    gap: 10px;
}

.btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.btn.primary {
    background: linear-gradient(135deg, #00ff88, #00cc6a);
    color: #1a1a2e;
}

.btn.primary:hover {
    background: linear-gradient(135deg, #00cc6a, #00ff88);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 255, 136, 0.4);
}

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

.btn.shop-btn, .btn.music-btn {
    font-size: 18px;
    padding: 8px 14px;
}

.canvas-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    background: #0a0a1a;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.5);
}

#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s ease;
    z-index: 100;
}

.overlay.hidden {
    display: none;
}

.overlay h1 {
    font-size: 48px;
    color: #00ff88;
    margin-bottom: 30px;
    text-shadow: 0 0 20px rgba(0, 255, 136, 0.7);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        text-shadow: 0 0 20px rgba(0, 255, 136, 0.7);
    }
    50% {
        text-shadow: 0 0 40px rgba(0, 255, 136, 1);
    }
}

.result {
    display: flex;
    gap: 40px;
    margin-bottom: 30px;
}

.final-score, .final-level {
    text-align: center;
}

.final-score .label, .final-level .label {
    display: block;
    font-size: 14px;
    color: #a0a0a0;
    margin-bottom: 8px;
}

.final-score .value, .final-level .value {
    font-size: 36px;
    font-weight: bold;
    color: #00ff88;
}

.footer {
    text-align: center;
    margin-top: 20px;
}

.footer p {
    color: #666;
    font-size: 12px;
}

.skin-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-top: 15px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.skin-btn {
    width: 40px;
    height: 40px;
    font-size: 20px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.skin-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.skin-preview {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.3);
}

.difficulty-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.difficulty-label {
    color: #a0a0a0;
    font-size: 14px;
}

.difficulty-btn {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.difficulty-btn:hover {
    transform: translateY(-2px);
}

.difficulty-btn.active {
    background: linear-gradient(135deg, #00ff88, #00cc6a);
    color: #1a1a2e;
}

.difficulty-btn.easy.active {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
}

.difficulty-btn.normal.active {
    background: linear-gradient(135deg, #00ff88, #00cc6a);
}

.difficulty-btn.classic.active {
    background: linear-gradient(135deg, #f093fb, #f5576c);
}

.difficulty-btn.intense.active {
    background: linear-gradient(135deg, #fa709a, #fee140);
}

.map-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.map-label {
    color: #a0a0a0;
    font-size: 14px;
}

.map-btn {
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 600;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.map-btn:hover {
    transform: translateY(-2px);
}

.map-btn.active {
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    color: #1a1a2e;
}

.map-btn.normal-map.active {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    color: #fff;
}

.map-btn.grass-map.active {
    background: linear-gradient(135deg, #228B22, #32CD32);
    color: #fff;
}

.map-btn.mountain-map.active {
    background: linear-gradient(135deg, #708090, #A9A9A9);
    color: #fff;
}

.map-btn.city-map.active {
    background: linear-gradient(135deg, #4682B4, #5F9EA0);
    color: #fff;
}

.map-btn.mall-map.active {
    background: linear-gradient(135deg, #FF69B4, #FF1493);
    color: #fff;
}

.time-limit-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}

.time-label {
    color: #a0a0a0;
    font-size: 14px;
}

.time-btn {
    padding: 8px 20px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.time-btn:hover {
    transform: translateY(-2px);
}

.time-btn.active {
    background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
    color: #fff;
}

.time-btn.unlimited.active {
    background: linear-gradient(135deg, #00ff88, #00cc6a);
    color: #1a1a2e;
}

.shop-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    max-width: 80%;
}

.snake-icon {
    font-size: 60px;
    animation: bounce 1s ease-in-out infinite;
}

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

.shop-items {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

.shop-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.item-icon {
    font-size: 32px;
}

.item-info {
    flex: 1;
}

.item-info h3 {
    color: #fff;
    font-size: 16px;
    margin-bottom: 5px;
}

.item-info p {
    color: #a0a0a0;
    font-size: 13px;
    margin-bottom: 5px;
}

.item-info .price {
    color: #00ff88;
    font-weight: bold;
}

.buy-btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background: linear-gradient(135deg, #00ff88, #00cc6a);
    color: #1a1a2e;
    transition: all 0.3s ease;
}

.buy-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 255, 136, 0.4);
}

.buy-btn:disabled {
    background: #444;
    color: #888;
    cursor: not-allowed;
}

.shop-tip {
    background: rgba(255, 255, 0, 0.1);
    padding: 10px 20px;
    border-radius: 8px;
    border-left: 3px solid #ffd700;
}

.shop-tip p {
    color: #ffd700;
    font-size: 13px;
}

.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    padding: 15px 30px;
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    border-radius: 10px;
    font-size: 14px;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.toast.show {
    opacity: 1;
}

.toast.success {
    background: linear-gradient(135deg, #00ff88, #00cc6a);
    color: #1a1a2e;
}

.toast.error {
    background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
    color: #fff;
}

.tutorial-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

.map-transition {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 300;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.map-transition.fade-out {
    opacity: 0;
}

.transition-snake {
    font-size: 80px;
    animation: snake-crawl 1.5s ease-in-out;
}

@keyframes snake-crawl {
    0% {
        transform: translateX(-100px) translateY(0);
        opacity: 0;
    }
    20% {
        opacity: 1;
    }
    80% {
        transform: translateX(0) translateY(0);
        opacity: 1;
    }
    100% {
        transform: translateX(100px) translateY(20px);
        opacity: 0;
    }
}

.transition-text {
    font-size: 24px;
    color: #fff;
    margin-top: 20px;
    animation: text-fade 1.5s ease-in-out;
}

@keyframes text-fade {
    0%, 100% {
        opacity: 0;
        transform: translateY(10px);
    }
    30%, 70% {
        opacity: 1;
        transform: translateY(0);
    }
}

.tutorial-overlay h2 {
    color: #00ff88;
    font-size: 28px;
    margin-bottom: 20px;
}

.tutorial-overlay p {
    color: #a0a0a0;
    font-size: 16px;
    margin-bottom: 30px;
    text-align: center;
    max-width: 80%;
}

.tutorial-overlay .btn-group {
    display: flex;
    gap: 15px;
}

@media (max-width: 480px) {
    .header {
        flex-direction: column;
        align-items: center;
    }
    
    .score-panel {
        gap: 20px;
    }
    
    .score-item .value {
        font-size: 24px;
    }
    
    .controls {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .btn {
        padding: 8px 16px;
        font-size: 12px;
    }
    
    .overlay h1 {
        font-size: 32px;
    }
    
    .difficulty-btn {
        padding: 6px 12px;
        font-size: 11px;
    }
    
    .shop-item {
        flex-direction: column;
        text-align: center;
    }
    
    .buy-btn {
        width: 100%;
    }
}