* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #1a1a2e;
    min-height: 100vh;
    padding: 15px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

h1 {
    text-align: center;
    color: #fcfcfc;
    margin-bottom: 20px;
    font-size: 1.8em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.upload-section {
    background: #2a2a3e;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    margin-bottom: 20px;
    text-align: center;
}

.file-input-wrapper {
    position: relative;
    display: inline-block;
    cursor: pointer;
    margin-bottom: 15px;
}

.file-input-wrapper input[type=file] {
    position: absolute;
    left: -9999px;
}

.file-input-label {
    display: inline-block;
    padding: 12px 24px;
    background: #425974;
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: transform 0.2s;
}

.file-input-label:hover {
    background: #3a5a7e;
    transform: scale(1.1);
}

.file-name {
    display: block;
    margin-top: 10px;
    color: #bebebe;
    font-size: 14px;
}

.help-button {
    margin-left: 10px;
    padding: 12px 24px;
    background: #425974;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: transform 0.2s;
}

.help-button:hover {
    background: #3a5a7e;
    transform: scale(1.1);
}

.help-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    overflow: auto;
}

.help-overlay.active {
    display: flex;
}

.help-overlay.zoomed {
    display: block;
}

.help-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    background: #1a1a2e;
    border-radius: 8px;
    padding: 20px;
}

.help-content.zoomed {
    max-width: none;
    max-height: none;
    width: fit-content;
    margin: 20px auto;
}

.help-image {
    max-width: 100%;
    max-height: 80vh;
    display: block;
    cursor: zoom-in;
    transition: all 0.3s ease;
}

.help-image.zoomed {
    max-width: none;
    max-height: none;
    width: auto;
    height: auto;
    cursor: zoom-out;
}

.close-help {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    z-index: 10;
}

.close-help:hover {
    background: #c0392b;
}

.guilds-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.guild-column {
    background: #2a2a3e;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.guild-header {
    text-align: center;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 1.2em;
    font-weight: bold;
    color: white;
}

.guild-1 .guild-header {
    background: #6c757d;
}

.guild-2 .guild-header {
    background: #6c757d;
}

.unassigned .guild-header {
    background: #5a5a6e;
}

.player-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.unassigned .player-list {
    grid-template-columns: 1fr 1fr 1fr 1fr;
}

.player-card {
    background: #3a3a4e;
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 6px;
    cursor: default;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.player-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(74, 158, 255, 0.3);
    border-color: #4a9eff;
}

.player-card.dragging {
    opacity: 0.5;
}

.player-card.drag-over {
    border-color: #667eea;
    background: #e9ecef;
}

.player-name {
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 4px;
    color: #fcfcfc;
}

.player-stats {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    gap: 4px;
    color: #fcfcfc;
}

.battlecard {
    display: grid;
    grid-template-columns: auto 1fr 1fr 1fr;
    gap: 2px 6px;
    align-items:center;
    flex-direction: column;
    justify-content: space-between;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #fcfcfc;
}

.tokens-remaining {
    color: #c2b11d;
    font-weight: bold;
}

.att-score {
    color: #1d9be4;
    font-weight: bold;
}

.avg-def {
    color: #f54933;
    font-weight: bold;
}

.tokens-used {
    color: #dc3545;
}

.stats-section {
    background: #2a2a3e;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    margin-bottom: 20px;
}

.stats-section h2 {
    color: #fcfcfc;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    column-gap: 15px;
    row-gap: 20px;
}

.stat-card {
    background: #3a3a4e;
    color: #fcfcfc;
    padding: 12px;
    border-radius: 6px;
    text-align: center;
}

.stat-value {
    font-size: 1.5em;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-label {
    color: #fcfcfc;
    font-size: 0.8em;
    opacity: 0.9;
}

.stat-hit-text {
    color: #fcfcfc;
}

.empty-state {
    text-align: center;
    color: #999;
    padding: 40px;
    font-size: 18px;
}

.team-card {
    background: #46556e;
    padding: 8px 12px;
    margin: 4px 0;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.team-card.clickable {
    cursor: pointer;
}

.team-name {
    font-weight: bold;
}

.team-count {
    background: #3a3a4e;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.9em;
}

.team-comp-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.team-expand-arrow {
    display: inline-block;
    width: 12px;
}

.team-variant-container {
    display: none;
    margin-left: 20px;
}

.team-variant-card {
    background: #46556e;
    padding: 6px 10px;
    margin: 4px 0;
    border-radius: 3px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.0em;
}

.team-variant-count {
    background: #3a3a4e;
    padding: 2px 6px;
    border-radius: 2px;
    font-size: 0.9em;
}

.team-show-more-btn {
    width: 100%;
    padding: 6px;
    margin-top: 8px;
    background: #444;
    border: none;
    border-radius: 4px;
    color: #fbbf24;
    cursor: pointer;
    font-size: 0.9em;
}

.team-show-more-btn:hover {
    background: #555;
}

.team-no-teams {
    color: #888;
}

.team-icons {
    display: flex;
    gap: 2px;
    margin: 2px 0;
    flex-wrap: wrap;
}

.unit-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #444;
}

.no-icons {
    font-size: 0.9em;
    color: #888;
    font-style: italic;
}

.variant-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }

@media (max-width: 768px) {
    body {
        padding: 8px;
    }

    .guilds-container {
        grid-template-columns: 1fr;
    }

    .player-list {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 1.3em;
    }

    .help-button {
        margin-left: 0;
        margin-top: 10px;
        display: block;
    }

    .team-comp-grid {
        grid-template-columns: 1fr;
    }

    .span-2, .span-3, .span-4 { grid-column: span 1; }
}