@charset "UTF-8";

/* --- 全体の設定 --- */
body {
    margin: 0;
    padding: 0;
    font-family: 'DotGothic16', sans-serif;
    background-color: #000;
    height: 100vh;
    overflow: hidden; /* スクロール禁止 */
}

/* ゲーム画面 */
.game-screen {
    position: relative;
    width: 100vw;
    height: 100dvh; /* スマホのアドレスバー対策 */
    background-image: url('background.png');
    background-size: cover;
    background-position: center;
    box-shadow: 0 0 100px rgba(0, 0, 0, 0.5) inset;
}

/* キャラクター */
.character-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    height: 70vh;
    width: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    pointer-events: none;
}

.character-img {
    height: 100%;
    width: auto;
    object-fit: contain;
    animation: float 3s ease-in-out infinite;
    filter: drop-shadow(0 10px 20px rgba(0,0,0,0.5));
}
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

/* メッセージウィンドウ */
.message-window {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 1000px;
    height: auto; /* 高さを自動に */
    min-height: 180px; /* 最低限の高さを確保 */
    background: rgba(0, 20, 40, 0.9);
    border: 4px solid #ff9d00;
    box-shadow: 0 0 0 4px #005f99, 0 0 30px #ff9d00, inset 0 0 50px rgba(0, 150, 255, 0.2);
    border-radius: 12px;
    padding: 25px 30px; /* 左右の余白を少し減らす */
    box-sizing: border-box;
    color: #fff;
    font-size: 22px; /* PCでのフォントサイズ */
    z-index: 100;
    cursor: pointer;
    user-select: none;
}

.speaker-name {
    color: #ff9d00;
    font-weight: bold;
    margin-bottom: 10px;
    font-size: 1em; /* 親要素のフォントサイズに合わせる */
    text-shadow: 2px 2px 0 #000;
    display: inline-block;
    border-bottom: 2px solid rgba(255, 157, 0, 0.5);
    padding-bottom: 2px;
}
.message-text {
    line-height: 1.5;
    display: block;
    min-height: 1.5em;
    word-break: break-all; /* 長い単語も折り返す */
}
.next-cursor {
    display: inline-block; margin-left: 10px; color: #ff9d00;
    animation: blink 1s steps(2, start) infinite;
}
@keyframes blink { to { visibility: hidden; } }

/* --- 入力フォーム (オーバーレイ) --- */
.input-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(5px);
    display: flex; justify-content: center; align-items: center;
    z-index: 200; display: none;
    overflow-y: auto;
    padding: 20px 0;
}

.input-box {
    background: linear-gradient(135deg, #002b4d 0%, #001a2e 100%);
    border: 3px solid #ff9d00;
    box-shadow: 0 0 40px rgba(0, 95, 153, 0.8);
    padding: 30px; /* 余白を少し減らす */
    border-radius: 20px;
    text-align: center; color: #fff;
    width: auto;
    min-width: 300px;
    max-width: 90%;
    box-sizing: border-box;
}

.input-label {
    font-size: 1.6rem; /* PCでのフォントサイズ */
    margin-bottom: 25px;
    display: block;
    color: #ff9d00;
    text-shadow: 0 0 10px rgba(255, 157, 0, 0.5);
    white-space: normal;
    word-break: break-word;
    line-height: 1.4;
}

/* 入力欄 */
.retro-input {
    background: #eef; border: 3px solid #005f99; padding: 12px;
    font-size: 1.3rem; font-family: 'DotGothic16', sans-serif;
    border-radius: 8px; outline: none;
    width: 100%;
    max-width: 350px; /* PCでの最大幅 */
    box-sizing: border-box;
    text-align: center; box-shadow: inset 0 2px 5px rgba(0,0,0,0.2);
    margin: 0 auto;
    display: block;
}
.retro-input:focus { border-color: #ff9d00; background: #fff; box-shadow: 0 0 15px #ff9d00; }

.retro-btn {
    background: linear-gradient(to bottom, #ffb340, #ff9d00);
    color: #000; border: none; border-bottom: 5px solid #c77a00;
    padding: 10px 30px;
    font-size: 1.3rem; font-family: 'DotGothic16', sans-serif;
    font-weight: bold; cursor: pointer; border-radius: 8px; margin-top: 25px;
    transition: all 0.1s; text-shadow: 0 1px 0 rgba(255,255,255,0.4);
    margin: 25px auto 0;
    display: block;
}
.retro-btn:active { transform: translateY(4px); border-bottom-width: 0; margin-top: 29px; }

/* 選択カード */
.card-container {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 800px;
}
.selection-card {
    background: rgba(0, 64, 112, 0.8); border: 2px solid #005f99;
    padding: 15px;
    border-radius: 12px;
    cursor: pointer;
    width: 130px; /* PCでの幅を少し小さく */
    text-align: center; transition: all 0.2s; box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.selection-card:hover {
    border-color: #ff9d00; background: #005f99;
    transform: translateY(-8px) scale(1.05); box-shadow: 0 10px 25px rgba(255, 157, 0, 0.4);
}
.card-icon { font-size: 3rem; display: block; margin-bottom: 10px; }
.selection-card span:last-child { font-size: 1.1rem; }

/* 年収入力 */
.salary-input-group {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    font-size: 1.6rem; color: #ffd700; flex-wrap: nowrap;
}
.salary-icon { font-size: 2.5rem; filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.7)); }

.radio-container { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 350px; margin: 0 auto; }
.radio-option {
    background: #004070; border: 2px solid #005f99; padding: 15px;
    border-radius: 10px; font-size: 1.2rem; cursor: pointer; transition: all 0.2s;
}
.radio-option:hover { border-color: #ff9d00; background: #005f99; padding-left: 25px; }

/* --- エンディング・ノイズ --- */
.ending-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: #000; z-index: 900;
    opacity: 0; pointer-events: none;
    transition: opacity 3s ease-in-out;
    display: flex; justify-content: center; align-items: center;
}
.ending-overlay.active { opacity: 1; pointer-events: auto; }
.ending-text {
    color: #fff; font-size: 1.8rem; text-align: center; line-height: 1.8;
    opacity: 0; transition: opacity 2s ease-in-out; transform: translateY(20px);
    width: 90%; /* スマホではみ出さないように */
}
.ending-text.show { opacity: 1; transform: translateY(0); }
.noise-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 2000; opacity: 0; pointer-events: none;
    background-image: url('data:image/svg+xml;charset=utf-8,%3Csvg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"%3E%3Cfilter id="noise"%3E%3CfeTurbulence type="fractalNoise" baseFrequency="0.65" numOctaves="3" stitchTiles="stitch"/%3E%3C/filter%3E%3Crect width="100%25" height="100%25" filter="url(%23noise)" opacity="1"/%3E%3C/svg%3E');
    filter: contrast(150%) brightness(100%);
}
.noise-overlay.active {
    opacity: 0.5; animation: noise-anim 0.2s steps(4) infinite;
    background-color: #fff; mix-blend-mode: hard-light;
}
@keyframes noise-anim {
    0% { background-position: 0 0; }
    100% { background-position: 100px 100px; }
}

/* ========================================= */
/* ★スマホ対応 (大幅調整版) */
/* ========================================= */
@media (max-width: 768px) {
    /* ゲーム画面全体 */
    .message-window {
        font-size: 16px; /* フォントサイズを小さく */
        min-height: 120px; /* 高さを小さく */
        padding: 15px;
        bottom: 15px;
        width: 92%; /* 横幅を少し狭くして余白を作る */
    }

    /* キャラクター */
    .character-container {
        height: 55vh; /* キャラのサイズを調整 */
        top: 45%;
    }

    /* 入力フォーム */
    .input-box {
        width: 88%; /* 横幅を狭く */
        padding: 25px 15px; /* 内部余白を調整 */
    }

    /* 質問文 */
    .input-label {
        font-size: 1.3rem; /* フォントサイズを小さく */
        margin-bottom: 20px;
        line-height: 1.4;
    }

    /* 入力欄（テキスト） */
    .retro-input {
        font-size: 16px;
        padding: 10px;
        max-width: 100%; /* 画面幅いっぱいに */
    }

    /* ボタン */
    .retro-btn {
        width: 100%;
        padding: 12px;
        font-size: 1.2rem;
        margin: 20px auto 0;
    }

    /* カード選択 (2列できれいに並べる) */
    .card-container {
        gap: 10px; /* カード間の隙間 */
        justify-content: space-around; /* 均等に配置 */
    }
    .selection-card {
        width: calc(50% - 10px); /* 2列になるように計算 (隙間の分を引く) */
        padding: 12px 5px;
        box-sizing: border-box; /* paddingを含めた幅計算 */
        flex-grow: 0; /* 勝手に伸びないように */
    }
    .card-icon { font-size: 2.2rem; margin-bottom: 5px; }
    .selection-card span:last-child { font-size: 1rem; }

    /* 年収入力 */
    .salary-input-group {
        gap: 8px;
        font-size: 1.2rem;
        flex-wrap: wrap;
    }
    .salary-icon { font-size: 2rem; }
    #formInput[type="number"] { width: 100px !important; }

    /* ラジオボタン */
    .radio-option {
        padding: 12px;
        font-size: 1.1rem;
    }
    
    /* エンディングテキスト */
    .ending-text {
        font-size: 1.4rem;
    }
}