/* ===================================================================
   콘텐츠 스타일 — 카드, 폼, 테이블, 결과 타일, FAQ

   ※ common.css → content.css 순으로 로드된다.
     덮어쓰기 규칙은 반드시 이쪽에 둘 것.
     (期待値ナビ 에서 터치 타깃 규칙을 common 에 뒀다가 먹지 않은 전례)
   =================================================================== */

/* === Card === */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 24px;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title::before {
  content: "";
  width: 4px;
  height: 1.1em;
  background: var(--green);
  border-radius: 2px;
  flex-shrink: 0;
}

/* === Form === */
.calc-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.field { display: flex; flex-direction: column; gap: 6px; }

.field label {
  font-weight: 700;
  font-size: .9rem;
  color: var(--text);
}

.field input[type="number"],
.field input[type="text"],
.field select {
  font-family: inherit;
  font-size: 1rem;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  width: 100%;
  /* iOS 가 16px 미만 입력에서 화면을 확대해버리는 것을 막는다 */
  min-height: 44px;
}

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

.field input[aria-invalid="true"] { border-color: var(--danger); }

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

.field-error {
  font-size: .78rem;
  color: var(--danger);
  font-weight: 700;
  min-height: 1.2em;
}

/* === 세그먼트 선택 (券種 / 買い方) === */
.seg {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.seg button {
  font-family: inherit;
  font-size: .85rem;
  font-weight: 600;
  padding: 8px 14px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}

.seg button:hover { border-color: var(--green); background: var(--green-bg); }

.seg button[aria-pressed="true"] {
  background: var(--green-solid);
  border-color: var(--green-solid);
  color: var(--on-green);
}

/* 레이스 선택처럼 항목이 많은 세그먼트는 조금 촘촘하게 */
.seg-wrap button {
  font-size: .8rem;
  padding: 6px 12px;
  min-height: 40px;
}

/* === 馬番 선택 그리드 === */
.pos-block { margin-bottom: 20px; }

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

.pos-head h3 {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
}

.pos-head .pos-desc { font-size: .78rem; color: var(--muted); }

.pos-actions { margin-left: auto; display: flex; gap: 6px; }

.mini-btn {
  font-family: inherit;
  font-size: .75rem;
  padding: 4px 10px;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
}

.mini-btn:hover { border-color: var(--green); color: var(--green-dark); }

/* 넓은 화면에서 auto-fill 로 두면 18두가 16+2 로 갈려 어색해진다.
   9열로 고정해 2행으로 떨어지게 한다. 모바일은 아래에서 auto-fill 로 되돌린다. */
.horse-grid {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 6px;
}

.horse-chk { position: relative; }

.horse-chk input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.horse-chk span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  font-weight: 700;
  font-size: .95rem;
  font-variant-numeric: tabular-nums;
  transition: background .12s, border-color .12s, color .12s;
}

.horse-chk input:checked + span {
  background: var(--green-solid);
  border-color: var(--green-solid);
  color: var(--on-green);
}

.horse-chk input:focus-visible + span {
  outline: 3px solid var(--green);
  outline-offset: 2px;
}

/* === オッズ 입력 행 === */
.odds-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}

.odds-no {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--green-bg);
  border: 1px solid var(--green-light);
  color: var(--green-dark);
  font-size: .8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.odds-row input {
  flex: 1;
  min-width: 0;
  font-family: inherit;
  font-size: 1rem;
  padding: 10px 12px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
}

.odds-row input:focus { border-color: var(--green); }

.is-minus { color: var(--danger); font-weight: 700; }

.tag-torigami {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  vertical-align: middle;
}

@media (prefers-color-scheme: dark) {
  .tag-torigami { color: #2a0f0d; }
}

/* === 결과 타일 === */
.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.result-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 16px 12px;
  background: var(--green-bg);
  border: 1px solid var(--green-light);
  border-radius: 12px;
  text-align: center;
}

.result-tile .label {
  font-size: .78rem;
  color: var(--muted);
  font-weight: 700;
}

.result-tile .value {
  font-size: clamp(1.4rem, 1.1rem + 1.4vw, 1.9rem);
  font-weight: 700;
  color: var(--green-dark);
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}

.result-tile .unit { font-size: .78rem; color: var(--muted); }

/* === Table === */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
  background: var(--card);
}

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

.data-table thead th {
  background: var(--green-bg);
  color: var(--green-dark);
  font-weight: 700;
  position: sticky;
  top: 0;
}

.data-table tbody tr:last-child th,
.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody th {
  background: var(--green-bg);
  font-weight: 700;
  color: var(--text);
}

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

.data-table .cell-left { text-align: left; white-space: normal; }

/* === Callout === */
.callout {
  background: var(--green-bg);
  border: 1px solid var(--green-light);
  border-left: 4px solid var(--green);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: .87rem;
  line-height: 1.75;
  margin-top: 16px;
}

.callout.warn {
  background: #fff8f0;
  border-color: #f3d9b8;
  border-left-color: #d98324;
}

@media (prefers-color-scheme: dark) {
  .callout.warn {
    background: #2a2015;
    border-color: #4a3a22;
    border-left-color: #e0a052;
  }
}

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

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

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

.faq-q::before {
  content: "Q. ";
  color: var(--green);
  font-weight: 700;
}

.faq-a {
  font-size: .89rem;
  color: var(--muted);
  line-height: 1.8;
}

/* === 用語集 === */
.yougo-count {
  font-size: .82rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.yougo-empty {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 16px;
  text-align: center;
  color: var(--muted);
  font-size: .9rem;
}

.yougo-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
}

.yougo-term {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.yougo-reading {
  font-size: .76rem;
  font-weight: 400;
  color: var(--muted);
}

.yougo-def {
  font-size: .88rem;
  line-height: 1.8;
  color: var(--text);
  margin-top: 4px;
}

.yougo-link {
  display: inline-block;
  margin-top: 6px;
  font-size: .8rem;
  font-weight: 700;
}

/* === 準備中 랜딩 === */
.coming-soon {
  text-align: center;
  padding: 64px 16px;
}

.coming-soon h1 {
  font-size: clamp(1.4rem, 1.1rem + 1.5vw, 2rem);
  color: var(--text);
  margin-bottom: 12px;
}

.coming-soon p { color: var(--muted); }

/* === 出典 === */
.sources {
  font-size: .78rem;
  color: var(--muted);
  line-height: 1.8;
  margin-top: 12px;
}

.sources li { margin-left: 1.2em; }

@media (max-width: 600px) {
  .card { padding: 16px; }
  .horse-grid { grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); }
}
