/* # style.css修正: 旧デザイン（管理画面用）のコードを削除し、現在の共通スタイルへ一本化しました */

/* バックテスト */
.backtest-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.bt-item {
  background: white;
  padding: 14px 12px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.bt-item:last-child {
  border-right: none;
}

.bt-label {
  font-size: var(--fs-xs);
  color: var(--text-light);
  font-weight: 700;
  margin-bottom: 4px;
}

.bt-value {
  font-size: var(--fs-xl);
  font-weight: 900;
}

.bt-value.green {
  color: var(--green);
}

.bt-value.red {
  color: var(--red);
}

.bt-sub {
  font-size: 10px;
  color: var(--text-light);
  margin-top: 2px;
}

/* 設定 */
.settings-section {
  background: white;
  border-bottom: 1px solid var(--border);
}

.settings-header {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  font-size: var(--fs-sm);
  font-weight: 900;
}

.settings-row {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  gap: 12px;
}

.settings-label {
  width: 120px;
  font-size: var(--fs-xs);
  font-weight: 700;
  flex-shrink: 0;
}

.settings-input,
.settings-select {
  flex: 1;
  max-width: 320px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: var(--fs-sm);
  font-family: 'Noto Sans JP', sans-serif;
  outline: none;
  background: white;
}

.settings-input:focus,
.settings-select:focus {
  border-color: var(--green);
}

.save-btn {
  margin: 14px 16px;
  padding: 9px 28px;
  background: var(--green);
  color: white;
  border: none;
  border-radius: 2px;
  font-size: var(--fs-sm);
  font-weight: 900;
  cursor: pointer;
  font-family: 'Noto Sans JP', sans-serif;
}

/* WIN5バッジ & フィルタボタン共通設定 */
.win5-badge {
  display: inline-flex;
  align-items: center;
  font-weight: 900;
  font-style: italic;
  line-height: 0.9;
  vertical-align: middle;
  user-select: none;
}

.win5-badge .label-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-right: 0;
  z-index: 2;
}

.win5-badge .win-text {
  font-size: 49px;
  color: #008844;
  /* 変数をやめ、より濃く力強いJRAグリーンを直接指定 */
  letter-spacing: -2px;
}

.win5-badge .horse-row {
  font-size: 22px;
  font-style: normal;
  margin-top: 0;
  letter-spacing: -8px;
}

.win5-badge .num {
  font-size: 100px;
  color: var(--blue);
  letter-spacing: -6px;
  margin-left: -12px;
  z-index: 1;
}

/* 履歴やリストで使用する小サイズ版 */
.win5-badge.small .win-text {
  font-size: 20px;
  letter-spacing: -1px;
}

.win5-badge.small .horse-row {
  font-size: 9px;
  margin-top: 0;
  letter-spacing: -3px;
}

.win5-badge.small .num {
  font-size: 42px;
  margin-left: -5px;
}

/* 開催場・WIN5 フィルタボタン */
.filter-group {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 16px 0;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 6px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--white);
  font-size: var(--fs-xs);
  cursor: pointer;
  font-weight: 700;
  transition: all 0.2s;
  color: var(--text-mid);
}

.filter-btn.active {
  background: var(--green);
  color: var(--white);
  border-color: var(--green);
}

/* セクションバー */
.section-bar {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  border-top: 1px solid var(--border);
  padding: 7px 16px;
  font-size: var(--fs-xs);
  font-weight: 900;
  color: var(--text-mid);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-bar a {
  font-size: var(--fs-xs);
  color: var(--green);
  font-weight: 700;
  text-decoration: none;
}

/* ボトムナビ */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: var(--white);
  border-top: 1px solid var(--border);
  z-index: 200;
}

.bn-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0;
  font-size: 9px;
  font-weight: 700;
  color: var(--text-light);
  border: none;
  background: none;
  cursor: pointer;
  font-family: 'Noto Sans JP', sans-serif;
  text-decoration: none;
}

.bn-item.active {
  color: var(--green);
}

.bn-icon {
  font-size: 20px;
  line-height: 1;
}

/* モーダル */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 500;
  align-items: center;
  justify-content: center;
}

.modal-overlay.show {
  display: flex;
}

.modal {
  background: white;
  padding: 24px;
  border-radius: 2px;
  width: 90%;
  max-width: 360px;
  text-align: center;
}

.modal-icon {
  font-size: 36px;
  margin-bottom: 12px;
}

.modal-title {
  font-size: var(--fs-lg);
  font-weight: 900;
  margin-bottom: 8px;
}

.modal-desc {
  font-size: var(--fs-xs);
  color: var(--text-mid);
  margin-bottom: 20px;
  line-height: 1.6;
}

.modal-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.modal-cancel {
  padding: 9px 24px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: var(--fs-sm);
  font-weight: 700;
  cursor: pointer;
  font-family: 'Noto Sans JP', sans-serif;
}

.modal-logout {
  padding: 9px 24px;
  background: var(--green);
  color: white;
  border: none;
  border-radius: 2px;
  font-size: var(--fs-sm);
  font-weight: 900;
  cursor: pointer;
  font-family: 'Noto Sans JP', sans-serif;
}

/* レスポンシブ */
@media(max-width:768px) {
  .sidebar {
    display: none;
  }

  .main {
    margin-left: 0;
  }

  .bottom-nav {
    display: flex;
  }

  .content {
    padding: 0 0 56px;
  }

  .topbar {
    padding: 0 10px;
  }

  .topbar-title {
    font-size: var(--fs-sm);
  }

  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .stat-card {
    padding: 10px;
  }

  .stat-value {
    font-size: var(--fs-lg);
  }

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

  .card {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .welcome-banner {
    flex-direction: column;
    padding: 12px;
  }

  .welcome-text h2 {
    font-size: var(--fs-md);
  }

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

  .settings-row {
    flex-wrap: wrap;
  }

  .settings-label {
    width: 100%;
  }

  /* # style.cssのCSS追記: フロントエンド共通ヘッダー・ボトムナビの統合 */
  .settings-input,
  .settings-select {
    max-width: 100%;
  }
}

/* # style.cssのCSS追記: ベース設定（カラー変数・フォント）の共通化 */
/* --- フロントエンド共通スタイル --- */
:root {
  --green: #1a7a3c;
  --green-light: #e8f5ee;
  --green-mid: #4caf70;
  --gold: #b8860b;
  --gold-light: #fdf8e1;
  --red: #c0392b;
  --red-light: #fdf0f0;
  --gray-bg: #f5f5f5;
  --gray-line: #e0e0e0;
  --gray-mid: #999;
  --white: #fff;
  --text: #111;
  --text-mid: #555;
}

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

body {
  font-family: 'Noto Sans JP', sans-serif;
  background: var(--gray-bg);
  color: var(--text);
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
}

.hdr {
  background: var(--green);
  color: white;
  height: 50px;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
}

.hdr-logo {
  font-size: 20px;
  font-weight: 900;
  color: white;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.hdr-logo-icon {
  width: 30px;
  height: 30px;
  background: white;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
}

.hdr-logo span {
  color: #a8f0c0;
}

.hdr-nav {
  display: flex;
  gap: 0;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.hdr-nav a {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-size: 15px;
  font-weight: 700;
  padding: 0 16px;
  height: 50px;
  display: flex;
  align-items: center;
  white-space: nowrap;
  /* ★タブレット等での改行防止 */
}

.hdr-nav a:hover {
  color: white;
  border-bottom: 3px solid white;
}

.hdr-nav a.active {
  color: white;
  border-bottom: 3px solid #e06060;
}

/* # style.cssのCSS修正: 削除してしまったボトムナビの基本構造（固定・横並び設定）を復元 */
.bnav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: var(--green);
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}

.bn-row {
  display: flex;
}

.bn-item {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 0;
  font-size: 13px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  border: none;
  background: none;
  cursor: pointer;
  font-family: 'Noto Sans JP', sans-serif;
}

/* # style.cssのCSS追記: フッター・免責・レスポンシブ共通設定 */
.bn-item.active {
  color: white;
}

.ftr {
  display: none;
  background: #222;
  color: #aaa;
  padding: 32px 16px 24px;
  margin-top: 40px;
}

.ftr-inner {
  max-width: 960px;
  margin: 0 auto;
}

.ftr-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin-bottom: 20px;
}

.ftr-links a {
  color: #aaa;
  text-decoration: none;
  font-size: 13px;
}

.ftr-links a:hover {
  color: white;
}

.ftr-copy {
  font-size: 12px;
  color: #666;
  border-top: 1px solid #444;
  padding-top: 16px;
}

.mobile-disclaimer {
  display: none;
  text-align: center;
  padding: 8px;
  font-size: 11px;
  background: var(--gray-bg);
}

.mobile-disclaimer a {
  color: #999;
  text-decoration: underline;
}

/* --- 共通レスポンシブ設定 --- */
@media(max-width:768px) {
  .mobile-disclaimer {
    display: block;
  }

  .hdr-nav {
    display: none;
  }

  .bnav {
    display: block;
  }

  body {
    padding-bottom: calc(56px + env(safe-area-inset-bottom));
  }
}

/* # style.css修正: PC表示時はスマホ用ナビと免責事項を完全に隠す */
@media(min-width:769px) {
  .ftr {
    display: block;
  }

  /* 強力に非表示にして、PC画面での2重表示を確実に防ぎます */
  .bnav,
  .mobile-disclaimer,
  .hdr-nav.mobile-only {
    display: none !important;
  }
}