/* Probiotic Defenders - Educational Tower Defense Game CSS */

/* Mobile-first base styles */
* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    touch-action: manipulation;
    font-family: 'Courier New', monospace;
    background: linear-gradient(135deg, #E8F5E8 0%, #D4F4D4 100%);
}

/* Touch-friendly button styles */
button, .btn, [role="button"] {
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    min-height: 44px;
    min-width: 44px;
}

/* Intro Scene Styles */
.intro-scene {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: linear-gradient(135deg, #C8E6C9 0%, #A5D6A7 50%, #81C784 100%);
}

.intro-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.body-outline {
    font-size: 20rem;
    opacity: 0.1;
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.1; }
    50% { transform: scale(1.05); opacity: 0.15; }
}

.intro-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: 2;
}

.intro-content {
    position: relative;
    z-index: 3;
    text-align: center;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    max-width: 800px;
    padding: 2rem;
}

.intro-title {
    font-size: 4rem;
    font-weight: bold;
    text-shadow: 4px 4px 8px rgba(0, 0, 0, 0.8);
    margin: 0;
    letter-spacing: 2px;
    color: #4CAF50;
    -webkit-text-stroke: 2px #1B5E20;
}

.intro-subtitle {
    font-size: 1.5rem;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
    color: #E8F5E8;
}

.intro-description {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    padding: 1.5rem;
    border-radius: 12px;
    border: 3px solid #4CAF50;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.intro-description p {
    margin: 0.5rem 0;
    font-size: 1.1rem;
    font-weight: bold;
}

.intro-start-btn {
    background: linear-gradient(45deg, #4CAF50 0%, #66BB6A 100%);
    color: white;
    border: 4px solid #2E7D32;
    padding: 1rem 2rem;
    font-size: 1.5rem;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.intro-start-btn:hover {
    background: linear-gradient(45deg, #388E3C 0%, #4CAF50 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

.intro-credits {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    color: rgba(255, 255, 255, 0.9);
    z-index: 4;
}

.creator-text {
    font-size: 1.1rem;
    font-weight: bold;
    margin: 0 0 0.5rem 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
}

.copyright-text {
    font-size: 0.9rem;
    margin: 0;
    opacity: 0.8;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
}

/* Hide intro scene when not active */
.intro-scene:not(.active) {
    display: none;
}

/* Hide game content when intro is active */
.intro-scene.active ~ .game-container {
    display: none;
}

/* Game Container */
.game-container {
    max-width: 1200px;
    margin: 0 auto;
    background: linear-gradient(135deg, #E8F5E8 0%, #C8E6C9 100%);
    min-height: 100vh;
    position: relative;
}

/* Game Header */
.game-header {
    background: linear-gradient(90deg, #4CAF50 0%, #66BB6A 100%);
    padding: 1rem;
    border-bottom: 4px solid #2E7D32;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.back-btn {
    background: #FF6B6B;
    color: white;
    border: 2px solid #FF4757;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.back-btn:hover {
    background: #FF4757;
    transform: translateY(-2px);
}

.game-header h1 {
    color: white;
    margin: 0;
    font-size: 2rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.player-info {
    display: flex;
    gap: 1rem;
    font-weight: bold;
    align-items: center;
    flex-wrap: wrap;
}

.health-display, .wave-display, .nutrients-display {
    background: white;
    padding: 0.5rem 1rem;
    border: 2px solid #333;
    border-radius: 4px;
    box-shadow: 2px 2px 4px rgba(0,0,0,0.2);
    color: #333;
}

.sound-toggle-btn {
    background: white;
    border: 2px solid #333;
    border-radius: 4px;
    padding: 0.5rem;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 2px 2px 4px rgba(0,0,0,0.2);
    width: 40px;
    height: 40px;
}

/* Phase Styles */
.game-phases {
    padding: 2rem;
}

.phase {
    display: none;
    background: white;
    border: 4px solid #4CAF50;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 4px 4px 8px rgba(0,0,0,0.3);
    margin-bottom: 2rem;
}

.phase.active {
    display: block;
}

.phase-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #E8F5E8;
}

.phase-header h2 {
    color: #2E7D32;
    margin: 0 0 0.5rem 0;
    font-size: 2rem;
}

.phase-header p {
    color: #666;
    margin: 0;
    font-size: 1.2rem;
}

/* Learning Phase Styles */
.learning-content {
    max-width: 1000px;
    margin: 0 auto;
}

.health-info h3 {
    color: #2E7D32;
    font-size: 1.8rem;
    text-align: center;
    margin-bottom: 2rem;
}

.health-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.fact-card {
    background: linear-gradient(135deg, #F1F8E9 0%, #E8F5E8 100%);
    border: 3px solid #4CAF50;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 2px 2px 6px rgba(0,0,0,0.2);
    transition: transform 0.3s ease;
}

.fact-card:hover {
    transform: translateY(-5px);
}

.fact-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.fact-card h4 {
    color: #2E7D32;
    margin: 0 0 1rem 0;
    font-size: 1.3rem;
}

.fact-card p {
    color: #333;
    margin: 0;
    line-height: 1.4;
}

.defender-guide h3 {
    color: #2E7D32;
    font-size: 1.8rem;
    text-align: center;
    margin-bottom: 2rem;
}

.defenders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.defender-card {
    background: linear-gradient(135deg, #FFF3E0 0%, #FFE0B2 100%);
    border: 3px solid #FF9800;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    box-shadow: 2px 2px 4px rgba(0,0,0,0.2);
    transition: transform 0.2s;
}

.defender-card:hover {
    transform: translateY(-3px);
}

.defender-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.defender-card h4 {
    color: #E65100;
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
}

.defender-card p {
    margin: 0.25rem 0;
    font-size: 0.9rem;
    color: #333;
}

/* Game Field Styles */
.game-field {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 2rem;
    min-height: 600px;
}

.defender-panel {
    background: linear-gradient(135deg, #E3F2FD 0%, #BBDEFB 100%);
    border: 3px solid #2196F3;
    border-radius: 12px;
    padding: 1.5rem;
    height: fit-content;
}

.defender-panel h3 {
    margin: 0 0 1rem 0;
    color: #1565C0;
    text-align: center;
}

.defender-slots {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.defender-slot {
    background: white;
    border: 3px solid #2196F3;
    border-radius: 8px;
    padding: 0.75rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.defender-slot:hover {
    background: #E3F2FD;
    transform: translateY(-2px);
}

.defender-slot.selected {
    background: #4CAF50;
    border-color: #2E7D32;
    color: white;
}

.defender-slot.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.slot-icon {
    font-size: 2rem;
    margin-bottom: 0.25rem;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 40px;
}

.slot-icon img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.slot-cost {
    font-size: 0.8rem;
    font-weight: bold;
    color: #1565C0;
}

.defender-slot.selected .slot-cost {
    color: white;
}

.selected-defender {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #333;
    border-radius: 8px;
    padding: 1rem;
    font-size: 0.9rem;
    color: #333;
    text-align: center;
}

/* Body Grid Styles */
.body-grid {
    background: linear-gradient(135deg, #FFF8E1 0%, #FFECB3 100%);
    border: 4px solid #FF9800;
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.digestive-system {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.system-label {
    background: linear-gradient(90deg, #FF9800 0%, #FFB74D 100%);
    color: white;
    padding: 0.5rem;
    border-radius: 4px;
    font-weight: bold;
    text-align: center;
    box-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.grid-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.grid-cell {
    width: 60px;
    height: 60px;
    border: 2px solid #333;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 2rem;
    box-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.grid-cell:hover {
    background: #E8F5E8;
    border-color: #4CAF50;
    transform: scale(1.05);
}

.grid-cell.occupied {
    cursor: not-allowed;
    background: #C8E6C9;
    border-color: #4CAF50;
}

.grid-cell.preview {
    background: #FFECB3;
    border-color: #FF9800;
    border-style: dashed;
}

.bacteria-lane {
    position: relative;
    width: 100%;
    height: 60px;
    overflow: hidden;
}

/* Wave Controls */
.wave-controls {
    grid-column: 1 / -1;
    text-align: center;
    margin-top: 1rem;
}

.start-wave-btn {
    background: linear-gradient(135deg, #FF6B35 0%, #F7931E 100%);
    color: white;
    border: 3px solid #E65100;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-size: 1.2rem;
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 2px 2px 6px rgba(0,0,0,0.2);
}

.start-wave-btn:hover {
    transform: translateY(-2px);
    box-shadow: 4px 4px 8px rgba(0,0,0,0.3);
}

.start-wave-btn:disabled {
    background: #ccc;
    border-color: #999;
    cursor: not-allowed;
    transform: none;
}

.wave-info {
    margin-top: 1rem;
    color: #333;
}

.wave-info p {
    margin: 0.25rem 0;
    font-weight: bold;
}

/* Game Entities */
.bacteria {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    z-index: 10;
    transition: all 0.1s ease;
    animation: bacteriaMove 0.1s linear infinite;
}

.bacteria.basic {
    background: #FF5722;
    border: 2px solid #D32F2F;
}

.bacteria.strong {
    background: #9C27B0;
    border: 2px solid #7B1FA2;
}

.bacteria.fast {
    background: #FF9800;
    border: 2px solid #F57C00;
}

.bacteria.boss {
    background: #F44336;
    border: 3px solid #C62828;
    width: 50px;
    height: 50px;
}

@keyframes bacteriaMove {
    0% { transform: translateX(0); }
    100% { transform: translateX(-2px); }
}

.projectile {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    position: absolute;
    z-index: 5;
    transition: all 0.1s ease;
}

.projectile.leafy {
    background: #4CAF50;
    box-shadow: 0 0 4px #4CAF50;
}

.projectile.carrot {
    background: #FF9800;
    box-shadow: 0 0 4px #FF9800;
}

.projectile.probiotic {
    background: #9C27B0;
    box-shadow: 0 0 6px #9C27B0;
}

.projectile.garlic {
    background: #FFF;
    box-shadow: 0 0 4px #FFF;
}

.projectile.berry {
    background: #3F51B5;
    box-shadow: 0 0 8px #3F51B5;
}

/* Results and Game Over Styles */
.results-content, .game-over-content {
    text-align: center;
}

.results-header h2, .game-over-header h2 {
    color: #2E7D32;
    font-size: 2.5rem;
    margin: 0 0 1rem 0;
}

.health-lesson, .final-lesson {
    background: linear-gradient(135deg, #E1F5FE 0%, #B3E5FC 100%);
    border: 3px solid #03A9F4;
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem 0;
}

.health-lesson h3, .final-lesson h3 {
    color: #0277BD;
    margin: 0 0 1rem 0;
}

.achievement-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.achievement-card {
    background: white;
    border: 3px solid #4CAF50;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 2px 2px 6px rgba(0,0,0,0.2);
}

.achievement-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.achievement-card h4 {
    color: #2E7D32;
    margin: 0 0 0.5rem 0;
}

.wave-stats {
    margin: 2rem 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.stat-item {
    background: white;
    border: 2px solid #333;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    box-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.stat-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #2E7D32;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.9rem;
    color: #666;
}

.healthy-tips {
    background: linear-gradient(135deg, #F3E5F5 0%, #E1BEE7 100%);
    border: 3px solid #9C27B0;
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem 0;
    text-align: left;
}

.healthy-tips h3 {
    color: #7B1FA2;
    text-align: center;
    margin-bottom: 1rem;
}

.healthy-tips ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.healthy-tips li {
    padding: 0.5rem 0;
    font-size: 1.1rem;
    color: #333;
}

/* Action Buttons */
.phase-actions, .final-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 2rem;
}

.continue-btn, .restart-btn {
    background: linear-gradient(135deg, #4CAF50 0%, #66BB6A 100%);
    color: white;
    border: 3px solid #2E7D32;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-size: 1.2rem;
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 2px 2px 6px rgba(0,0,0,0.2);
}

.restart-btn {
    background: linear-gradient(135deg, #FF6B35 0%, #F7931E 100%);
    border-color: #E65100;
}

.continue-btn:hover, .restart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 4px 4px 8px rgba(0,0,0,0.3);
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.bounce-in {
    animation: bounceIn 0.6s ease-out;
}

@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); opacity: 1; }
}

.health-float {
    position: absolute;
    font-weight: bold;
    color: #F44336;
    font-size: 1.2rem;
    pointer-events: none;
    animation: floatUp 2s ease-out forwards;
    z-index: 100;
}

@keyframes floatUp {
    0% {
        transform: translateY(0);
        opacity: 1;
    }
    100% {
        transform: translateY(-50px);
        opacity: 0;
    }
}

.nutrient-float {
    position: absolute;
    font-weight: bold;
    color: #4CAF50;
    font-size: 1rem;
    pointer-events: none;
    animation: floatUp 1.5s ease-out forwards;
    z-index: 100;
}

/* Bacteria Animations */
@keyframes fastBacteria {
    0% { transform: translateY(0px); }
    100% { transform: translateY(-3px); }
}

@keyframes bossBacteria {
    0% { transform: scale(1.5) rotate(0deg); }
    25% { transform: scale(1.6) rotate(5deg); }
    50% { transform: scale(1.5) rotate(0deg); }
    75% { transform: scale(1.6) rotate(-5deg); }
    100% { transform: scale(1.5) rotate(0deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .intro-title {
        font-size: 2.5rem;
        -webkit-text-stroke: 1px #1B5E20;
    }

    .intro-subtitle {
        font-size: 1.2rem;
    }

    .intro-start-btn {
        font-size: 1.2rem;
        padding: 0.8rem 1.5rem;
    }

    .game-header h1 {
        font-size: 1.5rem;
    }

    .header-content {
        flex-direction: column;
        gap: 0.5rem;
    }

    .player-info {
        justify-content: center;
        gap: 0.5rem;
    }

    .game-phases {
        padding: 1rem;
    }

    .phase {
        padding: 1rem;
    }

    .game-field {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .defender-panel {
        order: 2;
        padding: 1rem;
    }

    .defender-slots {
        grid-template-columns: repeat(3, 1fr);
    }

    .body-grid {
        order: 1;
        padding: 0.5rem;
    }

    .grid-cell {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }

    .bacteria-lane {
        height: 50px;
    }

    .health-facts, .defenders-grid {
        grid-template-columns: 1fr;
    }

    .achievement-cards {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .phase-actions, .final-actions {
        flex-direction: column;
        align-items: center;
    }
}

@media (max-width: 480px) {
    .intro-title {
        font-size: 2rem;
    }

    .game-header h1 {
        font-size: 1.25rem;
    }

    .phase-header h2 {
        font-size: 1.5rem;
    }

    .grid-cell {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }

    .bacteria-lane {
        height: 40px;
    }

    .defender-slots {
        grid-template-columns: repeat(2, 1fr);
    }

    .slot-icon {
        font-size: 1.5rem;
    }

    .fact-icon, .achievement-icon {
        font-size: 2.5rem;
    }
}
