/* ============================================================
   TPC / NE-GRAFIXX Unified Light Theme
   - 重複定義を排除
   - 背景は単色で「境界線っぽい段差」を根絶
   - SP可読性UP（フォント/余白/タップ領域）
   - ✅ Bootstrapの変数・ボタン・リンク等の“漏れ”も補完
============================================================ */

/* ---------- Theme tokens ---------- */
:root{
  color-scheme: light;

  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #fbfcff;

  --text: #0f172a;
  --muted: #334155;
  --subtle: #475569;

  --border: rgba(15,23,42,.12);
  --border-strong: rgba(15,23,42,.18);

  --accent: #2563eb;
  --accent-soft: rgba(37,99,235,.10);

  --radius: 14px;
  --shadow: 0 10px 26px rgba(15,23,42,.10);

  --tap: 44px;

  /* ✅ Bootstrapの“色ズレ”を抑えるための補助 */
  --link: #1d4ed8;
  --link-hover: #1e40af;
}

/* ✅ Bootstrap変数側にも反映（これがないと一部だけ既定色が混ざる） */
:root{
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--text);
  --bs-border-color: var(--border);
  --bs-link-color: var(--link);
  --bs-link-hover-color: var(--link-hover);
  --bs-primary: var(--accent);
}

/* Bootstrapが勝手にダーク化してもライト固定 */
html[data-bs-theme="dark"]{ color-scheme: light !important; }
html[data-bs-theme="dark"] body{
  background: var(--bg) !important;
  color: var(--text) !important;
}

/* ---------- Base / Layout (sticky footer) ---------- */
html, body{ height: 100%; }

body{
  display:flex;
  flex-direction:column;
  line-height:1.65;
  letter-spacing:.2px;
  background: var(--bg);
  color: var(--text);
}

main{
  flex:1 0 auto;
  padding: 1.25rem 0 2.25rem;
}

.tpc-footer{ flex-shrink:0; }

/* コンテナ幅 */
.tpc-narrow-container{ max-width: 680px; }
.tpc-wide-container{ max-width: 1040px; }

/* Bootstrapの薄すぎる色を矯正 */
small, .text-muted{ color: var(--muted) !important; }
.text-secondary{ color: var(--subtle) !important; }

/* ✅ リンク（漏れがち） */
a{ color: var(--link); }
a:hover{ color: var(--link-hover); }

/* ---------- Navbar (ライト固定) ---------- */
.tpc-navbar{
  background: rgba(255,255,255,.94) !important;
  border-bottom: 1px solid var(--border) !important;
  backdrop-filter: blur(10px);
  box-shadow: 0 1px 3px rgba(15,23,42,.06);
}

.tpc-navbar .navbar-brand,
.tpc-navbar .navbar-brand *{
  color: var(--text) !important;
}

.tpc-brand{
  font-weight: 900;
  letter-spacing: .06em;
  font-size: 1.1rem;
}
.tpc-brand span{
  font-weight: 600;
  font-size: .82rem;
  color: var(--subtle);
  margin-left: .35rem;
}

.tpc-nav-link,
.tpc-navbar .nav-link{
  font-size: .95rem;
  font-weight: 700;
  color: rgba(11,18,32,.78) !important;
}
.tpc-nav-link:hover,
.tpc-navbar .nav-link:hover{
  color: var(--accent) !important;
  text-decoration: none;
}

/* toggler */
.tpc-navbar .navbar-toggler{
  min-width: var(--tap);
  min-height: var(--tap);
  border-color: rgba(15,23,42,.18) !important;
}
.tpc-navbar .navbar-toggler-icon{ filter: invert(0); }

/* 戻るボタンを安定化 */
.btn.btn-light{
  background: #fff !important;
  border: 1px solid var(--border-strong) !important;
  color: var(--text) !important;
}

/* ✅ primary/outline/secondary など“漏れやすいボタン系”を統一 */
.btn{
  min-height: var(--tap);
  border-radius: 12px;
  font-weight: 800;
}
.btn-primary{
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: #fff !important;
}
.btn-primary:hover{
  filter: brightness(.95);
}
.btn-outline-primary{
  border-color: rgba(37,99,235,.45) !important;
  color: var(--accent) !important;
}
.btn-outline-primary:hover{
  background: rgba(37,99,235,.10) !important;
}

.tpc-latest-btn {
  display: inline-flex;
  align-items: center;
  height: 44px;              /* input-group-sm の実寸 */
  padding: 0 0.75rem;
  line-height: 1;
}

.tpc-btn-muted{
  min-height: var(--tap);
  padding: 0 .9rem;
  border-radius: 12px;

  background: #fff; /* 透明だと目立たないのでまず白に */
  border: 1px solid var(--border-strong);
  color: var(--subtle);

  font-weight: 800;
  display: inline-flex;
  align-items: center;         /* 縦中央 */
  justify-content: center;     /* 横中央 */
  line-height: 1;              /* Bootstrap由来のズレを排除 */
}

.tpc-btn-muted:hover{
  background: rgba(2,6,23,.04);
  color: var(--text);
}

/* ---------- Common cards ---------- */
.card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card.shadow-sm{ box-shadow: var(--shadow) !important; }

/* ✅ card-header の“段差っぽさ”抑制（透過をやめて単色に寄せる） */
.card-header{
  background: var(--surface-soft);
  border-bottom: 1px solid rgba(148,163,184,.35);
}

/* ---------- Landing ---------- */
.tpc-heading{ color: var(--text); }

.tpc-hero-title{
  font-weight: 950;
  letter-spacing: .02em;
  font-size: 2.2rem;
  line-height: 1.15;
  color: var(--text);
}

.tpc-text-muted{
  color: var(--subtle);
  font-size: 1rem;
}

.tpc-hero-actions{
  max-width: 520px;
  margin: 0 auto 1.25rem;
}

.tpc-btn-outline{
  border: 1px solid var(--border-strong);
  background: #fff;
  color: rgba(15,23,42,.85);
  font-weight: 800;
}

.tpc-guide-link{
  font-size: .95rem;
  text-decoration: underline;
  text-underline-offset: .18em;
  color: var(--subtle);
}
.tpc-guide-link:hover{ color: var(--text); }

/* ---------- Footer ---------- */
.tpc-footer,
footer{
  background:#ffffff;
  border-top: 1px solid #e5e7eb;
  padding: 24px 16px;
}
.tpc-footer, .tpc-footer * , footer, footer *{
  opacity: 1 !important;
  color: var(--text);
}

.tpc-footer-title{
  font-weight: 800;
  font-size: .98rem;
}
.tpc-footer-text{
  color: #334155 !important;
  font-size: 14px;
  line-height: 1.6;
}
.tpc-footer-link,
footer a{
  color:#1d4ed8 !important;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: .18em;
}
.tpc-footer-link:hover,
footer a:hover{ color:#1e40af !important; }

/* ============================================================
   Best Laps / Top10
============================================================ */
.tpc-bestlaps-page{ max-width: 1040px; margin: 0 auto; }

.tpc-title{
  font-size: 1.45rem;
  font-weight: 950;
  letter-spacing: .02em;
  color: var(--text);
}
.tpc-sub{
  font-size: .9rem;
  color: var(--subtle);
}

/* ============================================================
   Podium（PC: card / SP: 2-column row）
============================================================ */

/* Podium Card base */
.podium-card{
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border-top-width: .25rem;
}
.gold   { border-top-color:#f5c542 !important; }
.silver { border-top-color:#c9d3de !important; }
.bronze { border-top-color:#c08a5b !important; }

/* Inner layout (PC default) */
.podium-body{
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  gap:.5rem;
}

.podium-head{
  display:flex;
  align-items:center;
  gap:.6rem;
}

.podium-medal{
  width:42px;
  height:42px;
  border-radius:12px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:1.2rem;
  border:1px solid var(--border);
  background: var(--accent-soft);
  flex-shrink:0;
}

.podium-meta{ min-width:0; }

.podium-name{
  font-weight: 950;
  font-size: 1.08rem;
  color: var(--text) !important;
}

.podium-sub{
  font-size: .92rem;
  color: var(--muted);
  display:flex;
  flex-wrap:wrap;
  gap:.35rem;
}

.podium-result{ padding-top:.25rem; }

.podium-time{
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.6rem;
  font-weight: 950;
  letter-spacing: .2px;
  line-height: 1.1;
  color: var(--text) !important;
}

.podium-diff{
  font-size: .92rem;
  color: var(--muted);
}

/* ============================================================
   Top10 list row
============================================================ */
.rank-row{
  padding: 14px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: #fff;
}
.rank-row + .rank-row{ margin-top: 10px; }

.rank-badge{
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size: 1rem;
  font-weight: 950;
  border: 1px solid var(--border);
  background: var(--accent-soft);
  color: var(--text);
}

.name{
  font-weight: 900;
  font-size: 1rem;
  color: var(--text);
}

.subline{
  font-size: .92rem;
  color: var(--muted);
}

.chip{
  display:inline-flex;
  align-items:center;
  border-radius:999px;
  border:1px solid var(--border-strong);
  padding: 4px 10px;
  font-size: .8rem;
  margin-left: .4rem;
  color: var(--muted) !important;
  background: rgba(2,6,23,.04);
  font-weight: 800;
  white-space: nowrap;
}

.time-main{
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.12rem;
  font-weight: 950;
  color: var(--text);
}
.time-sub{
  font-size: .9rem;
  color: var(--muted);
}

.bar{
  margin-top: .35rem;
  height: 7px;
  border-radius: 999px;
  background: rgba(148,163,184,.30);
  overflow: hidden;
}
/* ✅ “単色背景思想”に寄せて段差感を抑える（グラデ残したいならここだけ戻せばOK） */
.bar span{
  display:block;
  height:100%;
  border-radius:inherit;
  background: rgba(37,99,235,.80);
}

.empty{
  text-align:center;
  padding: 1rem;
  font-size: .95rem;
  color: var(--muted);
}

/* ============================================================
   Search Dashboard
============================================================ */
.tpc-page{
  max-width: 1040px;
  margin: 0 auto;
}

.tpc-header{
  border-bottom: 1px solid var(--border);
  padding-bottom: .75rem;
  margin-bottom: 1.1rem;
}

.tpc-filters-card .card-body{ padding: 1rem 1.1rem; }

.tpc-filters .form-label{
  font-size: .82rem;
  font-weight: 800;
  color: var(--subtle);
  margin-bottom: .25rem;
}

.input-group-text{
  background:#fff !important;
  border-color: var(--border-strong) !important;
  color: var(--text) !important;
  font-weight: 800;
}
.form-select,
.form-control{
  min-height: var(--tap);
  background:#fff !important;
  border: 1px solid var(--border-strong) !important;
  color: var(--text) !important;
}
.form-select.form-select-sm{ min-height: 40px; }

.form-select:focus,
.form-control:focus{
  border-color: rgba(37,99,235,.55) !important;
  box-shadow: 0 0 0 .2rem rgba(37,99,235,.18) !important;
}

/* Result card header */
.tpc-result-card .card-header{
  border-bottom: 1px solid rgba(148,163,184,.35);
  background: var(--surface-soft); /* ✅ 透過をやめて段差っぽさ抑制 */
  padding: .7rem .9rem;
}

.tpc-table-wrapper{
  border-radius: 12px;
  border: 1px solid rgba(148,163,184,.45);
  overflow: hidden;
}

.table{
  margin-bottom: 0;
  background: #fff;
}
.table thead th{
  font-size: .8rem;
  font-weight: 800;
  color: var(--subtle);
  white-space: nowrap;
}
.table tbody td{
  font-size: .9rem;
  color: var(--text);
  vertical-align: middle;
}
.table tbody tr:hover{ background-color: rgba(148,163,184,.10); }

/* ✅ breadcrumb / pagination / badge / alert（漏れがち） */
.breadcrumb{
  margin-bottom: .75rem;
}
.breadcrumb .breadcrumb-item a{
  color: var(--subtle);
  text-decoration: underline;
  text-underline-offset: .18em;
}
.breadcrumb .breadcrumb-item.active{
  color: var(--text);
  font-weight: 800;
}

.pagination .page-link{
  min-width: var(--tap);
  min-height: var(--tap);
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius: 12px;
  border-color: var(--border-strong);
  color: var(--text);
  background:#fff;
  font-weight: 800;
}
.pagination .page-link:hover{
  background: rgba(37,99,235,.08);
  border-color: rgba(37,99,235,.25);
}
.pagination .page-item.active .page-link{
  background: var(--accent);
  border-color: var(--accent);
  color:#fff;
}

.badge{
  border-radius: 999px;
  font-weight: 800;
}
.alert{
  border-radius: 12px;
  border-color: var(--border-strong);
}

@media (max-width: 991.98px) { /* lg未満 */
  .tpc-menu-btn {
    width: 40px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}


/* ============================================================
   ✅ SP 可読性UP（575.98px）
============================================================ */
@media (max-width: 575.98px){

  body{ font-size:16px; }

  main{
    padding-top:1rem;
    padding-bottom:1.75rem;
  }

  /* Landing */
  .tpc-hero-title{
    font-size:1.75rem;
    line-height:1.2;
  }
  .tpc-text-muted{
    font-size:1rem;
    line-height:1.7;
  }
  .btn-lg{
    min-height:48px;
    font-size:1.02rem;
    font-weight:900;
  }

  /* タイトル類 */
  .tpc-title{ font-size:1.25rem; }
  .tpc-sub{ font-size:.92rem; }

  /* ----------------------------
     Podium：SPは2カラム + バランス調整
  ---------------------------- */

  /* podium列は縦積み */
  #podium{
    gap: .45rem;
  }
  #podium > div[class*="col-"]{
    width:100% !important;
    max-width:100% !important;
  }

  /* 行っぽく（影なし） */
  .podium-card{
    box-shadow:none !important;
    border-radius:12px !important;
  }
  .podium-card .card-body{
    padding: .70rem .80rem !important;
  }

  /* 2カラム本体（左広め / 右固定幅） */
  .podium-body{
    flex-direction:row;
    align-items:center;
    justify-content:space-between;
    gap:.85rem;
  }

  .podium-head{
    flex: 1 1 auto;
    min-width: 0;
    align-items: center;
    margin-bottom: 0 !important;
  }

  .podium-medal{
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
  }

  .podium-name{
    font-size: 1.00rem;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .podium-sub{
    font-size: .78rem;
    line-height: 1.15;
    margin-top: .18rem;
    opacity: .9;
  }

  .podium-result{
    flex: 0 0 108px; /* 96〜120 で微調整 */
    text-align: right;
    padding-top: 0;
  }

  .podium-time{
    font-size: 1.45rem;
    line-height: 1.05;
    letter-spacing: 0;
    font-variant-numeric: tabular-nums;
  }

  .podium-diff{
    font-size: .78rem;
    line-height: 1.1;
    margin-top: .18rem;
    text-align: right;
  }

  /* ----------------------------
     Top10 row：情報を詰めすぎない
  ---------------------------- */
  .rank-row{ padding:12px; }
  .name{ font-size:1.02rem; }

  .subline{
    font-size:.95rem;
    display:flex;
    flex-wrap:wrap;
    gap:.35rem;
  }

  .chip{
    font-size:.82rem;
    padding:5px 10px;
    margin-top:.35rem;
    margin-left:0;
    white-space:nowrap;
  }

  .bar{ height:8px; }

  /* Search：テーブルは横スクロール */
  .table-responsive{ -webkit-overflow-scrolling:touch; }
  .table thead th{ font-size:.82rem; }
  .table tbody td{ font-size:.92rem; }

  /* ✅ pagination SP */
  .pagination .page-link{
    min-width: 40px;
    min-height: 40px;
    border-radius: 10px;
  }
}
