body {
    background: linear-gradient(135deg, #1a1e2c, #2d1f3a);
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 10px;
}

.game-wrapper {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

.game-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.game-title {
    color: white;
    font-size: clamp(20px, 5vw, 28px);
    font-weight: 600;
    text-shadow: 0 2px 10px rgba(255, 255, 255, 0.3);
    letter-spacing: 2px;
}

.game-title span {
    color: #a0a0ff;
}

.score-container {
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.score-item {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 20px;
    padding: 10px 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.score-item.high {
    background: rgba(255, 215, 0, 0.1);
    border-color: rgba(255, 215, 0, 0.3);
}

.score-label {
    color: #a0a0ff;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.score-item.high .score-label {
    color: #ffd700;
}

.score-value {
    color: white;
    font-size: clamp(24px, 6vw, 32px);
    font-weight: 700;
    line-height: 1;
}

.canvas-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1/1;
    margin: 0 auto;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    background: #0f0f1a;
    border: 3px solid rgba(255, 255, 255, 0.1);
    touch-action: none;
}

.control-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-width: 280px;
    margin: 0 auto;
}

.control-btn {
    aspect-ratio: 1/1;
    border: none;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: clamp(24px, 6vw, 32px);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    width: 100%;
    height: 100%;
}

.control-btn:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.3);
}

.control-btn:disabled {
    opacity: 0.5;
    transform: none;
}

.empty-cell {
    aspect-ratio: 1/1;
}

.instruction-text {
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
    text-align: center;
    margin-top: 15px;
}

.restart-hint {
    color: #a0ffa0;
    font-size: 13px;
    margin-top: 5px;
}

.swipe-instruction {
    text-align: center;
    padding: 15px;
}

.swipe-icon {
    font-size: 28px;
    color: #a0a0ff;
    margin-bottom: 8px;
}

.swipe-icon i {
    margin: 0 6px;
    animation: bounce 2s infinite;
}

.instruction-text {
    color: rgba(255, 255, 255, 0.7);
    font-size: 15px;
    font-weight: 500;
}

.instruction-sub {
    color: rgba(255, 255, 255, 0.5);
    font-size: 13px;
    margin-top: 5px;
}

/* Splash Screen Styles */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a0c14, #1a1f2e);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

.splash-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.splash-content {
    text-align: center;
    padding: 20px;
}

.splash-logo {
    font-size: 80px;
    margin-bottom: 20px;
    animation: pulse 2s infinite;
}

.splash-title {
    color: white;
    font-size: 42px;
    font-weight: 800;
    letter-spacing: 4px;
    margin-bottom: 15px;
    text-shadow: 0 0 20px rgba(160, 160, 255, 0.5);
    animation: glow 2s ease-in-out infinite;
}

.splash-subtitle {
    color: #a0a0ff;
    font-size: 18px;
    margin-bottom: 40px;
    opacity: 0.8;
    animation: slideUp 1s ease;
}

.splash-snake {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 50px;
    animation: slideIn 1s ease;
}

.splash-snake-dot {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    animation: snakeMove 1.5s infinite;
}

.splash-snake-dot:nth-child(1) {
    background: #ffffaa;
    animation-delay: 0s;
}

.splash-snake-dot:nth-child(2) {
    background: #88ff88;
    animation-delay: 0.2s;
}

.splash-snake-dot:nth-child(3) {
    background: #44ff44;
    animation-delay: 0.4s;
}

.splash-snake-dot:nth-child(4) {
    background: #00cc00;
    animation-delay: 0.6s;
}

.splash-progress {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    margin: 30px auto;
    overflow: hidden;
}

.splash-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #a0a0ff, #ffa0a0);
    border-radius: 10px;
    animation: progress 2s ease-in-out forwards;
}

.splash-tap {
    color: rgba(255, 255, 255, 0.5);
    font-size: 16px;
    margin-top: 20px;
    animation: fadeInOut 2s infinite;
}

.splash-footer {
    position: absolute;
    bottom: 30px;
    color: rgba(255, 255, 255, 0.3);
    font-size: 14px;
}

/* Animations */
@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

@keyframes glow {

    0%,
    100% {
        text-shadow: 0 0 20px rgba(160, 160, 255, 0.5);
    }

    50% {
        text-shadow: 0 0 40px rgba(160, 160, 255, 0.8), 0 0 60px rgba(160, 160, 255, 0.4);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 0.8;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes snakeMove {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-15px);
    }
}

@keyframes progress {
    0% {
        width: 0%;
    }

    100% {
        width: 100%;
    }
}

@keyframes fadeInOut {

    0%,
    100% {
        opacity: 0.3;
    }

    50% {
        opacity: 1;
    }
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

/* Landscape mode adjustments */
@media (orientation: landscape) and (max-height: 600px) {
    .game-wrapper {
        display: flex;
        gap: 20px;
        align-items: center;
        max-width: 900px;
    }

    .canvas-container {
        width: 50%;
    }

    .right-panel {
        width: 50%;
    }
}

/* Prevent zoom on double tap */
* {
    touch-action: manipulation;
}

.splash-logo img{
    width: 120px;
    height: 120px;
    object-fit: contain;
}