/*====================
  基本設定
====================*/
body {
    font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    padding: 1rem;
    background-color: #f5f5f5; /* 淡いグレーの背景で柔らかさを追加 */
    color: #333;
    line-height: 1.6;
}

/*====================
  ヘッダー・タイトルエリア
====================*/
.title-area {
    background-color: #812990; /* 乃木坂の紫を意識した色に変更 */
    color: white;
    max-width: 360px;
    height: 60px;
    margin: 0 auto 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background-color: #812990; /* ヘッダーの色も統一 */
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    z-index: 1000;
}

.top-bar img {
    height: 50px;
}

/*====================
  テキストスタイル
====================*/
h1, h2, h4 {
    text-align: center;
    margin-bottom: 1rem;
    font-weight: 600; /* 太めに変更して視認性を向上 */
}

h3, h5 {
    text-align: center;
    margin-bottom: 1rem;
    font-weight: 500; /* 少し太めに変更 */
}

/*====================
  フォーム・ボタン
====================*/
form {
    max-width: 360px;
    margin: 0 auto 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

select {
    padding: 0.75rem 1rem;
    font-size: 1.1rem;
    border: 2px solid #ededed;
    border-radius: 12px;
    background: #fff;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s ease;
}

select:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

button {
    display: block;
    max-width: 360px;
    margin: 0 auto;
    text-align: center;
    padding: 0.75rem 5rem;
    font-size: 1.1rem;
    background-color: #812990; /* メインボタンの色を紫に統一 */
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

button:hover,
button:focus {
    background-color: #7a54b3; /* ホバー時に少し明るい紫に */
    transform: translateY(-2px); /* 少し上に動くアニメーション */
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
    outline: none;
}

.nav-button {
    display: inline-block;
    padding: 12px 24px;
    background-color: #812990;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.nav-button:hover,
.nav-button:focus {
    background-color: #7a54b3;
    transform: translateY(-2px);
    outline: none;
}

.button-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

/*====================
  コンテンツ・リスト
====================*/
.content {
    margin-top: 80px;
    padding: 20px;
}

.results {
    margin-top: 20px;
    text-align: left;
    width: 90%;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

li {
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee;
    font-size: 1rem;
}

li:last-child {
    border-bottom: none;
}

.result-item {
    font-size: 16px;
    margin: 8px 0;
    padding: 12px;
    border-radius: 8px;
    border: none; /* 元の枠線を削除し、シャドウで表現 */
    background-color: #fff;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}

.result-item:hover {
    transform: translateY(-2px);
}

/*====================
  ランキング強調
====================*/
.rank-1 {
    background: linear-gradient(135deg, #FFD700, #FFEF9F);
    font-weight: bold;
    color: #4a3800; /* テキストカラーを濃くして読みやすく */
}
.rank-2 {
    background: linear-gradient(135deg, #C0C0C0, #E0E0E0);
    font-weight: bold;
    color: #5c5c5c;
}
.rank-3 {
    background: linear-gradient(135deg, #CD7F32, #E5B07F);
    font-weight: bold;
    color: #61401a;
}

/*====================
  モーダル
====================*/
/* ... (既存のmodal, modal-contentスタイル) ... */
.modal {
    display: none;
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6); 
} 

.modal-content {
    background-color: #fefefe;
    margin: 30% auto;
    padding: 30px; 
    border: 1px solid #ddd; 
    width: 80%;
    max-width: 400px;
    text-align: center;
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.modal-content button {
    padding: 10px 20px;
    margin-top: 15px;
    cursor: pointer;
}

.modal-content p {
    font-size: 1.1rem;
    font-weight: bold;
}

/* スピナーのスタイル */

/* 画面全体を覆うスピナーコンテナ */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.5); /* 白っぽい半透明の背景 */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000; /* ヘッダーやモーダルより手前に表示 */
}
/*====================
  投票モーダル内のスピナーの調整 (投票処理時)
====================*/
#voteLoadingSpinner {
    /* ページのローディングスピナーと同じように、縦横中央揃えにする */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%; /* 親要素(modal-content)の幅を使う */
    height: 100%; /* 親要素(modal-content)の高さを使う */
}

.spinner {
    border: 6px solid #f3f3f3; /* Light grey */
    border-top: 6px solid #812990; /* 乃木坂カラー */
    border-radius: 80%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 10px auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ✅ 新規追加: ローディングコンテンツを格納するボックス (.loading-box) */
.loading-box {
    /* .modal-content と同じサイズ・見た目を適用 */
    background-color: #fefefe;
    padding: 30px; 
    border: 1px solid #ddd; 
    width: 90%;
    max-width: 200px; /* 投票モーダルと同じ最大幅に設定 */
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    
    /* 🚨 内部コンテンツ (スピナーとメッセージ) を中央で縦に並べる設定 */
    display: flex; 
    flex-direction: column; 
    justify-content: center;
    align-items: center;
}


/* ... (既存のmodal-content buttonスタイル) ...
.modal {
    display: none;
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6); 
} */

/* ページコンテンツを初期状態で隠すためのクラス */
.hidden-content {
    visibility: hidden; /* コンテンツ領域は確保したまま非表示 */
}

/* .modal-content {
    background-color: #fefefe;
    margin: 15% auto;
    padding: 30px; 
    border: 1px solid #ddd; 
    width: 90%;
    max-width: 400px;
    text-align: center;
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
} */

/* .modal-content button {
    padding: 10px 20px;
    margin-top: 15px;
    cursor: pointer;
} */

/*====================
  レスポンシブ対応
====================*/
@media (min-width: 600px) {
    body {
        padding: 2rem;
    }

    form, ol, a {
        max-width: 540px;
    }

    select, button, a {
        font-size: 1.25rem;
    }

    li {
        font-size: 1.125rem;
    }
}