#party-defense-modal .modal-content {
    max-width: 1600px;
    width: 98%;
    height: 95vh;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#defense-lobby-view, #defense-game-view {
    flex-grow: 1;
    min-height: 0;
}

#defense-lobby-view {
    padding: 20px;
    overflow-y: auto;
}

#defense-game-view {
    display: flex;
    flex-direction: row;
    gap: 15px;
    overflow: hidden;
}

#defense-lobby-selection {
    margin-bottom: 20px;
}

.lobby-list-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
    max-height: 500px;
    overflow-y: auto;
}

.lobby-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background-color: var(--bg-color-light);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.lobby-info span {
    margin-right: 20px;
}

#defense-current-lobby {
    padding: 20px;
    background-color: var(--surface-color);
    border-radius: 8px;
}

#defense-lobby-players li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

#defense-game-area {
    position: relative;
    background-color: #2a2a2a;
    border: 2px solid var(--border-color);
    overflow: auto;
    flex-shrink: 0;
    cursor: crosshair;
    max-height: 100%;
}

#defense-canvas {
    display: block;
}

#defense-ui-panel {
    width: 420px;
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: var(--surface-color);
    border-radius: 8px;
    overflow: hidden;
}

.defense-tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    flex-shrink: 0;
    flex-wrap: wrap;
}

.defense-tab-button {
    flex-basis: calc(100% / 6);
    padding: 12px 0;
    background-color: var(--bg-color-light);
    border: none;
    color: var(--text-muted);
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    text-align: center;
}

.defense-tab-button:hover {
    background-color: var(--primary-color-dark);
    color: white;
}

.defense-tab-button.active {
    background-color: var(--primary-color);
    color: white;
}

.defense-tab-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 15px;
    display: none;
}

.defense-panel {
    margin-bottom: 15px;
    flex-shrink: 0;
}

.defense-panel h3 {
    margin-bottom: 10px;
    color: var(--secondary-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.defense-control-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

#defense-ui-panel button {
    width: 100%;
    padding: 12px;
    font-size: 1em;
    cursor: pointer;
    border: none;
    border-radius: 6px;
    color: white;
    transition: opacity 0.2s;
    font-weight: bold;
}

#defense-ui-panel button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#defense-ui-panel button.primary { background-color: var(--primary-color); }
#defense-ui-panel button.success { background-color: var(--success-color); }
#defense-ui-panel button.danger { background-color: var(--fail-color); }
#defense-ui-panel button.warning { background-color: #f0ad4e; }


#defense-unit-info-panel {
    display: flex;
    flex-direction: column;
}

#defense-unit-details {
    margin-bottom: 15px;
    line-height: 1.6;
    flex-grow: 1;
}

#defense-enemy-details, #defense-synergy-details, #defense-artifacts-details {
     line-height: 1.6;
}

.unit-stat-name {
    font-weight: bold;
    color: var(--text-muted);
}

.unit-ability {
    color: var(--secondary-color);
    font-style: italic;
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px solid var(--border-color);
}

.defense-action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

#defense-evolve-btn, #defense-sell-btn {
    flex: 1;
}

#defense-gold-info {
    color: var(--gold-color);
    font-weight: bold;
    font-size: 1.1em;
}

.defense-upgrade-section {
    margin-bottom: 25px;
}

.defense-upgrade-section h4 {
    margin-bottom: 10px;
    font-size: 1.1em;
}

#defense-ui-panel button.upgrade-attack {
    background-color: #d9534f;
}

#defense-ui-panel button.upgrade-speed {
    background-color: #5bc0de;
}

.player-sidebar-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.player-sidebar-item {
    border-bottom: 1px solid var(--border-color);
    padding: 8px 0;
}

.player-sidebar-item:last-child {
    border-bottom: none;
}

.player-sidebar-item h4 {
    font-size: 1em;
    margin-bottom: 4px;
    color: var(--text-color);
}

.player-sidebar-item.self h4 {
    color: var(--success-color);
    font-weight: bold;
}

.player-sidebar-item p {
    font-size: 0.8em;
    color: var(--text-muted);
    margin: 2px 0;
}

.research-category-section {
    margin-bottom: 25px;
}

.research-category-section h4 {
    margin-bottom: 15px;
    font-size: 1.2em;
}

.research-tech-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.research-tech-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background-color: var(--bg-color-light);
    border-radius: 6px;
}

.research-info {
    display: flex;
    flex-direction: column;
}

.research-name {
    font-weight: bold;
    color: var(--text-color);
}

.research-level {
    font-size: 0.8em;
    color: var(--text-muted);
}

.research-btn {
    width: auto !important;
    padding: 8px 15px !important;
    font-size: 0.9em !important;
}

.combination-recipe {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    background-color: var(--bg-color-light);
}

.combination-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.combination-header h4 {
    margin: 0;
    font-size: 1.1em;
}

.combination-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ingredients-list {
    flex: 1;
    margin-right: 15px;
}

.ingredient-item {
    margin-bottom: 5px;
    font-size: 0.9em;
}

.ingredient-missing {
    text-decoration: line-through;
    opacity: 0.5;
}

.ingredient-present {
    font-weight: bold;
}

.combination-action {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.combination-cost {
    font-weight: bold;
    color: var(--gold-color);
    margin-bottom: 10px;
}

#defense-ui-panel button.combine-btn {
    background-color: var(--mystic-color);
    width: auto !important;
    padding: 8px 15px !important;
}

.artifact-modal-content {
    max-width: 800px;
    width: 80%;
    padding: 30px;
}

#defense-artifact-options-container {
    display: flex;
    justify-content: space-around;
    gap: 20px;
    margin-top: 20px;
}

.artifact-option {
    flex: 1;
    padding: 20px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    background-color: var(--bg-color-light);
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
    text-align: center;
}

.artifact-option:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
}

.artifact-name {
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 10px;
}

.artifact-rarity {
    font-size: 0.9em;
    font-style: italic;
    margin-bottom: 15px;
}

.artifact-description {
    font-size: 1em;
    color: var(--text-muted);
}

.artifact-item {
    padding: 5px 0;
    border-bottom: 1px solid var(--border-color-light);
}

.artifact-item:last-child {
    border-bottom: none;
}

#defense-game-area {
    /* Override previous background color for better aesthetics */
    background-color: #1e1e2e; 
}

.defense-rarity-select-btn {
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.1s;
    font-size: 0.85em;
    font-weight: bold;
    border: 1px solid transparent;
}

.defense-rarity-select-btn:hover {
    transform: scale(1.05);
}