/* Story Mode Styles */
.story-mode-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;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.story-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);
}

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

.exit-story-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-story-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(90, 24, 154, 0.6);
}

.story-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;
}

.story-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: 100px;
}

.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);
}

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

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

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

.story-side-panel {
    width: 250px;
    background: rgba(15, 12, 41, 0.6);
    padding: 15px;
    border-left: 1px solid var(--card-border);
    overflow-y: auto;
}

.inventory-section, .companions-section {
    margin-bottom: 20px;
}

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

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

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

.story-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;
}

.npc-message {
    background: rgba(255, 158, 0, 0.2);
    align-self: flex-start;
}

.battle-message {
    background: rgba(244, 67, 54, 0.2);
    align-self: center;
    width: 80%;
}

.system-message {
    background: rgba(33, 150, 243, 0.2);
    align-self: center;
    width: 70%;
}

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

.message-sender {
    font-weight: bold;
    font-size: 0.9rem;
}

.battle-message-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.battle-icon {
    font-size: 1.5rem;
}

.system-message-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.system-icon {
    font-size: 1.2rem;
}

.story-message p {
    margin: 0;
}

.story-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;
}

.story-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;
}

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

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

.story-mode-btn {
    background: linear-gradient(to right, #ff9e00, #ff5e62);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 50px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 94, 98, 0.4);
}

.story-mode-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 94, 98, 0.6);
}

.chat-only-mode .story-status-bar,
.chat-only-mode .collapsed-status-bar,
.chat-only-mode .story-side-panel,
.chat-only-mode .story-header {
    display: none;
}

.chat-only-mode .story-messages-container {
    max-height: calc(100vh - 100px);
}

.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);
}

.minimize-chat-btn {
    background: rgba(36, 0, 70, 0.7);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 50px;
    margin-right: 10px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.minimize-chat-btn:hover {
    background: rgba(36, 0, 70, 0.9);
}

/* Mobile optimization */
@media (max-width: 768px) {
    .story-main-content {
        flex-direction: column;
    }
    
    .story-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;
    }
    
    .story-message {
        max-width: 90%;
    }
    
    .story-status-bar {
        flex-direction: column;
        gap: 10px;
    }
}