* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
}

body {
    background: #202124;
    color: #ffffff;
    font-family:
        "Yu Gothic",
        "Hiragino Kaku Gothic ProN",
        Meiryo,
        sans-serif;

    overflow: hidden;
}

/* 全体：1画面に収める */
.novel-container {
    height: 100vh;
    width: 100vw;

    padding: 15px;

    display: flex;
    flex-direction: column;
}

/* ヘッダー */
header {
    flex: 0 0 auto;

    display: flex;
    justify-content: space-between;
    align-items: center;

    margin-bottom: 10px;
}

header h1 {
    margin: 0;
    font-size: 22px;
}

.counter {
    font-size: 15px;
    color: #cccccc;
}

/* メニューに戻るボタン（ヘッダー内、全コマ常時表示） */
#menu-button {
    margin-right: 15px;

    padding: 8px 16px;

    border: none;
    border-radius: 6px;

    background: rgba(255, 255, 255, 0.12);
    color: white;

    font-size: 14px;
    font-weight: bold;

    cursor: pointer;

    transition: 0.2s;
    white-space: nowrap;
}

#menu-button:hover {
    background: rgba(255, 255, 255, 0.24);
}

/* =========================
   ステージ（背景＋キャラ＋セリフ）
========================= */

.stage {
    position: relative;

    flex: 1;
    min-height: 0;

    border-radius: 10px;
    overflow: hidden;

    background: #111111;

    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

#main-image {
    position: absolute;
    inset: 0;

    width: 100%;
    height: 100%;

    object-fit: cover;
}

/* 中央に重ねるスクリーンショット等（浮遊キャラと同じ高さに合わせる） */
.screenshot-wrap {
    position: absolute;
    top: 8%;
    left: 50%;
    transform: translateX(-50%);

    display: none;

    max-width: 54%;
}

.screenshot-image {
    display: block;

    width: 100%;

    max-height: 58vh;

    object-fit: contain;

    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

/* さりげなく端に表示する注記（加工・開発中データの断り書き） */
.screenshot-caption {
    position: absolute;
    left: 6px;
    bottom: 6px;

    padding: 1px 7px;

    border-radius: 3px;

    background: rgba(0, 0, 0, 0.45);
    color: rgba(255, 255, 255, 0.65);

    font-size: 10px;
    font-weight: normal;

    white-space: nowrap;
}

/* キャラクター重ね表示 */
.character-layer {
    position: absolute;
    inset: 0;

    pointer-events: none;
}

.character-img {
    position: absolute;
    bottom: 0;

    height: 88%;

    object-fit: contain;

    filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.5));
}

.character-img.right {
    right: 2%;
}

.character-img.left {
    left: -8%;
}

/* 浮遊型キャラクター用（地面に接地させず高い位置に浮かせる） */
.character-img.float {
    bottom: 32%;
    height: 98%;
}

/* =========================
   セリフバー（ステージ下部に重ねる）
========================= */

.dialogue-bar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;

    display: flex;
    align-items: flex-end;
    gap: 20px;

    padding: 18px 22px;

    background: linear-gradient(to top, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.55) 70%, transparent);
}

.dialogue-content {
    flex: 1;
    min-width: 0;
}

.character-name {
    display: inline-block;

    margin-bottom: 8px;
    padding: 4px 14px;

    border-radius: 5px;

    background: #555;

    font-size: 16px;
    font-weight: bold;
}

.dialogue-text {
    font-size: 19px;
    line-height: 1.6;
}

/* =========================
   次へ／戻るボタン
========================= */

.nav-buttons {
    flex-shrink: 0;

    display: flex;
    gap: 10px;
}

#back-button,
#next-button {
    padding: 12px 22px;

    border: none;
    border-radius: 8px;

    background: rgba(0, 0, 0, 0.75);
    color: white;

    font-size: 16px;
    font-weight: bold;

    cursor: pointer;

    transition: 0.2s;
    white-space: nowrap;
}

#back-button:hover,
#next-button:hover {
    background: rgba(0, 0, 0, 0.95);

    transform: translateY(-2px);
}

#back-button:active,
#next-button:active {
    transform: translateY(0);
}

/* =========================
   選択肢エリア
========================= */

#choice-area {
    flex-shrink: 0;

    display: none;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;

    max-width: 55%;
}

.choice-button {
    padding: 12px 20px;

    border: none;
    border-radius: 8px;

    background: rgba(0, 90, 200, 0.85);
    color: white;

    font-size: 15px;
    font-weight: bold;

    cursor: pointer;

    transition: 0.2s;
    white-space: nowrap;
}

.choice-button:hover {
    background: rgba(0, 110, 240, 0.95);

    transform: translateY(-2px);
}

/* =========================
   スマホ対応
========================= */

@media (max-width: 700px) {

    header h1 {
        font-size: 16px;
    }

    .dialogue-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .character-name {
        font-size: 13px;
    }

    .dialogue-text {
        font-size: 15px;
    }

    .nav-buttons {
        justify-content: flex-end;
    }

    #back-button,
    #next-button {
        padding: 9px 16px;
        font-size: 13px;
    }

    #choice-area {
        max-width: 100%;
        justify-content: flex-start;
    }

    .choice-button {
        padding: 9px 14px;
        font-size: 13px;
    }

    .character-img {
        height: 65%;
    }
}
