@charset "utf-8";

body {
    margin: 0; padding: 0;
    overflow: hidden;
    background-color: #000;
    color: #fff;
    font-family: 'DotGothic16', sans-serif;
}

#game-container {
    position: relative;
    width: 100vw; height: 100dvh;
    display: flex; justify-content: center; align-items: center;
    background-color: #000; 
}

canvas {
    image-rendering: pixelated; 
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
    border: 1px solid #333;
}

#ui-layer {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
}

#start-screen {
    text-align: center; color: #fff;
    pointer-events: auto; background: transparent;
}
h1 { font-size: 4rem; margin-bottom: 20px; letter-spacing: 0.2em; text-shadow: 2px 2px 0 #555; }
p { font-size: 1.2rem; margin-bottom: 10px; color: #aaa; }
.blink { animation: blink 1.5s infinite; }
@keyframes blink { 0% {opacity:1;} 50% {opacity:0;} 100% {opacity:1;} }

#message-box {
    position: absolute; bottom: 20px; width: 80%; max-width: 600px;
    background: #000; 
    border: 2px solid #fff; 
    border-radius: 4px;    
    padding: 15px 20px;
    z-index: 100; pointer-events: auto; text-align: left;
    box-shadow: 0 0 0 2px #000; 
}
#speaker-name { font-size: 1rem; color: #aaa; margin-bottom: 8px; border-bottom: 1px solid #333; display: inline-block; }
#message-text { font-size: 1.2rem; line-height: 1.6; color: #fff; letter-spacing: 0.05em; }

#choice-box {
    position: absolute; bottom: 150px; right: 10%;
    min-width: 180px;
    background: #000;
    border: 2px solid #fff;
    padding: 5px;
    z-index: 101;
    pointer-events: auto;
    box-shadow: 4px 4px 0 rgba(0,0,0,0.5);
}
.choice-option {
    padding: 8px 12px; font-size: 1.1rem; cursor: pointer; color: #888;
}
.choice-option.selected {
    color: #fff; background: #333;
}
.choice-option::before { content: '　'; } 
.choice-option.selected::before { content: '▶ '; }

#status-display {
    position: absolute; top: 10px; left: 10px;
    text-align: left; z-index: 105; pointer-events: none;
    font-size: 0.8rem;
}
#sanity-container { margin-bottom: 5px; color: #ff4444; }
#sanity-bar-bg {
    display: inline-block; width: 80px; height: 6px;
    background: #222; border: 1px solid #ff4444; vertical-align: middle;
}
#sanity-bar-inner { width: 0%; height: 100%; background: #ff4444; transition: width 0.5s ease-out; }
#inventory-display { color: #aaa; }
#item-list { color: #fff; }

.falling-effect { animation: world-fall 5s ease-in forwards; }
@keyframes world-fall {
    0% { transform: scale(1); filter: blur(0); opacity: 1; }
    100% { transform: scale(3); filter: blur(10px); opacity: 0; }
}

.rooftop-bg {
    background: linear-gradient(to bottom, #2b2d42, #8d99ae) !important;
}

.choice-option.danger {
    color: #ff4444;
    border-color: #ff4444;
}

#back-home {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #444; 
    text-decoration: none;
    font-size: 1rem;
    font-family: 'DotGothic16', sans-serif;
    z-index: 200; 
    pointer-events: auto; 
    transition: all 0.3s ease;
    letter-spacing: 0.1em;
}

#back-home:hover {
    color: #fff; 
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.8); 
}
@media (orientation: portrait) {
    #rotate-overlay {
        display: flex; flex-direction: column; justify-content: center; align-items: center;
        position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
        background: #000; z-index: 9999; color: #fff;
        text-align: center; font-family: 'DotGothic16', sans-serif;
    }
    #rotate-overlay p { font-size: 1.5rem; line-height: 2; animation: blink 2s infinite; }
    
    #game-container, #mobile-controls { display: none !important; }
}

@media (orientation: landscape) {
    #rotate-overlay { display: none !important; } 

    #mobile-controls {
        display: block; position: fixed; width: 100%; height: 100%; top: 0; left: 0;
        pointer-events: none; 
        z-index: 200;
    }

    #d-pad {
        position: absolute; bottom: 20px; left: 20px;
        width: 160px; height: 160px;
        pointer-events: auto;
    }
    .d-row { display: flex; justify-content: center; }
    .d-btn {
        width: 50px; height: 50px; background: rgba(255,255,255,0.15);
        border: 2px solid rgba(255,255,255,0.3); border-radius: 10px;
        margin: 4px; display: flex; align-items: center; justify-content: center;
        color: rgba(255,255,255,0.8); font-size: 1.5rem; user-select: none;
        touch-action: manipulation; 
    }
    #btn-up { margin: 0 auto; }
    #btn-down { margin: 0 auto; }

    #action-btns {
        position: absolute; bottom: 30px; right: 30px;
        display: flex; gap: 20px;
        pointer-events: auto;
    }
    .a-btn {
        width: 70px; height: 70px; border-radius: 50%;
        background: rgba(255,255,255,0.15); border: 2px solid rgba(255,255,255,0.3);
        display: flex; align-items: center; justify-content: center;
        color: #fff; font-size: 0.9rem; font-weight: bold; user-select: none;
        touch-action: manipulation;
    }
    .a-btn.main { width: 85px; height: 85px; background: rgba(255,200,200,0.15); border-color: rgba(255,200,200,0.4); font-size: 1.2rem; }

    .d-btn:active, .a-btn:active, .d-btn.active, .a-btn.active {
        background: rgba(255,255,255,0.5); color: #000;
        transform: scale(0.95);
    }
}