/* ========================================= */
/* 1. 基本設定と全体レイアウト */
/* ========================================= */
html {
    /* スクロールアニメーションを無効化（JSで制御するため） */
    scroll-behavior: auto; 
}

body {
    background-color: #f0f0f0;
    display: flex;
    flex-direction: column; 
    justify-content: flex-start;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    font-family: 'BIZ UDGothic', 'Meiryo', sans-serif;
    overflow-x: hidden; 
}

/* ========================================= */
/* 2. 券売機本体とグリッドレイアウト */
/* ========================================= */
.vending-machine-wrapper {
    font-size: clamp(0.8em, 2vw, 1em);
    width: 600px;
    background-color: #333;
    border: 15px solid #1a1a1a;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
    padding: 10px;
    color: #fff;
    margin-top: 20px; /* 言語ボタンの下にスペースを確保 */
}

.top-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 0 5px;
}

.display-box {
    background-color: #000;
    color: #0f0; 
    padding: 10px 15px;
    border-radius: 3px;
    font-size: 1em;
    border: 1px solid #555;
    width: 50%;
    text-align: center;
}

.slot-container {
    display: flex;
    gap: 10px;
}

.coin-slot, .note-slot {
    background-color: #555;
    color: #fff;
    padding: 8px 10px;
    text-align: center;
    border-radius: 3px;
    font-size: 0.8em;
    line-height: 1.2;
    border: 3px solid #777;
    width: 100px;
    white-space: pre-wrap; /* \n (改行) を有効にする */
}

.button-grid-9x6 {
    display: grid;
    grid-template-columns: repeat(6, 1fr); 
    grid-template-rows: repeat(9, 1fr);
    gap: 5px;
    padding: 5px;
    background-color: #444; 
    border-radius: 5px;
}

/* ========================================= */
/* 3. メニューボタンのスタイル */
/* ========================================= */
.menu-button {
    display: flex; 
    justify-content: center; 
    align-items: center;
    flex-direction: column; 
    text-align: center; 
    text-decoration: none; 
    color: inherit; 
    
    height: 60px;
    font-size: 0.7em;
    font-weight: bold;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    line-height: 1.2;
    padding: 1px;
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.3);
    transition: transform 0.1s;
    background-color: #666; 
    color: #fff;
}

.menu-button:active {
    transform: translateY(3px);
    box-shadow: none;
}

/* 大型ボタン */
.menu-large {
    height: 70px;
    font-size: 0.8em;
}

/* ボタンの色分け */
.menu-red { background-color: #f7a27b; color: #fff; } 
.menu-rightred { background-color: #fc5269; color: #fff; }
.menu-purple { background-color: #ffb7ed; color: #000000;}
.menu-blue { background-color: #3498db; color: #000000; }
.menu-skyblue { background-color: #9ef0ff; color: #000000; }
.menu-deepblue { background-color: #00416d; color: #fff; }
.menu-black {background-color: #313131; color: #fff; }
.menu-white { background-color: #fff; color: #333; }
.menu-green { background-color: #2ecc71; color: #333; }
.menu-limegreen { background-color: #a7ffcc; color: #333; }
.menu-yellow { background-color: #f1c40f; color: #333; }
.menu-orange { background-color: #f39c12; color: #fff; }
.menu-pink { background-color: #ff94ff; color: #363030; }

/* ========================================= */
/* 4. フッターエリア (返却口、きっぷ排出口) */
/* ========================================= */
.bottom-section {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 10px 5px 0;
}

.slot-text {
    font-size: 0.8em;
    color: #ccc;
    background-color: #1a1a1a;
    padding: 5px;
    border-radius: 3px;
    width: 100%;
    text-align: center;
    margin-top: 5px;
}

.ticket-dispenser {
    width: 60%;
    background-color: #222;
    padding: 10px 0;
    text-align: center;
    border: 5px solid #555;
    border-radius: 5px;
    line-height: 1;
    font-size: 1.2em;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.ticket-dispenser p:first-child {
    font-size: 2em;
    font-weight: 900;
}

.logo-container {
    margin-top: 20px;
    text-align: center;
}

.logo-image {
    max-width: 300px;
    width: 80%;
    height: auto;
}
/* ========================================= */
/* 5. 多言語対応 (JS制御) */
/* ========================================= */
.language-block {
    display: none;
}
/* JSで active クラスが付与されたブロックのみ表示 */
.language-block.active {
    display: block;
}
.language-switcher {
    text-align: center;
    margin-top: 20px;
    margin-bottom: 10px;
}
.lang-btn {
    padding: 5px 10px;
    background-color: #555;
    color: white;
    text-decoration: none;
    margin: 0 5px;
    border-radius: 3px;
    font-weight: bold;
    cursor: pointer;
}
.info-button-container {
    text-align: center;
    margin-top: 10px;
    margin-bottom: 10px;
}

.info-btn {
    display: inline-block;
    padding: 10px 20px;
    background-color: #e74c3c; /* 赤色で目立たせる */
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 3px 0 #c0392b;
    transition: transform 0.1s;
}

.info-btn:active {
    transform: translateY(3px);
    box-shadow: none;
}

/* ========================================= */
/* 6. ポップアップ (モーダル) スタイル */
/* ========================================= */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: none; /* 初期状態では非表示 */
    justify-content: center;
    align-items: center;
    z-index: 1000; /* 最前面に表示 */
}

.popup-overlay.active {
    display: flex; /* JSで active クラスが付与されたら表示 */
}

.popup-content {
    background-color: #fff;
    color: #333;
    padding: 30px 40px;
    border-radius: 10px;
    max-height: 90vh; /* 画面の90%までに制限 */
    overflow-y: auto; /* 縦スクロールを許可 */
    max-width: 400px;
    width: 90%;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
    position: relative;
    text-align: left;
    -webkit-overflow-scrolling: touch;
}

.popup-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 2em;
    cursor: pointer;
    color: #999;
}

#popup-menu-name {
    font-size: 1.5em;
    color: #e74c3c;
    border-bottom: 2px solid #ccc;
    padding-bottom: 5px;
    margin-top: 0;
}
#popup-menu-price {
    font-size: 1.2em;
    font-weight: bold;
    color: #3498db;
    margin-bottom: 15px;
}
#popup-menu-description {
    line-height: 1.6;
}

/* ... (既存の 6. ポップアップ (モーダル) スタイルの修正) ... */
/* ポップアップのコンテンツの調整 */
#info-popup-title {
    font-size: 1.5em;
    color: #3498db; /* メニューと色を変える */
    border-bottom: 2px solid #ccc;
    padding-bottom: 5px;
    margin-top: 0;
}
#info-popup-content p {
    background-color: #f0f0f0;
    padding: 10px;
    margin-bottom: 10px;
    border-left: 5px solid #f39c12;
    line-height: 1.6;
}
/* ========================================= */
/* 7. モバイル対応 (レスポンシブデザイン) */
/* ========================================= */
@media (max-width: 650px) {
    
    /* 券売機本体: 画面幅いっぱいに広げ、マージンを調整 */
    .vending-machine-wrapper {
        width: 95%;
        border: 8px solid #1a1a1a;
        margin-top: 20px;
        margin-bottom: 20px;
        padding: 5px;
        font-size: 0.85em;

    }

    /* ボタンのグリッド: 画面が狭いので、ボタンサイズを全体的に縮小 */
    .button-grid-9x6 {
        gap: 3px;
        padding: 3px;
    }

    /* 上部エリア: ディスプレイとスロットを縦に並べる */
    .top-section {
        flex-direction: column; 
        align-items: stretch;
        gap: 10px;
    }

    .display-box {
        width: 100%;
        font-size: 0.7em;
    }
    .display-box p {
        font-size: 1.5em;
    }

    .slot-container {
        justify-content: space-around;
        width: 100%;
    }

    .coin-slot, .note-slot {
        width: 45%; 
        font-size: 0.7em;
        padding: 6px 8px;
    }

    /* メニューボタン: 高さとフォントサイズを縮小 */
    .menu-button {
        height: 45px;
        font-size: 0.7em; 
    }

    .menu-large {
        height: 55px;
        font-size: 0.7em;
    }
    
    /* フッターエリア: 排出口と返却口を調整 */
    .bottom-section {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .ticket-dispenser {
        width: 100%;
    }

    .popup-content {
        padding: 20px; /* ← 既存の値を少し減らす */
        max-height: 90vh; /* 画面の90%までに制限 */
        overflow-y: auto; /* スクロール可能にする */
        -webkit-overflow-scrolling: touch; /* スマホでスムーズスクロール */
    }
    .logo-image {
        max-width: 200px;
        width: 90%;
    }

}

/* 画面幅に応じて文字サイズを調整 */
.vending-machine-wrapper {
    font-size: clamp(0.8em, 2vw, 1em);
}