/* ===================================================================
   競艇データ — 콘텐츠 스타일
   (카드, 표, CSS 차트, 코스 도표, FAQ)

   차트는 전부 CSS 폭 계산이다. 외부 라이브러리를 쓰지 않는 이유는
   두 가지 — 광고 스크립트 외에 JS 를 늘리고 싶지 않고, 생성 시점에
   width 를 구워 두면 첫 렌더부터 그래프가 보이기 때문이다.
   =================================================================== */

/* === Card === */
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 2px rgba(16,35,46,.04), 0 4px 12px rgba(16,35,46,.03);
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 14px;
}

/* === Table === */
/*
  스크롤 가능한 표는 모바일에서 "더 있다"는 신호가 없으면 잘린 줄 모른다.
  배경 그라디언트 4장을 겹쳐 좌우 끝에 그림자를 만든다. 스크롤이 끝에
  닿으면 흰 그라디언트가 그림자를 덮어 자동으로 사라진다. JS 불필요.
*/
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 12px;
  background:
    linear-gradient(to right, #fff 30%, rgba(255,255,255,0)) left center,
    linear-gradient(to left,  #fff 30%, rgba(255,255,255,0)) right center,
    radial-gradient(farthest-side at 0 50%, rgba(0,0,0,.18), rgba(0,0,0,0)) left center,
    radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,.18), rgba(0,0,0,0)) right center;
  background-repeat: no-repeat;
  background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
  background-attachment: local, local, scroll, scroll;
}

/* 좌측 항목명은 스크롤해도 남아 있어야 어느 행인지 알 수 있다 */
.table-scroll .data-table th:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 480px;
}

table.data-table th,
table.data-table td {
  border: 1px solid var(--line);
  padding: 9px 10px;
  text-align: center;
}

table.data-table th {
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  white-space: nowrap;
}

table.data-table tbody tr:nth-child(even) { background: #fafbfc; }
table.data-table tbody tr:hover { background: var(--accent-bg); }

table.data-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* 표에서 가장 큰 값 */
.is-top {
  font-weight: 700;
  color: var(--accent-dark);
  background: var(--accent-bg);
}

/* === 艇番バッジ === */
/*
  실제 경정 출주표의 색(1白 2黒 3赤 4青 5黄 6緑)을 그대로 쓴다.
  이 색은 일본 팬에게 이미 학습된 신호라 임의 색으로 바꾸면 오히려 읽기 어렵다.
  다만 검정/흰색 바탕에서 글자가 묻히지 않도록 대비만 조정했다.
*/
.lane {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}

.lane-1 { background: #fff;    color: #222; border: 1px solid #bbb; }
.lane-2 { background: #222;    color: #fff; }
.lane-3 { background: #d93025; color: #fff; }
.lane-4 { background: #1a56c4; color: #fff; }
.lane-5 { background: #f5c518; color: #222; }
.lane-6 { background: #14874b; color: #fff; }

/* === CSS 막대 차트 === */
.bar-chart { display: flex; flex-direction: column; gap: 8px; }

.bar-row {
  display: grid;
  grid-template-columns: 96px 1fr 104px;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
}

.bar-row .bar-label {
  font-weight: 700;
  color: var(--ink);
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: 6px;
}

.bar-track {
  position: relative;
  height: 20px;
  background: #eceff1;
  border-radius: 4px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-dark), var(--accent));
  border-radius: 4px;
}

.bar-row .bar-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.bar-chart--wide .bar-row { grid-template-columns: 150px 1fr 104px; }

/* 코스별 색을 입힌 막대 */
.bar-fill.c1 { background: var(--c1); }
.bar-fill.c2 { background: var(--c2); }
.bar-fill.c3 { background: var(--c3); }
.bar-fill.c4 { background: var(--c4); }
.bar-fill.c5 { background: var(--c5); }
.bar-fill.c6 { background: var(--c6); }

/* 전국 평균 기준선 — 이 경기장이 평균보다 위인지 아래인지가 핵심 정보다 */
.bar-track.has-avg::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--avg, 0%);
  width: 2px;
  background: #d93025;
  opacity: .75;
  z-index: 1;
}

.avg-note {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.avg-note::before {
  content: "";
  width: 2px;
  height: 13px;
  background: #d93025;
  opacity: .75;
  flex-shrink: 0;
}

/* === 着順分布の積み上げ帯 === */
/*
  1착률만 보면 "2·3착にも来る"라는 감각이 빠진다. 6구간 띠로 보여주면
  같은 1착률이어도 안정형인지 극단형인지가 드러난다.
*/
.stack-row {
  display: grid;
  grid-template-columns: 96px 1fr;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 0.85rem;
}

.stack-bar {
  display: flex;
  height: 22px;
  border-radius: 4px;
  overflow: hidden;
}

.stack-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
}

/* 옅은 구간은 흰 글씨가 읽히지 않는다 */
.stack-seg.s5, .stack-seg.s6 { color: #23343d; }

.stack-seg.s1 { background: var(--c1); }
.stack-seg.s2 { background: var(--c2); }
.stack-seg.s3 { background: var(--c3); }
.stack-seg.s4 { background: var(--c4); }
.stack-seg.s5 { background: var(--c5); }
.stack-seg.s6 { background: var(--c6); }

.stack-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
  font-size: 0.76rem;
  color: var(--muted);
}

.stack-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.stack-legend i {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}

.stack-legend i.s1 { background: var(--c1); }
.stack-legend i.s2 { background: var(--c2); }
.stack-legend i.s3 { background: var(--c3); }
.stack-legend i.s4 { background: var(--c4); }
.stack-legend i.s5 { background: var(--c5); }
.stack-legend i.s6 { background: var(--c6); }

/* === 数値タイル === */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.stat-tile {
  background: var(--accent-bg);
  border: 1px solid var(--accent-light);
  border-radius: 10px;
  padding: 14px 12px;
  text-align: center;
}

.stat-tile .label {
  display: block;
  font-size: 0.76rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.stat-tile .value {
  display: block;
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}

.stat-tile .unit {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--muted);
  margin-left: 2px;
}

.stat-tile .sub {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 2px;
}

/* 전국 평균 대비 */
.plus  { color: #157347; }
.minus { color: #d93025; }
td.num.plus, td.num.minus { font-weight: 700; }

/* === 競艇場カード === */
.jyo-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.jyo-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0;
  text-decoration: none;
  color: var(--text);
  transition: background .15s, box-shadow .15s;
}

.jyo-card:hover {
  text-decoration: none;
  background: var(--accent-bg);
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

.jyo-card-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink);
  line-height: 1.4;
}

.jyo-card-meta {
  font-size: 0.72rem;
  color: var(--muted);
}

.jyo-card-rate {
  display: flex;
  align-items: baseline;
  gap: 5px;
  margin-top: 4px;
}

.jyo-card-rate .k { font-size: 0.7rem; color: var(--muted); }
.jyo-card-rate .v {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent-dark);
  font-variant-numeric: tabular-nums;
}

/* 랭킹 순번 */
.rank-no {
  display: inline-block;
  width: 20px;
  height: 20px;
  line-height: 20px;
  text-align: center;
  border-radius: 50%;
  background: var(--ink);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  margin-right: 6px;
  flex-shrink: 0;
}

/* === Callout === */
.callout {
  border-left: 4px solid var(--accent);
  background: var(--accent-bg);
  padding: 12px 16px;
  border-radius: 0 8px 8px 0;
  font-size: 0.88rem;
  margin: 16px 0;
}

.callout.warn {
  border-left-color: #e8a33d;
  background: #fdf6e9;
}

.callout strong { color: var(--ink); }

.hint {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.7;
}

/* === FAQ === */
.faq-item {
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
}

.faq-item:last-child { border-bottom: none; }

.faq-q {
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 6px;
}

.faq-q::before {
  content: "Q. ";
  color: var(--accent-dark);
}

.faq-a { font-size: 0.9rem; color: var(--text); }

.faq-a::before {
  content: "A. ";
  font-weight: 700;
  color: var(--muted);
}

/* === 手順リスト === */
ol.steps {
  list-style: none;
  counter-reset: step;
  margin: 0;
  padding: 0;
}

ol.steps li {
  counter-increment: step;
  position: relative;
  padding: 0 0 18px 46px;
  font-size: 0.92rem;
  line-height: 1.85;
}

ol.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 2px;
  width: 30px;
  height: 30px;
  line-height: 30px;
  text-align: center;
  border-radius: 50%;
  background: var(--ink);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.9rem;
}

/* 마지막 항목을 뺀 나머지는 세로선으로 이어 흐름을 보이게 */
ol.steps li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 14px;
  top: 36px;
  bottom: 4px;
  width: 2px;
  background: var(--accent-light);
}

ol.steps li strong {
  display: block;
  color: var(--ink);
  margin-bottom: 2px;
}

/* === 用語カード === */
.term-card {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 0 10px 10px 0;
  padding: 14px 16px;
  margin-bottom: 10px;
  scroll-margin-top: 72px;
}

.term-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}

.term-name {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--ink);
}

.term-kana { font-size: 0.75rem; color: var(--muted); }
.term-body { font-size: 0.9rem; line-height: 1.85; }

/* === Home hero === */
.hero {
  text-align: center;
  padding: 40px 16px 24px;
}

.hero h1 {
  font-size: 1.9rem;
  color: var(--ink);
  margin-bottom: 8px;
  letter-spacing: .03em;
}

.hero h1 .accent { color: var(--accent-dark); }

.hero p { color: var(--muted); font-size: 0.95rem; }

.hero-main {
  padding: 48px 16px 32px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}

.hero-main h1 { font-size: 2.3rem; }

.hero-main .hero-lead {
  font-size: 1.05rem;
  color: var(--ink);
  font-weight: 700;
  margin-bottom: 10px;
}

.hero-main .hero-sub {
  font-size: 0.88rem;
  max-width: 34em;
  margin: 0 auto;
  line-height: 1.9;
}

/* === 目的別カード === */
.purpose-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.purpose-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 18px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}

.purpose-card:hover {
  text-decoration: none;
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(18,165,196,.18);
  transform: translateY(-1px);
}

.purpose-icon { font-size: 1.6rem; line-height: 1; }

.purpose-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink);
}

.purpose-desc {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.7;
  flex: 1;
}

.purpose-go {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-dark);
  margin-top: 4px;
}

.link-row { display: flex; flex-wrap: wrap; gap: 18px; }

/* === Responsive === */
@media (max-width: 900px) {
  .jyo-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .purpose-grid { grid-template-columns: 1fr; }
  .jyo-grid { grid-template-columns: repeat(2, 1fr); }
  ol.steps li { padding-left: 40px; font-size: 0.88rem; }
  .hero-main { padding: 32px 16px 24px; }
  .hero-main h1 { font-size: 1.75rem; }
  .card { padding: 16px; }
  .hero h1 { font-size: 1.5rem; }

  /* 좁은 화면에서는 3열 그리드가 눌리므로 라벨을 위로 뺀다 */
  .bar-row,
  .bar-chart--wide .bar-row {
    grid-template-columns: 1fr 88px;
    font-size: 0.8rem;
    gap: 4px 8px;
  }
  .bar-row .bar-label { grid-column: 1 / -1; }
  .stack-row { grid-template-columns: 1fr; gap: 4px; }
}

/* ===================================================================
   タッチ操作向けの調整
   common.css より後に読み込まれるこのファイルに置くこと。
   =================================================================== */
@media (hover: none) and (pointer: coarse) {
  .jump-row a { padding: 8px 12px; }
  .site-logo { padding: 6px 0; }
  .site-nav a { padding: 14px 24px; }
}
