:root {
  --bg: #f7f5f0;
  --surface: #ffffff;
  --text: #1f1d1a;
  --muted: #6b665e;
  --line: #e4dfd5;
  --accent: #8a2c1d;
  --accent-soft: #f6e9e6;
  --head: #f1ede4;
  --gold: #b8901c;
  --silver: #7d848c;
  --bronze: #9a5b2e;
  --up: #2c7a3f;
  --down: #a23a2a;
  --men: #1f5f8b;
  --women: #8a2c1d;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  line-height: 1.6;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1000px; margin: 0 auto; padding: 0 16px; }

/* ヘッダー */
header { background: var(--surface); border-bottom: 3px solid var(--accent); position: sticky; top: 0; z-index: 10; }
.header-inner { display: flex; align-items: center; gap: 8px 24px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
.logo { font-weight: 700; font-size: 17px; color: var(--text); white-space: nowrap; }
.logo-mark { color: var(--accent); margin-right: 6px; }
nav { display: flex; gap: 16px; }
nav a { color: var(--text); padding: 2px 0; border-bottom: 2px solid transparent; }
nav a.active { color: var(--accent); font-weight: 700; border-bottom-color: var(--accent); }
.search { margin-left: auto; }
.search input {
  font-size: 15px; padding: 6px 10px; width: 200px; max-width: 100%;
  border: 1px solid var(--line); border-radius: 20px; background: var(--bg);
}

main { padding-top: 20px; padding-bottom: 48px; }
h1 { font-size: 26px; margin: 4px 0 6px; line-height: 1.3; }
h2 { font-size: 18px; margin: 36px 0 10px; border-left: 4px solid var(--accent); padding-left: 10px; }
h3 { font-size: 15px; margin: 20px 0 6px; color: var(--muted); }
.note { color: var(--muted); font-size: 13px; margin: 6px 0; }
.lead { color: var(--muted); margin: 0 0 8px; }

/* 操作部品 */
.controls { display: flex; gap: 10px 16px; flex-wrap: wrap; align-items: center; margin: 12px 0; }
select {
  font-size: 15px; padding: 6px 10px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--surface); color: var(--text); max-width: 100%;
}
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.segmented button {
  font: inherit; font-size: 14px; padding: 6px 16px; border: 0; background: transparent; cursor: pointer; color: var(--text);
}
.segmented button + button { border-left: 1px solid var(--line); }
.segmented button.on { background: var(--accent); color: #fff; }

/* 表 */
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: center; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
th { background: var(--head); font-weight: 600; font-size: 13px; }
tbody tr:hover { background: #fbfaf7; }
td.name, td.left { text-align: left; }
td.num { font-variant-numeric: tabular-nums; }
.rank-badge {
  display: inline-block; min-width: 26px; height: 26px; line-height: 26px; border-radius: 13px;
  font-weight: 700; font-size: 13px;
}
.rank-1 .rank-badge { background: var(--gold); color: #fff; }
.rank-2 .rank-badge { background: var(--silver); color: #fff; }
.rank-3 .rank-badge { background: var(--bronze); color: #fff; }
.bar { display: inline-block; height: 8px; background: var(--accent); border-radius: 4px; vertical-align: middle; margin-left: 8px; opacity: .65; }
.delta { font-size: 12px; margin-left: 4px; }
.delta.up { color: var(--up); }
.delta.down { color: var(--down); }
.wins { font-size: 13px; color: var(--muted); white-space: normal; min-width: 160px; }

/* カード */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin: 12px 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
.card .num { font-size: 26px; font-weight: 700; color: var(--accent); line-height: 1.3; }
.card .label { font-size: 13px; color: var(--muted); }
.card .num.small { font-size: 20px; }

/* トップページの最新大会 */
.latest { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.latest a.card { color: var(--text); display: block; }
.latest a.card:hover { border-color: var(--accent); text-decoration: none; }
.latest .t-name { font-weight: 700; }
.latest .t-date { font-size: 12px; color: var(--muted); }
.latest .winner { margin-top: 6px; font-size: 14px; }
.latest .winner b { color: var(--accent); }

.hero { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 8px; }
.hero h1 { margin-top: 0; }

.chart-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; height: 280px; }
table.overview { width: auto; min-width: 320px; }
table.overview td { text-align: left; white-space: normal; }
table.overview td:first-child { background: var(--head); font-weight: 600; white-space: nowrap; }

footer { color: var(--muted); font-size: 12px; text-align: center; padding: 24px 0 32px; border-top: 1px solid var(--line); line-height: 1.8; }

/* スマホ */
@media (max-width: 640px) {
  header { position: static; }
  .header-inner { gap: 6px 16px; padding-top: 8px; padding-bottom: 8px; }
  .logo { font-size: 15px; }
  nav { gap: 12px; font-size: 14px; }
  h1 { font-size: 21px; }
  h2 { margin-top: 28px; }
  .hero { padding: 14px 16px; }
  .hero .lead { font-size: 14px; }
  .latest { grid-template-columns: 1fr 1fr; gap: 8px; }
  .latest .card { padding: 10px 12px; }
  .latest .t-name { font-size: 14px; }
  .latest .winner { font-size: 13px; margin-top: 2px; }
  .cards { grid-template-columns: 1fr 1fr; gap: 8px; }
  .card .num { font-size: 22px; }
  .card .num.small { font-size: 18px; }
  .search { margin-left: 0; width: 100%; }
  .search input { width: 100%; font-size: 16px; padding: 5px 10px; }
  .sub { display: none; }
  th, td { padding: 7px 6px; font-size: 13px; }
  .bar { display: none; }
  .chart-box { height: 230px; }
}

/* このサイトについて・プライバシーポリシーなど、文章のページ */
.prose { max-width: 760px; line-height: 1.85; }
.prose p, .prose li { font-size: 15px; }
.prose ul { padding-left: 1.4em; margin: 8px 0; }
.prose li { margin: 4px 0; }
.prose a, footer a { color: var(--accent); }
footer a { margin: 0 6px; white-space: nowrap; }
.button { display: inline-block; background: var(--accent); color: #fff !important; padding: 10px 18px; border-radius: 8px; text-decoration: none; font-weight: bold; }

/* トップページの大きな検索欄 */
.hero-search { display: flex; gap: 8px; margin-top: 14px; max-width: 560px; }
.hero-search input {
  flex: 1; min-width: 0; font-size: 16px; padding: 11px 16px;
  border: 1px solid var(--line); border-radius: 24px; background: var(--bg); color: var(--text);
}
.hero-search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.hero-search button {
  font-size: 16px; font-weight: 700; padding: 0 22px; border: none; border-radius: 24px;
  background: var(--accent); color: #fff; cursor: pointer;
}
/* トップページは大きな検索欄があるので、ヘッダーの検索欄は出さない */
body.home header .search { display: none; }

/* 読み込み中の仮のカード（画面のガタつき＝CLSを防ぐため、本物と同じ大きさで場所を空けておく） */
.latest .card.placeholder { background: var(--head); border-color: transparent; }
/* メニューは JavaScript で後から入るので、入る前から同じ高さを空けておく */
header:empty { height: 55px; }
@media (max-width: 640px) {
  header:empty { height: 84px; }
  body.home header:empty { height: 48px; }
}
tr.placeholder td, tr.placeholder td * { color: transparent !important; }
tr.placeholder .bar { background: var(--head) !important; }

/* 読み物（記事） */
.guide-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin-top: 16px; }
.guide-card { display: block; color: var(--text); }
.guide-card:hover { border-color: var(--accent); text-decoration: none; }
.guide-card .t-name { font-weight: 700; line-height: 1.5; margin-bottom: 4px; }
.guide-card.planned { opacity: .55; }
.wrap-article h1 { font-size: 26px; line-height: 1.4; }
.wrap-article h2 { margin-top: 32px; }
.wrap-article ol { padding-left: 1.4em; }
.wrap-article .table-scroll { margin: 10px 0; }
.guide-card .t-date { font-size: 12px; color: var(--muted); margin-top: 6px; }
.guide-list { margin-bottom: 32px; }
.terms dt { font-weight: 700; margin-top: 12px; }
.terms dd { margin: 2px 0 0 1em; }
.summary { line-height: 1.9; margin: 8px 0 16px; }

/* 学校どうしの比較 */
.compare-pick { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 12px 0 4px; }
.compare-pick select { font-size: 16px; font-weight: 600; min-width: 0; flex: 1 1 160px; }
.compare-pick .pick-a { border: 2px solid #1f5f8b; }
.compare-pick .pick-b { border: 2px solid #b8701c; }
.compare-pick .vs { color: var(--muted); }
.swap { font-size: 18px; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 4px 10px; cursor: pointer; color: var(--text); }
.compare-table th.col-a, .compare-table th.col-b, th.col-a, th.col-b { white-space: normal; min-width: 90px; }
th.col-a { color: #1f5f8b; border-bottom: 3px solid #1f5f8b; }
th.col-b { color: #b8701c; border-bottom: 3px solid #b8701c; }
.compare-table td.label-cell { background: var(--head); font-weight: 600; font-size: 13px; }
.compare-table td { width: 36%; }
.compare-table td.label-cell { width: 28%; }
td.better { font-weight: 700; }
td.col-a.better { color: #1f5f8b; background: #eef4f9; }
td.col-b.better { color: #9a5c12; background: #fbf3e6; }
.of { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 2px; }
.txt-a { color: #1f5f8b; }
.txt-b { color: #9a5c12; }
@media (max-width: 640px) {
  .compare-pick select { flex-basis: 100%; }
  .compare-pick .vs { display: none; }
  .swap { margin-left: auto; }
}
