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

body {
    font-family: 'Space Mono', monospace;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    color: #ffffff;
    min-height: 100vh;
    overflow-x: hidden;
}

#gameContainer {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

.phase {
    display: none;
    animation: fadeIn 0.5s ease-in-out;
}

.phase.active {
    display: block;
}

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

/* Selection Phase */
.phase-header {
    text-align: center;
    margin-bottom: 30px;
}

.phase-header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.selection-counter {
    font-size: 1.2rem;
    color: #4ecdc4;
    font-weight: bold;
}

.character-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
    max-height: 60vh;
    overflow-y: auto;
    padding: 20px;
    border: 2px solid #333;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.3);
}

.character-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    border: 2px solid #444;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.05);
}

.character-card:hover {
    border-color: #4ecdc4;
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(78, 205, 196, 0.3);
}

.character-card.selected {
    border-color: #ff6b6b;
    background: rgba(255, 107, 107, 0.2);
    transform: scale(1.05);
}

.character-card img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 10px;
    border-radius: 5px;
}

.character-card span {
    font-size: 0.8rem;
    text-align: center;
    font-weight: bold;
}

.start-battle-btn {
    display: block;
    margin: 0 auto;
    padding: 15px 40px;
    font-size: 1.2rem;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    background: linear-gradient(45deg, #4ecdc4, #44a08d);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Space Mono', monospace;
}

.start-battle-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(78, 205, 196, 0.4);
}

.start-battle-btn:disabled {
    background: #666;
    cursor: not-allowed;
}

/* Battle Phase */
.battle-header {
    text-align: center;
    margin-bottom: 20px;
}

.battle-header h2 {
    font-size: 2rem;
    color: #ff6b6b;
}

.battle-field {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
}

.enemy-section {
    flex: 1;
    display: flex;
    justify-content: center;
}

.enemy-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    border: 3px solid #ff6b6b;
    border-radius: 15px;
    background: rgba(255, 107, 107, 0.1);
    animation: pulse 2s infinite;
}

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

.enemy-image {
    width: 150px;
    height: 150px;
    object-fit: contain;
    margin-bottom: 15px;
    border-radius: 10px;
}

.enemy-info h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    text-align: center;
}

.health-bar {
    width: 200px;
    height: 20px;
    background: #333;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    border: 2px solid #555;
}

.health-fill {
    height: 100%;
    transition: width 0.5s ease;
    border-radius: 8px;
}

.enemy-health {
    background: linear-gradient(90deg, #ff6b6b, #ff8e8e);
}

.player-health {
    background: linear-gradient(90deg, #4ecdc4, #6ee8dd);
}

.health-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.8rem;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.team-section {
    flex: 1;
    display: flex;
    justify-content: center;
}

.player-team {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.team-member {
    display: flex;
    align-items: center;
    padding: 15px;
    border: 2px solid #4ecdc4;
    border-radius: 10px;
    background: rgba(78, 205, 196, 0.1);
    transition: all 0.3s ease;
}

.team-member.active {
    border-color: #ffd93d;
    background: rgba(255, 217, 61, 0.2);
    transform: scale(1.05);
}

.team-member.defeated {
    opacity: 0.5;
    border-color: #666;
    background: rgba(102, 102, 102, 0.1);
}

.team-member img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    margin-right: 15px;
    border-radius: 5px;
}

.member-info {
    flex: 1;
}

.member-info h4 {
    margin-bottom: 5px;
    font-size: 1rem;
}

.action-panel {
    background: rgba(0, 0, 0, 0.5);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    border: 2px solid #333;
}

.current-turn {
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 15px;
    color: #ffd93d;
}

.action-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
}

.action-btn {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Space Mono', monospace;
}

.action-btn.attack {
    background: linear-gradient(45deg, #ff6b6b, #ee5a5a);
    color: white;
}

.action-btn.item {
    background: linear-gradient(45deg, #4ecdc4, #44a08d);
    color: white;
}

.action-btn.defend {
    background: linear-gradient(45deg, #ffd93d, #ffc107);
    color: #333;
}

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

.action-btn:disabled {
    background: #666;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.item-panel {
    margin-top: 15px;
    padding: 15px;
    border: 2px solid #4ecdc4;
    border-radius: 10px;
    background: rgba(78, 205, 196, 0.1);
}

.item-panel.hidden {
    display: none;
}

.item-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.item-btn {
    padding: 8px 15px;
    border: 2px solid #666;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Space Mono', monospace;
}

.item-btn:hover {
    border-color: #4ecdc4;
    background: rgba(78, 205, 196, 0.2);
}

.battle-log {
    background: rgba(0, 0, 0, 0.7);
    border-radius: 10px;
    padding: 15px;
    border: 2px solid #333;
    max-height: 200px;
    overflow-y: auto;
}

.battle-messages {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.battle-message {
    padding: 8px 12px;
    border-radius: 5px;
    font-size: 0.9rem;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

.battle-message.player {
    background: rgba(78, 205, 196, 0.2);
    border-left: 4px solid #4ecdc4;
}

.battle-message.enemy {
    background: rgba(255, 107, 107, 0.2);
    border-left: 4px solid #ff6b6b;
}

.battle-message.system {
    background: rgba(255, 217, 61, 0.2);
    border-left: 4px solid #ffd93d;
}

/* Result Phase */
.result-content {
    text-align: center;
    padding: 50px 20px;
}

.result-content h2 {
    font-size: 3rem;
    margin-bottom: 20px;
}

.result-content p {
    font-size: 1.2rem;
    margin-bottom: 30px;
    color: #ccc;
}

.play-again-btn {
    padding: 15px 40px;
    font-size: 1.2rem;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    background: linear-gradient(45deg, #4ecdc4, #44a08d);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Space Mono', monospace;
}

.play-again-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(78, 205, 196, 0.4);
}

.cheat-panel {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.cheat-input {
    padding: 8px 15px;
    border: 2px solid #333;
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-family: 'Space Mono', monospace;
    font-size: 0.9rem;
    width: 200px;
}

.cheat-input:focus {
    outline: none;
    border-color: #4ecdc4;
}

.cheat-btn {
    padding: 8px 15px;
    border: 2px solid #4ecdc4;
    border-radius: 5px;
    background: rgba(78, 205, 196, 0.2);
    color: white;
    cursor: pointer;
    font-family: 'Space Mono', monospace;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.cheat-btn:hover {
    background: rgba(78, 205, 196, 0.4);
}

/* Responsive Design */
@media (max-width: 768px) {
    .battle-field {
        flex-direction: column;
        gap: 20px;
    }
    
    .character-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 10px;
    }
    
    .action-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .action-btn {
        width: 100%;
        max-width: 200px;
    }
}