/* ==========================================
   1. 基本変数 & デザインリセット
   ========================================== */
:root {
    --gold: #d4a373;        /* ロゴに合わせた落ち着いた茶色寄りの金 */
    --navy: #5d4037;        /* ロゴの文字色に近いダークブラウン */
    --sakura: #faedcd;      /* ロゴ背景に合うクリーム色 */
    --wine: #bc6c25;        /* 温かいオレンジ系 */
    --white: #ffffff;
    --shadow: 0 10px 30px rgba(0,0,0,0.1);
    --transition: 0.3s ease;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    padding: 0;
    font-family: 'Hiragino Mincho ProN', 'Times New Roman', serif;
    background: #fefae0;
    color: #333;
    line-height: 1.6;
    overflow-x: hidden;
}

/* ==========================================
   2. ヘッダー & ナビゲーション
   ========================================== */
.main-header {
    height: 400px;
    /* ロゴの色合いに合わせたグラデーションを少し多めに設定 */
    background: linear-gradient(135deg, #faedcd, #fefae0, #f8ad9d, #faedcd);
    background-size: 300% 300%;
    animation: gradientFlow 15s ease infinite; /* 15秒かけてゆっくり動く */
    border-bottom: 5px solid var(--gold);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

@keyframes gradientFlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.logo-area h1 {
    font-size: 3.5rem;
    margin: 0;
    letter-spacing: 0.3rem;
    cursor: pointer;
    text-shadow: 2px 2px 10px rgba(0,0,0,0.5);
}
.logo-area img {
    max-width: 300px; /* ロゴを適切なサイズに */
    height: auto;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.logo-area img:hover { transform: scale(1.1); }
.sub-title { 
    font-size: 1.1rem; 
    opacity: 1; /* 透明度をなくす */
    color: #8b5e3c; /* 濃いめのブラウン */
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(255,255,255,0.8); /* 白い影をつけて浮かせる */
    margin-top: 5px;
}

.premium-nav {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.nav-item {
    text-decoration: none;
    color: var(--navy);
    padding: 10px 25px;
    border: 2px solid var(--navy);
    border-radius: 50px;
    transition: var(--transition);
    background: rgba(255,255,255,0.1);
    font-weight: bold;
    font-size: 0.9rem;
}

/* アクティブ・ホバー時の色を統一 */
.nav-item:hover, .nav-item.active {
    background: var(--wine) !important;
    color: white !important;
    border-color: var(--gold) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.mini-header {
    background: var(--sakura);
    padding: 20px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* ==========================================
   3. レイアウト共通 (カード & フェードイン)
   ========================================== */
.container {
    max-width: 1100px;
    margin: 40px auto;
    padding: 0 20px;
}

.luxury-section {
    background: var(--white);
    padding: 40px;
    margin-bottom: 40px;
    border-radius: 20px;
    box-shadow: var(--shadow);
    border-top: 6px solid var(--gold);
    /* JSアニメーション用初期設定 */
    opacity: 0;
    transform: translateY(30px);
    transition: 0.8s ease-out;
}

.luxury-section.show {
    opacity: 1;
    transform: translateY(0);
}

.gold-title {
    text-align: center;
    color: var(--navy);
    border-bottom: 2px solid var(--gold);
    padding-bottom: 10px;
    margin-bottom: 30px;
    font-size: 1.8rem;
}

/* ==========================================
   4. 画像コンテナ・丸枠・Coming Soon (最強ガード)
   ========================================== */
/* 300x300画像がはみ出さないように overflow:hidden を徹底 */

/* 各種サイズ */
.char-circle { width: 150px; height: 150px; }
.char-circle-small { width: 100px; height: 100px; }
.pickup-img { width: 120px; height: 120px; border-radius: 50%; border: 4px solid var(--gold); object-fit: cover; }
.rank-img { width: 80px; height: 80px; border-radius: 50%; border: 2px solid var(--gold); object-fit: cover; }

.img-container {
    width: 150px; height: 150px;
    border-radius: 50%;
    border: 4px solid var(--gold);
    overflow: hidden !important;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}
.char-circle-small.img-container { width: 80px; height: 80px; }

.img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Coming Soon 枠 */
/* --- Coming Soon アイコンのデザイン修正 --- */
.coming-soon-box {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e0e0e0;
    border: 2px dashed #aaa;
    color: #888;
    font-size: 0.8rem;
    font-weight: bold;
    text-align: center;
    border-radius: 50%;
}
.char-circle.coming-soon-box { width: 150px; height: 150px; }
.char-circle-small.coming-soon-box { width: 100px; height: 100px; }

/* ==========================================
   5. ホーム機能 (掲示板・学食・カレンダー)
   ========================================== */
.three-column {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

/* 掲示板入力エリア */
.bulletin-input-area {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    background: #f0f0f0;
    padding: 10px;
    border-radius: 30px;
}

.bulletin-input-area input { flex: 1; border: none; background: transparent; padding-left: 10px; outline: none; }
.bulletin-input-area button { background: var(--navy); color: white; border: none; padding: 8px 20px; border-radius: 20px; cursor: pointer; }

.bulletin-scroll {
    max-height: 250px;
    overflow-y: auto;
    background: #f9f9f9;
    padding: 15px;
    border-radius: 15px;
}

/* 学食メニュー */
.menu-card {
    padding: 20px;
    border-radius: 15px;
    border-left: 8px solid var(--navy);
    background: #fff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.menu-card.rare {
    background: linear-gradient(135deg, #fff0f5, #ffe4e1);
    border-color: #ff69b4;
    animation: glow 1s infinite alternate;
}

@keyframes glow { from { box-shadow: 0 0 5px #ff69b4; } to { box-shadow: 0 0 20px #ff69b4; } }

/* カレンダー */
.calendar-today {
    background: var(--sakura);
    padding: 15px;
    border-radius: 10px;
    border: 2px solid var(--gold);
    text-align: center;
    font-weight: bold;
    margin-bottom: 15px;
}

.calendar-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px dashed #ddd;
    font-size: 0.9rem;
}

.calendar-item.is-today { background: #fff0f5; color: #ff4d6d; font-weight: bold; padding: 8px 10px; border-radius: 5px; }

/* ==========================================
   6. 投票・お手紙・名簿
   ========================================== */
/* プルダウン装飾 */
.premium-select {
    width: 100%; padding: 12px 20px; border-radius: 50px;
    border: 2px solid var(--gold); background: white;
    font-weight: bold; color: var(--navy); outline: none;
    appearance: none; cursor: pointer;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d4af37' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='M6 9l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat; background-position: right 15px center; background-size: 15px;
}

/* お手紙フォーム */
/* お手紙ポスト風デザイン */
.letter-form {
    background: #fffafa;
    border: 10px solid #e74c3c; /* 赤いポスト風 */
    border-radius: 20px;
    padding: 30px;
    position: relative;
}
.letter-form::before {
    content: 'POST';
    position: absolute;
    top: -20px; left: 50%;
    transform: translateX(-50%);
    background: #e74c3c; color: white;
    padding: 5px 20px; font-weight: bold; border-radius: 10px;
}
.letter-form textarea { height: 150px; border-radius: 15px; border: 2px solid #ddd; padding: 15px; outline: none; }

.premium-btn {
    background: var(--navy); color: white; padding: 15px; border-radius: 50px; border: none; font-weight: bold; cursor: pointer; transition: 0.3s;
}
.premium-btn:hover { background: var(--wine); transform: scale(1.02); }

/* 投票横スクロール */
.vote-scroll-container {
    display: flex; gap: 20px; overflow-x: auto; padding: 25px; background: rgba(255,236,242,0.5); border-radius: 20px;
}
.vote-mini-card { flex: 0 0 130px; display: flex; flex-direction: column; align-items: center; }
.vote-mini-card span { font-size: 0.85rem; font-weight: bold; white-space: nowrap; margin: 10px 0; }
.vote-btn-heart { background: #ff4d6d; color: white; border: none; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; }

/* 名簿グリッド */
.char-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 25px; }
.char-card { background: white; border-radius: 20px; padding: 25px; text-align: center; border: 1px solid #eee; transition: 0.3s; cursor: pointer; }
.char-card:hover { border-color: var(--gold); transform: translateY(-5px); box-shadow: var(--shadow); }

/* ==========================================
   7. ストーリー・コンテンツ
   ========================================== */
.story-card { background: white; border-left: 10px solid #ddd; padding: 25px; margin-bottom: 25px; border-radius: 0 20px 20px 0; box-shadow: 0 5px 15px rgba(0,0,0,0.05); }
.story-tag { display: inline-block; background: #eee; padding: 4px 12px; border-radius: 20px; font-size: 0.8rem; margin-right: 10px; font-weight: bold; }

.filter-tabs { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 30px; }
.filter-btn { background: white; border: 2px solid var(--gold); color: var(--navy); padding: 8px 20px; border-radius: 50px; cursor: pointer; font-weight: bold; transition: 0.3s; }
.filter-btn.active { background: var(--gold); color: white; }

/* ゲームカード (コンテンツページ) */
.game-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }
.game-card { background: white; border: 2px solid #eee; border-radius: 20px; padding: 25px; display: flex; align-items: center; gap: 20px; text-decoration: none; color: inherit; transition: 0.3s; }
.game-card:hover { border-color: var(--gold); transform: translateY(-5px); box-shadow: var(--shadow); }
.game-icon { font-size: 2.5rem; color: var(--navy); width: 50px; text-align: center; }

/* ==========================================
   8. ミニゲーム (地獄の演出)
   ========================================== */
.game-stage {
    position: relative; height: 450px; background: #eef2f3; border: 6px solid var(--navy);
    border-radius: 25px; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center;
}

/* だいき・たすく (サイズ・位置修正) */
.char-sprite {
    position: absolute;
    bottom: -250px; /* 初期位置を下げて隠す */
    width: 220px;   /* たすく・だいきを大きく */
    z-index: 60;
    transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.char-sprite.left { left: -20px; }
.char-sprite.right { right: -20px; }

/* 登場アニメーション */
.zoom-in {
    bottom: 20px !important;
    transform: scale(1.3);
}

.horror-shake { animation: shake 0.15s infinite; }
.horror-dark { background: #1a1a1a !important; }
@keyframes shake { 0% { transform: translate(2px, 2px); } 50% { transform: translate(-2px, -2px); } 100% { transform: translate(2px, -2px); } }

/* のりおみシャッター */
.shutter { position: absolute; top: -100%; left: 0; width: 100%; height: 100%; background: #333; z-index: 100; transition: 0.6s ease-in; }
.shutter.closed { top: 0; }
.game-ui-nori { position: absolute; bottom: 40px; display: none; gap: 20px; z-index: 110; }
.speech-balloon { position: absolute; top: 30px; background: white; padding: 15px 25px; border-radius: 30px; border: 4px solid var(--navy); font-weight: bold; z-index: 120; text-align: center; max-width: 80%; }

/* ==========================================
   9. その他システム (トースト・モーダル・スープ)
   ========================================== */
#toast-container { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); z-index: 10000; }
.toast { background: rgba(26, 42, 108, 0.9); color: white; padding: 15px 30px; border-radius: 50px; margin-top: 10px; animation: fadeInUp 0.4s; }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0; top: 0; 
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(5px);
    overflow-y: auto; /* モーダル自体をスクロール可能に */
    padding: 20px 0;
}

.modal-content {
    background: white !important; /* 絶対に白にする */
    color: #333 !important;
    border: 3px solid var(--gold);
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    max-height: 90vh; /* 画面の90%までに制限 */
    overflow-y: auto; /* ★ここ！中身が長ければスクロールさせる */
    padding: 30px;
    border-radius: 20px;
}
.close-btn { position: absolute; right: 20px; top: 15px; font-size: 2rem; cursor: pointer; }

/* 秘密のスープ・ご褒美 */
.soup-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255, 255, 200, 0.9); display: none; flex-direction: column; justify-content: center; align-items: center; z-index: 20000; text-align: center; }
.walking-gohobi {
    position: fixed;
    bottom: 40px;
    right: -100px;
    font-size: 4rem;
    line-height: 1; /* ★これ！高さを文字サイズにピッタリ合わせる */
    width: 1em;     /* ★幅もピッタリに！ */
    z-index: 9999;
    cursor: pointer;
    user-select: none;
}
.drink-btn { background: #e67e22; color: white; border: 4px solid #8b4513; padding: 15px 40px; font-size: 1.2rem; border-radius: 50px; cursor: pointer; box-shadow: 0 5px 0 #5d2e0a; transition: 0.1s; }
.drink-btn:active { transform: translateY(5px); box-shadow: none; }

/* --- 人気ランキングの復活 --- */
.ranking-item {
    display: flex; align-items: center; gap: 15px; padding: 15px;
    border-bottom: 1px solid #eee; background: white; border-radius: 10px; margin-bottom: 10px;
}
.rank-1 { border: 2px solid var(--gold); background: #fffcf0; }
.rank-badge { background: var(--gold); color: white; width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: bold; }
.rank-quote { font-style: italic; color: #8b3a3a; font-size: 0.9rem; margin-top: 5px; }

/* --- 生徒名簿の応援ボタン（ハートマーク） --- */
.cheer-btn {
    background: #ff4d6d; color: white; border: none; padding: 8px 15px;
    border-radius: 20px; cursor: pointer; font-size: 0.8rem; margin-top: 10px;
    transition: 0.3s;
}
.cheer-btn:hover { transform: scale(1.1); background: #ff758c; }

/* --- キャラ名簿のフィルタ用プルダウン（スマホ対応） --- */
.filter-dropdown-area { margin-bottom: 30px; text-align: center; }
/* 前に渡した .premium-select をそのまま名簿のプルダウンにも適用してね */

/* --- ゲームの文字を見やすく（コントラスト強化） --- */
.success-text { color: #2ecc71; font-size: 1.8rem; font-weight: bold; text-shadow: 2px 2px 0 #fff, -2px -2px 0 #fff; }
.fail-text { color: #e74c3c; font-size: 1.8rem; font-weight: bold; text-shadow: 2px 2px 0 #fff, -2px -2px 0 #fff; }
.horror-text { color: #ff0000; font-size: 2rem; font-weight: bold; text-shadow: 0 0 15px #000, 2px 2px 0 #000; z-index: 200; position: relative; }

/* --- 1. 人気ランキングの枠とタイトル復活 --- */
#ranking-board {
    border: 3px double var(--gold);
    border-radius: 20px;
    padding: 25px;
    background: #fff;
    margin-top: 30px;
}
#ranking-board h3 {
    text-align: center;
    color: var(--navy);
    background: var(--sakura);
    padding: 10px;
    border-radius: 50px;
    margin-bottom: 20px;
}

/* --- 2. プロフモーダルの豪華装飾 --- */
.modal-profile-card {
    background: white;
    border-radius: 30px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    position: relative;
    border: 3px solid var(--gold);
}
.modal-header-bg {
    height: 100px;
    background: linear-gradient(135deg, var(--navy), #4a90e2);
}
.modal-main-content { padding: 0 30px 30px; margin-top: -60px; text-align: center; }
.modal-full-name { font-size: 1.8rem; color: var(--navy); margin: 15px 0 5px; }
.modal-tags { display: flex; justify-content: center; gap: 10px; margin-bottom: 15px; }
.m-tag { background: #f0f0f0; padding: 3px 12px; border-radius: 50px; font-size: 0.8rem; font-weight: bold; }
.modal-mbti-area { margin-bottom: 20px; }
.mbti-badge { background: var(--gold); color: white; padding: 5px 15px; border-radius: 5px; margin: 0 5px; font-weight: bold; }
.modal-description-box { background: #f9f9f9; padding: 15px; border-radius: 15px; text-align: left; margin: 15px 0; border-left: 5px solid var(--gold); }
.modal-quote-box { font-style: italic; color: var(--wine); font-weight: bold; margin: 20px 0; border-top: 1px solid #eee; padding-top: 10px; }

/* --- 3. のりおみゲームの選択肢を確実に表示 --- */
.game-ui-nori {
    display: none; /* JSでflexに切り替え */
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    gap: 15px;
}

/* --- 4. ご褒美ゲーム：手のはみ出し防止コンテナ --- */
#hand-container {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 150;
    pointer-events: none; /* 下のボタンをクリックさせない、手だけクリックさせる */
}
.falling-hand {
    position: absolute;
    font-size: 4rem;
    cursor: pointer;
    pointer-events: auto; /* 手だけはクリック可能に */
}

.birthday-card-special {
    background: linear-gradient(135deg, #fff0f5, #ffffff);
    border: 2px solid var(--gold);
    border-radius: 15px;
    padding: 15px;
    margin-top: 10px;
}
.b-day-person {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}
.b-day-info { text-align: left; }
.b-day-name { font-weight: bold; color: var(--navy); display: block; }
.b-day-greet { font-size: 0.8rem; color: #ff4d6d; }

/* --- モーダルのCloseボタン位置修正 --- */
.close-btn {
    position: absolute;
    right: 20px; top: 20px;
    font-size: 2.5rem;
    color: white; /* ヘッダー背景の上でも見えるように */
    cursor: pointer;
    z-index: 1000;
    text-shadow: 0 0 10px rgba(0,0,0,0.5);
}

/* --- 応援ボタンの装飾 --- */
.vote-btn-big {
    background: linear-gradient(135deg, #ff4d6d, #ff758c);
    color: white;
    border: 2px solid var(--gold);
    padding: 15px 30px;
    border-radius: 50px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 77, 109, 0.3);
    transition: 0.3s;
    width: 100%;
    margin-top: 20px;
}
.vote-btn-big:hover { transform: scale(1.05); filter: brightness(1.1); }

/* --- 社交辞令カウンターのボタン装飾 --- */
.sincerity-btn { 
    background: #3498db !important; color: white !important; 
    border: 2px solid white !important; box-shadow: 0 4px 0 #2980b9 !important;
}
.social-btn { 
    background: #e74c3c !important; color: white !important; 
    border: 2px solid white !important; box-shadow: 0 4px 0 #c0392b !important;
}

/* --- ストーリー検索・フィルタエリア --- */
.story-search-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    background: #f9f9f9;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 30px;
    border: 1px solid #eee;
}

/* --- 掲示板の削除ボタン --- */
.post-header { display: flex; justify-content: space-between; align-items: center; }
.delete-btn {
    background: none; border: none; color: #ccc; cursor: pointer; font-size: 0.8rem;
}
.delete-btn:hover { color: #e74c3c; }

/* ストーリー内のミニキャラ枠 */
.story-char-icons { display: flex; gap: -10px; margin: 10px 0; }
.char-circle-mini.img-container {
    width: 40px; height: 40px; border-width: 2px;
    margin-left: -10px; /* 重なり演出 */
}
.char-circle-mini.img-container:first-child { margin-left: 0; }

/* 掲示板スレ風デザイン */
.thread-style {
    background: #fff; border: 1px solid #ddd;
    border-radius: 10px; padding: 15px; margin-bottom: 10px;
}
.post-actions { display: flex; gap: 10px; }
.req-btn {
    background: var(--sakura);
    border: 1px solid var(--gold);
    color: var(--navy);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: 0.3s;
}
.req-btn:hover {
    background: var(--gold);
    color: white;
}
/* 削除要請ボタン（赤みを追加） */
.req-btn.delete-req {
    border-color: #e74c3c;
    color: #e74c3c;
}
.req-btn.delete-req:hover {
    background: #e74c3c;
    color: white;
}

/* 管理者ボタンは普段隠しておく（みつきがコンソールから消す時用など） */
.admin-only-btn { opacity: 0.2; font-size: 0.6rem; border: none; background: none; }

/* ストーリーアイコンの密着（再修正） */
.story-char-icons-wrap {
    display: flex;
    justify-content: flex-start; /* 左寄せ */
    padding-left: 10px;
    margin: 15px 0;
}
.char-circle-mini.img-container {
    width: 45px; height: 45px;
    margin-left: -15px; /* 重なり */
    border: 2px solid white;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
}

/* ストーリー全文表示の装飾 */
.story-modal-title { color: var(--navy); font-size: 2rem; margin: 10px 0; }
.story-modal-content {
    max-height: 60vh; /* 文章エリアの高さを制限 */
    overflow-y: auto; /* 長ければスクロール */
    padding-right: 10px;
    margin: 20px 0;
    line-height: 1.8;
    white-space: pre-wrap; /* 改行を反映 */
    text-align: left;
}
.read-more-btn {
    background: var(--gold);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    margin-top: 10px;
}
.search-container {
    margin-bottom: 20px;
    position: relative;
}
.search-container i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gold);
}
.search-input {
    width: 100%;
    padding: 12px 15px 12px 45px;
    border: 2px solid var(--gold);
    border-radius: 50px;
    font-size: 1rem;
    outline: none;
}
/* --- ローディングスピナーのデザイン --- */
.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* --- コンテンツアイコンの修正（FontAwesome 6 対応） --- */
.fa-crown, .fa-layer-group, .fa-cat, .fa-keyboard, .fa-wolf-pack-battalion {
    display: inline-block !important;
}

/* --- 掲示板：スレッド（返信）のデザイン --- */
.reply-post {
    margin-left: 30px;
    border-left: 3px solid var(--sakura);
    padding-left: 15px;
    background: #fdfdfd;
    margin-top: 5px;
}

.char-circle-mini {
    width: 45px; height: 45px;
    margin-right: 20px; /* ここをマイナスにして重ねる！ */
    border: 3px solid white;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.1);
    z-index: 1;
}

.char-circle-mini:first-child { margin-left: 0; }

.char-circle-mini img { width: 100%; height: 100%; object-fit: cover; }

/* 検索グリッド */
.story-search-grid {
    background: #fdfdfd;
    padding: 20px;
    border-radius: 20px;
    border: 1px solid #eee;
    margin-bottom: 20px;
}

/* ランキングアイテムの構造修正（2位のズレ防止） */
.ranking-item {
    display: flex;
    align-items: center; /* 縦方向を中央揃え */
    gap: 20px;
    padding: 15px;
    border-bottom: 1px solid #eee;
    background: white;
    border-radius: 15px;
    margin-bottom: 15px;
}

.rank-img-wrap {
    flex-shrink: 0; /* 画像が縮まないように */
}

.rank-content {
    flex-grow: 1; /* テキストエリアを広げる */
    text-align: left;
}

.rank-name-text {
    font-weight: bold;
    color: var(--navy);
    display: block;
}

/* 掲示板の改行をそのまま表示 */
.bulletin-post {
    white-space: pre-wrap; /* これで「テスト[改行]テスト」が反映される！ */
    word-wrap: break-word;
}

.bulletin-post.is-reply {
    margin-left: 40px;
    border-left: 4px solid var(--gold);
    background: #fff;
    transform: scale(0.95);
}

/* --- ストーリー投稿フォームの入力欄を豪華に --- */
.letter-form input[type="text"] {
    width: 100%;
    padding: 12px 20px;
    border-radius: 10px;
    border: 2px solid var(--gold);
    background: white;
    font-size: 1rem;
    color: var(--navy);
    outline: none;
    margin-bottom: 5px;
}
.letter-form input[type="text"]:focus {
    border-color: var(--wine);
    box-shadow: 0 0 10px rgba(188, 108, 37, 0.2);
}
.replies-container {
    margin-top: 15px;
    padding-left: 20px;
    border-left: 3px solid var(--sakura);
}
.reply-item {
    background: #fdfdfd;
    border: 1px solid #eee;
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 5px;
    font-size: 0.9rem;
}
.reply-item small { color: #999; }

/* --- ホーム画面のオープニング演出 --- */
.home-intro-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: #fefae0; /* ロゴに合わせた背景色 */
    z-index: 30000;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeOutIntro 2s forwards 1.5s; /* 1.5秒待ってから消える */
    pointer-events: none; /* これがないと下のボタンが押せなくなるゾ！ */
}

.intro-logo {
    width: 250px;
    animation: zoomPulse 1.5s ease-in-out;
}
@keyframes fadeOutIntro {
    from { opacity: 1; visibility: visible; }
    to { opacity: 0; visibility: hidden; }
}
@keyframes zoomPulse {
    0% { transform: scale(0.8); opacity: 0; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); }
}
/* ページを開いた時のふわっとした表示 */
body.home-page {
    animation: bodyFadeIn 1s ease-out;
}
@keyframes bodyFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOutIntro {
    from { opacity: 1; }
    to { opacity: 0; }
}
@keyframes zoomPulse {
    0% { transform: scale(0.8); opacity: 0; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); }
}

/* ページ全体のフェードイン */
body {
    animation: bodyFadeIn 1s ease-out;
}
@keyframes bodyFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* --- 掲示板スレッドの初期非表示 --- */
.replies-container {
    display: none; /* 初期は隠す */
    margin-top: 15px;
    padding: 15px;
    background: rgba(255, 236, 242, 0.3);
    border-radius: 15px;
    border-left: 5px solid var(--gold);
}

/* ==========================================
   スマホ対応（レスポンシブ）
   ========================================== */
@media screen and (max-width: 768px) {
    /* ヘッダーの高さを縮小 */
    .main-header { height: 250px; }
    .logo-area img { max-width: 200px; }
    
    /* ナビを縦並びに近くする、またはスクロール可能に */
    .premium-nav {
        overflow-x: auto;
        justify-content: flex-start;
        padding: 10px;
        white-space: nowrap;
    }
    .nav-item { padding: 8px 15px; font-size: 0.8rem; }

    /* 3カラムを1カラムに変更（重要！） */
    .three-column {
        grid-template-columns: 1fr;
    }

    /* モーダルを画面いっぱいに */
    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 20px;
    }

    /* ストーリー検索グリッドを縦並びに */
    .story-search-grid {
        grid-template-columns: 1fr;
    }
    
    .char-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 10px;
    }
    
    .char-card { padding: 10px; }
    .char-circle-small { width: 80px; height: 80px; }
}

/* --- ハンバーガーメニュー用 --- */
.menu-toggle {
    display: none; /* PCでは隠す */
    font-size: 2rem;
    color: var(--navy);
    cursor: pointer;
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10000;
}

/* スマホ用レスポンシブ */
/* ==========================================
   スマホ対応（レスポンシブ）絶対修正版
   ========================================== */
@media screen and (max-width: 768px) {
    .main-header { height: 250px; position: relative; /* ★超重要！これがないとボタンが飛んでいく */ }
    .logo-area img { max-width: 200px; }
    .three-column { grid-template-columns: 1fr; }
    .modal-content { width: 95%; margin: 10% auto; padding: 20px; }
    .story-search-grid { grid-template-columns: 1fr; }
    .char-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
    .char-card { padding: 10px; }
    .char-circle-small.img-container { width: 80px; height: 80px; }

    /* --- ハンバーガーメニューの表示 --- */
    .menu-toggle { 
        display: block !important; 
        position: absolute; 
        top: 20px; 
        right: 20px; 
        font-size: 2.2rem; 
        color: var(--navy); 
        cursor: pointer; 
        z-index: 99999; /* ★絶対に一番手前！ */
    }
    
    .premium-nav {
        display: none; /* 初期は隠す */
        flex-direction: column;
        background: rgba(250, 237, 205, 0.98);
        position: absolute;
        top: 60px; 
        left: 0;
        width: 100%;
        padding: 20px 0;
        z-index: 99990; /* メニューも手前に */
        box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    }
    
    /* JSで .open が付いたら強制表示（!importantの暴力！） */
    .premium-nav.open { display: flex !important; }

    /* --- 今日のとりの細長バグ修正 --- */
    .pickup-card {
        flex-direction: column !important;
        text-align: center;
        gap: 15px !important;
    }
    .pickup-card .img-container {
        flex-shrink: 0; /* ★これが細長くなるのを防ぐ！ */
        margin: 0 auto;
    }

    /* --- お手紙・掲示板のスマホ調整 --- */
    .post-header { flex-direction: column; align-items: flex-start; gap: 10px; }
    .post-actions { flex-wrap: wrap; }
}
/* ==========================================
   フッター (AdSense対策・ナビゲーション)
   ========================================== */
.site-footer {
    background: var(--navy);
    color: white;
    padding: 30px 20px;
    margin-top: 50px;
    text-align: center;
}

.footer-container {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

.footer-links {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-links a {
    color: var(--sakura);
    text-decoration: none;
    font-size: 0.9rem;
    transition: 0.3s;
}
.footer-links a:hover { color: var(--gold); text-decoration: underline; }

.back-to-kobo-btn {
    background: var(--wine);
    color: white;
    padding: 12px 30px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: bold;
    border: 2px solid var(--gold);
    transition: 0.3s;
}
.back-to-kobo-btn:hover { background: var(--gold); color: var(--navy); transform: scale(1.05); }

.copyright { font-size: 0.8rem; color: #ccc; margin: 0; }

/* ==========================================
   LINEスタンプの画像付きカード
   ========================================== */
.line-sticker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.sticker-card {
    display: flex;
    flex-direction: column;
    background: white;
    border: 2px solid #00B900;
    border-radius: 20px;
    overflow: hidden;
    text-decoration: none;
    color: var(--navy);
    transition: 0.3s;
    box-shadow: 0 4px 10px rgba(0, 185, 0, 0.1);
}

.sticker-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 185, 0, 0.2);
}

.sticker-img {
    width: 100%;
    height: auto;
    background: #f9f9f9;
    border-bottom: 1px solid #eee;
    padding: 20px;
    box-sizing: border-box;
}

.sticker-info {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    text-align: center;
}

.sticker-info h3 {
    margin: 0 0 10px 0;
    font-size: 1.1rem;
    color: #333;
}

.sticker-info p {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 20px;
    flex-grow: 1;
}

.sticker-btn {
    background: #00B900;
    color: white;
    padding: 10px 15px;
    border-radius: 50px;
    font-weight: bold;
    font-size: 0.9rem;
    display: inline-block;
}

/* 制服コレクションのグリッド */
.uniform-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    margin-top: 20px;
    text-align: center;
}
.uniform-card {
    background: #fdfdfd;
    padding: 20px;
    border-radius: 20px;
    border: 1px solid #eee;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    transition: 0.3s;
}
.uniform-card:hover { transform: translateY(-5px); border-color: var(--navy); }

/* --- 学園ニュースの枠をスクロール可能に --- */
.news-container {
    max-height: 250px; /* ここで高さを制限！ */
    overflow-y: auto;  /* はみ出たらスクロール */
    padding-right: 15px; /* スクロールバー用の余白 */
    background: #fdfdfd;
    border-radius: 10px;
    border: 1px solid #eee;
    padding: 15px;
}

/* スクロールバーのお洒落な装飾（ニュース用） */
.news-container::-webkit-scrollbar { width: 6px; }
.news-container::-webkit-scrollbar-thumb { background: var(--gold); border-radius: 10px; }

.news-item {
    display: flex;
    gap: 20px;
    padding: 15px 0;
    border-bottom: 1px dashed #ddd;
    align-items: flex-start;
}
.news-item:last-child { border-bottom: none; } /* 最後の下線を消す */

.news-date {
    background: var(--navy);
    color: white;
    padding: 5px 15px;
    border-radius: 5px;
    font-weight: bold;
    font-size: 0.9rem;
    flex-shrink: 0;
}
.news-title { margin: 0 0 5px 0; font-size: 1.1rem; color: var(--wine); font-weight: bold; }
.news-text { margin: 0; font-size: 0.9rem; color: #555; line-height: 1.5; }

/* --- 制服専用の画像コンテナ（横長・見切れ防止版） --- */
.uniform-img-container {
    width: 100%;
    /* 高さを固定せず、横幅に合わせて自然な比率にする */
    height: auto; 
    border-radius: 15px; 
    border: 4px solid var(--navy); 
    overflow: hidden;
    background: #f9f9f9;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    /* 画像を真ん中に配置 */
    display: flex;
    justify-content: center;
    align-items: center;
}

.uniform-img-container img {
    width: 100%;
    height: auto; /* 縦横比を崩さない */
    object-fit: contain; /* ★ cover ではなく contain にして、絶対に全体を映す！ */
    transition: transform 0.4s ease; 
}

/* マウスを乗せたら画像が少し拡大する演出 */
.uniform-card:hover .uniform-img-container img {
    transform: scale(1.05); 
}
/* 各ページへ飛ぶボタン（完全装飾版） */
.step-btn {
    display: inline-block;
    background: var(--gold) !important; /* ゴールドに固定 */
    color: white !important; /* 文字を絶対に白にする */
    text-decoration: none !important; /* 紫の線を絶対に消す！ */
    padding: 12px 20px;
    border-radius: 50px;
    font-weight: bold;
    transition: 0.3s;
    font-size: 0.95rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.step-btn:hover {
    background: var(--wine) !important; /* ホバーでワインレッドに */
    transform: scale(1.05);
    box-shadow: 0 6px 15px rgba(139, 58, 58, 0.3);
}

/* タイトルホバー時の演出 */
.welcome-header:hover h2 {
    color: var(--wine);
    transition: 0.3s;
}
/* ==========================================
   スマホ対応（レスポンシブ）の追加・上書き部分
   ========================================== */
@media screen and (max-width: 768px) {
    /* 画面の左右の余白を少し詰める */
    .container { padding: 0 10px; }

    /* --- ハンバーガーメニューの確実な配置 --- */
    .menu-toggle { 
        display: block !important; 
        position: absolute; 
        top: 20px; 
        right: 20px; 
        font-size: 2.2rem; 
        color: var(--navy); 
        cursor: pointer; 
        z-index: 99999; 
    }
    .premium-nav {
        display: none; 
        flex-direction: column;
        background: rgba(250, 237, 205, 0.98);
        position: absolute;
        top: 70px; 
        left: 0;
        width: 100%;
        padding: 20px 0;
        z-index: 99990; 
        box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    }
    .premium-nav.open { display: flex !important; }
    .nav-item { margin: 5px 20px; text-align: center; }

    /* --- はみ出し防止！カード類をスマホの幅に合わせる --- */
    .game-grid, .term-grid, .line-sticker-grid {
        grid-template-columns: 1fr !important; /* スマホでは絶対に1列！ */
        gap: 15px;
    }

    .game-card, .term-card, .sticker-card {
        min-width: auto !important; /* PC用の固定幅を解除！ */
        width: 100%;
        box-sizing: border-box;
    }

    /* ゲームのリンクカードを縦並びに変えてスッキリさせる */
    .game-card {
        flex-direction: column;
        text-align: center;
        padding: 15px;
    }
    .game-icon { margin-bottom: 10px; }
/* ==========================================
       スマホ対応（追加分）
       ========================================== */

    /* --- ランキングを縦並びにして綺麗に収める --- */
    .ranking-item {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    .rank-img-wrap {
        margin: 0 auto;
    }
    .rank-content {
        text-align: center;
    }

    /* --- パン争奪戦のボタン隠れ防止 --- */
    .game-stage {
        height: auto;
        min-height: 400px;
        padding-bottom: 70px; /* ボタン用の余白を確保 */
    }
    .char-sprite {
        width: 140px; /* スマホでは威圧感キャラを少し小さく */
    }
    /* ボタンを「絶対」に最前面へ！ */
    #melonpan-game-stage .game-btn,
    .premium-btn {
        z-index: 9999 !important; 
    }
}
