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

body {
    font-family: 'Space Grotesk', sans-serif;
    background: #0a0a1a;
    color: white;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

#scene-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#scene-container canvas {
    cursor: grab;
}

#scene-container canvas:active {
    cursor: grabbing;
}

/* Breadcrumb */
#breadcrumb {
    position: fixed;
    top: 20px;
    left: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: rgba(20, 20, 40, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 100;
}

.breadcrumb-label {
    font-size: 12px;
    opacity: 0.6;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#breadcrumb-trail {
    display: flex;
    gap: 5px;
}

/* Mini Map */
#minimap {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 100px;
    height: 100px;
    background: rgba(20, 20, 40, 0.8);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    border: 2px solid rgba(74, 158, 255, 0.3);
    overflow: hidden;
    z-index: 100;
}

#minimap-canvas {
    width: 100%;
    height: 100%;
    border-radius: 50%;
}

#minimap-viewport {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(74, 158, 255, 0.8);
    border-radius: 4px;
    pointer-events: none;
}

/* Search */
#search-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 10px;
}

#search-toggle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(20, 20, 40, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

#search-toggle:hover {
    background: rgba(74, 158, 255, 0.3);
    border-color: rgba(74, 158, 255, 0.5);
}

#search-input {
    width: 0;
    padding: 0;
    border: none;
    background: rgba(20, 20, 40, 0.8);
    backdrop-filter: blur(10px);
    border-radius: 22px;
    color: white;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
    opacity: 0;
}

#search-container.expanded #search-input {
    width: 250px;
    padding: 12px 20px;
    opacity: 1;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#search-results {
    position: absolute;
    top: 100%;
    left: 44px;
    width: 250px;
    margin-top: 5px;
    background: rgba(20, 20, 40, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    overflow: hidden;
    display: none;
}

#search-container.expanded #search-results:not(:empty) {
    display: block;
}

.search-result {
    padding: 12px 15px;
    border-left: 3px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-result:hover {
    background: rgba(74, 158, 255, 0.2);
}

/* Discovery Panel */
#discovery-panel {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 20px 30px;
    background: rgba(20, 20, 40, 0.9);
    backdrop-filter: blur(15px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    max-width: 90%;
}

#discovery-panel.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

#discovery-name {
    font-family: 'Crimson Pro', serif;
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
}

#discovery-desc {
    font-size: 14px;
    opacity: 0.8;
    line-height: 1.5;
    max-width: 400px;
}

#discovery-meta {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 10px;
    font-size: 12px;
    opacity: 0.6;
}

#discovery-domain {
    text-transform: uppercase;
    letter-spacing: 1px;
}

.discovery-hint {
    margin-top: 10px;
    font-size: 11px;
    opacity: 0.4;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Concept Modal */
#concept-modal {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 26, 0.9);
    backdrop-filter: blur(20px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

#concept-modal.visible {
    opacity: 1;
    pointer-events: auto;
}

#concept-modal-content {
    background: rgba(30, 30, 60, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.4s ease;
}

#concept-modal.visible #concept-modal-content {
    transform: scale(1);
}

#concept-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    color: white;
    font-size: 30px;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
}

#concept-close:hover {
    opacity: 1;
}

#concept-domain-badge {
    display: inline-block;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 15px;
}

#concept-title {
    font-family: 'Crimson Pro', serif;
    font-size: 36px;
    font-weight: 600;
    margin-bottom: 20px;
}

#concept-description {
    font-family: 'Crimson Pro', serif;
    font-size: 18px;
    line-height: 1.7;
    opacity: 0.9;
    margin-bottom: 30px;
}

#concept-connections h4 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0.5;
    margin-bottom: 15px;
}

#concept-connections-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.connection-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    color: white;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.connection-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

#concept-wander {
    margin-top: 30px;
    padding: 12px 30px;
    background: linear-gradient(135deg, #4a9eff, #00bfff);
    border: none;
    border-radius: 25px;
    color: white;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

#concept-wander:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(74, 158, 255, 0.4);
}

/* Progress */
#progress {
    position: fixed;
    bottom: 60px;
    left: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 100;
}

#progress-bar {
    width: 100px;
    height: 4px;
    background: linear-gradient(90deg, #4a9eff, #00ff88);
    border-radius: 2px;
    transition: width 0.5s ease;
}

#progress-text {
    font-size: 11px;
    opacity: 0.5;
}

/* Serendipity Button */
#serendipity {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff6b6b, #ffd700);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    transition: all 0.3s ease;
    animation: pulse 3s infinite;
}

#serendipity:hover {
    transform: scale(1.1);
    box-shadow: 0 10px 30px rgba(255, 107, 107, 0.4);
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.4); }
    50% { box-shadow: 0 0 0 15px rgba(255, 215, 0, 0); }
}

/* Footer */
#footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(20, 20, 40, 0.5);
    backdrop-filter: blur(10px);
    font-size: 12px;
    z-index: 100;
}

#footer a {
    color: #4a9eff;
    text-decoration: none;
}

#footer a:hover {
    text-decoration: underline;
}

#footer-controls {
    display: flex;
    gap: 10px;
}

#footer-controls button {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

#footer-controls button:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Help Modal */
#help-modal {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 26, 0.95);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#help-modal.visible {
    opacity: 1;
    pointer-events: auto;
}

#help-content {
    background: rgba(30, 30, 60, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 40px;
    max-width: 400px;
    width: 90%;
    position: relative;
}

#help-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    opacity: 0.5;
}

#help-content h2 {
    font-family: 'Crimson Pro', serif;
    font-size: 28px;
    margin-bottom: 20px;
}

#help-content ul {
    list-style: none;
    margin-bottom: 20px;
}

#help-content li {
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 14px;
}

#help-content li strong {
    color: #4a9eff;
}

.help-quote {
    font-family: 'Crimson Pro', serif;
    font-style: italic;
    opacity: 0.6;
    font-size: 14px;
    text-align: center;
}

/* Tutorial */
#tutorial {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 26, 0.98);
    z-index: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

#tutorial.visible {
    opacity: 1;
    pointer-events: auto;
}

#tutorial-content {
    text-align: center;
    max-width: 400px;
    padding: 40px;
}

#tutorial-content h2 {
    font-family: 'Crimson Pro', serif;
    font-size: 42px;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #ffd700, #ff6b6b, #4a9eff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#tutorial-content p {
    font-size: 18px;
    opacity: 0.8;
    line-height: 1.6;
    margin-bottom: 30px;
}

#tutorial-start {
    padding: 15px 40px;
    background: linear-gradient(135deg, #4a9eff, #00bfff);
    border: none;
    border-radius: 30px;
    color: white;
    font-family: inherit;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

#tutorial-start:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(74, 158, 255, 0.4);
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    #breadcrumb {
        display: none;
    }
    
    #minimap {
        width: 70px;
        height: 70px;
        top: 10px;
        right: 10px;
    }
    
    #search-container {
        top: 10px;
    }
    
    #search-container.expanded #search-input {
        width: 180px;
    }
    
    #discovery-panel {
        bottom: 100px;
        padding: 15px 20px;
    }
    
    #discovery-name {
        font-size: 20px;
    }
    
    #concept-modal-content {
        padding: 30px 20px;
    }
    
    #concept-title {
        font-size: 28px;
    }
    
    #concept-description {
        font-size: 16px;
    }
    
    #serendipity {
        width: 48px;
        height: 48px;
        bottom: 100px;
    }
    
    #progress {
        bottom: 70px;
        left: 10px;
    }
    
    #footer {
        padding: 10px 15px;
        font-size: 11px;
    }
    
    #footer-controls button {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
}