/* Tier System Button Styles */
.tier-system-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: linear-gradient(to right, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 50px;
    padding: 8px 15px;
    font-size: 0.9rem;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

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

/* Popup Styles */
.tier-system-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 800px;
    height: 80%;
    max-height: 700px;
    background: var(--dark);
    border-radius: 15px;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    resize: both;
    min-width: 300px;
    min-height: 300px;
}

.tier-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--primary-dark);
    border-bottom: 1px solid var(--card-border);
}

.tier-popup-header h3 {
    margin: 0;
    color: white;
}

.tier-popup-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.tier-popup-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.tiers-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.tier-item {
    background: rgba(15, 12, 41, 0.6);
    border-radius: 10px;
    padding: 15px;
    border: 1px solid var(--card-border);
}

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

.tier-name {
    font-weight: bold;
    font-size: 1.1rem;
}

.tier-level {
    font-size: 0.9rem;
    opacity: 0.7;
}

.tier-description {
    margin-bottom: 10px;
    font-size: 0.9rem;
    font-style: italic;
}

.tier-characters {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 10px;
    margin-top: 5px;
    min-height: 30px;
}

.tier-character-item {
    display: inline-block;
    background: rgba(123, 44, 191, 0.3);
    border-radius: 15px;
    padding: 3px 10px;
    margin: 3px;
    font-size: 0.8rem;
}

/* Tier coloring */
.tier-cosmic {
    border-left: 5px solid #ff00ff;
    background: linear-gradient(to right, rgba(255, 0, 255, 0.2), rgba(15, 12, 41, 0.6));
}

.tier-divine {
    border-left: 5px solid #ffcc00;
    background: linear-gradient(to right, rgba(255, 204, 0, 0.2), rgba(15, 12, 41, 0.6));
}

.tier-universal {
    border-left: 5px solid #00ccff;
    background: linear-gradient(to right, rgba(0, 204, 255, 0.2), rgba(15, 12, 41, 0.6));
}

.tier-planetary {
    border-left: 5px solid #00ff99;
    background: linear-gradient(to right, rgba(0, 255, 153, 0.2), rgba(15, 12, 41, 0.6));
}

.tier-city {
    border-left: 5px solid #ff5e62;
    background: linear-gradient(to right, rgba(255, 94, 98, 0.2), rgba(15, 12, 41, 0.6));
}

.tier-street {
    border-left: 5px solid #7b2cbf;
    background: linear-gradient(to right, rgba(123, 44, 191, 0.2), rgba(15, 12, 41, 0.6));
}

.tier-human {
    border-left: 5px solid #808080;
    background: linear-gradient(to right, rgba(128, 128, 128, 0.2), rgba(15, 12, 41, 0.6));
}

.resize-handle {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 20px;
    height: 20px;
    background: var(--primary-dark);
    cursor: nwse-resize; /* Show resize cursor */
    border-top-left-radius: 5px;
}

/* Ensure tier system button is visible in all modes */
.story-mode-container .tier-system-button,
.battle-mode-container .tier-system-button {
    z-index: 1500;
}

/* Mobile optimization */
@media (max-width: 768px) {
    .tier-system-popup {
        width: 95%;
        height: 80%;
        top: 10%;
        transform: translateX(-50%);
    }
    
    .tier-system-button {
        bottom: 70px;
    }
}