@import url('https://fonts.googleapis.com/css2?family=VT323&family=Playfair+Display:ital,wght@0,400;0,700;1,400&display=swap');

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #000;
    font-family: 'Playfair Display', serif;
}

/* --- TERMINAL STYLES --- */
#terminal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    z-index: 100;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #0f0;
    font-family: 'VT323', monospace;
    font-size: 1.5rem;
    text-shadow: 0 0 5px #0f0;
    padding: 20px;
    box-sizing: border-box;
}

#terminal-content {
    max-width: 800px;
    width: 100%;
    text-align: left;
    line-height: 1.5;
}

.cursor {
    display: inline-block;
    width: 10px;
    height: 1.2em;
    background-color: #0f0;
    animation: blink 1s step-end infinite;
    vertical-align: bottom;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

#start-btn {
    margin-top: 30px;
    padding: 10px 30px;
    background: transparent;
    border: 2px solid #0f0;
    color: #0f0;
    font-family: 'VT323', monospace;
    font-size: 1.5rem;
    cursor: pointer;
    text-shadow: 0 0 5px #0f0;
    box-shadow: 0 0 5px #0f0;
    transition: all 0.3s ease;
    display: block; /* Initially visible to unlock audio */
}

#start-btn:hover {
    background: #0f0;
    color: #000;
}

/* --- 3D SCENE STYLES --- */
#canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    opacity: 0; /* Hidden initially */
}

/* --- UI OVERLAY STYLES --- */
#ui-overlay {
    position: absolute;
    bottom: 30px;
    right: 30px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 15px;
    color: #fff;
    opacity: 0; /* Hidden initially */
    pointer-events: none; /* Enable when visible */
}

.ui-panel {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 15px 25px;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    gap: 15px;
    pointer-events: auto;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.control-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 5px;
    transition: transform 0.2s;
    outline: none;
}

.control-btn:hover {
    transform: scale(1.1);
}

input[type=range] {
    -webkit-appearance: none;
    appearance: none;
    width: 100px;
    height: 4px;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
    outline: none;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    transition: background .15s ease-in-out;
}

input[type=range]::-webkit-slider-thumb:hover {
    background: #ffb7b2;
}

.hidden {
    display: none !important;
}

/* --- LETTER OVERLAY --- */
#letter-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.5s;
    pointer-events: none;
}
#letter-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}
.letter-content {
    background: #fffaf0;
    color: #2c1810;
    padding: 60px 40px;
    border-radius: 2px;
    text-align: center;
    font-family: 'Playfair Display', serif;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    max-width: 500px;
    width: 90%;
    transform: rotate(-1deg);
    border: 1px solid #e6dccf;
}
.letter-content h2 {
    margin: 0 0 20px 0;
    font-size: 3rem;
    color: #8b0000;
}
.letter-content p {
    font-size: 1.5rem;
    margin: 10px 0;
}
#close-letter {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #8b4513;
    transition: color 0.3s;
}
#close-letter:hover {
    color: #ff0000;
}/* --- MOBILE RESPONSIVENESS --- */
@media (max-width: 768px) {
    #terminal-overlay {
        font-size: 1.2rem;
        padding: 15px;
    }

    #start-btn {
        font-size: 1.2rem;
        padding: 8px 20px;
    }

    .letter-content {
        padding: 30px 20px;
    }

    .letter-content h2 {
        font-size: 2rem;
    }

    .letter-content p {
        font-size: 1.1rem;
    }

    #ui-overlay {
        bottom: 20px;
        right: 50%;
        transform: translateX(50%);
        width: 90%;
        align-items: center;
        flex-direction: row;
        justify-content: center;
    }
    
    .ui-panel {
        width: auto;
        justify-content: center;
        padding: 10px 20px;
        /* Ensure panel doesn't get too wide on small screens */
        max-width: 95%; 
    }

    .control-btn {
        font-size: 1.5rem; /* Larger icons */
        padding: 10px; /* Larger touch target */
    }

    input[type=range] {
        width: 80px; /* Slightly smaller slider to fit */
    }
}

/* Touch Optimization */
button, .control-btn, #start-btn, input[type=range] {
    touch-action: manipulation; /* Improves touch response */
    user-select: none; /* Prevents text selection */
    -webkit-user-select: none;
}
