* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    max-width: 1400px;
    width: 100%;
}

header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

header h1 {
    font-size: 3.5em;
    margin-bottom: 10px;
    letter-spacing: 3px;
}

.tagline {
    font-size: 1.2em;
    opacity: 0.9;
}

.screen {
    display: none;
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: slideIn 0.3s ease-out;
}

.screen.active {
    display: block;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #667eea;
    font-size: 2.5em;
}

/* Agent Selection Grid */
.agent-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.agent-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 3px solid transparent;
}

.agent-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.agent-card.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.agent-card canvas {
    width: 128px;
    height: 128px;
    margin: 0 auto 15px;
    image-rendering: pixelated;
    border-radius: 10px;
}

.agent-card h3 {
    font-size: 1.3em;
    margin-bottom: 10px;
}

.agent-card .role {
    font-size: 0.9em;
    opacity: 0.8;
    margin-bottom: 10px;
}

.agent-card .specialty {
    font-size: 0.85em;
    font-style: italic;
    opacity: 0.7;
}

/* Buttons */
.btn-primary, .btn-secondary {
    display: block;
    width: 100%;
    max-width: 400px;
    margin: 20px auto;
    padding: 15px 30px;
    font-size: 1.2em;
    font-weight: bold;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.6);
}

.btn-secondary {
    background: #f5f7fa;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-secondary:hover {
    background: #667eea;
    color: white;
}

/* Tournament Bracket */
.bracket-container {
    display: flex;
    justify-content: space-around;
    gap: 30px;
    margin-bottom: 30px;
    overflow-x: auto;
    padding: 20px;
}

.bracket-round {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    min-width: 200px;
}

.bracket-round h3 {
    text-align: center;
    margin-bottom: 20px;
    color: #667eea;
}

.bracket-match {
    background: #f5f7fa;
    border-radius: 10px;
    padding: 15px;
    margin: 10px 0;
    border: 2px solid #ddd;
}

.bracket-match.winner {
    border-color: #ffd700;
    background: linear-gradient(135deg, #fff9e6 0%, #ffe6b3 100%);
}

.bracket-fighter {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    margin: 5px 0;
    background: white;
    border-radius: 5px;
}

.bracket-fighter canvas {
    width: 32px;
    height: 32px;
    image-rendering: pixelated;
}

.bracket-fighter.winner {
    font-weight: bold;
    background: #ffd700;
}

/* Battle Arena */
.battle-arena {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
    align-items: start;
}

.fighter {
    text-align: center;
}

.fighter-avatar {
    width: 160px;
    height: 160px;
    margin: 0 auto 20px;
    position: relative;
}

.fighter-avatar canvas {
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
}

.fighter-left .fighter-avatar {
    animation: bounceLeft 2s ease-in-out infinite;
}

.fighter-right .fighter-avatar {
    animation: bounceRight 2s ease-in-out infinite;
}

@keyframes bounceLeft {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(-10px); }
}

@keyframes bounceRight {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(10px); }
}

.fighter h3 {
    font-size: 1.5em;
    color: #667eea;
    margin-bottom: 15px;
}

.health-bar {
    width: 100%;
    height: 30px;
    background: #ddd;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 15px;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.2);
}

.health-fill {
    height: 100%;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    transition: width 0.5s ease;
    width: 100%;
}

.stats {
    text-align: left;
    font-size: 0.9em;
    color: #666;
}

.stats div {
    margin: 5px 0;
}

/* Battle Log */
.battle-log {
    background: #f5f7fa;
    border-radius: 15px;
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.battle-title {
    text-align: center;
    font-size: 1.5em;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 20px;
}

.battle-messages {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.battle-message {
    padding: 10px 15px;
    border-radius: 10px;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.battle-message.attack {
    background: #ffe6e6;
    border-left: 4px solid #ff6b6b;
}

.battle-message.critical {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    font-weight: bold;
}

.battle-message.miss {
    background: #e6e6e6;
    border-left: 4px solid #999;
    opacity: 0.7;
}

.battle-message.victory {
    background: #d4edda;
    border-left: 4px solid #28a745;
    text-align: center;
    font-weight: bold;
    font-size: 1.2em;
}

/* Attack Buttons */
.attack-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.attack-btn {
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.attack-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.5);
}

.attack-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.attack-btn .damage {
    display: block;
    font-size: 0.8em;
    opacity: 0.9;
}

/* Victory Screen */
.victory-content {
    text-align: center;
}

.champion-avatar {
    width: 200px;
    height: 200px;
    margin: 30px auto;
    animation: victory-pulse 2s ease-in-out infinite;
}

@keyframes victory-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.champion-avatar canvas {
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(255, 215, 0, 0.6);
}

#champion-name {
    font-size: 2.5em;
    color: #ffd700;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
    margin-bottom: 20px;
}

#champion-quote {
    font-size: 1.3em;
    font-style: italic;
    color: #666;
    margin-bottom: 30px;
}

.share-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.share-buttons button {
    width: auto;
    margin: 0;
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 2em;
    }

    .battle-arena {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .bracket-container {
        flex-direction: column;
    }

    .agent-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}
