:root {
    --primary: #333;
    --bg: #f4f7f6;
    --text: #333;
    --white: #ffffff;
    
    /* テーマカラー */
    --loto6: #0067c0;
    --loto7: #f39c12;
    --mini:  #c0392b;
    --num3:  #e91e63;
    --num4:  #9c27b0;
}

body {
    font-family: "Helvetica Neue", Arial, sans-serif;
    margin: 0; padding: 0;
    background-color: var(--bg); color: var(--text);
    line-height: 1.6;
    -webkit-text-size-adjust: 100%;
}

/* === ヘッダー === */
.main-header {
    background: var(--white); padding: 20px 15px;
    text-align: center; border-bottom: 1px solid #eee;
}
.main-header h1 { margin: 0; font-size: 1.6rem; color: #333; font-weight: 800; }
.subtitle { color: #666; font-size: 0.85rem; margin-top: 5px; }

/* === ナビゲーション（固定） === */
.game-nav-scroll {
    background: #fff; position: sticky; top: 0; z-index: 1000;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05); padding: 10px 0;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.game-nav-list {
    display: flex; justify-content: center; padding: 0 15px; gap: 10px; min-width: max-content;
}
@media (max-width: 600px) { .game-nav-list { justify-content: flex-start; } }

.nav-item {
    display: block; padding: 8px 16px; border-radius: 20px;
    text-decoration: none; font-weight: bold; font-size: 0.85rem;
    color: #555; background: #f0f2f5; transition: 0.2s; white-space: nowrap;
}
.nav-item.active { color: #fff; box-shadow: 0 2px 5px rgba(0,0,0,0.2); }
.nav-item.n-top.active { background: #333; }
.nav-item.n-loto6.active { background: var(--loto6); }
.nav-item.n-loto7.active { background: var(--loto7); }
.nav-item.n-mini.active { background: var(--mini); }
.nav-item.n-num3.active { background: var(--num3); }
.nav-item.n-num4.active { background: var(--num4); }

.container { max-width: 960px; margin: 0 auto; padding: 20px; }

/* === TOPページ ゲームリスト === */
.game-list { display: flex; flex-direction: column; gap: 25px; margin-bottom: 40px; }

.game-strip {
    background: #fff; border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08); 
    display: flex; flex-direction: column;
    overflow: hidden; 
    border: 1px solid rgba(0,0,0,0.05); 
    transition: transform 0.2s;
}
.game-strip:hover { transform: translateY(-3px); box-shadow: 0 10px 25px rgba(0,0,0,0.12); }

/* PCレイアウト */
@media (min-width: 768px) {
    .game-strip { flex-direction: row; min-height: 140px; }
    .strip-header { 
        width: 180px; flex-shrink: 0; 
        display:flex; align-items:center; justify-content:center;
        padding: 0 10px;
    }
    .strip-body { 
        flex-grow: 1; display: flex; align-items: center; justify-content: space-between; 
        padding: 25px 30px; 
    }
    .strip-actions { 
        flex-shrink: 0; margin-left: 30px; 
        display: flex; flex-direction: column; gap: 10px; width: 160px;
    }
}

/* スマホレイアウト */
@media (max-width: 767px) {
    .strip-header { padding: 15px; text-align: center; }
    .strip-body { padding: 20px 15px; text-align: center; }
    .result-area { margin-bottom: 20px; }
    .strip-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
    .result-nums-row { justify-content: center; flex-wrap: wrap; }
}

.strip-header .game-name { 
    font-weight: 900; font-size: 1.6rem; color: #fff; line-height: 1.2; 
    text-shadow: 0 2px 3px rgba(0,0,0,0.15);
}

.bg-loto6 { background: linear-gradient(135deg, #0067c0, #1976d2); }
.bg-loto7 { background: linear-gradient(135deg, #f39c12, #fb8c00); }
.bg-mini { background: linear-gradient(135deg, #c0392b, #d32f2f); }
.bg-num3 { background: linear-gradient(135deg, #e91e63, #f06292); }
.bg-num4 { background: linear-gradient(135deg, #9c27b0, #ab47bc); }

/* 結果ラベルとボール（デフォルト） */
.result-label {
    display: inline-block; font-size: 0.8rem; font-weight: bold; color: #666;
    background: #f0f2f5; padding: 4px 12px; border-radius: 12px; margin-bottom: 12px;
}
.result-nums-row { display: flex; gap: 6px; align-items: center; }
.ball {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 50%;
    background: #fff; border: 2px solid #eee; 
    font-weight: 800; font-size: 1.1rem; color: #333;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.ball.bonus { background: #e1f5fe; border-color: #81d4fa; color: #0277bd; }

/* ボタン類 */
.btn { 
    display: block; padding: 12px 0; border-radius: 8px; 
    font-weight: bold; text-align: center; text-decoration: none; 
    font-size: 0.9rem; transition: 0.2s; cursor: pointer;
}
.btn:hover { transform: translateY(-2px); opacity: 0.9; }
.btn-history-link { 
    display: inline-block; width: auto; padding: 10px 40px; border-radius: 30px; 
    border: 2px solid #ccc; background: #fff; color: #666; font-size: 0.9rem;
}
.btn-history-link:hover { background: #f5f5f5; }
.active-btn-style { color: #fff !important; }

/* === 個別ページ用 ヘッダーとセクション === */
.analysis-header {
    text-align: center; padding: 20px 0 10px; margin-bottom: 20px;
    background: transparent; border: none;
}
.analysis-header h1 { font-size: 1.8rem; font-weight: 900; margin: 0; letter-spacing: 0.05em; }

.section-box {
    background: #fff; border-radius: 12px; padding: 30px; margin-bottom: 30px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03); border: 1px solid #eee;
}
h2 {
    font-size: 1.2rem; border-left: 6px solid #ccc; padding-left: 15px; margin: 0 0 25px 0;
    color: #333; display: flex; align-items: center; font-weight: 800;
}

/* マトリックスとステータス */
.st-hot { background: #ff5252; color: #fff; border: 1px solid #d32f2f; }
.st-trend { background: #e040fb; color: #fff; border: 1px solid #7b1fa2; }
.st-stable { background: #ffb74d; color: #fff; border: 1px solid #f57c00; }
.st-normal { background: #fff; color: #333; border: 1px solid #ccc; }
.st-cold { background: #eceff1; color: #90a4ae; border: 1px solid #cfd8dc; }

.status-legend { display: flex; justify-content: center; gap: 15px; font-size: 0.8rem; flex-wrap: wrap; margin-bottom: 15px;}
.legend-item { display: flex; align-items: center; gap: 6px; }
.dot { width: 12px; height: 12px; border-radius: 50%; }

.matrix-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; justify-items: center; margin-top: 20px; }
@media(max-width:400px){ .matrix-grid { grid-template-columns: repeat(6, 1fr); } }
.matrix-ball { width: 36px; height: 36px; border-radius: 50%; font-size: 0.9rem; display: flex; align-items: center; justify-content: center; font-weight: bold; cursor: pointer; position: relative; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.tooltip { position: absolute; bottom: -25px; background: rgba(0,0,0,0.8); color: #fff; font-size: 0.7rem; padding: 4px 8px; border-radius: 4px; display: none; white-space: nowrap; z-index: 10; }
.matrix-ball:hover .tooltip { display: block; }

/* ナンバーズ用 ヒートマップ */
.analysis-table-wrap { overflow-x: auto; }
.analysis-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; text-align: center; min-width: 300px; }
.analysis-table th, .analysis-table td { border: 1px solid #eee; padding: 10px; }
.analysis-table th { background: #333; color: #fff; }
.heat-high { background: rgba(255, 82, 82, 0.15); font-weight: bold; color: #d32f2f; border-bottom: 2px solid #ff5252; }
.heat-mid { background: rgba(255, 82, 82, 0.03); }

/* 生成モードボタン */
.mode-buttons { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 10px; }
.mode-btn { background: #fff; border: 1px solid #e0e0e0; padding: 15px 5px; border-radius: 8px; cursor: pointer; text-align: center; transition: 0.2s; }
.mode-btn:hover { background: #f9f9f9; border-color: #ccc; }
.mode-btn strong { display: block; margin-bottom: 5px; color: #333; font-size: 0.95rem; }
.mode-btn span { font-size: 0.7rem; color: #888; }

/* === SEOセクション & フッター === */
.seo-section { background: #fff; padding: 40px; margin-top: 60px; border-radius: 12px; border: 1px solid #eee; }
.seo-section h2 { border-bottom: 2px solid #eee; padding-bottom: 10px; margin-bottom: 25px; font-size: 1.3rem; margin-top: 0; }
.seo-section h3 { font-size: 1.1rem; margin-top: 30px; margin-bottom: 15px; font-weight: bold; color: #333; border-left: 4px solid #ddd; padding-left: 10px; }
.seo-section p { font-size: 0.95rem; color: #666; line-height: 1.9; margin-bottom: 20px; }

.spec-table { width: 100%; border-collapse: separate; border-spacing: 0; margin-bottom: 25px; font-size: 0.9rem; border-top: 1px solid #eee; }
.spec-table th { background: #fff; text-align: left; vertical-align: top; padding: 12px 15px 12px 5px; border-bottom: 1px solid #eee; width: 25%; min-width: 80px; font-weight: bold; color: #333; white-space: nowrap; }
.spec-table td { padding: 12px 0 12px 10px; border-bottom: 1px solid #eee; color: #555; line-height: 1.6; }

.prize-list { margin: 0; padding: 0; list-style: none; }
.prize-list li { margin-bottom: 6px; display: flex; align-items: baseline; }
.prize-label { font-weight: bold; margin-right: 10px; min-width: 40px; display: inline-block; color: #333; }

footer { text-align: center; padding: 40px 20px; color: #999; font-size: 0.8rem; border-top: 1px solid #eee; background: #fff; margin-top: 40px;}
footer a { color: #666; margin: 0 10px; text-decoration: none; }

.loading-text { font-size: 0.8rem; color: #ccc; }
.hidden { display: none; }


/* =========================================================
   ▼ 設定パネルと買い目リストのレイアウト（PC・スマホ共通） ▼
   ========================================================= */

/* ▼ 共通：設定パネルの見た目 ▼ */
.settings-box {
    margin: 0 auto 20px auto;
    max-width: 800px;
    padding: 15px;
    background: #fdfdfd;
    border: 1px solid #eee;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
    text-align: center;
}
.taste5 {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
    justify-content: center;
}
.taste5 label {
    border: 1px solid #ddd;
    border-radius: 999px;
    padding: 8px 16px;
    background: #fff;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s;
    user-select: none;
}
.taste5 label:has(input:checked) {
    border-color: #333;
    background: #f0f0f0;
    color: #111;
}
.taste5 input[type="radio"] { 
    display: none; 
}

#patterns-display {
    max-width: 500px;
    margin: 0 auto; 
}

.result-nums {
    display: flex !important;
    flex-wrap: nowrap !important; 
    align-items: center !important;
    justify-content: center !important; 
    padding: 12px 0 !important;
    margin-bottom: 0 !important;
    border-bottom: 1px dashed #eee; 
    gap: 8px !important; 
}
.result-nums:last-child {
    border-bottom: none; 
}

#patterns-display .result-nums > span:first-child {
    display: inline-block !important;
    min-width: 45px !important; 
    text-align: right !important;
    margin-right: 15px !important;
    color: #777 !important;
    font-weight: bold !important;
    line-height: 1 !important;
    font-size: 0.9rem !important;
}

/* =========================================================
   ▼ スマホ向けの縮小表示（レスポンシブ対応） ▼
   ========================================================= */
@media screen and (max-width: 600px) {
    .settings-box { padding: 12px 8px; }
    .settings-box strong { font-size: 1rem !important; }
    .settings-box p { font-size: 0.75rem !important; margin-bottom: 8px !important; }
    .taste5 { gap: 4px; }
    .taste5 label {
        padding: 6px 12px;
        font-size: 0.75rem;
        letter-spacing: -0.5px;
        white-space: nowrap;
    }
    #genCount { padding: 4px 8px !important; font-size: 0.9rem !important; }

    .result-nums {
        gap: 4px !important; 
        padding: 10px 0 !important;
    }
    #patterns-display .result-nums > span:first-child {
        min-width: 35px !important;
        margin-right: 8px !important;
        font-size: 0.8rem !important;
    }
    
    #patterns-display .result-nums .ball {
        width: 30px !important;
        height: 30px !important;
        font-size: 0.85rem !important;
    }
}

/* =========================================================
   ▼ ロード中オーバーレイ＆フッター固定バナー ▼
   ========================================================= */

/* ▼ オーバーレイ画面（解析中） ▼ */
#loading-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(255, 255, 255, 0.95);
    z-index: 9999;
    display: none; 
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.loader-spinner {
    width: 50px; height: 50px;
    border: 5px solid #f0f0f0;
    border-top: 5px solid var(--theme-color, #333);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.loader-text {
    font-size: 1.2rem; font-weight: bold; color: #333;
    margin-bottom: 30px; letter-spacing: 2px;
}
.pr-box-content {
    margin: 10px auto;
    text-align: center;
    min-height: 250px;
}

/* ★ローディング広告の上に【PR】をつける */
.pr-box-content::before {
    content: "【PR】";
    display: block;
    font-size: 11px;
    color: #999;
    margin-bottom: 5px;
    letter-spacing: 1px;
}

/* ▼ フッター固定バナー ▼ */
#sticky-ad-container {
    position: fixed;
    bottom: 0; left: 0; width: 100%;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 10000;
    display: flex; justify-content: center; align-items: center;
    padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
    transition: transform 0.3s ease-in-out; 
}
.sticky-ad-slot {
    width: 320px; height: 50px; 
    position: relative;
    perspective: 1000px; 
}
.sticky-ad-content {
    width: 100%; height: 100%;
    transition: transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1);
    transform-style: preserve-3d;
}
.sticky-ad-content.flip {
    transform: rotateX(180deg); 
}
.sticky-ad-face {
    position: absolute; width: 100%; height: 100%;
    backface-visibility: hidden; 
    display: flex; justify-content: center; align-items: center;
}
.sticky-ad-back {
    transform: rotateX(180deg); 
}

/* ★枠内のPRバッジ */
.sticky-pr-badge {
    position: absolute;
    top: 0; left: 0;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 9px;
    padding: 2px 5px;
    border-bottom-right-radius: 4px;
    z-index: 10;
    pointer-events: none; /* クリックの邪魔にならないようにする */
}

/* ★枠内の閉じるボタン */
.sticky-close-btn {
    position: absolute;
    top: 0; right: 0;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    width: 20px; height: 20px;
    font-size: 16px; line-height: 18px; text-align: center;
    cursor: pointer;
    z-index: 10;
    border-bottom-left-radius: 4px;
    font-family: sans-serif;
}
.sticky-close-btn:hover { background: rgba(0, 0, 0, 0.8); }

/* 1pxの透明画像を無視してバナーをド真ん中に配置する */
.sticky-ad-face a {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}
.sticky-ad-face img[width="1"] {
    position: absolute;
    visibility: hidden;
}

/* バナーが横にはみ出さないように自動縮小する */
.sticky-ad-face img:not([width="1"]) {
    max-width: 100% !important;
    height: auto !important;
    display: block;
    margin: 0 auto;
}

/* PCでは固定バナーを非表示にする */
@media (min-width: 768px) {
    #sticky-ad-container {
        display: none !important;
    }
}
/* =========================================================
   ▼ プロジェクトB追加分：手動メモ＆バッジ用スタイル ▼
========================================================= */
/* ▼ 手動入力・マークシート用 ▼ */
.manual-entry-area { display: none; background: #fff; border: 2px solid var(--theme-color, #333); border-radius: 8px; padding: 20px; margin: 20px 0; box-shadow: 0 4px 10px rgba(0,0,0,0.05); }
.mark-sheet-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin: 15px auto; max-width: 400px; }
.mark-btn { padding: 10px 0; border: 1px solid #ccc; border-radius: 50%; background: #fff; cursor: pointer; text-align: center; font-size: 1rem; font-weight: bold; color: #333; transition: all 0.2s; aspect-ratio: 1/1; box-sizing: border-box; }
.mark-btn.selected { background: var(--theme-color, #333); color: #fff; border-color: var(--theme-color, #333); box-shadow: 0 2px 4px rgba(0,0,0,0.2); }

/* ▼ 保存オプション（トグル/チェックボックス） ▼ */
.save-options { display: flex; gap: 15px; justify-content: center; margin-bottom: 10px; font-size: 0.85rem; color: #555; }
.save-options label { display: flex; align-items: center; gap: 4px; cursor: pointer; font-weight:bold; }
.save-options input[type="checkbox"] { accent-color: var(--theme-color, #333); transform: scale(1.2); }

/* ▼ 保存リストのバッジ ▼ */
.memo-badges { display: flex; gap: 6px; margin-bottom: 8px; font-size: 0.7rem; }
.badge { padding: 3px 8px; border-radius: 4px; color: #fff; font-weight: bold; line-height: 1; }
.bdg-auto { background: #607d8b; }
.bdg-manual { background: #8d6e63; }
.bdg-public { background: #4caf50; }
.bdg-private { background: #9e9e9e; }
.bdg-purchased { background: #ff9800; }
.bdg-unpurchased { background: #03a9f4; }
/* ▼ 手動入力・マークシート用（はみ出し完全防止版） ▼ */
.manual-entry-area { display: none; background: #fff; border: 2px solid var(--theme-color, #333); border-radius: 8px; padding: 15px 10px !important; margin: 20px 0; box-shadow: 0 4px 10px rgba(0,0,0,0.05); width: 100% !important; box-sizing: border-box !important; overflow: hidden !important; }

/* ↓ minmax(0, 1fr) で親枠を絶対に突き破らないようにします */
.mark-sheet-grid { display: grid !important; grid-template-columns: repeat(7, minmax(0, 1fr)) !important; gap: 4px !important; margin: 15px auto; width: 100% !important; max-width: 400px; }

/* ↓ min-width: 0 がスマホでのボタン巨大化を防ぐ最大の魔法です */
.mark-btn { -webkit-appearance: none !important; appearance: none !important; min-width: 0 !important; padding: 0 !important; border: 1px solid #ccc; border-radius: 50%; background: #fff; cursor: pointer; text-align: center; font-size: clamp(10px, 3.5vw, 16px) !important; font-weight: bold; color: #333; transition: all 0.2s; aspect-ratio: 1/1 !important; box-sizing: border-box !important; display: flex !important; align-items: center !important; justify-content: center !important; height: auto !important; width: 100% !important; }

.mark-btn.selected { background: var(--theme-color, #333); color: #fff; border-color: var(--theme-color, #333); box-shadow: 0 2px 4px rgba(0,0,0,0.2); }

/* ▼ 保存オプション（トグル/チェックボックス） ▼ */
.save-options { display: flex; gap: 15px; justify-content: center; margin-bottom: 10px; font-size: 0.85rem; color: #555; }
.save-options label { display: flex; align-items: center; gap: 4px; cursor: pointer; font-weight:bold; }
.save-options input[type="checkbox"] { accent-color: var(--theme-color, #333); transform: scale(1.2); }

/* ▼ スマホでの左右の余白を減らして広く使う ▼ */
@media screen and (max-width: 767px) {
    .section-box { padding: 20px 10px !important; }
}