body {
    background-color: #1a1a1a;
    color: #eee;
    font-family: 'Noto Sans JP', sans-serif;
    text-align: center;
    margin: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    /* ゲーム背景画像。変更する場合はここを修正してください */
    background-image: url('images/bg_majang.png');
    background-size: cover;
    background-position: center;
}

#game-container, #cg-display {
    max-width: 900px;
    width: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease-in-out;
}

.game-title, .clear-title {
    color: gold;
    text-shadow: 2px 2px 5px #000;
}

#info-panel {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    padding: 10px;
    margin-bottom: 20px;
}

/* CPUキャラクター表示エリア */
#cpu-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
    position: relative;
    height: 550px;
}

/* キャラクターのレイヤーコンテナ */
.character-layers {
    position: relative;
    width: 550px;
    height: 550px;
}

/* キャラクターの各レイヤー画像 */
.character-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#cpu-dialogue {
    background: rgba(255, 255, 255, 0.1);
    padding: 10px;
    border-radius: 5px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-style: italic;
    color: #ccc;
    width: 100%;
    box-sizing: border-box;
}

#cpu-hand-area {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 10px;
}

#cpu-hand-area .tile {
    background-color: #222;
    border: 2px solid #555;
    transform: rotateX(180deg);
}

#discard-areas {
    display: flex;
    justify-content: space-between;
    width: 100%;
}

.discard-area {
    min-height: 80px;
    background-color: rgba(255, 255, 255, 0.05);
    border: 2px dashed #777;
    padding: 10px;
    border-radius: 8px;
    width: 45%;
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    justify-content: flex-start;
}

#player-hand-container {
    margin-top: 30px;
}

#player-hand {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 5px;
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

/* 牌の共通スタイル */
.tile {
    width: 40px;
    height: 60px;
    background-size: cover;
    border: 1px solid #000;
    border-radius: 5px;
    box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: transform 0.2s ease;
}

.tile:hover {
    transform: translateY(-5px);
}

/* 牌の画像パスをクラスで指定 */
.tile-p_1 { background-image: url('images/tiles/p_1.png'); }
.tile-p_2 { background-image: url('images/tiles/p_2.png'); }
.tile-p_3 { background-image: url('images/tiles/p_3.png'); }
.tile-p_4 { background-image: url('images/tiles/p_4.png'); }
.tile-p_5 { background-image: url('images/tiles/p_5.png'); }
.tile-p_6 { background-image: url('images/tiles/p_6.png'); }
.tile-p_7 { background-image: url('images/tiles/p_7.png'); }
.tile-p_8 { background-image: url('images/tiles/p_8.png'); }
.tile-p_9 { background-image: url('images/tiles/p_9.png'); }
.tile-m_1 { background-image: url('images/tiles/m_1.png'); }
.tile-m_2 { background-image: url('images/tiles/m_2.png'); }
.tile-m_3 { background-image: url('images/tiles/m_3.png'); }
.tile-m_4 { background-image: url('images/tiles/m_4.png'); }
.tile-m_5 { background-image: url('images/tiles/m_5.png'); }
.tile-m_6 { background-image: url('images/tiles/m_6.png'); }
.tile-m_7 { background-image: url('images/tiles/m_7.png'); }
.tile-m_8 { background-image: url('images/tiles/m_8.png'); }
.tile-m_9 { background-image: url('images/tiles/m_9.png'); }
.tile-s_1 { background-image: url('images/tiles/s_1.png'); }
.tile-s_2 { background-image: url('images/tiles/s_2.png'); }
.tile-s_3 { background-image: url('images/tiles/s_3.png'); }
.tile-s_4 { background-image: url('images/tiles/s_4.png'); }
.tile-s_5 { background-image: url('images/tiles/s_5.png'); }
.tile-s_6 { background-image: url('images/tiles/s_6.png'); }
.tile-s_7 { background-image: url('images/tiles/s_7.png'); }
.tile-s_8 { background-image: url('images/tiles/s_8.png'); }
.tile-s_9 { background-image: url('images/tiles/s_9.png'); }
.tile-ton { background-image: url('images/tiles/ton.png'); }
.tile-nan { background-image: url('images/tiles/nan.png'); }
.tile-sha { background-image: url('images/tiles/sha.png'); }
.tile-pei { background-image: url('images/tiles/pei.png'); }
.tile-haku { background-image: url('images/tiles/haku.png'); }
.tile-hatsu { background-image: url('images/tiles/hatsu.png'); }
.tile-chun { background-image: url('images/tiles/chun.png'); }

/* 裏向きの牌 */
.tile.back {
    background-image: url('images/tiles/back.png');
}

/* CG表示エリア */
#cg-display {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #222;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
    text-align: center;
    z-index: 1000;
}

#stage-cg {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin-top: 15px;
}

#next-stage-btn {
    margin-top: 20px;
    padding: 10px 20px;
    font-size: 18px;
    cursor: pointer;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
}

/* 画面を非表示にするクラス */
.hidden {
    display: none;
}

/* ゲームオーバー表示エリア */
#game-over-display {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #222;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
    text-align: center;
    z-index: 1000;
}

#game-over-message {
    font-size: 24px;
    margin-bottom: 20px;
}

#retry-btn {
    padding: 10px 20px;
    font-size: 18px;
    cursor: pointer;
    background-color: #f44336;
    color: white;
    border: none;
    border-radius: 5px;
}

/* チートボタンのスタイル */
.cheat-area {
    margin-top: 20px;
}

#cheat-btn {
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    transition: background-color 0.3s;
}

#cheat-btn:hover {
    background-color: #0056b3;
}