@charset "UTF-8";

/* ==========================================
   ゲーム画面全体コンテナ（レスポンシブ対応）
   ========================================== */
#game-container {
    position: relative;
    width: 100%;
    max-width: 800px;
    aspect-ratio: 16 / 9;
    margin: 20px auto;
    background-color: #0f172a;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    font-family: 'Hiragino Sans', 'Meiryo', sans-serif;
    user-select: none;
}

/* 背景画像 */
#bg-layer {
    width: 100%;
    height: 100%;
    background-image: url('../images/clubroom.webp');
    background-size: cover;
    background-position: center;
    filter: brightness(0.95);
}

/* 猪狩進の立ち絵 */
#susumu-img {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    height: 88%;
    pointer-events: none;
    z-index: 2;
    transition: opacity 0.25s ease-in-out, transform 0.25s ease-in-out;
    filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.4));
}

#susumu-img.fade-out {
    opacity: 0;
    transform: translateX(-50%) translateY(5px);
}

/* ==========================================
   非表示用クラス（※最優先で非表示にする）
   ========================================== */
.hidden {
    display: none !important;
}

/* ==========================================
   ポップアップ共通（名前入力 / 選択肢 / リンクボタン）
   ========================================== */
.overlay-box {
    position: absolute;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    padding: 20px 24px;
    border-radius: 16px;
    border: 3px solid #2a5298;
    text-align: center;
    z-index: 10;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    
    /* 横幅をpx固定＋max-widthでコントロールして画面端に広がらないように修正 */
    width: 80%;
    max-width: 360px;
    box-sizing: border-box;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from { opacity: 0; transform: translate(-50%, -40%) scale(0.95); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.overlay-box p {
    font-weight: bold;
    color: #1e3c72;
    font-size: clamp(0.85rem, 2.5vw, 1rem);
    margin-bottom: 12px;
}

/* 名前入力インプット欄（長くなりすぎないよう調整） */
.overlay-box input {
    width: 100%;
    max-width: 220px; /* 入力欄が伸びすぎるのを防止 */
    padding: 8px 12px;
    font-size: clamp(0.85rem, 2.5vw, 1rem);
    margin-bottom: 14px;
    border: 2px solid #cbd5e1;
    border-radius: 8px;
    text-align: center;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.overlay-box input:focus {
    border-color: #2a5298;
}

/* ボタン共通 */
.overlay-box button {
    display: block;
    width: 100%;
    max-width: 240px;
    margin: 6px auto;
    padding: 10px 16px;
    background: linear-gradient(135deg, #2a5298 0%, #1e3c72 100%);
    color: white;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: clamp(0.8rem, 2.2vw, 0.95rem);
    box-shadow: 0 4px 10px rgba(42, 82, 152, 0.3);
    transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
}

.overlay-box button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(42, 82, 152, 0.4);
    filter: brightness(1.1);
}

.overlay-box button:active {
    transform: translateY(0);
}

/* ==========================================
   メッセージボックス（セリフ枠）
   ========================================== */
#message-box {
    position: absolute;
    bottom: 3%;
    left: 3%;
    right: 3%;
    height: 26%;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.92) 0%, rgba(30, 41, 59, 0.96) 100%);
    border: 2px solid #38bdf8;
    border-radius: 10px;
    padding: 2% 3%;
    color: #ffffff;
    cursor: pointer;
    z-index: 5;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
    box-sizing: border-box;
    overflow: hidden;
}

#speaker-name {
    display: inline-block;
    font-weight: bold;
    color: #38bdf8;
    font-size: clamp(0.7rem, 2vw, 0.9rem);
    background: rgba(56, 189, 248, 0.15);
    padding: 1px 8px;
    border-radius: 10px;
    border: 1px solid rgba(56, 189, 248, 0.3);
    margin-bottom: 2px;
}

#message-text {
    font-size: clamp(0.75rem, 2.2vw, 1rem);
    line-height: 1.5;
    letter-spacing: 0.02em;
    color: #f1f5f9;
}

#next-arrow {
    position: absolute;
    bottom: 6px;
    right: 12px;
    color: #38bdf8;
    font-size: clamp(0.6rem, 1.8vw, 0.8rem);
    animation: bounce 0.8s infinite alternate ease-in-out;
}

@keyframes bounce {
    from { transform: translateY(0); opacity: 0.6; }
    to { transform: translateY(-5px); opacity: 1; }
}

/* ==========================================
   スマホ向け立ち絵微調整
   ========================================== */
@media (max-width: 600px) {
    #susumu-img {
        height: 92%;
        bottom: -2%;
    }
}