/* ==========================================================================
   競馬データ分析 & AI予想シミュレーター - デザインシステム & スタイル定義
   ========================================================================== */

/* Google Fonts インポート */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
    /* カラーパレット */
    --bg-main: #070a13;
    --bg-card: rgba(19, 27, 46, 0.75);
    --bg-card-hover: rgba(27, 38, 64, 0.85);
    --border-color: rgba(255, 255, 255, 0.1);
    --border-highlight: rgba(16, 185, 129, 0.4);

    --primary: #10b981;        /* ネオンエメラルド */
    --primary-glow: rgba(16, 185, 129, 0.3);
    --secondary: #06b6d4;      /* シアン */
    --accent-gold: #f59e0b;    /* アンバーゴールド */
    --accent-rose: #f43f5e;    /* ローズレッド */
    
    --text-main: #f8fafc;
    --text-sub: #94a3b8;
    --text-muted: #64748b;

    /* 枠順カラー */
    --waku-1: #ffffff;
    --waku-2: #1e293b;
    --waku-3: #ef4444;
    --waku-4: #3b82f6;
    --waku-5: #eab308;
    --waku-6: #22c55e;
    --waku-7: #f97316;
    --waku-8: #ec4899;

    /* フォント */
    --font-sans: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* 基本リセット */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-main);
    background-image: 
        radial-gradient(circle at 15% 15%, rgba(16, 185, 129, 0.08) 0%, transparent 45%),
        radial-gradient(circle at 85% 85%, rgba(6, 182, 212, 0.08) 0%, transparent 45%);
    background-attachment: fixed;
    color: var(--text-main);
    font-family: var(--font-sans);
    line-height: 1.6;
    min-height: 100vh;
    padding-bottom: 3rem;
}

/* ガラスモフィズム・パネル */
.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.glass-panel:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

/* ヘッダー */
header {
    background: rgba(10, 15, 29, 0.85);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 1rem 2rem;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    font-size: 1.8rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text h1 {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(90deg, #ffffff, #e2e8f0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text p {
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 600;
    letter-spacing: 1px;
}

/* メインコンテンツレイアウト */
main {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* レース選択タブ */
.race-tabs {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.race-tab {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.75rem 1.5rem;
    color: var(--text-sub);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.race-tab:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.race-tab.active {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(6, 182, 212, 0.2));
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 0 15px var(--primary-glow);
}

/* レース概要カード */
.race-info-card {
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.race-info-main h2 {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
}

.race-meta {
    color: var(--primary);
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

.race-desc {
    color: var(--text-sub);
    font-size: 0.9rem;
    max-width: 800px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #059669);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 0.85rem 1.75rem;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 20px var(--primary-glow);
    transition: all 0.2s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(16, 185, 129, 0.5);
}

/* メイン2カラムグリッド */
.dashboard-grid {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 1.5rem;
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* AIチューニングパネル */
.tuning-panel {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.panel-title {
    font-size: 1.15rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

.preset-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.btn-preset {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.4rem 0.75rem;
    color: var(--text-sub);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-preset:hover {
    background: rgba(16, 185, 129, 0.15);
    border-color: var(--primary);
    color: #fff;
}

.slider-group {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.slider-item {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.slider-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 600;
}

.slider-val {
    color: var(--primary);
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 10px var(--primary);
    cursor: pointer;
    transition: transform 0.1s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.25);
}

/* メインデータ表示エリア */
.data-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* テーブルスタイル */
.table-container {
    overflow-x: auto;
    border-radius: 12px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th, td {
    padding: 0.9rem 1rem;
    text-align: left;
}

th {
    background: rgba(10, 15, 29, 0.9);
    color: var(--text-sub);
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}

.horse-row {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: background 0.15s ease;
}

.horse-row:hover {
    background: var(--bg-card-hover);
}

.horse-row.active-row {
    background: rgba(16, 185, 129, 0.12);
    border-left: 3px solid var(--primary);
}

.horse-name-cell {
    display: flex;
    flex-direction: column;
}

.horse-name {
    font-weight: 700;
    color: #fff;
    font-size: 0.95rem;
}

.horse-sub {
    font-size: 0.75rem;
    color: var(--text-sub);
}

/* バッジ類 */
.waku-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    font-weight: 800;
    font-size: 0.8rem;
}

.waku-1 { background: var(--waku-1); color: #000; }
.waku-2 { background: var(--waku-2); color: #fff; border: 1px solid rgba(255,255,255,0.2); }
.waku-3 { background: var(--waku-3); color: #fff; }
.waku-4 { background: var(--waku-4); color: #fff; }
.waku-5 { background: var(--waku-5); color: #000; }
.waku-6 { background: var(--waku-6); color: #fff; }
.waku-7 { background: var(--waku-7); color: #fff; }
.waku-8 { background: var(--waku-8); color: #fff; }

.mark-badge {
    font-weight: 800;
    font-size: 1.1rem;
}

.mark-honme { color: #ef4444; }   /* ◎ 赤 */
.mark-taikou { color: #f59e0b; }  /* ◯ 金 */
.mark-tanana { color: #3b82f6; }  /* ▲ 青 */
.mark-renshita { color: #10b981; }/* △ 緑 */
.mark-anuma { color: #ec4899; }   /* ☆ 穴 */
.mark-none { color: var(--text-muted); }

.ev-badge {
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.8rem;
}

.ev-high { background: rgba(16, 185, 129, 0.2); color: var(--primary); border: 1px solid var(--primary); }
.ev-normal { background: rgba(255, 255, 255, 0.05); color: var(--text-sub); }
.ev-low { background: rgba(244, 63, 94, 0.1); color: var(--accent-rose); }

/* 下部詳細・分析グリッド */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 900px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }
}

.detail-card {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.radar-wrapper {
    position: relative;
    height: 260px;
    width: 100%;
}

.horse-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.horse-detail-name {
    font-size: 1.3rem;
    font-weight: 800;
}

.stat-pills {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.stat-pill {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.6rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-pill-label {
    font-size: 0.75rem;
    color: var(--text-sub);
}

.stat-pill-val {
    font-weight: 700;
    font-size: 1rem;
    color: #fff;
}

.ai-comment-box {
    background: rgba(16, 185, 129, 0.05);
    border-left: 3px solid var(--primary);
    padding: 0.85rem 1rem;
    border-radius: 0 8px 8px 0;
    font-size: 0.88rem;
    color: #e2e8f0;
}

/* 推奨買い目カード */
.recommendations-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.rec-card {
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    border-left: 3px solid var(--secondary);
}

.rec-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rec-type-badge {
    background: rgba(6, 182, 212, 0.2);
    color: var(--secondary);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
}

.rec-ev {
    font-size: 0.8rem;
    color: var(--primary);
}

.rec-target {
    font-weight: 800;
    font-size: 1.05rem;
    color: #fff;
}

.rec-reason {
    font-size: 0.82rem;
    color: var(--text-sub);
}

/* モーダル (レースビジュアライザ) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(3, 7, 18, 0.85);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-container {
    width: 90%;
    max-width: 850px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-close-btn {
    background: none;
    border: none;
    color: var(--text-sub);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.15s;
}

.modal-close-btn:hover {
    color: #fff;
}

.canvas-wrapper {
    width: 100%;
    background: #064e3b;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

#raceCanvas {
    width: 100%;
    height: 320px;
    display: block;
}

.live-commentary-box {
    background: rgba(10, 15, 29, 0.9);
    border: 1px solid var(--border-color);
    padding: 0.85rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    color: var(--accent-gold);
    min-height: 48px;
    display: flex;
    align-items: center;
}

.anim-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    color: #fff;
    border-radius: 8px;
    padding: 0.6rem 1.25rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ユーティリティクラス */
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.text-emerald { color: var(--primary); }
.text-score { color: var(--secondary); }
.text-sub { color: var(--text-sub); }

/* ==========================================================================
   当日全レース一覧タップ型 AI予想ダッシュボード - 追加スタイル
   ========================================================================== */

/* メインコンテナ */
.dashboard-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

/* ページ最上部ステータスバー */
.daily-status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 12px;
    padding: 0.75rem 1.25rem;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.daily-status-bar .status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--primary);
    font-weight: 600;
}

.daily-status-bar .updated-time {
    color: var(--text-sub);
    font-size: 0.85rem;
}

/* 会場セレクタ・スクロールタブ */
.venue-selector-wrap {
    margin-bottom: 1.5rem;
}

.venue-selector-title {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.venue-tabs {
    display: flex;
    gap: 0.6rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
    -webkit-overflow-scrolling: touch;
}

.venue-tabs::-webkit-scrollbar {
    height: 4px;
}

.venue-tabs::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.venue-btn {
    background: rgba(19, 27, 46, 0.8);
    border: 1px solid var(--border-color);
    color: var(--text-sub);
    padding: 0.6rem 1.25rem;
    border-radius: 30px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.venue-btn:hover {
    background: rgba(27, 38, 64, 0.95);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.25);
}

.venue-btn.active {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(6, 182, 212, 0.25));
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.35);
}

.venue-btn .race-count-tag {
    background: rgba(255, 255, 255, 0.12);
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* レース一覧グリッド */
.race-accordion-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* 単一レースアコーディオンカード */
.race-item-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    overflow: hidden;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.race-item-card:hover {
    border-color: rgba(255, 255, 255, 0.22);
}

.race-item-card.is-open {
    border-color: var(--border-highlight);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

/* レースヘッダー（タップ領域） */
.race-header-btn {
    width: 100%;
    background: transparent;
    border: none;
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    text-align: left;
    color: var(--text-main);
    gap: 0.75rem;
    transition: background 0.15s ease;
}

.race-header-btn:hover {
    background: rgba(255, 255, 255, 0.03);
}

.race-meta-left {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex: 1;
    min-width: 0;
}

.race-number-badge {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    font-weight: 800;
    font-size: 1rem;
    padding: 0.4rem 0.7rem;
    border-radius: 8px;
    min-width: 46px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

.race-number-badge.main-race {
    background: linear-gradient(135deg, #d97706, #b45309);
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.4);
}

.race-info-text {
    min-width: 0;
}

.race-info-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.race-info-cond {
    font-size: 0.8rem;
    color: var(--text-sub);
}

.race-meta-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

/* AI推奨シグナルバッジ */
.ai-signal-badge {
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    letter-spacing: 0.02em;
}

.ai-signal-badge.recommended {
    background: rgba(16, 185, 129, 0.18);
    border: 1px solid rgba(16, 185, 129, 0.5);
    color: #34d399;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

.ai-signal-badge.skip {
    background: rgba(148, 163, 184, 0.1);
    border: 1px solid rgba(148, 163, 184, 0.25);
    color: var(--text-sub);
}

.chevron-icon {
    font-size: 0.85rem;
    color: var(--text-muted);
    transition: transform 0.25s ease;
}

.race-item-card.is-open .chevron-icon {
    transform: rotate(180deg);
    color: var(--primary);
}

/* アコーディオン展開ボディ */
.race-body-panel {
    display: none;
    padding: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(10, 15, 28, 0.5);
}

.race-item-card.is-open .race-body-panel {
    display: block;
    animation: fadeIn 0.25s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 👑 AI最終推奨カード */
.hero-rec-card {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(6, 182, 212, 0.08));
    border: 1px solid rgba(16, 185, 129, 0.4);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    position: relative;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.15);
}

.hero-rec-card.is-skip {
    background: rgba(30, 41, 59, 0.4);
    border-color: rgba(148, 163, 184, 0.25);
    box-shadow: none;
}

.hero-rec-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.85rem;
}

.hero-rec-badge {
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    text-transform: uppercase;
}

.hero-rec-badge.badge-buy {
    background: var(--primary);
    color: #022c22;
}

.hero-rec-badge.badge-skip {
    background: var(--text-muted);
    color: #fff;
}

.hero-rec-ticket {
    font-size: 1.35rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.hero-rec-ticket .type-tag {
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.15);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    color: var(--secondary);
}

.hero-rec-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    text-align: center;
}

.metric-item .metric-label {
    font-size: 0.75rem;
    color: var(--text-sub);
    margin-bottom: 0.2rem;
}

.metric-item .metric-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
}

.metric-item .metric-value.highlight-ev {
    color: #34d399;
}

.hero-rec-comment {
    font-size: 0.85rem;
    color: var(--text-sub);
    line-height: 1.5;
}

/* 🏆 券種別 No.1 グリッド */
.best-by-type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.type-card {
    background: rgba(19, 27, 46, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.type-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
}

.type-name-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--secondary);
}

.type-ev-badge {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary);
}

.type-selection-txt {
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.4rem;
    word-break: break-all;
}

.type-card-meta {
    font-size: 0.75rem;
    color: var(--text-sub);
    display: flex;
    justify-content: space-between;
}

/* 📊 期待値TOP10 & 🐴 出走馬 セクション */
.sub-panel-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.compact-table-wrap {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 1.25rem;
}

.compact-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.compact-table th {
    background: rgba(15, 23, 42, 0.8);
    color: var(--text-sub);
    font-weight: 600;
    text-align: left;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    white-space: nowrap;
}

.compact-table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-main);
    white-space: nowrap;
}

.compact-table tr:hover td {
    background: rgba(255, 255, 255, 0.03);
}

.compact-table .badge-ev {
    font-weight: 700;
    padding: 0.2rem 0.45rem;
    border-radius: 4px;
}

.compact-table .ev-high {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.compact-table .ev-mid {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}

/* 🐴 出走馬AI勝率リスト */
.horses-list-grid {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.horse-row-card {
    display: flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    gap: 0.6rem;
    font-size: 0.85rem;
}

.horse-waku-badge {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.horse-num-badge {
    font-weight: 700;
    min-width: 20px;
    text-align: center;
    color: #fff;
    flex-shrink: 0;
}

.horse-name-jockey {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.horse-name-row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
}

.horse-name-txt {
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.pure-rank-badge {
    font-size: 0.65rem;
    padding: 0.08rem 0.35rem;
    border-radius: 4px;
    font-weight: 800;
    white-space: nowrap;
    flex-shrink: 0;
    line-height: 1.2;
}

.pure-rank-1 {
    background: rgba(245, 158, 11, 0.22);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.5);
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.2);
}

.pure-rank-2 {
    background: rgba(148, 163, 184, 0.22);
    color: #e2e8f0;
    border: 1px solid rgba(148, 163, 184, 0.5);
}

.pure-rank-3 {
    background: rgba(249, 115, 22, 0.22);
    color: #fb923c;
    border: 1px solid rgba(249, 115, 22, 0.5);
}

.horse-jockey-txt {
    font-size: 0.75rem;
    color: var(--text-sub);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.horse-odds-txt {
    font-size: 0.8rem;
    color: var(--text-sub);
    min-width: 50px;
    text-align: right;
    flex-shrink: 0;
}

.horse-ai-meter-wrap {
    width: 90px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.15rem;
}

.horse-ai-prob-val {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--secondary);
}

.horse-ai-bar-bg {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.horse-ai-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--secondary), var(--primary));
    border-radius: 3px;
}

/* 枠番ごとの背景色・文字色 */
.waku-bg-1 { background-color: var(--waku-1); color: #000; }
.waku-bg-2 { background-color: var(--waku-2); color: #fff; border: 1px solid rgba(255,255,255,0.2); }
.waku-bg-3 { background-color: var(--waku-3); color: #fff; }
.waku-bg-4 { background-color: var(--waku-4); color: #fff; }
.waku-bg-5 { background-color: var(--waku-5); color: #000; }
.waku-bg-6 { background-color: var(--waku-6); color: #000; }
.waku-bg-7 { background-color: var(--waku-7); color: #fff; }
.waku-bg-8 { background-color: var(--waku-8); color: #fff; }

/* スマホ表示最適化 (レスポンシブ) */
@media (max-width: 640px) {
    .dashboard-container {
        padding: 0.75rem;
    }
    .race-header-btn {
        padding: 0.85rem 0.9rem;
    }
    .race-body-panel {
        padding: 1rem 0.75rem;
    }
    .hero-rec-metrics {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.4rem;
        padding: 0.5rem;
    }
    .metric-item .metric-value {
        font-size: 0.95rem;
    }
    .best-by-type-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }
    .horse-row-card {
        padding: 0.45rem 0.55rem;
        gap: 0.4rem;
    }
    .horse-odds-txt {
        min-width: 44px;
        font-size: 0.78rem;
    }
    .horse-ai-meter-wrap {
        width: 68px;
    }
    .pure-rank-badge {
        font-size: 0.62rem;
        padding: 0.06rem 0.28rem;
    }
}

/* 予想更新ボタンスピナー & トースト通知 */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.refresh-spinner.is-spinning {
    display: inline-block;
    animation: spin 1s linear infinite;
}

.toast-notification {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(16, 185, 129, 0.95);
    backdrop-filter: blur(8px);
    color: #022c22;
    padding: 0.75rem 1.5rem;
    border-radius: 30px;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    z-index: 9999;
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toast-notification.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-notification.toast-error {
    background: rgba(244, 63, 94, 0.95);
    color: #fff;
}

/* ==========================================================================
   レース内サブタブ (🔮 AI直前予想 / 🏁 レース結果・確定払戻)
   ========================================================================== */
.race-sub-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 0.35rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.sub-tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-sub);
    padding: 0.6rem 0.8rem;
    border-radius: 7px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.sub-tab-btn:hover {
    color: #fff;
}

.sub-tab-btn.active {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.sub-tab-btn.active.tab-res {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.25), rgba(37, 99, 235, 0.25));
    color: var(--secondary);
    border: 1px solid rgba(6, 182, 212, 0.4);
}

/* 🏁 レース結果・確定払戻パネル */
.result-payout-panel {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.hit-summary-banner {
    border-radius: 10px;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
}

.hit-summary-banner.is-hit {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(245, 158, 11, 0.2));
    border: 1px solid rgba(16, 185, 129, 0.5);
    color: #34d399;
}

.hit-summary-banner.no-hit {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-sub);
}

.payouts-table-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
}

.payout-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.payout-card-type {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
}

.payout-card-num {
    font-size: 0.95rem;
    font-weight: 800;
    color: #fff;
}

.payout-card-val {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--accent-gold);
}

/* ==========================================================================
   Cloudflare Pages用 PINコード認証ロックモーダル
   ========================================================================== */
.pin-lock-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(7, 10, 19, 0.96);
    backdrop-filter: blur(20px);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.pin-lock-card {
    background: rgba(19, 27, 46, 0.9);
    border: 1px solid rgba(16, 185, 129, 0.4);
    border-radius: 20px;
    padding: 2.25rem 2rem;
    max-width: 380px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(16, 185, 129, 0.15);
}

.pin-lock-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
}

.pin-lock-title {
    font-size: 1.3rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 0.4rem;
}

.pin-lock-sub {
    font-size: 0.85rem;
    color: var(--text-sub);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.pin-input-group {
    display: flex;
    justify-content: center;
    margin-bottom: 1.25rem;
}

.pin-input {
    width: 180px;
    font-size: 2rem;
    letter-spacing: 0.6rem;
    text-align: center;
    padding: 0.6rem 0.5rem;
    background: rgba(10, 15, 29, 0.8);
    border: 2px solid rgba(16, 185, 129, 0.5);
    border-radius: 12px;
    color: #fff;
    font-weight: 800;
    outline: none;
    transition: all 0.2s ease;
}

.pin-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
}

.pin-submit-btn {
    width: 100%;
    background: linear-gradient(135deg, #10b981, #06b6d4);
    color: #022c22;
    border: none;
    padding: 0.85rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.pin-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45);
}

.pin-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 1rem;
}

/* ==========================================================================
   レース別 リアルタイム直前オッズ更新アクションバー
   ========================================================================== */
.race-live-odds-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: 12px;
    padding: 0.65rem 0.9rem;
    margin-bottom: 1rem;
    backdrop-filter: blur(8px);
}

.live-odds-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    color: var(--text-main);
}

.live-pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
    display: inline-block;
    animation: livePulse 2s infinite ease-in-out;
}

@keyframes livePulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.3);
        opacity: 1;
        box-shadow: 0 0 12px #34d399;
    }
}

.live-odds-label {
    color: var(--text-sub);
}

.live-odds-time {
    font-weight: 700;
    color: #34d399;
    background: rgba(16, 185, 129, 0.15);
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    font-size: 0.78rem;
}

.btn-refresh-race-odds {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(6, 182, 212, 0.2));
    border: 1px solid rgba(52, 211, 153, 0.5);
    color: #a7f3d0;
    padding: 0.45rem 0.95rem;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.15);
}

.btn-refresh-race-odds:hover {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.4), rgba(6, 182, 212, 0.35));
    border-color: #34d399;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-refresh-race-odds:active {
    transform: translateY(0);
}

.btn-refresh-race-odds:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.race-refresh-spinner {
    font-size: 0.95rem;
    display: inline-block;
    transition: transform 0.3s ease;
}

.race-refresh-spinner.is-spinning {
    animation: raceSpin 0.75s linear infinite;
}

@keyframes raceSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}




