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

body {
    background: #0a0a0f;
    color: #A0F0E8;
    overflow: hidden;
    font-family: 'JetBrains Mono', monospace;
    cursor: default;
}

/* ===== TITLE SCREEN ===== */
#title-screen {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    background: radial-gradient(ellipse at center, #0d1520 0%, #0a0a0f 70%);
}

#title-particles {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
}

#title-fog {
    position: absolute;
    bottom: 0; left: 0;
    width: 100%; height: 30%;
    background: linear-gradient(to top, rgba(0,206,209,0.06) 0%, transparent 100%);
    pointer-events: none;
    animation: fogPulse 6s ease-in-out infinite;
}

@keyframes fogPulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

#title-content {
    position: relative;
    z-index: 10;
    text-align: center;
}

#title-text {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: clamp(2rem, 5vw, 4rem);
    color: #A0F0E8;
    letter-spacing: 0.08em;
    text-shadow: 0 0 40px rgba(0,206,209,0.3), 0 0 80px rgba(0,206,209,0.1);
    margin-bottom: 0.5em;
    animation: titleGlow 4s ease-in-out infinite;
}

@keyframes titleGlow {
    0%, 100% { text-shadow: 0 0 40px rgba(0,206,209,0.3), 0 0 80px rgba(0,206,209,0.1); }
    50% { text-shadow: 0 0 60px rgba(0,206,209,0.5), 0 0 120px rgba(0,206,209,0.2); }
}

#subtitle-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(0.7rem, 1.5vw, 0.9rem);
    color: rgba(160,240,232,0.5);
    letter-spacing: 0.15em;
    margin-bottom: 3em;
}

#descend-btn-wrapper {
    position: relative;
    display: inline-block;
}

#descend-ripple {
    position: absolute;
    top: 50%; left: 50%;
    width: 120px; height: 120px;
    border: 1px solid rgba(0,206,209,0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: rippleExpand 3s ease-out infinite;
}

@keyframes rippleExpand {
    0% { width: 80px; height: 80px; opacity: 0.6; }
    100% { width: 200px; height: 200px; opacity: 0; }
}

#descend-btn {
    position: relative;
    background: transparent;
    border: 2px solid #00CED1;
    color: #A0F0E8;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    letter-spacing: 0.3em;
    padding: 16px 40px;
    border-radius: 50%;
    width: 120px; height: 120px;
    cursor: pointer;
    transition: all 0.4s ease;
    text-shadow: 0 0 10px rgba(0,206,209,0.5);
    box-shadow: 0 0 20px rgba(0,206,209,0.15), inset 0 0 20px rgba(0,206,209,0.05);
}

#descend-btn:hover {
    background: rgba(0,206,209,0.1);
    box-shadow: 0 0 40px rgba(0,206,209,0.3), inset 0 0 30px rgba(0,206,209,0.1);
    transform: scale(1.05);
}

#title-footer {
    position: absolute;
    bottom: 20px;
    text-align: center;
    font-size: 0.7rem;
    color: rgba(160,240,232,0.3);
}

#title-footer a {
    color: rgba(0,206,209,0.5);
    text-decoration: none;
    margin-left: 1em;
}

#title-footer a:hover {
    color: #00CED1;
}

/* ===== MOBILE WARNING ===== */
#mobile-warning {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(10,10,15,0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.mobile-warning-content {
    text-align: center;
    padding: 2em;
}

.mobile-warning-content h2 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.5rem;
    margin-bottom: 1em;
}

.mobile-warning-content p {
    font-size: 0.85rem;
    color: rgba(160,240,232,0.6);
    margin-bottom: 2em;
}

#mobile-continue {
    background: transparent;
    border: 1px solid #00CED1;
    color: #A0F0E8;
    font-family: 'JetBrains Mono', monospace;
    padding: 10px 24px;
    cursor: pointer;
    font-size: 0.8rem;
}

/* ===== GAME CONTAINER ===== */
#game-container {
    width: 100vw;
    height: 100vh;
    position: relative;
}

#scene-container {
    width: 100%;
    height: 100%;
}

#scene-container canvas {
    display: block;
}

/* ===== HUD ===== */
#hud {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 100;
}

#hud > * {
    pointer-events: auto;
}

#hud-depth {
    position: absolute;
    top: 20px; left: 20px;
    background: rgba(26,26,46,0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0,206,209,0.2);
    border-radius: 8px;
    padding: 10px 16px;
    min-width: 120px;
}

.hud-label {
    display: block;
    font-size: 0.6rem;
    color: rgba(160,240,232,0.5);
    letter-spacing: 0.2em;
    margin-bottom: 4px;
}

#depth-value {
    font-size: 1.4rem;
    font-weight: 500;
    color: #A0F0E8;
}

#infrasound-wave {
    margin-top: 6px;
    height: 16px;
    background: linear-gradient(90deg, transparent, rgba(0,206,209,0.3), transparent);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

#infrasound-wave::after {
    content: '8.2 Hz';
    position: absolute;
    right: 4px;
    top: 1px;
    font-size: 0.5rem;
    color: rgba(0,206,209,0.5);
}

#hud-atmosphere {
    position: absolute;
    top: 20px; right: 20px;
    background: rgba(26,26,46,0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0,206,209,0.2);
    border-radius: 8px;
    padding: 10px 16px;
    min-width: 140px;
    overflow: hidden;
}

.atmo-scanline {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 2px;
    background: rgba(0,206,209,0.3);
    animation: scanline 3s linear infinite;
}

@keyframes scanline {
    0% { top: 0; }
    100% { top: 100%; }
}

.atmo-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    padding: 2px 0;
    color: rgba(160,240,232,0.7);
}

.atmo-row span:last-child {
    color: #A0F0E8;
}

#hud-controls {
    position: absolute;
    bottom: 20px; left: 20px;
    font-size: 0.7rem;
    color: rgba(160,240,232,0.4);
    transition: opacity 1s ease;
}

#hud-controls.faded {
    opacity: 0;
    pointer-events: none;
}

#hud-compass {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
}

#hud-journal {
    position: absolute;
    bottom: 20px; right: 20px;
    background: rgba(26,26,46,0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0,206,209,0.2);
    border-radius: 8px;
    padding: 8px 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    transition: border-color 0.3s;
}

#hud-journal:hover {
    border-color: #00CED1;
}

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

#hud-map-btn {
    position: absolute;
    bottom: 20px; right: 140px;
    background: rgba(26,26,46,0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0,206,209,0.2);
    border-radius: 8px;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    transition: border-color 0.3s;
}

#hud-map-btn:hover {
    border-color: #00CED1;
}

/* ===== CROSSHAIR ===== */
#crosshair {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(160,240,232,0.4);
    font-size: 1.2rem;
    pointer-events: none;
    z-index: 101;
    font-family: 'JetBrains Mono', monospace;
}

/* ===== TOOLTIP ===== */
#tooltip {
    position: fixed;
    top: 40%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(26,26,46,0.85);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(0,206,209,0.3);
    border-radius: 8px;
    padding: 12px 20px;
    max-width: 400px;
    text-align: center;
    z-index: 200;
    transition: opacity 0.3s;
}

#tooltip.hidden {
    opacity: 0;
    pointer-events: none;
}

#tooltip-text {
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.95rem;
    font-style: italic;
    color: #A0F0E8;
    line-height: 1.5;
}

/* ===== LORE PANEL ===== */
#lore-panel {
    position: fixed;
    top: 0; right: 0;
    width: 360px;
    max-width: 90vw;
    height: 100vh;
    background: rgba(26,26,46,0.92);
    backdrop-filter: blur(16px);
    border-left: 1px solid rgba(0,206,209,0.2);
    z-index: 300;
    transition: transform 0.4s ease;
    overflow-y: auto;
    padding: 20px;
}

#lore-panel.hidden {
    transform: translateX(100%);
}

#lore-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(0,206,209,0.2);
    padding-bottom: 12px;
}

#lore-panel-header h2 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: 1.4rem;
}

#lore-close {
    background: none;
    border: none;
    color: #A0F0E8;
    font-size: 1.2rem;
    cursor: pointer;
}

#lore-panel-content {
    font-size: 0.8rem;
}

.lore-category {
    margin-bottom: 16px;
}

.lore-category-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1rem;
    color: #00CED1;
    margin-bottom: 8px;
    letter-spacing: 0.1em;
}

.lore-entry {
    background: rgba(0,206,209,0.05);
    border: 1px solid rgba(0,206,209,0.1);
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.lore-entry:hover {
    border-color: rgba(0,206,209,0.4);
}

.lore-entry.locked {
    opacity: 0.3;
    cursor: default;
}

.lore-entry-title {
    font-weight: 500;
    color: #A0F0E8;
    margin-bottom: 4px;
}

.lore-entry-detail {
    color: rgba(160,240,232,0.6);
    font-size: 0.75rem;
    line-height: 1.4;
    display: none;
}

.lore-entry.expanded .lore-entry-detail {
    display: block;
    margin-top: 6px;
}

/* ===== MAP OVERLAY ===== */
#map-overlay {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(10,15,30,0.92);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(0,206,209,0.3);
    border-radius: 12px;
    padding: 20px;
    z-index: 300;
}

#map-overlay.hidden {
    display: none;
}

#map-close-btn {
    position: absolute;
    top: 10px; right: 14px;
    color: #A0F0E8;
    cursor: pointer;
    font-size: 1.2rem;
    z-index: 10;
}

/* ===== MESSAGE OVERLAY ===== */
#message-overlay {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 400;
    text-align: center;
    pointer-events: none;
}

#message-overlay.hidden {
    display: none;
}

#message-text {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.5rem;
    color: #FFB347;
    text-shadow: 0 0 30px rgba(255,179,71,0.5), 0 0 60px rgba(255,179,71,0.3);
    animation: messageGlow 0.5s ease-in-out;
}

@keyframes messageGlow {
    0% { opacity: 0; transform: scale(0.9); }
    100% { opacity: 1; transform: scale(1); }
}

/* Scrollbar */
#lore-panel::-webkit-scrollbar {
    width: 4px;
}

#lore-panel::-webkit-scrollbar-track {
    background: transparent;
}

#lore-panel::-webkit-scrollbar-thumb {
    background: rgba(0,206,209,0.3);
    border-radius: 2px;
}