* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Georgia', 'Times New Roman', serif;
    background: linear-gradient(to bottom, #0a0e27 0%, #1a1a2e 50%, #16213e 100%);
    color: #e8e8e8;
    min-height: 100vh;
    line-height: 1.8;
    position: relative;
    overflow-x: hidden;
    transition: background 3s ease;
}

/* Mist Particles Background */
#mist-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.mist-particle {
    position: absolute;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.03) 0%, transparent 70%);
    border-radius: 50%;
    animation: float infinite ease-in-out;
    opacity: 0.4;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) scale(1);
        opacity: 0.2;
    }
    50% {
        transform: translate(50px, -50px) scale(1.2);
        opacity: 0.4;
    }
}

/* Layout */
.layout {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.main-content {
    flex: 1;
    transition: margin-right 0.3s ease;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 2rem 0;
    border-bottom: 1px solid rgba(232, 232, 232, 0.2);
}

/* Hero Image Section */
.hero-section {
    margin: 2rem 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

.hero-image {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

.hero-section.hidden {
    display: none;
}

h1 {
    font-size: 2.5rem;
    font-weight: 300;
    letter-spacing: 0.3rem;
    margin-bottom: 0.5rem;
    color: #ffd700;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

.glow-text {
    animation: glow 3s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% {
        text-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
    }
    50% {
        text-shadow: 0 0 30px rgba(255, 215, 0, 0.6), 0 0 40px rgba(255, 215, 0, 0.4);
    }
}

.subtitle {
    font-size: 0.9rem;
    letter-spacing: 0.2rem;
    color: #b8b8b8;
    font-style: italic;
}

/* Controls */
.controls {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-bottom: 2rem;
}

.control-btn {
    padding: 0.7rem 1.3rem;
    background: rgba(255, 215, 0, 0.15);
    border: 1px solid rgba(255, 215, 0, 0.3);
    color: #e8e8e8;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    font-size: 0.85rem;
    border-radius: 4px;
}

.control-btn:hover {
    background: rgba(255, 215, 0, 0.25);
    border-color: rgba(255, 215, 0, 0.5);
    transform: translateY(-2px);
}

.save-status {
    text-align: center;
    padding: 0.8rem;
    background: rgba(255, 215, 0, 0.2);
    border: 1px solid rgba(255, 215, 0, 0.4);
    border-radius: 4px;
    margin-bottom: 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    color: #ffd700;
}

.save-status.show {
    opacity: 1;
}

/* Story Container */
#story-container {
    min-height: 400px;
    margin-bottom: 2rem;
}

.metadata {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 1.5rem;
    padding: 0.8rem;
    border-left: 3px solid rgba(255, 215, 0, 0.4);
    background: rgba(255, 215, 0, 0.05);
    backdrop-filter: blur(5px);
    border-radius: 0 4px 4px 0;
}

#narrative-text {
    font-size: 1.1rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    border-radius: 4px;
    white-space: pre-line;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.choices-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-top: 2rem;
}

.choice-btn {
    padding: 1.2rem;
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.3);
    color: #e8e8e8;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    font-size: 1rem;
    text-align: left;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.choice-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: rgba(255, 215, 0, 0.2);
    border-radius: 50%;
    font-size: 0.85rem;
    font-weight: bold;
    color: #ffd700;
    flex-shrink: 0;
}

.choice-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.2), transparent);
    transition: left 0.5s ease;
}

.choice-btn:hover::before {
    left: 100%;
}

.choice-btn:hover {
    background: rgba(255, 215, 0, 0.2);
    border-color: rgba(255, 215, 0, 0.5);
    transform: translateX(5px);
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.2);
}

.choice-btn:active {
    transform: translateX(5px) scale(0.98);
}

.start-btn, .restart-btn {
    display: block;
    margin: 2rem auto;
    padding: 1rem 2rem;
    background: rgba(255, 215, 0, 0.2);
    border: 2px solid rgba(255, 215, 0, 0.5);
    color: #ffd700;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    letter-spacing: 0.1rem;
    border-radius: 4px;
}

.start-btn:hover, .restart-btn:hover {
    background: rgba(255, 215, 0, 0.3);
    transform: scale(1.05);
    box-shadow: 0 4px 20px rgba(255, 215, 0, 0.3);
}

.hidden {
    display: none !important;
}

#loading {
    text-align: center;
    padding: 3rem;
}

.mist-loader {
    width: 60px;
    height: 60px;
    margin: 0 auto 1rem;
    border: 3px solid rgba(255, 215, 0, 0.1);
    border-top: 3px solid rgba(255, 215, 0, 0.6);
    border-radius: 50%;
    animation: spin 1.5s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Dream Journal - Right Sidebar */
.dream-journal {
    position: fixed;
    right: 0;
    top: 0;
    width: 350px;
    height: 100vh;
    background: rgba(10, 14, 39, 0.98);
    backdrop-filter: blur(10px);
    border-left: 2px solid rgba(255, 215, 0, 0.3);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.5);
    z-index: 100;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateX(0);
    transition: transform 0.3s ease;
}

.dream-journal.hidden {
    transform: translateX(100%);
}

.journal-header {
    padding: 1.5rem;
    border-bottom: 2px solid rgba(255, 215, 0, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 215, 0, 0.05);
}

.journal-header h3 {
    color: #ffd700;
    font-size: 1.2rem;
    font-weight: 300;
    letter-spacing: 0.15rem;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.close-journal {
    background: rgba(255, 215, 0, 0.2);
    border: 1px solid rgba(255, 215, 0, 0.3);
    color: #ffd700;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0.3rem 0.6rem;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.close-journal:hover {
    background: rgba(255, 215, 0, 0.3);
    transform: scale(1.1);
    box-shadow: 0 2px 10px rgba(255, 215, 0, 0.3);
}

.journal-stats {
    padding: 1.5rem;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    background: rgba(255, 215, 0, 0.03);
    border-bottom: 1px solid rgba(255, 215, 0, 0.2);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.stat-label {
    font-size: 0.75rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.1rem;
    margin-bottom: 0.3rem;
}

.stat-value {
    font-size: 1.5rem;
    color: #ffd700;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.journal-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.journal-content h4 {
    color: #ffd700;
    font-size: 0.9rem;
    font-weight: 300;
    letter-spacing: 0.15rem;
    margin-bottom: 1rem;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(255, 215, 0, 0.2);
    padding-bottom: 0.5rem;
}

.journal-path {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.journal-empty {
    color: #666;
    font-style: italic;
    text-align: center;
    padding: 2rem 1rem;
    font-size: 0.9rem;
}

.journal-entry {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border-left: 3px solid rgba(255, 215, 0, 0.3);
    border-radius: 0 4px 4px 0;
    transition: all 0.3s ease;
}

.journal-entry:hover {
    background: rgba(255, 255, 255, 0.05);
    border-left-color: rgba(255, 215, 0, 0.6);
    transform: translateX(5px);
}

.journal-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.journal-step {
    color: #ffd700;
    font-weight: bold;
    font-size: 0.85rem;
}

.journal-location {
    color: #888;
    font-size: 0.75rem;
}

.journal-choice {
    color: #b8b8b8;
    font-size: 0.85rem;
    font-style: italic;
    line-height: 1.4;
}

/* Scrollbar styling for journal */
.journal-content::-webkit-scrollbar {
    width: 8px;
}

.journal-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.journal-content::-webkit-scrollbar-thumb {
    background: rgba(255, 215, 0, 0.3);
    border-radius: 4px;
}

.journal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 215, 0, 0.5);
}

/* Load Menu Modal */
.load-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

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

.load-menu-content {
    background: linear-gradient(to bottom, #1a1a2e 0%, #16213e 100%);
    padding: 2rem;
    border-radius: 8px;
    border: 2px solid rgba(255, 215, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.load-menu-content h2 {
    color: #ffd700;
    margin-bottom: 1.5rem;
    text-align: center;
    font-weight: 300;
    letter-spacing: 0.2rem;
}

.save-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.save-item {
    background: rgba(255, 215, 0, 0.05);
    border: 1px solid rgba(255, 215, 0, 0.2);
    padding: 1rem;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.3s ease;
}

.save-item:hover {
    background: rgba(255, 215, 0, 0.1);
}

.save-info {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.save-info strong {
    color: #ffd700;
    font-size: 1.1rem;
}

.save-info small {
    color: #888;
    font-size: 0.85rem;
}

.save-actions {
    display: flex;
    gap: 0.5rem;
}

.load-btn, .delete-btn {
    padding: 0.6rem 1.2rem;
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    font-size: 0.9rem;
}

.load-btn {
    background: rgba(255, 215, 0, 0.2);
    color: #ffd700;
}

.load-btn:hover {
    background: rgba(255, 215, 0, 0.3);
    transform: scale(1.05);
}

.delete-btn {
    background: rgba(200, 50, 50, 0.2);
    color: #ff6b6b;
    border-color: rgba(200, 50, 50, 0.3);
}

.delete-btn:hover {
    background: rgba(200, 50, 50, 0.3);
    transform: scale(1.05);
}

.close-menu-btn {
    display: block;
    width: 100%;
    padding: 1rem;
    background: rgba(255, 215, 0, 0.15);
    border: 1px solid rgba(255, 215, 0, 0.3);
    color: #e8e8e8;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    font-size: 1rem;
    border-radius: 4px;
}

.close-menu-btn:hover {
    background: rgba(255, 215, 0, 0.25);
}

/* Export Format Selection */
.export-format-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.export-format-btn {
    background: rgba(255, 215, 0, 0.05);
    border: 2px solid rgba(255, 215, 0, 0.3);
    padding: 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
}

.export-format-btn:hover {
    background: rgba(255, 215, 0, 0.15);
    border-color: rgba(255, 215, 0, 0.5);
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.2);
}

.format-icon {
    font-size: 2.5rem;
}

.format-name {
    color: #ffd700;
    font-size: 1.1rem;
    font-weight: bold;
}

.format-desc {
    color: #888;
    font-size: 0.85rem;
    text-align: center;
}

footer {
    text-align: center;
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(232, 232, 232, 0.2);
    color: #666;
    font-size: 0.85rem;
    font-style: italic;
}

/* Mobile Responsive */
@media (max-width: 1024px) {
    .dream-journal {
        width: 100%;
        max-width: 400px;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 1rem;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    #narrative-text {
        font-size: 1rem;
        padding: 1rem;
    }
    
    .controls {
        gap: 0.5rem;
    }
    
    .control-btn {
        padding: 0.6rem 1rem;
        font-size: 0.8rem;
    }

    .dream-journal {
        width: 100%;
        max-width: 100%;
    }

    .journal-stats {
        padding: 1rem;
    }
    
    .save-item {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .save-actions {
        width: 100%;
        justify-content: stretch;
    }
    
    .load-btn, .delete-btn {
        flex: 1;
    }
    
    .export-format-grid {
        grid-template-columns: 1fr;
    }
}