:root {
  --blue: #087ff5;
  --blue-dark: #0067d4;
  --line: #c9c9c9;
  --surface: #f4f4f4;
  --text: #111;
  --muted: #666;
  --warning: #fff2cc;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--text);
  background: #fff;
  font-family: "Meiryo", "Yu Gothic", "Hiragino Kaku Gothic ProN", sans-serif;
  -webkit-text-size-adjust: 100%;
}
.page-header {
  padding: 18px 16px 15px;
  color: #fff;
  text-align: center;
  background: var(--blue);
}
.page-header .eyebrow { margin: 0 0 3px; font-size: .78rem; font-weight: 700; }
.page-header h1 { margin: 0; font-size: clamp(1.25rem, 5.5vw, 1.8rem); line-height: 1.35; }
.page-header > p:last-child { margin: 5px 0 0; font-size: .8rem; }
main { width: min(100%, 760px); margin: 0 auto; padding: 12px 10px 32px; }
.return-nav { font-size: .82rem; font-weight: 700; }
.return-nav a { display: inline-block; min-height: 40px; padding: 9px 4px; color: var(--blue-dark); text-decoration: none; }
.return-nav a:focus-visible, .return-nav a:hover { text-decoration: underline; }
.return-nav-top { margin-bottom: 2px; }
.return-nav-bottom { margin-top: 14px; text-align: center; }
.day-tabs { position: sticky; top: 0; z-index: 10; display: grid; grid-template-columns: 1fr 1fr; background: #fff; padding: 4px 0 8px; }
.day-tab {
  min-height: 46px;
  border: 1px solid var(--blue);
  color: var(--blue);
  background: #fff;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
}
.day-tab:first-child { border-right: 0; }
.day-tab.is-active { color: #fff; background: var(--blue); }
.summary { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); }
.summary div { display: flex; flex-direction: column; gap: 3px; padding: 9px 10px; text-align: center; }
.summary div + div { border-left: 1px solid var(--line); }
.summary strong { font-size: .78rem; color: var(--blue-dark); }
.summary span { font-size: .9rem; font-weight: 700; }
.view-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.view-tab { min-height: 46px; border: 2px solid var(--blue); border-radius: 0; color: var(--blue-dark); background: #fff; font: inherit; font-size: 1rem; font-weight: 700; }
.view-tab.is-active { color: #fff; background: var(--blue); }
.view-panel[hidden] { display: none; }
.tools { display: flex; gap: 8px; align-items: end; margin: 12px 0; }
.tools label { flex: 1; font-size: .75rem; font-weight: 700; color: var(--muted); }
.tools select, .tools button { width: 100%; min-height: 42px; margin-top: 4px; border: 1px solid #aaa; border-radius: 0; background: #fff; color: #111; font: inherit; }
.tools select { padding: 0 9px; }
.tools button { width: auto; padding: 0 12px; color: var(--blue-dark); border-color: var(--blue); font-size: .8rem; font-weight: 700; }
.csv-status { margin: -5px 0 9px; color: var(--muted); text-align: right; font-size: .68rem; }
.ranking-section { margin: 0 0 14px; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 8px 10px; color: #fff; background: var(--blue); }
.section-heading h2 { margin: 0; font-size: 1rem; }
.section-heading span { font-size: .65rem; }
.ranking-scroll { overflow-x: auto; border: 1px solid var(--line); border-top: 0; -webkit-overflow-scrolling: touch; }
.ranking-table { width: 100%; min-width: 450px; table-layout: fixed; border-collapse: collapse; background: #fff; font-size: .72rem; }
.ranking-table th, .ranking-table td { height: 34px; padding: 4px 3px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: center; white-space: nowrap; }
.ranking-table th { color: #fff; background: var(--blue); font-weight: 700; }
.ranking-table th:first-child, .ranking-table td:first-child { width: 38px; }
.ranking-table th:nth-child(2), .ranking-table td:nth-child(2) { width: 106px; text-align: left; white-space: normal; overflow-wrap: anywhere; line-height: 1.25; }
.ranking-table th:nth-child(n+3), .ranking-table td:nth-child(n+3) { width: 43px; }
.ranking-table tr:last-child td { border-bottom: 0; }
.ranking-table .rank-top td:first-child { color: var(--blue-dark); font-weight: 700; }
.schedule { display: grid; gap: 10px; }
.time-block { border: 1px solid var(--line); background: var(--surface); scroll-margin-top: 62px; }
.time-block.is-warning { border-color: #d6b64b; background: var(--warning); }
.time-heading { display: flex; align-items: center; gap: 9px; min-height: 42px; padding: 7px 11px; color: #fff; background: var(--blue); }
.time-heading .slot { font-size: 1rem; }
.time-heading time { font-size: 1rem; font-weight: 700; }
.time-heading .status { margin-left: auto; font-size: .68rem; font-weight: 700; opacity: .9; }
.match { display: grid; grid-template-columns: 58px minmax(0, 1fr); min-height: 58px; align-items: stretch; background: rgba(255,255,255,.56); }
.match[hidden] { display: none; }
.match + .match { border-top: 1px solid var(--line); }
.court { display: flex; flex-direction: column; justify-content: center; align-items: center; border-right: 1px solid var(--line); font-size: .8rem; font-weight: 700; color: var(--blue-dark); }
.court small { color: var(--muted); font-size: .62rem; font-weight: 400; }
.card { display: grid; grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); gap: 7px; align-items: center; padding: 9px 10px; }
.team { overflow-wrap: anywhere; font-size: .92rem; font-weight: 700; line-height: 1.35; }
.team.home { text-align: right; }
.team.away { text-align: left; }
.versus { color: #777; font-size: .7rem; font-weight: 400; }
.score { min-width: 78px; color: #111; text-align: center; font-size: 1rem; font-weight: 400; white-space: nowrap; }
.score .mark { font-family: "Meiryo", "Yu Gothic", sans-serif; font-size: 1.08em; }
.time-block[hidden] { display: none; }
.notes { margin-top: 16px; padding-top: 12px; border-top: 1px dotted #aaa; font-size: .75rem; line-height: 1.65; }
.notes h2 { margin: 0 0 5px; color: var(--blue-dark); font-size: .9rem; }
.notes p { margin: 4px 0; }
.note-mark { display: inline-block; width: 9px; height: 9px; margin-right: 5px; background: #548235; }
.note-mark.yellow { background: #a67c00; }
@media (min-width: 620px) {
  main { padding-inline: 16px; }
  .match { grid-template-columns: 80px minmax(0,1fr); }
  .team { font-size: 1rem; }
}
@media print {
  .tools, .day-tabs { position: static; }
  .time-block { break-inside: avoid; }
}
