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

body {
    overflow: hidden;
    background: #0a0806;
    font-family: 'Special Elite', cursive;
    color: #d4a574;
}

#scene-container {
    width: 100vw;
    height: 100vh;
}

#start-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, #1a1410 0%, #0a0806 70%, #050302 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    cursor: pointer;
}

.title-container {
    text-align: center;
    margin-bottom: 60px;
}

.title-container h1 {
    font-size: 5rem;
    letter-spacing: 0.5em;
    color: #d4a574;
    text-shadow: 
        0 0 10px rgba(212, 165, 116, 0.5),
        0 0 20px rgba(212, 165, 116, 0.3),
        0 0 40px rgba(212, 165, 116, 0.1);
    animation: flicker 4s infinite;
}

.glitch {
    position: relative;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
}

.glitch::before {
    animation: glitch-1 2s infinite linear alternate-reverse;
    clip-path: polygon(0 0, 100% 0, 100% 35%, 0 35%);
    color: #ff6b6b;
}

.glitch::after {
    animation: glitch-2 3s infinite linear alternate-reverse;
    clip-path: polygon(0 65%, 100% 65%, 100% 100%, 0 100%);
    color: #6bfff6;
}

@keyframes glitch-1 {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-2px); }
    40% { transform: translateX(2px); }
    60% { transform: translateX(-1px); }
    80% { transform: translateX(1px); }
}

@keyframes glitch-2 {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(2px); }
    40% { transform: translateX(-2px); }
    60% { transform: translateX(1px); }
    80% { transform: translateX(-1px); }
}

.subtitle {
    font-size: 1.5rem;
    letter-spacing: 0.3em;
    color: #8b7355;
    margin-top: 20px;
}

.start-prompt {
    margin-bottom: 40px;
}

.blink {
    font-size: 1.2rem;
    animation: blink 1.5s infinite;
}

@keyframes blink {
    0%, 50%, 100% { opacity: 1; }
    25%, 75% { opacity: 0.3; }
}

@keyframes flicker {
    0%, 100% { opacity: 1; }
    92% { opacity: 1; }
    93% { opacity: 0.8; }
    94% { opacity: 1; }
    96% { opacity: 0.9; }
    97% { opacity: 1; }
}

.controls-legend {
    font-family: 'VT323', monospace;
    font-size: 1rem;
    color: #6b5a4a;
    text-align: center;
    line-height: 1.8;
}

.footer {
    position: absolute;
    bottom: 20px;
    font-size: 0.9rem;
}

.footer a {
    color: #6b5a4a;
    text-decoration: none;
    transition: color 0.3s;
}

.footer a:hover {
    color: #d4a574;
}

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

#flashlight-indicator {
    position: absolute;
    bottom: 20px;
    left: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'VT323', monospace;
    font-size: 1rem;
}

.battery-icon {
    width: 40px;
    height: 20px;
    border: 2px solid #d4a574;
    border-radius: 3px;
    position: relative;
    padding: 2px;
}

.battery-icon::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 10px;
    background: #d4a574;
    border-radius: 0 2px 2px 0;
}

.battery-level {
    height: 100%;
    width: 100%;
    background: #44ff44;
    transition: width 0.3s, background-color 0.3s;
}

#interaction-prompt {
    position: absolute;
    bottom: 50%;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'VT323', monospace;
    font-size: 1.2rem;
    color: #d4a574;
    text-shadow: 0 0 10px rgba(212, 165, 116, 0.5);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

#collected-items {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
}

.item-icon {
    width: 40px;
    height: 40px;
    background: rgba(26, 20, 16, 0.8);
    border: 2px solid #d4a574;
    border-radius: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
}

#timer {
    position: absolute;
    top: 20px;
    right: 20px;
    font-family: 'VT323', monospace;
    font-size: 1.5rem;
    color: #6b5a4a;
}

#vignette {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, 0.8) 100%);
    opacity: 0.2;
    transition: opacity 0.5s;
    z-index: 40;
}

#pause-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 8, 6, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 20px;
    z-index: 200;
}

#pause-menu h2 {
    font-size: 3rem;
    letter-spacing: 0.3em;
    margin-bottom: 30px;
}

#pause-menu button {
    font-family: 'Special Elite', cursive;
    font-size: 1.2rem;
    padding: 15px 40px;
    background: transparent;
    border: 2px solid #d4a574;
    color: #d4a574;
    cursor: pointer;
    transition: all 0.3s;
}

#pause-menu button:hover {
    background: #d4a574;
    color: #0a0806;
}

.sensitivity-control {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.sensitivity-control input {
    width: 200px;
    accent-color: #d4a574;
}

#puzzle-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 8, 6, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 150;
}

#puzzle-container {
    background: #1a1410;
    border: 3px solid #d4a574;
    padding: 40px;
    text-align: center;
    max-width: 500px;
}

#puzzle-container h2 {
    font-size: 2rem;
    letter-spacing: 0.2em;
    margin-bottom: 20px;
}

#puzzle-container p {
    margin-bottom: 20px;
    color: #8b7355;
}

.combo-dials {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 30px 0;
}

.combo-dial {
    width: 60px;
    height: 80px;
    font-family: 'VT323', monospace;
    font-size: 3rem;
    text-align: center;
    background: #0a0806;
    border: 2px solid #d4a574;
    color: #d4a574;
}

.combo-dial:focus {
    outline: none;
    border-color: #ffa574;
}

#puzzle-container button {
    font-family: 'Special Elite', cursive;
    font-size: 1rem;
    padding: 12px 30px;
    background: transparent;
    border: 2px solid #d4a574;
    color: #d4a574;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 20px;
}

#puzzle-container button:hover {
    background: #d4a574;
    color: #0a0806;
}

.puzzle-hint {
    font-size: 0.9rem;
    color: #4a3c2a;
    margin-top: 30px;
}

.music-cylinders {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 30px 0;
}

.cylinder {
    width: 50px;
    height: 80px;
    background: linear-gradient(to right, #4a3c2a, #6b5a4a, #4a3c2a);
    border: 2px solid #8b7355;
    border-radius: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s;
}

.cylinder:hover {
    transform: translateY(-5px);
    border-color: #d4a574;
}

.cylinder.selected {
    border-color: #ffa574;
    box-shadow: 0 0 15px rgba(255, 165, 116, 0.5);
}

.hint {
    font-size: 0.8rem;
    color: #4a3c2a;
    font-style: italic;
}

.mirror-grid {
    display: grid;
    grid-template-columns: repeat(3, 60px);
    gap: 10px;
    justify-content: center;
    margin: 30px 0;
}

.mirror-cell {
    width: 60px;
    height: 60px;
    background: #0a0806;
    border: 1px solid #4a3c2a;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
}

.mirror-cell.mirror {
    background: #1a1410;
    border: 2px solid #8b7355;
    cursor: pointer;
    transition: all 0.3s;
}

.mirror-cell.mirror:hover {
    border-color: #d4a574;
}

.mirror-cell.light-source {
    color: #ffd700;
    text-shadow: 0 0 10px #ffd700;
}

.mirror-cell.target {
    color: #ff6b6b;
    animation: targetPulse 1.5s infinite;
}

@keyframes targetPulse {
    0%, 100% { text-shadow: 0 0 5px #ff6b6b; }
    50% { text-shadow: 0 0 15px #ff6b6b; }
}

#win-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, #fff 0%, #f0e6d2 50%, #d4c8b8 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 300;
}

#win-screen h1 {
    font-size: 4rem;
    letter-spacing: 0.3em;
    color: #3d2817;
    margin-bottom: 30px;
}

#win-screen p {
    font-size: 1.5rem;
    color: #6b5a4a;
    margin-bottom: 40px;
}

#win-screen button {
    font-family: 'Special Elite', cursive;
    font-size: 1.2rem;
    padding: 15px 40px;
    background: #3d2817;
    border: none;
    color: #d4c8b8;
    cursor: pointer;
    transition: all 0.3s;
}

#win-screen button:hover {
    background: #5a4030;
}

#win-screen .footer {
    position: absolute;
    bottom: 20px;
}

#win-screen .footer a {
    color: #3d2817;
}

#message-display {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(10, 8, 6, 0.9);
    border: 2px solid #d4a574;
    padding: 20px 40px;
    font-size: 1.2rem;
    z-index: 250;
    animation: fadeInOut 3s forwards;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
    10% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    80% { opacity: 1; }
    100% { opacity: 0; }
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .title-container h1 {
        font-size: 2.5rem;
        letter-spacing: 0.2em;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .controls-legend {
        font-size: 0.8rem;
    }
    
    #puzzle-container {
        padding: 20px;
        margin: 20px;
    }
    
    .combo-dial {
        width: 50px;
        height: 60px;
        font-size: 2rem;
    }
    
    .cylinder {
        width: 40px;
        height: 60px;
    }
}