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

body {
    font-family: 'Comic Sans MS', cursive, sans-serif;
    background: linear-gradient(135deg, #87ceeb 0%, #98fb98 100%);
    min-height: 100vh;
    padding: 20px;
}

.game-container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    color: white;
    text-align: center;
    padding: 20px;
}

header h1 {
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.game-stats {
    display: flex;
    justify-content: space-around;
    background: #f8f9fa;
    padding: 15px;
    border-bottom: 2px solid #dee2e6;
}

.stat {
    text-align: center;
    font-size: 1.2em;
    font-weight: bold;
}

.label {
    color: #666;
}

.status-indicator {
    font-weight: bold;
    color: #007bff;
}

.status-indicator.processing {
    color: #ffc107;
}

.status-indicator.pickles-turn {
    color: #28a745;
}

.battlefield {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    margin: 20px 0;
}

.battlefield-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-weight: bold;
    font-size: 1.1em;
}

.cats-label {
    color: #ff6b6b;
}

.pickles-label {
    color: #28a745;
}

.battle-grid {
    display: grid;
    grid-template-columns: repeat(50, 1fr);
    grid-template-rows: repeat(20, 1fr);
    gap: 1px;
    background: #dee2e6;
    border: 2px solid #adb5bd;
    border-radius: 5px;
    padding: 2px;
    height: 480px;
    width: 100%;
    overflow: hidden;
}

.grid-cell {
    background: #ffffff;
    border-radius: 1px;
    position: relative;
    transition: all 0.2s ease;
}

.grid-cell.cat-territory {
    background: #ffe6e6;
}

.grid-cell.pickle-territory {
    background: #e6ffe6;
}

.grid-cell.occupied-cat {
    background: #007bff;
}

.grid-cell.occupied-captured-cat {
    background: #dc3545;
}

.grid-cell.occupied-pickle {
    background: inherit;
}

.grid-cell.occupied-hamburger {
    background: #ffeb3b;
}

.grid-cell.empty {
    background: #f8f9fa;
}

.grid-unit {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    position: relative;
}

.grid-unit.pickle-unit {
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.grid-unit.cat-unit {
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* Hide text when PNG is loaded */
.grid-unit.pickle-unit[style*="background-image"] {
    color: transparent;
}

.grid-unit.cat-unit[style*="background-image"] {
    color: transparent;
    font-size: 0; /* Additional method to hide text */
}

.grid-unit.cat-unit {
    color: transparent; /* Just hide text for cats by default since we always want PNG */
}

.cat {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    position: relative;
    display: inline-block;
    animation: bounce 2s infinite;
}

.cat.orange { background: #ff8c00; }
.cat.black { background: #2c2c2c; }
.cat.white { background: #f5f5f5; border: 2px solid #ccc; }
.cat.gray { background: #808080; }
.cat.brown { background: #8b4513; }

.cat::before {
    content: '😺';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
}

.cat.equipped::after {
    content: '⚔️';
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: 12px;
}

.pickle {
    width: 40px;
    height: 60px;
    display: inline-block;
    margin: 5px;
    animation: wiggle 3s infinite;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    position: relative;
}

.explosion {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 30px;
    pointer-events: none;
    animation: explode 0.6s ease-out forwards;
    z-index: 10;
}

.pickle.exploding {
    animation: shake 0.6s ease-out forwards;
}

.action-panel {
    background: #f8f9fa;
    padding: 20px;
    border-top: 2px solid #dee2e6;
}

.action-panel h3 {
    text-align: center;
    margin-bottom: 15px;
    color: #333;
}

.action-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.action-btn {
    padding: 15px 20px;
    font-size: 1.1em;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
}

#deploy-doom { background: #dc3545; }
#make-hamburgers { background: #ffc107; color: #333; }
#eat-pickles { background: #28a745; }
#recruit-cats { background: #007bff; }

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

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

/* Tooltip styling */
.action-btn[data-tooltip] {
    position: relative;
}

.action-btn[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: normal;
    white-space: nowrap;
    z-index: 1000;
    max-width: 300px;
    white-space: normal;
    text-align: center;
    line-height: 1.3;
}

.action-btn[data-tooltip]:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid rgba(0, 0, 0, 0.9);
    z-index: 1000;
}

.game-log {
    background: #343a40;
    color: white;
    padding: 20px;
    max-height: 200px;
    overflow-y: auto;
}

.game-log h3 {
    margin-bottom: 15px;
    color: #ffc107;
}

#log-messages {
    font-family: monospace;
    line-height: 1.4;
}

.log-entry {
    margin-bottom: 5px;
    padding: 5px;
    border-radius: 3px;
}

.log-success { background: rgba(40, 167, 69, 0.2); }
.log-failure { background: rgba(220, 53, 69, 0.2); }
.log-info { background: rgba(23, 162, 184, 0.2); }

.game-over {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 2em;
}

.game-over.hidden {
    display: none;
}

#restart-btn {
    padding: 15px 30px;
    font-size: 1.2em;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    margin-top: 20px;
}

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

@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(2deg); }
    75% { transform: rotate(-2deg); }
}

@keyframes explode {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.3);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.5);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10% { transform: translateX(-2px); }
    20% { transform: translateX(2px); }
    30% { transform: translateX(-2px); }
    40% { transform: translateX(2px); }
    50% { transform: translateX(-1px); }
    60% { transform: translateX(1px); }
    70% { transform: translateX(-1px); }
    80% { transform: translateX(1px); }
    90% { transform: translateX(-1px); }
}

@media (max-width: 768px) {
    .battlefield {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        grid-template-columns: 1fr;
    }
    
    .game-stats {
        flex-direction: column;
        gap: 10px;
    }
}