body {
    font-family: 'Arial', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh; /* 画面全体に広がるように */
    background-color: skyblue; /* 空色 */
    margin: 0;
    overflow: hidden; /* 回転時の要素のはみ出しを防ぐ */
    box-sizing: border-box; /* paddingとborderをwidth/heightに含める */
}

#game-container {
    background: linear-gradient(135deg, #fceabb, #f8b500); /* 暖色系のグラデーション */
    padding: 30px 50px;
    border-radius: 15px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3); /* 影を強調 */
    text-align: center;
    width: 90%; /* 幅を調整 */
    max-width: 600px; /* PCでの最大幅 */
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 3px solid rgba(255, 255, 255, 0.5); /* 枠線を追加 */
    box-sizing: border-box;
}

h1 {
    color: #4a4a4a;
    margin-bottom: 30px;
    font-size: 2.8em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 10px;
    font-size: 1.1em;
    color: #666;
}

#num-players,
.player-initial-input {
    padding: 10px 15px;
    border: 1px solid #bbb;
    border-radius: 8px;
    font-size: 1em;
    width: 80px;
    text-align: center;
    margin-right: 10px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
    box-sizing: border-box;
}

#create-inputs-button,
#finish-input-button {
    padding: 12px 25px;
    font-size: 1.1em;
    cursor: pointer;
    border: none;
    border-radius: 8px;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
    margin-top: 15px;
    background-color: #007bff;
    color: white;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
}

#create-inputs-button:hover,
#finish-input-button:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

#player-initials-area {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    margin-bottom: 20px;
}

.player-initial-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.player-initial-wrapper label {
    font-size: 0.9em;
    color: #777;
    margin-bottom: 5px;
}

.player-initial-input {
    width: 60px;
    text-transform: uppercase;
    box-sizing: border-box;
}


/* Kuji Board Styles */
#kuji-board {
    margin-top: 30px;
    align-items: center; /* flex-directionをcolumnにしていれば中央揃え */
    display: flex; /* これも必要に応じて */
    flex-direction: column; /* #player-circleの下にボタンを置くため */
}

#player-circle {
    position: relative;
    width: 450px; /* PCでの円の直径 */
    height: 450px; /* PCでの円の直径 */
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.7);
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.2);
    flex-shrink: 0; /* flexアイテムとして縮小させない */
    margin-bottom: 20px; /* もう一度遊ぶボタンとの間隔 */
}

.player-slot {
    position: absolute;
    width: 60px; /* PCでのスロット幅 */
    height: 60px; /* PCでのスロット高さ */
    background-color: white;
    border: 1px solid black;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 1.5em; /* PCでのフォントサイズ */
    color: #333;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: background-color 0.1s ease, color 0.1s ease, transform 0.1s ease;
    cursor: default;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
}

/* STARTボタンのスタイル */
#start-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    padding: 20px 40px; /* PCでのパディング */
    font-size: 1.5em; /* PCでのフォントサイズ */
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

#start-button:hover {
    background-color: #c82333;
    transform: translate(-50%, -50%) scale(1.05);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
}


/* アニメーション用クラス */
.spinning {
    transition: transform 4s ease-out;
}

.highlight-winner {
    background-color: #ff4500 !important;
    color: white !important;
    transform: scale(1.6) !important;
    transition: transform 0.3s ease-out, background-color 0.3s ease-out, color 0.3s ease-out;
}

/* もう一度遊ぶボタンのスタイル */
#reset-button {
    position: absolute; /* PC版では円の中央に配置 */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    padding: 20px 40px; /* PCでのパディング */
    font-size: 1.5em; /* PCでのフォントサイズ */
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 50%;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

#reset-button:hover {
    background-color: #218838;
    transform: translate(-50%, -50%) scale(1.05);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
}


/* ユーティリティクラス */
.hidden {
    display: none !important;
}

.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ========================================= */
/* スマートフォン対応 (画面幅600px以下に適用) */
/* ========================================= */
@media (max-width: 600px) {
    #game-container {
        padding: 20px; /* パディングを減らす */
        width: 95%; /* 幅を少し広げる */
        border-radius: 10px; /* 角丸を少し小さく */
    }

    h1 {
        font-size: 2em; /* タイトルを小さく */
        margin-bottom: 20px;
    }

    .input-group label {
        font-size: 1em;
    }

    #num-players,
    .player-initial-input {
        padding: 8px 12px;
        font-size: 0.9em;
        width: 60px; /* 入力欄の幅を調整 */
        margin-right: 5px;
    }

    #create-inputs-button,
    #finish-input-button {
        padding: 10px 20px;
        font-size: 1em;
        margin-top: 10px;
    }

    #player-initials-area {
        gap: 10px; /* 入力欄間の隙間を減らす */
        margin-top: 15px;
        margin-bottom: 15px;
    }

    .player-initial-wrapper label {
        font-size: 0.8em;
    }

    /* Kuji Board Styles for Mobile */
    #kuji-board {
        margin-top: 20px;
    }

    #player-circle {
        width: 280px; /* スマホでの円の直径を大幅に縮小 */
        height: 280px; /* スマホでの円の直径を大幅に縮小 */
        /* margin-bottom: 15px; */ /* 円の下の余白も調整 */
    }

    .player-slot {
        width: 45px; /* スマホでのスロット幅を縮小 */
        height: 45px; /* スマホでのスロット高さを縮小 */
        font-size: 1.1em; /* スマホでのフォントサイズを調整 */
    }

    /* START / もう一度遊ぶボタンのスタイル for Mobile */
    #start-button,
    #reset-button {
        padding: 15px 30px; /* パディングを減らす */
        font-size: 1.2em; /* フォントサイズを小さく */
        /* border-radius: 50%; はそのまま */
        box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); /* 影を調整 */
    }

    #start-button:hover,
    #reset-button:hover {
        transform: translate(-50%, -50%) scale(1.02); /* ホバー時の拡大率を少し控えめに */
        box-shadow: 0 7px 14px rgba(0, 0, 0, 0.3);
    }
}