/* プレミアムなホラー演出を意識したリセットとベーススタイル */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: #000;
    color: #fff;
    font-family: 'Shippori Mincho', serif;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
    user-select: none; /* テキスト選択防止 */
}

/* ゲームのメインコンテナ：16:9のアスペクト比を維持 */
#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    max-width: 1280px;
    max-height: 720px;
    aspect-ratio: 16 / 9;
    background-color: #000;
    overflow: hidden;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.hidden {
    display: none !important;
}

/* タイトル画面 */
#title-screen {
    background-image: url('assets/bgimage/title_bg.jpg');
    background-size: cover;
    background-position: center;
    z-index: 10;
    transition: opacity 2s ease;
}

#title-menu {
    position: absolute;
    top: 60%;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
}

.glink-button {
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 15px 40px;
    font-size: 24px;
    font-family: 'Shippori Mincho', serif;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 300px;
}

.glink-button:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.8);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

/* ゲーム画面 */
#game-screen {
    z-index: 5;
}

#bg-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-color: transparent;
    transition: background-image 2s ease, background-color 2s ease, opacity 2s ease;
}

/* ビネット（四隅の暗転）レイヤー。画像を使わずCSSグラデーションで生成することで格子柄の不具合を完全に排除 */
#vignette-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, transparent 40%, rgba(0,0,0,0.85) 100%);
    pointer-events: none;
    z-index: 6;
    opacity: 0;
    transition: opacity 1s ease;
}

/* メッセージウィンドウ */
#message-window {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    height: 30%; /* 3行のテキストがはみ出さないように高さを拡張 */
    background: rgba(0, 0, 0, 0.85); /* 透過度を下げてよりはっきりとした黒に */
    backdrop-filter: blur(8px); /* 背景をぼかして文字をくっきりさせる */
    border: 1px solid rgba(255,255,255,0.4); /* 境界線を少し強くする */
    box-shadow: 0 4px 15px rgba(0,0,0,0.8), inset 0 0 20px rgba(0,0,0,0.5);
    border-radius: 8px; /* 角を少し丸める */
    z-index: 8;
    padding: 30px 40px;
    box-sizing: border-box;
    cursor: pointer;
    transition: background 0.5s ease, border 0.5s ease; /* 色変更時のアニメーション */
}

#message-text {
    font-size: 26px;
    line-height: 1.8;
    letter-spacing: 2px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    white-space: pre-wrap;
    /* クリックイベントが下に通るように */
    pointer-events: none; 
}

/* イタリック体の指定（シナリオのfont italic="true"用） */
.italic-text {
    font-style: italic;
}

#message-cursor {
    position: absolute;
    bottom: 20px;
    right: 30px;
    font-size: 20px;
    animation: blink 1s infinite;
}

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

/* システムボタン */
.system-button {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0,0,0,0.5);
    color: #aaa;
    border: 1px solid #555;
    padding: 5px 15px;
    font-family: 'Shippori Mincho', serif;
    font-size: 16px;
    cursor: pointer;
    transition: 0.3s;
    z-index: 9;
}

.system-button:hover {
    color: #fff;
    border-color: #fff;
    background: rgba(255,255,255,0.1);
}

/* ログ画面 */
#log-screen {
    background: rgba(0, 0, 0, 0.9);
    z-index: 20;
    display: flex;
    flex-direction: column;
}

.log-header {
    height: 60px;
    position: relative;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}

.log-header .system-button {
    top: 15px;
    bottom: auto;
}

#log-content {
    flex: 1;
    overflow-y: auto;
    padding: 40px;
    font-size: 22px;
    line-height: 2;
    color: #ccc;
}

.log-entry {
    margin-bottom: 20px;
    border-bottom: 1px dashed rgba(255,255,255,0.1);
    padding-bottom: 10px;
}

/* エンディング画面 */
#ending-screen {
    background: #000;
    z-index: 30;
    display: flex;
    justify-content: center;
    align-items: center;
}

#ending-text {
    font-size: 40px;
    letter-spacing: 10px;
    opacity: 0;
    transition: opacity 3s ease;
}

/* クエイクアニメーション（画面揺れ） */
@keyframes quake {
    0% { transform: translateY(0); }
    25% { transform: translateY(-2px); }
    50% { transform: translateY(0); }
    75% { transform: translateY(2px); }
    100% { transform: translateY(0); }
}

.quake-effect {
    animation: quake 4s ease-in-out infinite;
}
