/* レース詳細ページ専用スタイル */

body.with-app-fixed-title {
  background-color: transparent;
}

.race-header {
  padding: 12px 14px;
  margin-bottom: 10px;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.detail-menu {
  margin-bottom: 14px;
  padding: 10px 12px;
}

.app-fixed-header-race {
  background: transparent;
  border-bottom: 0;
}

.app-fixed-header-race .app-content-wrap {
  padding: 0;
}

.detail-nav {
  border-bottom: 0;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.detail-nav::-webkit-scrollbar {
  display: none;
}

.detail-nav .nav-link {
  border: 1px solid #dee2e6;
  border-radius: var(--app-radius);
  color: #495057;
  background: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.2;
  padding: 0.5rem 1rem;
  min-width: 7.5rem;
  white-space: nowrap;
  flex-shrink: 0;
  text-align: center;
  justify-content: center;
}

.detail-nav .nav-link.active {
  color: #fff;
  background: #198754;
  border-color: #198754;
}

.section-card {
  margin-bottom: 14px;
  padding: 16px;
}

/* h4 と同じ見た目で h2 として機能させるSEO用スタイル */
.section-h2 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--app-text);
}

.recommend-rank-label {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--app-accent);
  text-transform: uppercase;
}

.recommend-card {
  border: 1px solid #d1e7dd;
  background: linear-gradient(180deg, #f6fffa 0%, #ffffff 100%);
  border-radius: var(--app-radius);
  padding: 12px;
}

.recommend-card-second {
  border-color: #d4e6f1;
  background: linear-gradient(180deg, #f5faff 0%, #ffffff 100%);
}

.recommend-title {
  font-size: 1.08rem;
  font-weight: 700;
  color: #146c43;
}

.recommend-sub {
  font-size: 0.84rem;
  color: #5f6b75;
}

.hit-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #198754 0%, #20c060 100%);
  box-shadow: 0 2px 8px rgba(25, 135, 84, 0.45);
  letter-spacing: 0.03em;
}

.hit-recovery {
  font-size: 1.0rem;
  font-weight: 700;
  color: #0a5c36;
}

.recommend-badge {
  display: inline-block;
  min-width: 72px;
  text-align: center;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid #ced4da;
  background: #fff;
}

.recommend-badge.good {
  color: #146c43;
  border-color: #198754;
  background: #e9f8f0;
}

.recommend-badge.bad {
  color: #6c757d;
  background: #f8f9fa;
}

.recommend-rank-1 {
  background: #e9f8f0;
}

.recommend-rank-hit {
  background: linear-gradient(90deg, #d4f0e2 0%, #edfaf4 100%);
  box-shadow: inset 3px 0 0 #198754;
}

.recommend-rank-hit td {
  border-top-color: #b8e6cc !important;
  border-bottom-color: #b8e6cc !important;
}

.hit-row-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.68rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #198754, #20c060);
  border-radius: 999px;
  padding: 1px 7px;
  margin-left: 6px;
  letter-spacing: 0.03em;
  vertical-align: middle;
  box-shadow: 0 1px 4px rgba(25, 135, 84, 0.4);
  white-space: nowrap;
}


.table-responsive {
  overflow-x: auto;
  overflow-y: visible;
}

.table-results {
  table-layout: auto;
  width: max-content;
  min-width: 100%;
}

.table-results th {
  background: #ededed;
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: keep-all;
  writing-mode: horizontal-tb;
  text-orientation: mixed;
}

.table-results th,
.table-results td {
  text-align: center;
  vertical-align: middle;
  font-size: 0.88rem;
  padding: 0.4rem 0.3rem;
  line-height: 1.25;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: keep-all;
  writing-mode: horizontal-tb;
  text-orientation: mixed;
}

.stats-section {
  margin-top: 20px;
  padding: 12px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(520px, 1fr));
  gap: 16px;
  align-items: start;
}

.stats-card h5 {
  margin: 0 0 10px 0;
  font-size: 0.98rem;
  font-weight: 700;
  text-align: center;
}

.stats-table-wrap {
  overflow: hidden;
}

.stats-table {
  width: 100%;
  table-layout: fixed;
  margin-bottom: 0;
}

.stats-table .col-label {
  width: 20%;
}

.stats-table .col-metric {
  width: 10%;
}

.stats-table th {
  background: #f1f3f5;
  text-align: center;
  font-size: clamp(0.66rem, 0.78vw, 0.76rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  writing-mode: horizontal-tb;
  text-orientation: mixed;
  line-height: 1.2;
  padding: 0.3rem 0.16rem;
}

.stats-table td {
  text-align: center;
  font-size: clamp(0.68rem, 0.82vw, 0.78rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  writing-mode: horizontal-tb;
  text-orientation: mixed;
  line-height: 1.2;
  padding: 0.3rem 0.16rem;
}

.stats-table td.label {
  text-align: center;
  font-weight: 700;
  border-radius: 4px;
  max-width: none;
}

.weekday-sat {
  color: #007bff;
}
.weekday-sun {
  color: #dc3545;
}
.weekday-week {
  color: #6c757d;
}

@media (max-width: 992px) {
  .hide-lg {
    display: none;
  }

  .table-results td,
  .table-results th {
    font-size: 0.8rem;
    padding: 0.35rem;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .stats-table th,
  .stats-table td {
    font-size: 0.72rem;
    padding: 0.28rem 0.14rem;
  }

  .stats-table .col-label {
    width: 24%;
  }

  .stats-table .col-metric {
    width: 9.5%;
  }
}

@media (max-width: 768px) {
  .hide-md {
    display: none;
  }

  .stats-table th,
  .stats-table td {
    font-size: 0.72rem;
    padding: 0.28rem 0.18rem;
  }

  .stats-table .col-label {
    width: 26%;
  }

  .stats-table .col-metric {
    width: 9.25%;
  }
}

/* ファクター重要度バッジ */
.importance-rank {
  display: inline-block;
  min-width: 2.2em;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  text-align: center;
  background-color: #e2e8f0;
  color: #475569;
}
.importance-rank.rank-1 { background-color: #fde68a; color: #92400e; }
.importance-rank.rank-2 { background-color: #d1fae5; color: #065f46; }
.importance-rank.rank-3 { background-color: #dbeafe; color: #1e40af; }

/* ===== 関連レース ===== */
.related-races-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.related-race-card {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--app-panel-border);
  border-radius: var(--app-radius);
  background: var(--app-panel-bg);
  text-decoration: none;
  color: var(--app-text);
  font-size: 0.85rem;
  transition: border-color 0.15s, background 0.15s;
}

.related-race-card:hover {
  border-color: var(--app-accent);
  background: #f0faf5;
  color: var(--app-accent);
}

.related-race-grade {
  font-size: 0.7rem;
  padding: 1px 5px;
  flex-shrink: 0;
}

.related-race-name {
  font-weight: 600;
}

.related-race-date {
  font-size: 0.78rem;
  flex-shrink: 0;
}

