/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    padding: 20px;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Header */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 50px 30px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '🐍';
    position: absolute;
    font-size: 150px;
    opacity: 0.1;
    top: -30px;
    right: 50px;
    animation: slither 4s ease-in-out infinite;
}

@keyframes slither {
    0%, 100% { 
        transform: translateX(0) translateY(0) rotate(0deg);
    }
    25% { 
        transform: translateX(20px) translateY(-10px) rotate(10deg);
    }
    75% { 
        transform: translateX(-20px) translateY(10px) rotate(-10deg);
    }
}

.header h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    font-weight: 700;
    position: relative;
    z-index: 1;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.3rem;
    opacity: 0.95;
    position: relative;
    z-index: 1;
}

/* Main Content */
.main-content {
    padding: 40px 30px;
}

/* Game Section */
.game-section {
    margin-bottom: 50px;
}

.game-container {
    background: linear-gradient(135deg, #f9fafb 0%, #ffffff 100%);
    border-radius: 16px;
    padding: 30px;
    border: 2px solid #e5e7eb;
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.15);
}

/* Game Header */
.game-header {
    margin-bottom: 20px;
}

.score-board {
    display: flex;
    justify-content: center;
    gap: 40px;
}

.score-item {
    text-align: center;
    background: white;
    padding: 15px 30px;
    border-radius: 12px;
    border: 2px solid #e5e7eb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.score-label {
    font-size: 0.9rem;
    color: #6b7280;
    margin-bottom: 5px;
    font-weight: 600;
}

.score-value {
    font-size: 2rem;
    color: #667eea;
    font-weight: 900;
}

/* Game Wrapper */
.game-wrapper {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
    background: #1a1a1a;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

#gameCanvas {
    display: block;
    width: 100%;
    height: auto;
    background: #2d2d2d;
}

/* Game Overlay */
.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    animation: fadeIn 0.3s ease-out;
}

.game-overlay.hidden {
    display: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.overlay-content {
    text-align: center;
    padding: 30px;
    max-width: 400px;
}

.overlay-title {
    color: white;
    font-size: 2.5rem;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.overlay-title.game-over {
    color: #ef4444;
}

.overlay-subtitle {
    color: #d1d5db;
    font-size: 1.1rem;
    margin-bottom: 30px;
}

/* Difficulty Selector */
.difficulty-selector {
    margin-bottom: 30px;
}

.difficulty-selector h3 {
    color: white;
    font-size: 1.2rem;
    margin-bottom: 15px;
}

.difficulty-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.difficulty-btn {
    padding: 12px 20px;
    background: #374151;
    color: white;
    border: 2px solid #4b5563;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.difficulty-btn:hover {
    background: #4b5563;
    transform: translateY(-2px);
}

.difficulty-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.5);
}

/* Buttons */
.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-large {
    padding: 18px 40px;
    font-size: 1.3rem;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

.controls-hint {
    margin-top: 20px;
    color: #9ca3af;
    font-size: 0.9rem;
}

.controls-hint p {
    margin: 5px 0;
}

/* Final Score Display */
.final-score-display {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.final-score-label {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.final-score-value {
    color: white;
    font-size: 4rem;
    font-weight: 900;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.3);
}

.new-high-score {
    color: #fbbf24;
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 20px;
    animation: pulse 1s ease-in-out infinite;
}

.new-high-score.hidden {
    display: none;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.game-over-buttons,
.pause-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Game Controls */
.game-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.control-btn {
    padding: 12px 25px;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.control-btn:hover:not(:disabled) {
    background: #f9fafb;
    border-color: #667eea;
    transform: translateY(-2px);
}

.control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Mobile Controls */
.mobile-controls {
    display: none;
    margin-top: 20px;
}

.d-pad {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto;
}

.d-pad-btn {
    position: absolute;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.5rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.3);
    transition: all 0.2s;
}

.d-pad-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 5px rgba(102, 126, 234, 0.5);
}

.d-pad-up {
    top: 0;
    left: 50%;
    transform: translateX(-50%);
}

.d-pad-down {
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
}

.d-pad-left {
    top: 50%;
    left: 0;
    transform: translateY(-50%);
}

.d-pad-right {
    top: 50%;
    right: 0;
    transform: translateY(-50%);
}

/* Stats Section */
.stats-section {
    margin-bottom: 50px;
}

.stats-section h2 {
    color: #667eea;
    font-size: 2rem;
    text-align: center;
    margin-bottom: 30px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.stat-card {
    background: white;
    padding: 30px;
    border-radius: 12px;
    border: 2px solid #e5e7eb;
    text-align: center;
    transition: all 0.3s;
}

.stat-card:hover {
    border-color: #667eea;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.15);
    transform: translateY(-5px);
}

.stat-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 900;
    color: #667eea;
    margin-bottom: 5px;
}

.stat-label {
    color: #6b7280;
    font-size: 1rem;
    font-weight: 600;
}

/* Info Section */
.info-section {
    margin-bottom: 50px;
}

.info-section h2 {
    color: #667eea;
    font-size: 2rem;
    text-align: center;
    margin-bottom: 30px;
}

.how-to-play {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
}

.instruction-card {
    background: white;
    padding: 30px;
    border-radius: 12px;
    border: 2px solid #e5e7eb;
    position: relative;
    transition: all 0.3s;
}

.instruction-card:hover {
    border-color: #667eea;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.15);
}

.instruction-number {
    position: absolute;
    top: -15px;
    left: 20px;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: 900;
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.3);
}

.instruction-card h3 {
    color: #374151;
    font-size: 1.3rem;
    margin-bottom: 10px;
    margin-top: 10px;
}

.instruction-card p {
    color: #6b7280;
    line-height: 1.7;
}

/* Features Section */
.features-section {
    margin-bottom: 50px;
}

.features-section h2 {
    color: #667eea;
    font-size: 2rem;
    text-align: center;
    margin-bottom: 30px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
}

.feature-card {
    background: white;
    padding: 30px;
    border-radius: 12px;
    border: 2px solid #e5e7eb;
    text-align: center;
    transition: all 0.3s;
}

.feature-card:hover {
    transform: translateY(-5px);
    border-color: #667eea;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.15);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.feature-card h3 {
    color: #374151;
    font-size: 1.3rem;
    margin-bottom: 10px;
}

.feature-card p {
    color: #6b7280;
    line-height: 1.6;
}

/* Tips Section */
.tips-section {
    margin-bottom: 50px;
}

.tips-section h2 {
    color: #667eea;
    font-size: 2rem;
    text-align: center;
    margin-bottom: 30px;
}

.tips-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.tip-card {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    padding: 20px;
    border-radius: 12px;
    border-left: 4px solid #f59e0b;
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.tip-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.tip-card p {
    color: #78350f;
    line-height: 1.6;
}

/* About Section */
.about-section {
    margin-bottom: 50px;
}

.about-section h2 {
    color: #667eea;
    font-size: 2rem;
    text-align: center;
    margin-bottom: 30px;
}

.about-content {
    background: white;
    padding: 40px;
    border-radius: 12px;
    border: 2px solid #e5e7eb;
}

.about-content p {
    color: #4b5563;
    line-height: 1.8;
    margin-bottom: 20px;
    font-size: 1.05rem;
}

.zodiac-traits {
    background: linear-gradient(135deg, #f9fafb 0%, #e0e7ff 100%);
    padding: 25px;
    border-radius: 10px;
    margin-top: 25px;
}

.zodiac-traits h3 {
    color: #667eea;
    font-size: 1.4rem;
    margin-bottom: 15px;
}

.zodiac-traits ul {
    list-style: none;
    padding: 0;
}

.zodiac-traits li {
    color: #4b5563;
    padding: 8px 0;
    font-size: 1.05rem;
}

/* Footer */
.footer {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

.footer-content p {
    margin: 5px 0;
    opacity: 0.95;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .header h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .main-content {
        padding: 25px 15px;
    }

    .game-container {
        padding: 20px;
    }

    .score-board {
        gap: 15px;
    }

    .score-item {
        padding: 10px 20px;
    }

    .score-value {
        font-size: 1.5rem;
    }

    .overlay-title {
        font-size: 2rem;
    }

    .final-score-value {
        font-size: 3rem;
    }

    .mobile-controls {
        display: block;
    }

    .how-to-play,
    .features-grid,
    .stats-grid,
    .tips-container {
        grid-template-columns: 1fr;
    }

    .about-content {
        padding: 25px;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 30px 20px;
    }

    .header h1 {
        font-size: 1.8rem;
    }

    .btn {
        padding: 12px 20px;
        font-size: 1rem;
    }

    .btn-large {
        padding: 15px 30px;
        font-size: 1.1rem;
    }

    .difficulty-buttons {
        flex-direction: column;
    }

    .game-over-buttons .btn,
    .pause-buttons .btn {
        width: 100%;
    }
}

/* Loading Animation */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}