/* UmaScore - モバイルファースト レスポンシブCSS */
:root {
  --primary: #1a237e;
  --primary-light: #3949ab;
  --primary-dark: #0d1b60;
  --accent: #f57c00;
  --accent-light: #ffb74d;
  --success: #2e7d32;
  --warning: #f9a825;
  --danger: #c62828;
  --bg: #f5f5f5;
  --bg-card: #ffffff;
  --text: #212121;
  --text-muted: #757575;
  --border: #e0e0e0;
  --shadow: 0 2px 8px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.15);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.2s ease;

  /* Confidence Rank Colors */
  --rank-s: #e65100;
  --rank-a: #1565c0;
  --rank-b: #2e7d32;
  --rank-c: #6a1b9a;
  --rank-d: #757575;
  --surface: #ffffff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
}

/* ==================== Header ==================== */
.site-header {
  background: var(--primary);
  position: sticky; top: 0; z-index: 1000;
  box-shadow: var(--shadow);
}
.header-inner {
  max-width: 1200px; margin: 0 auto;
  padding: 0 16px;
  display: flex; align-items: center; gap: 16px;
  height: 60px;
}
.logo {
  display: flex; align-items: center; gap: 8px;
  text-decoration: none; color: white;
  font-size: 1.3rem; font-weight: 700;
}
.logo-icon { font-size: 1.5rem; }
.main-nav {
  margin-left: auto;
  display: flex; align-items: center; gap: 8px;
}
.nav-link {
  color: rgba(255,255,255,0.85);
  text-decoration: none; padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  font-size: 0.9rem;
}
.nav-link:hover { background: rgba(255,255,255,0.1); color: white; }
.nav-cta {
  background: var(--accent); color: white !important;
  padding: 6px 16px;
}
.nav-cta:hover { background: var(--accent-light) !important; }
.nav-toggle {
  display: none; background: none; border: none;
  color: white; font-size: 1.5rem; cursor: pointer;
}

/* ==================== Hero ==================== */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white; padding: 80px 16px;
}
.hero-inner {
  max-width: 1100px; margin: 0 auto;
  display: grid; grid-template-columns: 1fr; gap: 48px;
  align-items: center;
}
.hero-title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 900; line-height: 1.2;
  margin-bottom: 16px;
}
.highlight { color: var(--accent-light); }
.hero-subtitle {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  opacity: 0.9; margin-bottom: 32px; line-height: 1.7;
}
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.hero-note { font-size: 0.85rem; opacity: 0.7; }

/* ==================== Buttons ==================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 20px; border-radius: var(--radius-sm);
  font-weight: 600; text-decoration: none;
  cursor: pointer; border: 2px solid transparent;
  transition: var(--transition); font-size: 0.95rem;
}
.btn-lg { padding: 14px 28px; font-size: 1.05rem; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: #ef6c00; transform: translateY(-1px); }
.btn-secondary { background: rgba(255,255,255,0.15); color: white; border-color: rgba(255,255,255,0.4); }
.btn-secondary:hover { background: rgba(255,255,255,0.25); }
.btn-outline { background: transparent; border-color: var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: white; }

/* ==================== Score Demo ==================== */
.hero-score-demo { display: flex; justify-content: center; }
.hero-score-card {
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius); padding: 24px;
  display: flex; gap: 16px; align-items: center;
  min-width: 280px;
}
.score-rank {
  width: 56px; height: 56px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; font-weight: 900; flex-shrink: 0;
  color: white;
}
.rank-s { background: var(--rank-s); }
.rank-a { background: var(--rank-a); }
.rank-b { background: var(--rank-b); }
.rank-c { background: var(--rank-c); }
.rank-d { background: var(--rank-d); }

.score-info { color: white; }
.horse-name { font-size: 1.1rem; font-weight: 700; margin-bottom: 4px; }
.master-score { font-size: 1.8rem; font-weight: 900; color: var(--accent-light); }
.sub-scores { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.sub-scores span {
  font-size: 0.75rem;
  background: rgba(255,255,255,0.15);
  padding: 2px 8px; border-radius: 20px;
}

/* ==================== Sections ==================== */
.section-inner {
  max-width: 1100px; margin: 0 auto; padding: 0 16px;
}
.section-title {
  text-align: center; font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 800; margin-bottom: 48px; color: var(--primary);
}

/* ==================== Features ==================== */
.features { padding: 80px 16px; background: var(--bg-card); }
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}
.feature-card {
  background: var(--bg); border-radius: var(--radius);
  padding: 28px; transition: var(--transition);
  border: 1px solid var(--border);
}
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.feature-icon { font-size: 2.5rem; margin-bottom: 12px; }
.feature-card h3 { font-size: 1.1rem; margin-bottom: 8px; color: var(--primary); }
.feature-card p { color: var(--text-muted); font-size: 0.9rem; line-height: 1.7; }

/* ==================== Pricing ==================== */
.pricing { padding: 80px 16px; background: var(--bg); }
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px; align-items: start;
}
.pricing-card {
  background: var(--bg-card); border-radius: var(--radius);
  padding: 32px 24px; border: 2px solid var(--border);
  position: relative; transition: var(--transition);
}
.pricing-card.featured {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(26, 35, 126, 0.1);
  transform: scale(1.02);
}
.plan-badge {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--primary); color: white;
  padding: 4px 16px; border-radius: 20px; font-size: 0.8rem; font-weight: 700;
}
.plan-name { font-size: 1.2rem; font-weight: 700; margin-bottom: 12px; color: var(--primary); }
.plan-price { font-size: 2.2rem; font-weight: 900; margin-bottom: 24px; }
.plan-price span { font-size: 1rem; font-weight: 400; color: var(--text-muted); }
.plan-features { list-style: none; margin-bottom: 28px; }
.plan-features li {
  padding: 8px 0; border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.plan-features li:last-child { border-bottom: none; }

/* ==================== Mogu ==================== */
.mogu-section { padding: 80px 16px; background: linear-gradient(135deg, #e8eaf6, #e3f2fd); }
.mogu-inner {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 48px; align-items: center;
}
.mogu-demo { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.mogu-avatar { font-size: 5rem; animation: bounce 2s infinite; }
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
.mogu-speech {
  background: white; border-radius: var(--radius);
  padding: 16px 20px; box-shadow: var(--shadow);
  position: relative; max-width: 280px;
}
.mogu-speech::after {
  content: '';
  position: absolute; bottom: -10px; left: 50%;
  transform: translateX(-50%);
  border: 10px solid transparent;
  border-top-color: white;
  border-bottom: none;
}
.mogu-text h2 { font-size: 1.8rem; font-weight: 800; color: var(--primary); margin-bottom: 16px; }
.mogu-text p { color: var(--text-muted); line-height: 1.8; }

/* ==================== Race List ==================== */
.races-container { padding: 24px 16px; max-width: 1100px; margin: 0 auto; }

/* 会場グループ */
.venue-group { margin-bottom: 20px; }
.venue-header {
  font-size: 1rem; font-weight: 700; color: var(--text);
  padding: 10px 14px; background: var(--bg-card);
  border-radius: var(--radius) var(--radius) 0 0;
  border: 1px solid var(--border); border-bottom: 2px solid var(--primary);
}
.venue-pin { margin-right: 4px; }

/* レースカード */
.race-card {
  background: var(--bg-card);
  padding: 14px 16px; display: flex;
  justify-content: space-between; align-items: center;
  border: 1px solid var(--border); border-top: none;
  cursor: pointer; transition: var(--transition);
  text-decoration: none; color: inherit;
}
.race-card:last-child { border-radius: 0 0 var(--radius) var(--radius); }
.race-card:hover { background: #f5f7ff; }

/* G1/G2/G3 強調 */
.race-card-grade { border-left: 4px solid transparent; }
.race-card-g1 { border-left-color: #c62828; background: #fffbfb; }
.race-card-g2 { border-left-color: #6a1b9a; background: #fdfbff; }
.race-card-g3 { border-left-color: #1a237e; background: #fbfcff; }

.race-card-main { flex: 1; min-width: 0; }
.race-card-top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.race-number-badge {
  background: var(--primary); color: #fff;
  font-size: .7rem; font-weight: 700;
  padding: 2px 7px; border-radius: 4px; white-space: nowrap;
}
.race-name-text { font-weight: 700; font-size: .95rem; }
.race-grade-badge-sm {
  display: inline-block; padding: 1px 7px;
  border-radius: 4px; font-size: .7rem; font-weight: 700;
}
.race-grade-g1 { background: #ffcdd2; color: #c62828; }
.race-grade-g2 { background: #e1bee7; color: #6a1b9a; }
.race-grade-g3 { background: #c5cae9; color: #1a237e; }

.race-card-bottom { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.race-cond { font-size: .8rem; color: var(--text-muted); }
.race-featured { font-size: .7rem; font-weight: 700; color: #c62828; }

.race-card-arrow { font-size: 1.4rem; color: #bbb; font-weight: 300; margin-left: 8px; flex-shrink: 0; }

/* ==================== Score Table ==================== */
.score-table { width: 100%; border-collapse: collapse; margin-top: 16px; }
.score-table th, .score-table td {
  padding: 12px 8px; text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.score-table th { font-weight: 700; color: var(--text-muted); background: var(--bg); }
.score-table tr:hover td { background: #f8f9ff; }

/* ==================== Heatmap ==================== */
.heatmap-grid {
  display: grid; grid-template-columns: repeat(8, 1fr);
  gap: 4px; margin: 16px 0;
}
.heatmap-cell {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: white; font-size: 0.8rem;
}

/* ==================== Toggle Switch ==================== */
.mode-toggle {
  display: flex; gap: 4px; background: var(--bg);
  padding: 4px; border-radius: var(--radius-sm);
}
.mode-btn {
  padding: 8px 16px; border-radius: var(--radius-sm);
  border: none; cursor: pointer; font-weight: 600;
  transition: var(--transition); background: transparent;
  color: var(--text-muted); font-size: 0.9rem;
}
.mode-btn.active { background: var(--primary); color: white; }

/* ==================== User Prediction ==================== */
.prediction-marks { display: flex; gap: 8px; flex-wrap: wrap; }
.mark-btn {
  width: 48px; height: 48px;
  border-radius: 50%; border: 2px solid var(--border);
  background: white; cursor: pointer; font-size: 1.2rem;
  font-weight: 900; transition: var(--transition);
}
.mark-btn:hover, .mark-btn.selected { transform: scale(1.1); }
.mark-honmei { border-color: #c62828; color: #c62828; }
.mark-honmei.selected { background: #c62828; color: white; }
.mark-taikou { border-color: #1565c0; color: #1565c0; }
.mark-taikou.selected { background: #1565c0; color: white; }
.mark-tanren { border-color: #2e7d32; color: #2e7d32; }
.mark-tanren.selected { background: #2e7d32; color: white; }
.mark-hazushi { border-color: var(--text-muted); color: var(--text-muted); }
.mark-hazushi.selected { background: var(--text-muted); color: white; }

/* ==================== Mogu Guide Floating ==================== */
.mogu-guide {
  position: fixed; bottom: 20px; right: 20px;
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
  z-index: 999;
}
.mogu-guide .mogu-icon {
  width: 56px; height: 56px;
  background: var(--primary); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; cursor: pointer; box-shadow: var(--shadow-lg);
  transition: var(--transition);
}
.mogu-guide .mogu-icon:hover { transform: scale(1.1); }
.mogu-bubble {
  background: white; border-radius: var(--radius);
  padding: 12px 16px; max-width: 250px;
  box-shadow: var(--shadow-lg); font-size: 0.85rem;
  display: none;
}
.mogu-bubble.visible { display: block; }

/* ==================== Alert ==================== */
.alert-badge {
  display: inline-block; background: var(--danger); color: white;
  padding: 2px 8px; border-radius: 20px; font-size: 0.75rem;
  font-weight: 700; animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ==================== Loading ==================== */
.loading {
  display: flex; align-items: center; justify-content: center;
  padding: 48px; color: var(--text-muted);
}
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==================== Disclaimer ==================== */
.disclaimer-section { padding: 24px 16px; background: #fff8e1; }
.disclaimer-text {
  max-width: 900px; margin: 0 auto; text-align: center;
  font-size: 0.85rem; color: #5d4037; line-height: 1.7;
}

/* ==================== Footer ==================== */
.site-footer {
  background: var(--primary-dark); color: rgba(255,255,255,0.7);
  padding: 32px 16px;
}
.footer-inner { max-width: 1100px; margin: 0 auto; text-align: center; }
.footer-links { display: flex; gap: 24px; justify-content: center; margin-bottom: 16px; }
.footer-links a { color: rgba(255,255,255,0.7); text-decoration: none; font-size: 0.9rem; }
.footer-links a:hover { color: white; }
.disclaimer { font-size: 0.8rem; margin-bottom: 12px; line-height: 1.7; }
.copyright { font-size: 0.8rem; }

/* ==================== Responsive ==================== */
@media (min-width: 768px) {
  .hero-inner { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 767px) {
  .main-nav { display: none; }
  .main-nav.open {
    display: flex; flex-direction: column;
    position: absolute; top: 60px; left: 0; right: 0;
    background: var(--primary); padding: 16px;
  }
  .nav-toggle { display: block; margin-left: auto; }
  .hero { padding: 48px 16px; }
  .mogu-inner { grid-template-columns: 1fr; }
  .footer-links { flex-direction: column; gap: 12px; }
}

@media (min-width: 1200px) {
  .features-grid { grid-template-columns: repeat(3, 1fr); }
  .pricing-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ==================== Race Detail ==================== */
.race-detail-header { margin-bottom: 1.5rem; }
.race-meta-detail { display: flex; gap: 1rem; flex-wrap: wrap; margin: .5rem 0; color: var(--text-muted); }
.race-grade-badge { background: var(--danger); color: #fff; padding: 2px 10px; border-radius: 4px; font-weight: bold; font-size: .9rem; }
.rank-badge { display: inline-block; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; color: #fff; font-weight: bold; font-size: .8rem; text-align: center; }
.rank-S { background: var(--danger); }
.rank-A { background: var(--rank-s); }
.rank-B { background: var(--success); }
.rank-C { background: var(--rank-a); }
.rank-D { background: var(--rank-d); }
.horse-name-cell { text-align: left !important; font-weight: 600; }
.ev-high { color: var(--danger); font-weight: bold; }
.score-table-wrap { overflow-x: auto; }
.detail-section { margin-top: 2rem; background: var(--bg-card); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }
.detail-section-title { font-size: 1.1rem; font-weight: 700; color: var(--primary); margin-bottom: 1rem; }
.budget-input-row { display: flex; align-items: center; gap: 12px; margin-bottom: 1rem; }
.budget-field { width: 100px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: .9rem; }
.ev-card { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 8px; }
.ev-value { font-weight: 700; color: var(--danger); font-size: 1.1rem; }
.betting-card { padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 8px; background: var(--bg-card); }
.betting-type { display: inline-block; font-weight: 700; color: var(--primary); margin-bottom: 4px; font-size: .85rem; background: #e8eaf6; padding: 2px 8px; border-radius: 4px; }
.betting-horse { font-weight: 700; font-size: .95rem; margin-bottom: 2px; }
.betting-reason { font-size: .8rem; color: var(--text-muted); margin-bottom: 4px; }
.betting-amount { font-size: .9rem; font-weight: 600; color: var(--text); }
.mogu-tips-box { background: linear-gradient(135deg, #e8eaf6, #e3f2fd); border: none; }
.mogu-tips-header { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.mogu-tips-avatar { font-size: 1.5rem; }
.mogu-tips-title { font-weight: 700; color: var(--primary); }
.mogu-tip-item { background: #fff; padding: 8px 12px; border-radius: var(--radius-sm); margin-bottom: 6px; font-size: .9rem; }

/* Odds Polling */
.odds-polling-badge { font-size: .7rem; padding: 2px 8px; border-radius: 10px; margin-left: 8px; font-weight: 400; }
.odds-polling-badge.active { background: #e8f5e9; color: var(--success); }
.odds-polling-badge.stopped { background: var(--bg); color: var(--text-muted); }
.odds-alert-item { background: #fff3e0; border-left: 4px solid var(--rank-s); padding: 10px 12px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; font-size: .9rem; }
.odds-alert-badge { background: var(--danger); color: #fff; padding: 2px 8px; border-radius: 4px; font-size: .75rem; font-weight: 600; }
.odds-last-update { font-size: .75rem; color: var(--text-muted); text-align: right; margin-top: 8px; }
.odds-chart-svg { width: 100%; max-width: 700px; }

/* ==================== Dashboard ==================== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin: 1.5rem 0; }
.stat-card { background: var(--bg-card); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); text-align: center; }
.stat-value { font-size: 2rem; font-weight: bold; color: var(--primary); }
.stat-label { color: var(--text-muted); font-size: .9rem; margin-top: .3rem; }
.no-data-msg { background: var(--bg); border-radius: var(--radius-sm); padding: 2rem; text-align: center; color: var(--text-muted); margin: 2rem 0; }
.dash-section { background: var(--bg-card); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); margin: 1.5rem 0; }
.dash-section-title { font-size: 1.1rem; font-weight: 700; color: var(--primary); margin-bottom: 1rem; }
.profile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.profile-card { background: var(--bg); border-radius: var(--radius-sm); padding: 1rem; text-align: center; }
.profile-card-label { font-size: .85rem; color: var(--text-muted); margin-bottom: 4px; }
.profile-card-value { font-size: 1.3rem; font-weight: 700; color: var(--primary); }
.mogu-feedback-box { background: linear-gradient(135deg, #e8eaf6, #e3f2fd); border-radius: var(--radius); padding: 1.5rem; margin: 1.5rem 0; }
.mogu-feedback-header { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-weight: 700; color: var(--primary); }
.mogu-feedback-item { background: #fff; padding: 8px 12px; border-radius: var(--radius-sm); margin-bottom: 6px; font-size: .9rem; }

/* 戦略カード */
.strategy-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.strategy-card { background: var(--bg); border-radius: var(--radius-sm); padding: 1rem 1.2rem; position: relative; overflow: hidden; border-left: 4px solid var(--text-muted); }
.strategy-card.profit { border-left-color: #4CAF50; }
.strategy-card.near { border-left-color: #FF9800; }
.strategy-card.loss { border-left-color: #ef5350; }
.strategy-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .6rem; }
.strategy-card-name { font-weight: 700; font-size: .95rem; color: var(--text); }
.strategy-card-badge { font-size: .7rem; padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.strategy-card-badge.win { background: #e8f5e9; color: #2e7d32; }
.strategy-card-badge.place { background: #e3f2fd; color: #1565c0; }
.strategy-card-badge.wide { background: #fff3e0; color: #e65100; }
.strategy-card-badge.quinella { background: #fce4ec; color: #c62828; }
.strategy-card-badge.trio { background: #f3e5f5; color: #6a1b9a; }
.strategy-card-badge.trifecta { background: #efebe9; color: #4e342e; }
.strategy-card-stats { display: flex; gap: 1rem; flex-wrap: wrap; }
.strategy-card-stat { flex: 1; min-width: 60px; }
.strategy-card-stat-label { font-size: .7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.strategy-card-stat-value { font-size: 1.1rem; font-weight: 700; }
.strategy-card-stat-value.roi-green { color: #2e7d32; }
.strategy-card-stat-value.roi-orange { color: #e65100; }
.strategy-card-stat-value.roi-red { color: #c62828; }
.strategy-card-bar { height: 4px; background: #e0e0e0; border-radius: 2px; margin-top: .6rem; overflow: hidden; }
.strategy-card-bar-fill { height: 100%; border-radius: 2px; transition: width .6s ease; }
.strategy-card-bar-fill.green { background: linear-gradient(90deg, #66bb6a, #43a047); }
.strategy-card-bar-fill.orange { background: linear-gradient(90deg, #ffa726, #fb8c00); }
.strategy-card-bar-fill.red { background: linear-gradient(90deg, #ef5350, #e53935); }

/* サマリーカード改善 */
.stat-card .stat-sub { font-size: .75rem; color: var(--text-muted); margin-top: 2px; }

/* ==================== Backtest ==================== */
.page-desc { color: var(--text-muted); margin-bottom: 2rem; text-align: center; }
.bt-form { background: var(--bg-card); border-radius: var(--radius); padding: 2rem; box-shadow: var(--shadow); margin-bottom: 2rem; }
.bt-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.5rem; }
.bt-form-group label { display: block; font-weight: 600; margin-bottom: 4px; color: var(--text); font-size: .9rem; }
.bt-input { width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: .9rem; }
.bt-subtitle { font-size: 1rem; font-weight: 700; color: var(--primary); margin: 1.5rem 0 1rem; }
.bt-sliders { display: grid; gap: 12px; margin-bottom: 1.5rem; }
.bt-slider-group label { font-size: .9rem; font-weight: 600; display: block; margin-bottom: 4px; }
.bt-slider { width: 100%; -webkit-appearance: none; height: 6px; border-radius: 3px; background: var(--border); outline: none; }
.bt-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--primary); cursor: pointer; }
.bt-result-title { font-size: 1.2rem; font-weight: 700; color: var(--primary); margin: 2rem 0 1rem; }
.bt-chart-area { background: var(--bg-card); border-radius: var(--radius); padding: 1.5rem; margin: 1rem 0; box-shadow: var(--shadow); }
.bt-monthly-area { margin: 1rem 0; }
.bt-monthly-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.bt-monthly-label { width: 70px; font-size: .8rem; font-weight: 600; }
.bt-monthly-fill { height: 24px; border-radius: 4px; display: flex; align-items: center; padding: 0 8px; font-size: .75rem; color: #fff; font-weight: 600; min-width: 40px; }
.bt-history-item { background: var(--bg-card); border-radius: var(--radius-sm); padding: 12px 16px; margin-bottom: 8px; border: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; font-size: .9rem; }
@media (max-width: 600px) { .bt-form-grid { grid-template-columns: 1fr; } }

/* ==================== Membership ==================== */
.ms-status-box { background: var(--bg-card); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); margin-bottom: 2rem; }
.ms-status-title { font-size: 1.1rem; font-weight: 700; color: var(--primary); margin-bottom: 1rem; }
.ms-status-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; }
.ms-status-item { text-align: center; }
.ms-status-label { font-size: .8rem; color: var(--text-muted); margin-bottom: 4px; }
.ms-status-value { font-size: 1.2rem; font-weight: 700; color: var(--primary); }
.ms-status-value.active { color: var(--success); }
.ms-status-value.trial { color: var(--rank-s); }
.ms-status-value.expired { color: var(--danger); }
.ms-status-actions { display: flex; gap: 8px; margin-top: 1rem; flex-wrap: wrap; }
.ms-plan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 2rem; }
.ms-plan-card { background: var(--bg-card); border: 2px solid var(--border); border-radius: var(--radius); padding: 1.5rem; text-align: center; cursor: pointer; transition: border-color var(--transition), box-shadow var(--transition); position: relative; }
.ms-plan-card:hover, .ms-plan-card.selected { box-shadow: var(--shadow-lg); }
.ms-plan-monthly.selected { border-color: var(--primary); }
.ms-plan-yearly.selected { border-color: var(--success); }
.ms-plan-badge { position: absolute; top: -10px; right: 12px; background: var(--success); color: #fff; padding: 2px 10px; border-radius: 4px; font-size: .75rem; font-weight: 600; }
.ms-plan-price { font-size: 2rem; font-weight: bold; margin: .5rem 0; }
.ms-plan-unit { font-size: .9rem; color: var(--text-muted); }
.ms-plan-note { color: var(--text-muted); font-size: .85rem; }
.ms-plan-features { list-style: none; padding: 0; margin: 1rem 0 0; text-align: left; }
.ms-plan-features li { padding: 4px 0; font-size: .85rem; color: #444; }
.ms-plan-features li::before { content: "\2713  "; color: var(--success); font-weight: bold; }
.ms-trial-box { background: linear-gradient(135deg, #e8eaf6, #e3f2fd); border-radius: var(--radius); padding: 1.5rem; text-align: center; margin-bottom: 1.5rem; }
.ms-campaign-box { background: linear-gradient(135deg, #fff3e0, #fce4ec); border-radius: var(--radius); padding: 1rem; text-align: center; display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; color: var(--rank-s); }
@media (max-width: 600px) { .ms-plan-grid { grid-template-columns: 1fr; } }

/* ==================== Global Notifications ==================== */
.global-notifications { max-width: 900px; margin: 0 auto; padding: 0 1rem; }
.global-notifications:empty { display: none; padding: 0; }

/* ==================== Common Page ==================== */
.page-title { font-size: clamp(1.3rem, 3vw, 1.8rem); font-weight: 800; color: var(--primary); text-align: center; margin-bottom: 1.5rem; }
.loading-text { text-align: center; color: var(--text-muted); padding: 2rem; }
.login-prompt { text-align: center; padding: 2rem; }
.btn-sm { padding: 6px 12px; font-size: .85rem; }

/* ==================== Account Management ==================== */
.dash-account-section { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid #e0e0e0; }
.dash-account-actions { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; }
.btn-danger { background: #c62828; color: #fff; border: none; padding: 10px 20px; border-radius: 8px; cursor: pointer; font-size: .9rem; }
.btn-danger:hover { background: #b71c1c; }

.delete-confirm-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.delete-confirm-dialog { background: #fff; border-radius: 12px; padding: 2rem; max-width: 450px; width: 90%; box-shadow: 0 8px 30px rgba(0,0,0,0.3); }
.delete-confirm-dialog h3 { margin: 0 0 1rem; color: #c62828; }
.delete-confirm-dialog ul { margin: .5rem 0 1rem; padding-left: 1.5rem; }
.delete-confirm-dialog li { margin: .3rem 0; font-size: .9rem; }
.delete-confirm-actions { display: flex; gap: 1rem; justify-content: flex-end; margin-top: 1.5rem; }

/* ==================== Trial/Campaign Notifications ==================== */
.trial-notification { background: linear-gradient(135deg, #fff3e0, #ffe0b2); border: 1px solid #ff9800; border-radius: 8px; padding: 12px 16px; margin-bottom: 1rem; display: flex; align-items: center; gap: 10px; }
.trial-notification.urgent { background: linear-gradient(135deg, #ffebee, #ffcdd2); border-color: #e53935; }
.trial-notification .notif-icon { font-size: 1.3rem; }
.trial-notification .notif-text { flex: 1; font-size: .9rem; }
.trial-notification .notif-action { font-size: .85rem; }
.campaign-end-banner { background: linear-gradient(135deg, #e8eaf6, #c5cae9); border: 1px solid #5c6bc0; border-radius: 8px; padding: 12px 16px; margin-bottom: 1rem; text-align: center; }
.campaign-end-banner a { color: var(--primary); font-weight: 700; }

/* ==================== ML Comparison ==================== */
.ml-compare-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-top: 1rem; }
.ml-compare-card { background: var(--surface); border-radius: 8px; padding: 1rem; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.ml-compare-label { font-size: .8rem; color: var(--text-muted); margin-bottom: .3rem; }
.ml-compare-value { font-size: 1.2rem; font-weight: 700; }
.ml-not-active { text-align: center; padding: 2rem; color: var(--text-muted); }

/* ==================== Score Table (PC) ==================== */
.score-table { border-collapse: collapse; width: 100%; }
.score-table th { font-size: .75rem; color: var(--text-muted); font-weight: 600; padding: 8px 4px; border-bottom: 2px solid var(--border); white-space: nowrap; }
.score-table td { padding: 10px 4px; border-bottom: 1px solid #f0f0f0; text-align: center; vertical-align: middle; }
.score-table tbody tr:hover { background: #f8f9ff; }
.horse-name-cell { text-align: left !important; font-weight: 600; }
.prediction-marks { display: flex; gap: 4px; }
.mark-btn { width: 32px; height: 32px; border-radius: 50%; border: 2px solid #ccc; background: #fff; cursor: pointer; font-size: .9rem; display: flex; align-items: center; justify-content: center; transition: var(--transition); }
.mark-btn:hover, .mark-btn.active { transform: scale(1.1); }
.mark-btn.selected { transform: scale(1.1); }
.mark-honmei { border-color: #c62828; color: #c62828; }
.mark-honmei.active, .mark-honmei.selected { background: #c62828; color: #fff; }
.mark-taikou { border-color: #1565c0; color: #1565c0; }
.mark-taikou.active, .mark-taikou.selected { background: #1565c0; color: #fff; }
.mark-tanren { border-color: #2e7d32; color: #2e7d32; }
.mark-tanren.active, .mark-tanren.selected { background: #2e7d32; color: #fff; }
.mark-hazushi { border-color: #757575; color: #757575; }
.mark-hazushi.active, .mark-hazushi.selected { background: #757575; color: #fff; }
.score-cards-mobile { display: none; }

/* ==================== Score Cards (Mobile) ==================== */
.score-card { background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; margin-bottom: 10px; }
.score-card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.score-card-number { font-weight: 700; font-size: 1rem; color: var(--primary); min-width: 24px; }
.score-card-name { font-weight: 700; font-size: .95rem; flex: 1; }
.score-card-stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.score-card-stat { display: flex; flex-direction: column; align-items: center; min-width: 48px; }
.score-card-stat-label { font-size: .7rem; color: var(--text-muted); }
.score-card-stat-value { font-size: .95rem; font-weight: 700; }
.card-ev { background: #ffebee; color: var(--danger); font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 10px; align-self: center; }
.score-card-footer { display: flex; align-items: center; justify-content: space-between; }
.score-card-marks { display: flex; gap: 8px; justify-content: flex-start; }
.score-card-marks .mark-btn { width: 36px; height: 36px; font-size: 1rem; }
.score-card-toggle { background: none; border: none; color: var(--primary); font-size: .75rem; cursor: pointer; padding: 4px 8px; white-space: nowrap; }
.score-card-detail { max-height: 0; overflow: hidden; transition: max-height 0.25s ease; border-top: 1px solid transparent; }
.score-card-detail .score-card-stats { margin-top: 10px; margin-bottom: 4px; }
[aria-expanded="true"] + .score-card-detail { border-top-color: #e0e0e0; }
.card-ev-value { color: var(--danger); font-weight: 800; }
.card-ev-tag { display: inline-block; background: #ffebee; color: var(--danger); font-size: .7rem; font-weight: 700; padding: 2px 8px; border-radius: 10px; margin-top: 2px; margin-bottom: 4px; }

@media (max-width: 600px) {
  .score-table-desktop { display: none; }
  .score-cards-mobile { display: block; }
}

/* ==================== 320px Minimum Width (Req 12.4) ==================== */
@media (max-width: 380px) {
  .site-header .header-inner { padding: 0 8px; }
  .logo-text { font-size: .9rem; }
  .section-inner, .main-content { padding-left: 8px; padding-right: 8px; }
  .page-title { font-size: 1.1rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: .5rem; }
  .stat-card { padding: 10px 6px; }
  .stat-value { font-size: 1.1rem; }
  .stat-label { font-size: .7rem; }
  .profile-grid { grid-template-columns: 1fr 1fr; gap: .5rem; }
  .profile-card { padding: 8px; }
  .score-card { padding: 10px 10px; }
  .score-card-name { font-size: .88rem; }
  .score-card-marks .mark-btn { width: 32px; height: 32px; font-size: .9rem; }
  .score-card-marks { gap: 6px; }
  .score-card-toggle { font-size: .7rem; }
  .rank-badge { width: 28px; height: 28px; font-size: .8rem; }
  .rank-reliability-row { padding: 10px 12px; gap: 8px; }
  .rank-reliability-value { font-size: .95rem; min-width: 50px; }
  .rank-reliability-label { font-size: .8rem; }
  .top-pick-card { padding: 10px 12px; gap: 10px; }
  .top-pick-label { font-size: .85rem; }
  .highlight-row { padding: 10px 12px; gap: 8px; }
  .highlight-payout { font-size: .9rem; min-width: 60px; }
  .ev-card { padding: 8px; font-size: .85rem; }
  .bt-form-grid { grid-template-columns: 1fr; }
  .bt-slider-group label { font-size: .85rem; }
  .ms-plan-grid { grid-template-columns: 1fr; }
  .ms-plan-card { padding: 1rem; }
  .ms-plan-price { font-size: 1.3rem; }
  .ml-compare-grid { grid-template-columns: 1fr 1fr; gap: .5rem; }
  .ml-compare-card { padding: .7rem; }
  .dash-account-actions { flex-direction: column; }
  .delete-confirm-dialog { padding: 1.2rem; }
  .delete-confirm-actions { flex-direction: column; }
  .odds-chart-area svg { min-width: 280px; }
  .trial-notification { flex-direction: column; text-align: center; gap: 6px; }
  .global-notifications { padding: 0 8px; }
  .footer-inner { padding: 16px 8px; }
  .hero { padding: 32px 8px; }
  .hero-title { font-size: 1.3rem; }
  .hero-subtitle { font-size: .85rem; }
}

/* ==================== Section Wrappers ==================== */
.dashboard-section,
.races-section,
.race-detail-section,
.backtest-section,
.membership-section { padding: 24px 0; min-height: 60vh; }

/* ==================== Auth Pages (Login / Register) ==================== */
.auth-section {
  display: flex; align-items: center; justify-content: center;
  min-height: 70vh; padding: 24px 16px;
}
.auth-card {
  background: var(--bg-card); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 32px 28px;
  width: 100%; max-width: 420px;
}
.auth-card h1 { text-align: center; margin-bottom: 24px; font-size: 1.4rem; color: var(--primary); }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: .85rem; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-group input[type="email"],
.form-group input[type="password"] {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: .95rem;
  transition: var(--transition);
}
.form-group input:focus { outline: none; border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(26,35,126,0.1); }
.form-group input[type="checkbox"] { width: auto; margin-right: 6px; }
.btn-block { display: block; width: 100%; padding: 12px; font-size: 1rem; margin-top: 8px; }
.error-msg { color: var(--danger); font-size: .85rem; margin-top: 12px; text-align: center; }
.auth-link { text-align: center; font-size: .85rem; color: var(--text-muted); margin-top: 16px; }
.auth-link a { color: var(--primary); font-weight: 600; text-decoration: none; }
.auth-link a:hover { text-decoration: underline; }

/* ==================== Admin ==================== */
.admin-card { background: var(--surface); border-radius: 12px; padding: 1.5rem; margin-bottom: 1.5rem; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.admin-card h2 { font-size: 1.1rem; margin: 0 0 1rem; color: var(--primary); border-bottom: 2px solid var(--primary); padding-bottom: .5rem; }
.admin-row { padding: 1rem 0; border-bottom: 1px solid var(--border); }
.admin-row:last-child { border-bottom: none; }
.admin-row h3 { font-size: .95rem; margin: 0 0 .3rem; }
.admin-row p { font-size: .82rem; color: var(--text-muted); margin: 0 0 .8rem; }
.admin-form { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.admin-input { padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: .9rem; }
select.admin-input { min-width: 200px; }
.admin-result { margin-top: .8rem; }
.result-ok { background: #f0fdf4; border: 1px solid #86efac; border-radius: 8px; padding: 1rem; font-size: .85rem; overflow-x: auto; }
.result-ok pre { margin: 0; white-space: pre-wrap; word-break: break-word; }
.result-error { background: #fef2f2; border: 1px solid #fca5a5; border-radius: 8px; padding: 1rem; font-size: .85rem; color: var(--danger); }
.result-loading { padding: .8rem; color: var(--text-muted); font-size: .85rem; }
.admin-table { width: 100%; border-collapse: collapse; margin-top: .5rem; font-size: .82rem; }
.admin-table th { background: var(--bg-light); padding: 6px 8px; text-align: left; font-weight: 600; border-bottom: 2px solid var(--border); }
.admin-table td { padding: 6px 8px; border-bottom: 1px solid #f0f0f0; }
.btn-secondary { background: var(--bg-light); color: var(--text); border: 1px solid var(--border); padding: 8px 16px; border-radius: 6px; cursor: pointer; font-size: .85rem; }
.btn-secondary:hover { background: #e2e8f0; }

/* ==================== User Dashboard - Rank Reliability ==================== */
.rank-reliability-grid { display: flex; flex-direction: column; gap: 10px; }
.rank-reliability-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg); border-radius: var(--radius-sm); padding: 12px 16px;
  transition: var(--transition);
}
.rank-reliability-row:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.rank-badge {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 1rem; flex-shrink: 0;
}
.rank-reliability-info { flex: 1; min-width: 0; }
.rank-reliability-label {
  font-size: .85rem; font-weight: 600; color: var(--text);
  display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px;
}
.rank-reliability-sub { font-size: .75rem; color: var(--text-muted); font-weight: 400; }
.rank-reliability-bar-wrap {
  height: 8px; background: #e8e8e8; border-radius: 4px; overflow: hidden;
}
.rank-reliability-bar {
  height: 100%; border-radius: 4px; transition: width 0.6s ease;
}
.rank-reliability-value {
  font-size: 1.1rem; font-weight: 700; color: var(--text); text-align: right; min-width: 60px;
}
.rank-reliability-value-sub { display: block; font-size: .7rem; color: var(--text-muted); font-weight: 400; }

/* ==================== User Dashboard - Top Picks ==================== */
.top-picks-grid { display: flex; flex-direction: column; gap: 10px; }
.top-pick-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--bg); border-radius: var(--radius-sm); padding: 14px 16px;
  border-left: 4px solid var(--border); transition: var(--transition);
}
.top-pick-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.top-pick-card.gold { border-left-color: #f9a825; background: linear-gradient(135deg, #fffde7, var(--bg)); }
.top-pick-card.silver { border-left-color: #90a4ae; background: linear-gradient(135deg, #eceff1, var(--bg)); }
.top-pick-card.bronze { border-left-color: #8d6e63; background: linear-gradient(135deg, #efebe9, var(--bg)); }
.top-pick-rank {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .9rem; flex-shrink: 0;
}
.top-pick-card.gold .top-pick-rank { background: #f9a825; color: #4e342e; }
.top-pick-card.silver .top-pick-rank { background: #90a4ae; }
.top-pick-card.bronze .top-pick-rank { background: #8d6e63; }
.top-pick-info { flex: 1; }
.top-pick-label { font-size: .95rem; font-weight: 600; color: var(--text); }
.top-pick-stats { font-size: .8rem; color: var(--text-muted); margin-top: 2px; }

/* ==================== User Dashboard - Hit Highlights ==================== */
.highlights-list { display: flex; flex-direction: column; gap: 8px; }
.highlight-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg); border-radius: var(--radius-sm); padding: 12px 16px;
  transition: var(--transition);
}
.highlight-row:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.highlight-rank-badge {
  width: 32px; height: 32px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: .85rem; flex-shrink: 0;
}
.highlight-rank-badge.rank-S { background: #1565c0; }
.highlight-rank-badge.rank-A { background: #2e7d32; }
.highlight-rank-badge.rank-B { background: #e65100; }
.highlight-rank-badge.rank-C { background: #9e9e9e; }
.highlight-rank-badge.rank-D { background: #bdbdbd; }
.highlight-info { flex: 1; min-width: 0; }
.highlight-horse { font-size: .9rem; font-weight: 600; color: var(--text); }
.highlight-detail { font-size: .75rem; color: var(--text-muted); margin-top: 2px; }
.highlight-payout {
  font-size: 1rem; font-weight: 700; color: var(--accent);
  white-space: nowrap; min-width: 70px; text-align: right;
}
