* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    font-size: 20px;
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    background: white;
    border-radius: 25px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.15);
    padding: 40px;
    max-width: 1000px;
    margin: 0 auto;
    animation: slideIn 0.8s ease-out;
}

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

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes bounce {
    0%, 20%, 60%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    80% { transform: translateY(-5px); }
}

@keyframes celebrate {
    0% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.1) rotate(5deg); }
    50% { transform: scale(1.2) rotate(-5deg); }
    75% { transform: scale(1.1) rotate(5deg); }
    100% { transform: scale(1) rotate(0deg); }
}

/* Welcome Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: white;
    padding: 50px;
    border-radius: 25px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 25px 50px rgba(0,0,0,0.3);
    animation: modalSlide 0.6s ease-out;
}

@keyframes modalSlide {
    from { opacity: 0; transform: scale(0.8) translateY(-50px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal h2 {
    font-size: 36px;
    color: #4a5568;
    margin-bottom: 30px;
}

.modal input {
    font-size: 24px;
    padding: 20px;
    border: 3px solid #e2e8f0;
    border-radius: 15px;
    width: 100%;
    margin: 20px 0;
    text-align: center;
}

.modal input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 40px;
}

.header h1 {
    color: #4a5568;
    font-size: 48px;
    margin-bottom: 15px;
    animation: bounce 2s infinite;
}

.welcome-message {
    font-size: 32px;
    color: #667eea;
    font-weight: bold;
    margin-bottom: 30px;
    animation: pulse 3s infinite;
}

/* Performance Analytics */
.analytics-section {
    background: linear-gradient(135deg, #e6fffa 0%, #b2f5ea 100%);
    border: 3px solid #38b2ac;
    border-radius: 20px;
    padding: 30px;
    margin: 30px 0;
    font-size: 22px;
    line-height: 1.8;
    animation: slideIn 1s ease-out 0.3s both;
}

.analytics-title {
    font-size: 28px;
    font-weight: bold;
    color: #234e52;
    margin-bottom: 20px;
    text-align: center;
}

.analytics-content {
    color: #234e52;
    text-align: center;
}

/* Education Section */
.education-section {
    background: linear-gradient(135deg, #fef7ff 0%, #f3e8ff 100%);
    border: 3px solid #8b5cf6;
    border-radius: 20px;
    padding: 30px;
    margin: 30px 0;
    animation: slideIn 1s ease-out 0.6s both;
}

.education-title {
    font-size: 28px;
    font-weight: bold;
    color: #5b21b6;
    margin-bottom: 20px;
    text-align: center;
}

.education-content {
    font-size: 20px;
    color: #6b21a8;
    line-height: 1.8;
}

.exercise-benefits {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-top: 25px;
}

.benefit-card {
    background: rgba(255, 255, 255, 0.7);
    padding: 20px;
    border-radius: 15px;
    border: 2px solid #c084fc;
}

.benefit-card h4 {
    font-size: 22px;
    color: #5b21b6;
    margin-bottom: 10px;
}

/* Game Navigation */
.game-navigation {
    margin-top: 40px;
    text-align: center;
}

.nav-title {
    font-size: 24px;
    color: #4a5568;
    margin-bottom: 25px;
}

.game-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.game-link {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    border: none;
    font-size: 18px;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.game-link:hover, .game-link:active {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
    animation: celebrate 0.6s ease-in-out;
}

.game-link h3 {
    font-size: 24px;
    margin-bottom: 12px;
}

/* Controls */
.controls {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
    display: flex;
    gap: 15px;
}

.control-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.volume-btn {
    background: #22c55e;
    color: white;
}

.volume-btn.muted {
    background: #ef4444;
}

.control-btn:hover {
    transform: scale(1.1);
}

/* Game Area Styles */
.game-area {
    display: none;
    text-align: center;
    margin-bottom: 30px;
    animation: slideIn 0.6s ease-out;
}

.game-canvas {
    border: 4px solid #e2e8f0;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    margin: 25px auto;
    display: block;
    background: #f8fafc;
    touch-action: none;
}

.game-controls {
    margin: 25px 0;
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 18px 35px;
    border-radius: 25px;
    font-size: 22px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 150px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

.btn:hover, .btn:active {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.back-btn {
    background: #718096;
    margin-bottom: 25px;
}

/* Stats */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 25px 0;
}

.stat-card {
    background: #f8fafc;
    padding: 25px;
    border-radius: 15px;
    text-align: center;
    border: 3px solid #e2e8f0;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.stat-value {
    font-size: 36px;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 8px;
}

.stat-label {
    color: #718096;
    font-size: 18px;
}

/* Timer Display */
.timer-display {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 28px;
    font-weight: bold;
    z-index: 100;
    display: none;
    animation: pulse 2s infinite;
}

/* Progress Section */
.progress-section {
    margin-top: 40px;
    padding: 30px;
    background: #f8fafc;
    border-radius: 20px;
    border: 3px solid #e2e8f0;
}

.progress-section h3 {
    text-align: center;
    color: #4a5568;
    margin-bottom: 25px;
    font-size: 28px;
}

.chart-container {
    position: relative;
    height: 350px;
    margin-top: 25px;
}

/* Difficulty Selector */
.difficulty-selector {
    margin: 20px 0;
    text-align: center;
}

.difficulty-selector select {
    padding: 15px 25px;
    border-radius: 15px;
    border: 3px solid #e2e8f0;
    font-size: 20px;
    background: white;
    cursor: pointer;
}

/* Game Instructions */
.game-instructions {
    background: #e6fffa;
    border: 3px solid #38b2ac;
    border-radius: 15px;
    padding: 20px;
    margin: 20px 0;
    color: #234e52;
    font-size: 20px;
    text-align: center;
}

/* Success Animation */
.success-celebration {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 72px;
    z-index: 1000;
    animation: celebrate 2s ease-in-out;
    pointer-events: none;
}

/* Additional Animations */
@keyframes slideOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(-50px); }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* iPad Optimizations */
@media (max-width: 1024px) {
    .container {
        padding: 30px 20px;
        margin: 10px;
        border-radius: 20px;
    }

    .game-canvas {
        width: 100% !important;
        max-width: 700px;
        height: auto !important;
    }

    .btn {
        padding: 20px 30px;
        font-size: 24px;
        min-width: 160px;
    }

    .header h1 {
        font-size: 42px;
    }

    .welcome-message {
        font-size: 28px;
    }
}

@media (max-width: 768px) {
    body {
        font-size: 18px;
        padding: 10px;
    }

    .container {
        padding: 25px 15px;
    }

    .controls {
        top: 15px;
        right: 15px;
    }

    .control-btn {
        width: 55px;
        height: 55px;
        font-size: 20px;
    }

    .header h1 {
        font-size: 36px;
    }

    .game-links {
        grid-template-columns: 1fr;
    }
}