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

body {
    font-family: 'Yu Gothic', 'Hiragino Kaku Gothic ProN', 'Meiryo', sans-serif;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    height: -webkit-fill-available;
    position: relative;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: 0;
    background-color: #000;
}

/* コンテナ（縦位置固定） */
#app-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    height: 100vh;
    overflow: hidden;
}

/* 背景画像 */
.background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
    filter: blur(0px);
    transition: filter 2s ease-in-out;
}

.background.blurred {
    filter: blur(3px);
    transform: scale(1.03);
    /* エッジ欠けを補正 */
}

/* 背景上の半透明黒オーバーレイ */
.bg-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 2;
}

/* フェード用オーバーレイ */
.fade-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    z-index: 10;
    pointer-events: none;
    opacity: 1;
    transition: opacity 2s ease-in-out;
}

.fade-overlay.fade-out {
    opacity: 0;
}

.fade-overlay.fade-in {
    opacity: 1;
}

/* テキストウィンドウ */
.text-window {
    position: absolute;
    bottom: 25%;
    /* 画面中央やや下寄り */
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 400px;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 1s ease-in-out;
}

.text-window.active {
    opacity: 1;
    pointer-events: auto;
}

.text-area {
    width: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    min-height: 80px;
    /* ガタつき防止用の最低高さ */
}

/* テキスト内容 */
.text-content {
    font-size: 16px;
    /* モバイル優先だと16px〜18px */
    line-height: 2.0;
    /* ゆったりとした行間 */
    color: #ffffff;
    width: 100%;
    text-align: left;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.text-content.show {
    opacity: 1;
}

/* 進行可能マーク */
.continue-icon {
    margin-top: 30px;
    font-size: 24px;
    color: #ffffff;
    opacity: 0;
    pointer-events: none;
}

.continue-icon.show {
    opacity: 1;
    animation: blink 1s ease-in-out infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 0.3;
    }

    50% {
        opacity: 1;
    }
}

/* タイトル画面 */
.title-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 40vh;
    z-index: 20;
    opacity: 1;
    transition: opacity 1s ease-in-out;
}

.title-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.title-text {
    color: #fff;
    font-size: 48px;
    font-weight: 300;
    letter-spacing: 4px;
    text-align: center;
}

/* 常時表示クローズボタン */
.close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 30;
    font-size: 32px;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: color 0.2s ease;
    line-height: 1;
    user-select: none;
}

.close-btn:hover {
    color: #fff;
}

/* エンド画面 */
.replay-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 40vh;
    z-index: 15;
    opacity: 0;
    pointer-events: none;
    transition: opacity 1s ease-in-out;
}

.replay-screen.show {
    opacity: 1;
    pointer-events: auto;
}

.replay-button {
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    letter-spacing: 2px;
    transition: opacity 0.2s ease;
}

.replay-button:hover {
    opacity: 0.7;
}

/* グローバルミュートボタン */
.mute-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 100;
    background: transparent;
    border: none;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.mute-btn svg {
    fill: rgba(255, 255, 255, 0.5);
    width: 28px;
    height: 28px;
    transition: fill 0.2s ease, transform 0.3s ease;
    display: block;
}

.mute-btn:hover svg {
    fill: #ffffff;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    body {
        align-items: flex-start;
        padding-top: 10vh;
    }

    #app-container {
        height: 90vh;
    }

    .title-screen {
        padding-top: 30vh;
    }

    .text-window {
        bottom: max(15%, env(safe-area-inset-bottom, 15px));
        padding: 15px 20px;
    }

    .text-content {
        font-size: 16px;
    }

    .continue-icon {
        margin-top: 20px;
        font-size: 20px;
    }

    .title-text {
        font-size: 36px;
    }

    .replay-button {
        font-size: 20px;
    }
}