body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #1a1a2e; /* Dark background fallback */
    color: #e0e0e0; /* Light text */
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Align to top, not center vertically */
    min-height: 100vh;
    box-sizing: border-box;

    /* Background Image for the whole page */
    background-image: url('TrueFlowTournamentCover.png');
    background-size: cover; /* Cover the entire viewport */
    background-position: center center; /* Center the image */
    background-attachment: fixed; /* Keep background fixed when scrolling */
    background-repeat: no-repeat; /* Do not repeat the image */
    background-blend-mode: luminosity; /* Adds a subtle blend effect */
    filter: brightness(0.95) contrast(1.1);
}

.container {
    background-color: #3a3a5a;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    padding: 30px;
    max-width: 1200px; /* Increased max-width */
    width: 100%;
    text-align: center;
    margin-bottom: 20px; /* Space from bottom of viewport */
}

h1 {
    color: #8c7ae6; /* Vibrant purple */
    text-shadow: 0 0 10px rgba(140, 122, 230, 0.7);
    margin-bottom: 30px;
    font-size: 2.5em;
    letter-spacing: 1.5px;
}

/* Universe Selection Tabs */
.universe-selection {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
    padding: 15px;
    background-color: #2a2a4a; /* Darker background for tabs */
    border-radius: 10px;
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.3);
}

.universe-tab {
    background-color: #555580; /* Slightly lighter purple */
    color: white;
    padding: 12px 20px;
    border: 2px solid transparent;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    min-width: 180px;
    flex-grow: 1;
    max-width: 250px;

    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.7);
    position: relative;
}

.universe-tab.has-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 25px;
    transition: background-color 0.3s ease;
}

.universe-tab.has-image:hover::before {
    background-color: rgba(0, 0, 0, 0.1);
}


.universe-tab:hover:not(.active) {
    background-color: #7070a0;
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.universe-tab.active {
    background-color: #8c7ae6;
    border-color: #c0c0e0;
    transform: translateY(-1px);
    box-shadow: 0 0 15px rgba(140, 122, 230, 0.7);
    color: #e0e0e0;
}

.universe-tab.active.has-image::before {
    background-color: rgba(0, 0, 0, 0.1);
}


/* Character Selection Area */
.character-selection-area {
    margin-top: 30px;
}

.character-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    justify-content: center;
    padding: 20px;
    background-color: #2a2a4a;
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.4);
}

.character-card {
    background-color: #4a4a6e;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.character-card:hover:not(.selected) {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
    background-color: #5a5a80;
}

.character-card.selected {
    border-color: #8c7ae6;
    box-shadow: 0 0 20px rgba(140, 122, 230, 0.7);
    transform: translateY(-2px);
    background-color: #555580;
}

.character-card img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 15px;
    border: 3px solid #8c7ae6;
    box-shadow: 0 0 10px rgba(140, 122, 230, 0.5);
}

.character-card h3 {
    color: #c0c0e0;
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.3em;
}

.character-card p {
    color: #b0b0d0;
    font-size: 0.9em;
    line-height: 1.4;
    margin-bottom: 5px;
}


/* Toggle Lore Button */
#toggle-lore-btn {
    background-color: #8c7ae6;
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    margin-top: 30px;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

#toggle-lore-btn:hover {
    background-color: #7a6ad0;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

/* Lore Section (PDF) */
.lore-section {
    background-color: #3a3a5a;
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.4);
    text-align: center;
    display: none; /* Hidden by default */
}

.lore-section h2 {
    color: #8c7ae6;
    margin-top: 0;
    margin-bottom: 10px;
    text-shadow: 0 0 8px rgba(140, 122, 230, 0.4);
}

#lore-pdf-frame {
    border: 1px solid #8c7ae6;
    border-radius: 5px;
}

/* Universe Lore Display */
.universe-lore-display {
    background-color: #3a3a5a;
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.4);
    text-align: center;
    display: none;
    border: 1px solid #8c7ae6;
}

.universe-lore-display h2 {
    color: #8c7ae6;
    margin-top: 0;
    margin-bottom: 10px;
    text-shadow: 0 0 8px rgba(140, 122, 230, 0.4);
}

.universe-lore-display p {
    color: #c0c0e0;
    font-size: 0.95em;
    line-height: 1.5;
}


/* Modal Styles (Character Details) */
.modal {
    display: none;
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: #3a3a5a;
    margin: auto;
    padding: 30px;
    border: 1px solid #8c7ae6;
    border-radius: 12px;
    width: 80%;
    max-width: 600px;
    position: relative;
    box-shadow: 0 0 25px rgba(140, 122, 230, 0.7);
    animation: fadeInScale 0.3s ease-out forwards;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-content h2 {
    color: #8c7ae6;
    text-align: center;
    margin-top: 0;
    margin-bottom: 20px;
}

.modal-content p, .modal-content ul {
    color: #c0c0e0;
    font-size: 1em;
    line-height: 1.6;
    margin-bottom: 10px;
    text-align: left;
}

.modal-content h3 {
    color: #a0a0ff;
    margin-top: 15px;
    margin-bottom: 8px;
    text-align: left;
}

.modal-content ul {
    list-style-type: disc;
    padding-left: 25px;
    margin-bottom: 20px;
}

.modal-content li {
    margin-bottom: 5px;
}

.close-button {
    color: #aaaaaa;
    float: right;
    font-size: 32px;
    font-weight: bold;
    position: absolute;
    top: 10px;
    right: 15px;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close-button:hover,
.close-button:focus {
    color: #e0e0e0;
    text-decoration: none;
}

#start-battle-modal-btn {
    display: block;
    width: 80%;
    margin: 20px auto 0;
    padding: 15px;
    background-color: #8c7ae6;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

#start-battle-modal-btn:hover:not(:disabled) {
    background-color: #7a6ad0;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

#start-battle-modal-btn:disabled {
    background-color: #5a5a7a;
    cursor: not-allowed;
    opacity: 0.6;
    box-shadow: none;
    transform: none;
}


/* Battle Page Specific Styles */
.battle-container {
    padding: 20px;
    max-width: 900px;
}

.battle-display {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-bottom: 30px;
    gap: 20px;
}

.battle-card {
    background-color: #4a4a6e;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    text-align: center;
    width: 45%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.battle-card h2 {
    color: #8c7ae6;
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.5em;
}

.battle-card .warrior-img {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 15px;
    border: 3px solid #8c7ae6;
    box-shadow: 0 0 15px rgba(140, 122, 230, 0.5);
}

.battle-card .warrior-name {
    color: #e0e0e0;
    font-size: 1.8em;
    margin-bottom: 10px;
}

.health-bar-container {
    width: 90%;
    background-color: #555;
    border-radius: 5px;
    height: 20px;
    margin-top: 10px;
    overflow: hidden;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.3);
}

.health-bar {
    height: 100%;
    width: 100%;
    background-color: #28a745; /* Green */
    border-radius: 5px;
    transition: width 0.5s ease-out, background-color 0.5s ease-out;
}

.health-text {
    color: #c0c0e0;
    font-size: 0.9em;
    margin-top: 5px;
    font-weight: bold;
}

.vs-text {
    font-size: 3em;
    color: #8c7ae6;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(140, 122, 230, 0.7);
}

/* Battle Controls and Log */
.battle-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
}

.battle-log {
    margin-top: 30px;
    background-color: #2a2a4a;
    border-radius: 10px;
    padding: 15px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.2);
    min-height: 150px;
    overflow-y: auto;
    max-height: 250px;
    text-align: left;
}

.battle-log h3 {
    color: #8c7ae6;
    text-align: center;
    margin-top: 0;
    margin-bottom: 10px;
}

.battle-log p {
    color: #d0d0e0;
    margin: 5px 0;
    font-size: 0.9em;
}

/* Battle Controls and Turn Display */
.battle-controls {
    text-align: center;
    margin-top: 20px;
    padding: 15px;
    background-color: #3a3a5a;
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

#turn-display {
    color: #a0a0ff;
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 10px;
    text-shadow: 0 0 5px rgba(160, 160, 255, 0.5);
}

.player-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    width: 100%;
    max-width: 600px;
}

.action-btn {
    background-color: #8c7ae6;
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    flex-grow: 1;
    min-width: 120px;
    max-width: 200px;
}

.action-btn:hover:not(:disabled) {
    background-color: #7a6ad0;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

.action-btn:disabled {
    background-color: #5a5a7a;
    cursor: not-allowed;
    opacity: 0.6;
    box-shadow: none;
    transform: none;
}

.ability-btn {
    background-color: #5cb85c; /* Greenish for abilities */
}

.ability-btn:hover:not(:disabled) {
    background-color: #4CAF50;
}

.signature-move-btn {
    background-color: #f0ad4e; /* Orange/Yellow for signature moves */
}

.signature-move-btn:hover:not(:disabled) {
    background-color: #f7a236;
}

/* Battle Display Adjustments for space */
.battle-display {
    margin-bottom: 20px;
}
