/* Ad.Universe Adventure Styles */
.ad-universe-btn {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7b2cbf, #3a0ca3);
    color: white;
    border: none;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(90, 24, 154, 0.6);
    z-index: 1000;
    transition: all 0.3s ease;
}

.ad-universe-btn:hover {
    transform: translateY(-3px) scale(1.1);
    box-shadow: 0 6px 20px rgba(90, 24, 154, 0.8);
}

/* Character Selection UI */
.universe-character-selection {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 800px;
    max-height: 80vh;
    background: linear-gradient(to bottom, rgba(15, 12, 41, 0.95), rgba(48, 43, 99, 0.95));
    border-radius: 15px;
    z-index: 1200;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from { transform: translate(-50%, -50%) scale(0.8); opacity: 0; }
    to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.selection-header {
    background: rgba(36, 0, 70, 0.8);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.selection-header h2 {
    color: var(--secondary);
    margin: 0;
    font-size: 1.4rem;
}

.close-selection-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
}

.selection-characters-grid {
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 15px;
    overflow-y: auto;
    max-height: 60vh;
}

.selection-character-card {
    background: rgba(36, 0, 70, 0.6);
    border-radius: 10px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.selection-character-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
}

.selection-character-image {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    overflow: hidden;
    margin-bottom: 10px;
    border: 3px solid var(--primary);
}

.selection-character-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.selection-character-name {
    font-weight: bold;
    margin-bottom: 5px;
    text-align: center;
}

.selection-character-tier {
    font-size: 0.8rem;
    color: var(--secondary);
}

.no-characters-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: rgba(255, 255, 255, 0.8);
}

/* Main Adventure UI */
.ad-universe-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: fadeIn 0.3s ease-in;
}

.universe-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(15, 12, 41, 0.8);
    border-bottom: 1px solid var(--card-border);
}

.universe-title {
    color: var(--secondary);
    margin: 0;
    font-size: 1.6rem;
    text-shadow: 0 0 10px rgba(255, 158, 0, 0.3);
}

.ui-mode-buttons {
    display: flex;
    gap: 10px;
}

.immersive-mode-btn, .compact-mode-btn {
    background: rgba(36, 0, 70, 0.7);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.immersive-mode-btn:hover, .compact-mode-btn:hover {
    background: rgba(123, 44, 191, 0.7);
    transform: scale(1.1);
}

.exit-universe-btn {
    background: linear-gradient(to right, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 50px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(90, 24, 154, 0.4);
}

.exit-universe-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(90, 24, 154, 0.6);
}

.universe-status-bar {
    display: flex;
    justify-content: space-between;
    padding: 12px 20px;
    background: rgba(36, 0, 70, 0.7);
    border-bottom: 1px solid var(--card-border);
    position: relative;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.universe-status-bar.fade-out {
    opacity: 0.5;
}

.toggle-status-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.3);
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    z-index: 5;
}

.toggle-status-btn:hover {
    background: rgba(0, 0, 0, 0.5);
}

.collapsed-status-bar {
    display: flex;
    justify-content: center;
    padding: 5px;
    background: rgba(36, 0, 70, 0.5);
    border-bottom: 1px solid var(--card-border);
}

.show-status-btn {
    background: rgba(0, 0, 0, 0.3);
    color: white;
    border: none;
    width: 30px;
    height: 24px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
}

.show-status-btn:hover {
    background: rgba(0, 0, 0, 0.5);
}

.hidden {
    display: none;
}

.character-name {
    font-weight: bold;
    font-size: 1.1rem;
    color: var(--secondary);
    margin-bottom: 5px;
}

.character-location {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
}

.character-stats {
    display: flex;
    gap: 15px;
}

.stat-item {
    min-width: 80px;
}

.stat-label {
    font-size: 0.9rem;
    margin-bottom: 3px;
}

.stat-bar {
    height: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
    overflow: hidden;
}

.stat-fill {
    height: 100%;
    transition: width 0.5s ease;
}

.health-fill {
    background: linear-gradient(to right, #f44336, #ff7043);
}

.energy-fill {
    background: linear-gradient(to right, #2196f3, #03a9f4);
}

.rep-fill {
    background: linear-gradient(to right, #4CAF50, #8BC34A);
}

.stat-text {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 3px;
}

.universe-main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.universe-messages-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: calc(100vh - 240px);
}

.universe-side-panel {
    width: 250px;
    background: rgba(15, 12, 41, 0.6);
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--card-border);
    overflow: hidden;
}

.side-panel-tabs {
    display: flex;
    border-bottom: 1px solid var(--card-border);
}

.side-tab {
    flex: 1;
    background: none;
    border: none;
    padding: 10px;
    color: var(--light);
    cursor: pointer;
    transition: all 0.2s ease;
}

.side-tab.active {
    background: rgba(123, 44, 191, 0.3);
    color: var(--secondary);
    font-weight: bold;
}

.side-panel-section {
    padding: 15px;
    display: none;
    overflow-y: auto;
    flex: 1;
}

.side-panel-section.active {
    display: block;
}

.side-panel-section h3 {
    color: var(--secondary);
    margin: 0 0 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 5px;
}

.inventory-list, .quests-list, .companions-list {
    list-style: none;
    padding: 0;
}

.inventory-list li {
    background: rgba(36, 0, 70, 0.5);
    padding: 10px;
    margin-bottom: 5px;
    border-radius: 5px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.inventory-list li:hover {
    background: rgba(123, 44, 191, 0.3);
}

.quests-list li, .companions-list li {
    background: rgba(36, 0, 70, 0.5);
    padding: 10px;
    margin-bottom: 5px;
    border-radius: 5px;
    font-size: 0.9rem;
}

.quest-title {
    font-weight: bold;
    margin-bottom: 5px;
    color: var(--secondary);
}

.quest-description {
    font-size: 0.8rem;
}

.universe-choices-container {
    padding: 20px;
    background: rgba(15, 12, 41, 0.8);
    border-top: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.universe-choice-btn {
    background: rgba(36, 0, 70, 0.7);
    color: white;
    border: 1px solid var(--card-border);
    border-radius: 5px;
    padding: 12px 15px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
}

.universe-choice-btn:hover {
    background: rgba(123, 44, 191, 0.4);
    transform: translateY(-2px);
}

.universe-loading {
    text-align: center;
    padding: 15px;
    font-style: italic;
    color: rgba(255, 255, 255, 0.7);
}

.universe-message {
    padding: 12px 15px;
    border-radius: 8px;
    animation: messageAppear 0.3s ease;
    max-width: 80%;
}

@keyframes messageAppear {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.narrator-message {
    background: rgba(36, 0, 70, 0.5);
    align-self: center;
    width: 90%;
}

.player-message {
    background: rgba(123, 44, 191, 0.4);
    align-self: flex-end;
}

.chapter-message {
    background: rgba(255, 158, 0, 0.3);
    align-self: center;
    width: 90%;
    padding: 15px 20px;
    border-left: 5px solid var(--secondary);
    border-right: 5px solid var(--secondary);
    text-align: center;
    animation: chapterReveal 0.8s ease;
}

.chapter-header h3 {
    font-size: 1.5rem;
    color: var(--secondary);
    text-shadow: 0 0 10px rgba(255, 158, 0, 0.3);
    margin: 0;
}

@keyframes chapterReveal {
    0% { opacity: 0; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.05); }
    100% { transform: scale(1); }
}

.encounter-message-content,
.system-message-content,
.reward-message-content,
.quest-message-content,
.location-message-content,
.lore-message-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.encounter-icon,
.system-icon,
.reward-icon,
.quest-icon,
.location-icon,
.lore-icon {
    font-size: 1.3rem;
}

.encounter-message {
    background: rgba(244, 67, 54, 0.2);
    align-self: center;
    width: 80%;
    border-left: 3px solid #f44336;
}

.system-message {
    background: rgba(33, 150, 243, 0.2);
    align-self: center;
    width: 70%;
    border-left: 3px solid #2196f3;
}

.reward-message {
    background: rgba(255, 193, 7, 0.2);
    align-self: center;
    width: 60%;
    border-left: 3px solid #ffc107;
}

.quest-message {
    background: rgba(156, 39, 176, 0.2);
    align-self: center;
    width: 75%;
    border-left: 3px solid #9c27b0;
}

.location-message {
    background: rgba(76, 175, 80, 0.2);
    align-self: center;
    width: 60%;
    border-left: 3px solid #4caf50;
}

.lore-message {
    background: rgba(121, 85, 72, 0.2);
    align-self: center;
    width: 85%;
    border-left: 3px solid #795548;
}

.message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.message-sender {
    font-weight: bold;
    font-size: 0.9rem;
    color: var(--secondary);
}

.universe-message p {
    margin: 0;
    line-height: 1.5;
}

/* Message size in different modes */
.immersive-mode .narrator-message {
    width: 100%;
    font-size: 1.1rem;
    line-height: 1.6;
    background: rgba(36, 0, 70, 0.8);
    padding: 20px;
}

.compact-mode .universe-message {
    padding: 8px 12px;
    font-size: 0.9rem;
}

.compact-mode .universe-messages-container {
    gap: 8px;
}

/* Interface Mode Styles */
.immersive-mode .universe-side-panel,
.immersive-mode .universe-status-bar,
.immersive-mode .collapsed-status-bar,
.immersive-mode .universe-header {
    display: none;
}

.immersive-mode .universe-messages-container {
    max-height: calc(100vh - 80px);
}

.restore-interface-btn {
    position: fixed;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(123, 44, 191, 0.7);
    color: white;
    border: none;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1010;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.restore-interface-btn:hover {
    background: rgba(123, 44, 191, 0.9);
    transform: scale(1.1);
}

.compact-mode .universe-side-panel {
    width: 200px;
}

.compact-mode .stat-item {
    min-width: 60px;
}

/* Mobile optimization */
@media (max-width: 768px) {
    .universe-main-content {
        flex-direction: column;
    }
    
    .universe-side-panel {
        width: 100%;
        max-height: 150px;
        border-left: none;
        border-top: 1px solid var(--card-border);
    }
    
    .character-stats {
        flex-direction: column;
        gap: 5px;
    }
    
    .stat-item {
        min-width: auto;
        display: flex;
        align-items: center;
        gap: 10px;
    }
    
    .universe-message {
        max-width: 90%;
    }
    
    .universe-status-bar {
        flex-direction: column;
        gap: 10px;
    }
    
    .universe-character-selection {
        width: 95%;
    }
}