/* Tombstone comment: Styles split out from index.html for refactor clarity. */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap');
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    background: #0a0a0a;
    color: #e0e0e0;
    overflow: hidden;
    height: 100vh;
}
.container { display: grid; grid-template-columns: 300px 1fr; height: 100vh; position: relative; }
.sidebar {
    background: rgba(20, 20, 30, 0.95);
    backdrop-filter: blur(10px);
    padding: 2rem;
    overflow-y: auto;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}
.sidebar-title { margin-bottom: 2rem; color: #6495ED; }
.sidebar-subtitle { margin: 2rem 0 1rem; color: #6495ED; }
.main-content {
    position: relative; display: flex; flex-direction: column;
    align-items: center; justify-content: center; overflow: hidden;
}
.animated-bg {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1; transition: opacity 2s ease;
}
/* Theme, Architect, Learning, Controls, Biometric UI styles */
.dream-theme, .dream-architect { margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex; align-items: center; gap: 1rem;
}
.dream-theme:hover, .dream-architect:hover {
    background: rgba(255, 255, 255, 0.1); transform: translateY(-2px);
}
.dream-theme.active, .dream-architect.active {
    background: rgba(100, 149, 237, 0.2); border-color: #6495ED;
}
.theme-icon, .architect-icon { width: 24px; height: 24px; opacity: 0.8; }
.narrative-display {
    position: absolute; 
    top: 50%; 
    left: 50%; 
    transform: translate(-50%, -50%);
    max-width: 700px; 
    max-height: 70vh;
    padding: 2rem; 
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(10px); 
    border-radius: 20px; 
    opacity: 0; 
    transition: opacity 2s ease; 
    pointer-events: none;
    overflow: hidden;
}
.narrative-display.active { 
    opacity: 1; 
    pointer-events: auto; 
}
.narrative-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}
.narrative-header h3 {
    color: #6495ED;
    margin: 0;
    font-size: 1.1rem;
}
.clear-narrative-btn {
    background: rgba(255, 68, 68, 0.2);
    border: 1px solid #ff4444;
    border-radius: 6px;
    color: #ff4444;
    padding: 0.3rem 0.8rem;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}
.clear-narrative-btn:hover {
    background: rgba(255, 68, 68, 0.4);
}
.narrative-stream {
    max-height: 50vh;
    overflow-y: auto;
    padding-right: 1rem;
}
.narrative-entry {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    border-left: 3px solid #6495ED;
    animation: fadeInUp 0.5s ease-out;
}
.narrative-entry.learning {
    border-left-color: #c1efd1;
    background: rgba(193, 239, 209, 0.1);
}
.narrative-entry.nightmare-mitigation {
    border-left-color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
}
.narrative-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    opacity: 0.7;
}
.narrative-entry-type {
    color: #6495ED;
    font-weight: 600;
}
.narrative-entry-time {
    color: #888;
}
.narrative-entry-content {
    color: #f0f0f0;
    line-height: 1.6;
}
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.controls { position: absolute; top: 2rem; right: 2rem; display: flex; gap: 1rem; }
.control-btn { padding: 0.75rem 1.5rem; background: rgba(100, 149, 237, 0.2); border: 1px solid #6495ED; border-radius: 8px; color: #e0e0e0;
    cursor: pointer; transition: all 0.3s ease; font-size: 0.9rem; }
.control-btn:hover { background: rgba(100, 149, 237, 0.4); }
.biometric-indicator {
    position: absolute; top: 2rem; left: 2rem; padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1); border-radius: 20px; font-size: 0.9rem;
    display: flex; align-items: center; gap: 0.5rem;
}
.heart-rate { color: #ff6b6b; font-weight: 600; }
.lucid-indicator {
    position: absolute; top: 4rem; left: 2rem; padding: 0.5rem 1rem;
    background: rgba(255, 215, 0, 0.2); border-radius: 20px; font-size: 0.9rem;
    display: none; border: 1px solid rgba(255, 215, 0, 0.4);
    animation: pulse 2s ease-in-out infinite;
}
.lucid-indicator.active { display: block; }
@keyframes pulse { 0%, 100% { opacity: 0.8; } 50% { opacity: 1; } }
.interaction-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.8); display: flex;
    flex-direction: column; align-items: center; justify-content: center;
    z-index: 1000; cursor: pointer; transition: opacity 0.5s ease;
}
.interaction-overlay.hidden { opacity: 0; pointer-events: none; }
.interaction-overlay h2 { color: #6495ED; margin-bottom: 1rem; font-size: 2.5rem; font-weight: 300; letter-spacing: 2px; }
.interaction-overlay p { color: #e0e0e0; font-size: 1.2rem; text-align: center; max-width: 400px; line-height: 1.6; opacity: 0.8; }
.start-btn { margin-top: 2rem; padding: 1rem 2rem; background: rgba(100, 149, 237, 0.2); border: 1px solid #6495ED; border-radius: 20px;
    color: #e0e0e0; font-size: 1.1rem; cursor: pointer; transition: all 0.3s ease; }
.start-btn:hover { background: rgba(100, 149, 237, 0.4); transform: translateY(-2px); }
.volume-control {
    position: absolute; bottom: 2rem; left: 50%; transform: translateX(-50%);
    display: flex; align-items: center; gap: 1rem; background: rgba(20, 20, 30, 0.8);
    padding: 0.5rem 1rem; border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.volume-slider { width: 100px; height: 4px; background: rgba(255, 255, 255, 0.2); border-radius: 2px; outline: none; cursor: pointer; }
.volume-slider::-webkit-slider-thumb {
    width: 12px; height: 12px; background: #6495ED; border-radius: 50%; cursor: pointer; -webkit-appearance: none;
}
.mode-indicator {
    position: absolute; bottom: 2rem; right: 2rem; padding: 0.5rem 1rem;
    background: rgba(100, 149, 237, 0.2); border-radius: 20px; font-size: 0.9rem; opacity: 0.7;
}

/* Tutorial System Styles */
.tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    pointer-events: none;
}

.tutorial-spotlight {
    position: fixed;
    background: rgba(255, 255, 255, 0.1);
    border: 3px solid #ff4444;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(255, 68, 68, 0.5);
    animation: tutorialPulse 2s ease-in-out infinite;
}

@keyframes tutorialPulse {
    0%, 100% { 
        box-shadow: 0 0 20px rgba(255, 68, 68, 0.5);
        border-color: #ff4444;
    }
    50% { 
        box-shadow: 0 0 30px rgba(255, 68, 68, 0.8);
        border-color: #ff6666;
    }
}

.tutorial-tooltip {
    position: fixed;
    background: rgba(20, 20, 30, 0.95);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 68, 68, 0.3);
    border-radius: 16px;
    padding: 1.5rem;
    width: 320px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    pointer-events: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 2100;
}

.tutorial-tooltip::before {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border-style: solid;
}

.tutorial-tooltip.arrow-left::before {
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 10px 10px 10px 0;
    border-color: transparent #ff4444 transparent transparent;
}

.tutorial-tooltip.arrow-right::before {
    right: -10px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 10px 0 10px 10px;
    border-color: transparent transparent transparent #ff4444;
}

.tutorial-tooltip.arrow-top::before {
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 0 10px 10px 10px;
    border-color: transparent transparent #ff4444 transparent;
}

.tutorial-tooltip.arrow-bottom::before {
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 10px 10px 0 10px;
    border-color: #ff4444 transparent transparent transparent;
}

.tutorial-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.tutorial-header h3 {
    color: #ff4444;
    margin: 0;
    font-size: 1.2rem;
}

.tutorial-step-counter {
    color: #888;
    font-size: 0.8rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
}

.tutorial-tooltip p {
    color: #e0e0e0;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.tutorial-controls {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tutorial-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.tutorial-btn.primary {
    background: #ff4444;
    color: white;
}

.tutorial-btn.primary:hover {
    background: #ff6666;
}

.tutorial-btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.tutorial-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.tutorial-btn.skip {
    background: transparent;
    color: #888;
    border: 1px solid #444;
}

.tutorial-btn.skip:hover {
    color: #aaa;
    border-color: #666;
}

.tutorial-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.tutorial-highlight {
    position: relative;
    z-index: 1500;
    animation: tutorialHighlight 2s ease-in-out infinite;
}

@keyframes tutorialHighlight {
    0%, 100% { 
        box-shadow: 0 0 15px rgba(255, 68, 68, 0.3);
        transform: scale(1);
    }
    50% { 
        box-shadow: 0 0 25px rgba(255, 68, 68, 0.6);
        transform: scale(1.02);
    }
}

/* Help Button in Sidebar */
.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.help-btn {
    background: rgba(255, 68, 68, 0.2);
    border: 1px solid #ff4444;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.help-btn:hover {
    background: rgba(255, 68, 68, 0.4);
    transform: scale(1.1);
}

.help-icon {
    color: #ff4444;
    font-weight: 600;
    font-size: 1.1rem;
}

/* Welcome Screen Updates */
.welcome-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 2rem;
}

.tutorial-start-btn {
    padding: 0.8rem 1.5rem;
    background: rgba(255, 68, 68, 0.2);
    border: 1px solid #ff4444;
    border-radius: 20px;
    color: #e0e0e0;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tutorial-start-btn:hover {
    background: rgba(255, 68, 68, 0.4);
    transform: translateY(-2px);
}

/* Enhanced Learning Module Styles */
.learning-module-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.learning-module-header h4 {
    margin: 0;
    color: #6495ED;
    font-size: 1.1rem;
}

.learning-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.learning-indicator.active {
    background: #4CAF50;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
    animation: pulse 2s ease-in-out infinite;
}

.learning-control-group {
    margin-bottom: 1.2rem;
}

.learning-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: #ccc;
    font-weight: 500;
}

.learning-select {
    width: 100%;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.learning-select:focus {
    outline: none;
    border-color: #6495ED;
    box-shadow: 0 0 0 2px rgba(100, 149, 237, 0.2);
}

.learning-input {
    width: 100%;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 0.9rem;
    margin-top: 0.5rem;
    transition: all 0.3s ease;
}

.learning-input:focus {
    outline: none;
    border-color: #6495ED;
    box-shadow: 0 0 0 2px rgba(100, 149, 237, 0.2);
}

.learning-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.learning-action-btn {
    background: rgba(100, 149, 237, 0.2);
    border: 1px solid #6495ED;
    border-radius: 6px;
    color: #6495ED;
    padding: 0.5rem;
    margin-left: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.learning-action-btn:hover {
    background: rgba(100, 149, 237, 0.4);
    transform: translateY(-1px);
}

.learning-controls {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.learning-btn {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.learning-btn.play {
    background: rgba(76, 175, 80, 0.2);
    border-color: #4CAF50;
    color: #4CAF50;
}

.learning-btn.pause {
    background: rgba(255, 152, 0, 0.2);
    border-color: #FF9800;
    color: #FF9800;
}

.learning-btn.stop {
    background: rgba(244, 67, 54, 0.2);
    border-color: #F44336;
    color: #F44336;
}

.learning-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.learning-status-container {
    text-align: center;
    margin-bottom: 1rem;
}

.learning-status {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    background: rgba(255, 255, 255, 0.1);
    color: #ccc;
    transition: all 0.3s ease;
}

.learning-status.active {
    background: rgba(76, 175, 80, 0.2);
    color: #4CAF50;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.learning-seed-display {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 0.75rem;
    font-style: italic;
    color: #aaa;
    text-align: center;
    font-size: 0.85rem;
    min-height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Screensaver Styles */
.screensaver-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #0a0a0a 0%, #000000 100%);
    z-index: 9999;
    display: none;
    justify-content: center;
    align-items: center;
    cursor: none;
}

.screensaver-overlay.active {
    display: flex;
}

.screensaver-orb {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #6495ED, #4169E1, #191970);
    box-shadow: 
        0 0 50px rgba(100, 149, 237, 0.8),
        0 0 100px rgba(100, 149, 237, 0.6),
        0 0 150px rgba(100, 149, 237, 0.4);
    animation: float 6s ease-in-out infinite;
    position: relative;
    transition: all 0.3s ease;
}

.screensaver-orb::before {
    content: '';
    position: absolute;
    top: 20%;
    left: 20%;
    width: 30%;
    height: 30%;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    filter: blur(10px);
}

@keyframes float {
    0%, 100% { 
        transform: translateY(0px) scale(1);
    }
    50% { 
        transform: translateY(-30px) scale(1.1);
    }
}

.screensaver-info {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
    text-align: center;
}

/* Learning module styles, chat UI, etc. (unchanged, split out for clarity) */

/* removed inline learning, chat, and component display styles (see respective refactored CSS modules if needed) */

.audio-settings {
    position: absolute;
    top: 2rem;
    right: 2rem;
    background: rgba(20, 20, 30, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 1.5rem;
    min-width: 250px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    transform: translateX(20px);
}

.audio-settings.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
}

.audio-settings h4 {
    color: #6495ED;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.setting-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.setting-row label {
    min-width: 80px;
    font-size: 0.9rem;
    color: #ccc;
}

.setting-row input[type="range"] {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.setting-row input[type="range"]::-webkit-slider-thumb {
    width: 12px;
    height: 12px;
    background: #6495ED;
    border-radius: 50%;
    cursor: pointer;
    -webkit-appearance: none;
}

.setting-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #6495ED;
}

.setting-row span {
    min-width: 40px;
    font-size: 0.8rem;
    color: #888;
    text-align: right;
}