:root {
  --bg-page: #eefcff;
  --bg-card: #ffffff;
  --bg-surface: #f7f9fb;
  --bg-raised: #eef3f6;
  --accent: #1976d2;
  --accent-dark: #0f5fad;
  --accent-dim: rgba(25, 118, 210, 0.08);
  --accent-border: rgba(25, 118, 210, 0.28);
  --green: #2e7d32;
  --green-dark: #276b2b;
  --green-dim: rgba(46, 125, 50, 0.08);
  --danger: #d94141;
  --danger-dim: rgba(217, 65, 65, 0.12);
  --text-primary: #202124;
  --text-secondary: #4f5b67;
  --text-muted: #7d8791;
  --border: rgba(32, 33, 36, 0.12);
  --border-strong: rgba(32, 33, 36, 0.2);
  --winner-bg: rgba(46, 125, 50, 0.08);
  --winner-border: rgba(46, 125, 50, 0.24);
  --radius-lg: 4px;
  --radius-md: 4px;
  --radius-sm: 4px;
  --shadow-card: 0 2px 6px rgba(0, 0, 0, 0.18);
  --shadow-soft: 0 1px 4px rgba(0, 0, 0, 0.14);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", Meiryo, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  color: var(--text-primary);
  font-family: var(--font);
  background:
    linear-gradient(135deg, rgba(31, 205, 226, 0.28) 0%, rgba(31, 205, 226, 0.0) 32%),
    linear-gradient(225deg, rgba(31, 205, 226, 0.2) 0%, rgba(31, 205, 226, 0.0) 30%),
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.32) 34%, rgba(31, 205, 226, 0.14) 68%),
    #eafdff;
}

body { position: relative; overflow-x: hidden; }
body::before, body::after { content: ""; position: fixed; z-index: -1; pointer-events: none; }
body::before {
  left: -120px; bottom: -80px; width: 520px; height: 620px;
  background:
    linear-gradient(135deg, rgba(0,188,212,.42), rgba(0,188,212,.08) 54%, transparent 55%),
    linear-gradient(45deg, rgba(255,255,255,.36), transparent 62%);
  clip-path: polygon(0 20%, 80% 0, 100% 100%, 0 84%);
  opacity: .8;
}
body::after {
  right: -110px; top: -70px; width: 520px; height: 620px;
  background:
    linear-gradient(225deg, rgba(0,188,212,.28), rgba(0,188,212,.06) 58%, transparent 59%),
    linear-gradient(135deg, rgba(255,255,255,.42), transparent 64%);
  clip-path: polygon(20% 0, 100% 0, 100% 88%, 0 100%);
  opacity: .72;
}

#loading-overlay {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 35%, rgba(255,255,255,.94), rgba(234,252,255,.72) 44%, rgba(234,252,255,.92) 100%);
  transition: opacity .35s ease;
}
#loading-overlay.hidden { opacity: 0; pointer-events: none; }
.loading-card {
  width: min(360px, calc(100vw - 40px));
  padding: 28px 28px 24px;
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(32,33,36,.1);
  border-radius: 4px;
  box-shadow: 0 4px 18px rgba(0,0,0,.18);
  text-align: center;
}
.loading-logo { margin-bottom: 18px; font-size: 18px; font-weight: 900; letter-spacing: .02em; color: var(--text-primary); }
.loading-track { width: 100%; height: 6px; background: rgba(32,33,36,.1); border-radius: 999px; overflow: hidden; }
.loading-bar { height: 100%; width: 0%; background: var(--green); border-radius: 999px; animation: lb-run 1.45s ease-in-out infinite; }
@keyframes lb-run { 0%{width:0%;opacity:1} 65%{width:88%;opacity:1} 90%{width:100%;opacity:1} 100%{width:100%;opacity:0} }
.loading-label { margin-top: 14px; font-size: 13px; font-weight: 700; color: var(--text-secondary); }
.loading-note { margin: 10px 0 0; color: var(--text-muted); font-size: 12px; font-weight: 600; line-height: 1.6; }

.page-shell { width: min(1180px, calc(100vw - 48px)); margin: 0 auto; padding: 34px 0 72px; }
.hero {
  margin: 0 auto 26px; padding: 22px 20px 18px; text-align: center;
  background: rgba(255,255,255,.34);
  border-bottom: 1px solid rgba(32,33,36,.16);
  backdrop-filter: blur(2px);
}
.back-link {
  display: inline-flex; align-items: center; min-height: 30px; margin-bottom: 10px; padding: 0 12px;
  color: var(--accent-dark); background: rgba(255,255,255,.82); border: 1px solid rgba(32,33,36,.12); border-radius: 999px;
  font-size: 12px; font-weight: 800; text-decoration: none;
}
.eyebrow { margin: 0 0 8px; font-size: 13px; font-weight: 800; color: var(--text-muted); }
.hero h1 { margin: 0; color: var(--text-primary); font-size: clamp(34px, 4.6vw, 48px); font-weight: 900; letter-spacing: -.04em; line-height: 1.1; }
.lead { margin: 16px auto 0; max-width: 680px; color: var(--text-secondary); font-size: 15px; font-weight: 600; line-height: 1.8; }
.meta-line { margin-top: 18px; display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.meta-line span { display: inline-flex; align-items: center; min-height: 30px; padding: 0 12px; color: var(--text-secondary); background: rgba(255,255,255,.72); border: 1px solid rgba(32,33,36,.12); border-radius: 999px; font-size: 12px; font-weight: 700; }
.cache-note { margin: 14px auto 0; max-width: 640px; color: var(--text-muted); font-size: 12px; font-weight: 700; line-height: 1.7; }

.score-card { overflow: hidden; margin-top: 22px; background: var(--bg-card); border: 1px solid rgba(32,33,36,.1); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); }
.section-title { padding: 14px 18px; color: #fff; font-size: 16px; font-weight: 900; text-align: center; border-bottom: 1px solid rgba(32,33,36,.1); }
.section-title.purple, .section-title.orange { background: var(--green); }

.day-tabs, .game-tabs { display: flex; align-items: center; justify-content: center; gap: 0; flex-wrap: wrap; padding: 0 14px; background: rgba(255,255,255,.68); border-bottom: 1px solid rgba(32,33,36,.18); }
.game-tabs { justify-content: flex-start; }
.day-tab, .game-tab {
  appearance: none; min-height: 52px; padding: 0 18px; border: none; border-bottom: 3px solid transparent; border-radius: 0;
  background: transparent; color: var(--text-secondary); cursor: pointer; font-family: var(--font);
  transition: color .14s ease, border-color .14s ease, background .14s ease;
  display: inline-flex; flex-direction: column; justify-content: center; align-items: center; gap: 3px;
}
.day-tab:hover, .game-tab:hover { color: var(--accent-dark); background: rgba(25,118,210,.04); }
.day-tab.active, .game-tab.active { color: var(--accent); border-bottom-color: var(--accent); background: rgba(25,118,210,.04); }
.tab-main { font-size: 14px; font-weight: 850; line-height: 1.1; }
.tab-sub { font-size: 11px; font-weight: 600; opacity: .82; line-height: 1.1; }

.day-current { padding: 22px 18px 10px; text-align: center; }
.day-kicker, .game-kicker { margin: 0; color: var(--text-muted); font-size: 12px; font-weight: 800; }
.day-current h2 { margin: 6px 0 0; color: var(--text-primary); font-size: clamp(24px, 3vw, 34px); font-weight: 900; letter-spacing: -.03em; }
.day-section { padding: 0 0 18px; }
.mini-section-title { margin: 18px 18px 10px; color: var(--text-primary); font-size: 18px; font-weight: 900; text-align: center; }

.game-detail-section { margin-top: 8px; padding-top: 0; border-top: 1px solid rgba(32,33,36,.14); background: rgba(255,255,255,.64); }
.game-current { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 18px 20px 14px; border-bottom: 1px solid rgba(32,33,36,.1); }
.game-current h3 { margin: 5px 0 0; color: var(--text-primary); font-size: clamp(24px, 3vw, 34px); font-weight: 900; letter-spacing: -.03em; }
.game-meta { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; max-width: 680px; }
.game-meta span { display: inline-flex; align-items: center; min-height: 30px; padding: 0 10px; color: var(--text-secondary); background: #fff; border: 1px solid rgba(32,33,36,.12); border-radius: 999px; font-size: 12px; font-weight: 800; box-shadow: 0 1px 2px rgba(0,0,0,.08); }

.table-wrap { width: calc(100% - 28px); margin: 0 auto; overflow-x: auto; padding-bottom: 2px; }
.table-wrap::-webkit-scrollbar { height: 10px; }
.table-wrap::-webkit-scrollbar-track { background: rgba(32,33,36,.06); }
.table-wrap::-webkit-scrollbar-thumb { background: rgba(32,33,36,.22); border-radius: 999px; }
table { width: 100%; min-width: 760px; border-collapse: separate; border-spacing: 0 8px; table-layout: auto; background: transparent; }
#game-detail-table { min-width: 1120px; }
thead th { padding: 10px 12px; color: var(--text-primary); background: #fff; border-top: 1px solid rgba(32,33,36,.1); border-bottom: 1px solid rgba(32,33,36,.16); font-size: 12px; font-weight: 900; white-space: nowrap; }
thead th:first-child { border-left: 1px solid rgba(32,33,36,.1); border-radius: 4px 0 0 4px; }
thead th:last-child { border-right: 1px solid rgba(32,33,36,.1); border-radius: 0 4px 4px 0; }
tbody td { padding: 12px 12px; color: var(--text-primary); background: #fff; border-top: 1px solid rgba(32,33,36,.08); border-bottom: 1px solid rgba(32,33,36,.16); font-size: 14px; line-height: 1.45; vertical-align: middle; }
tbody td:first-child { border-left: 1px solid rgba(32,33,36,.08); border-radius: 4px 0 0 4px; }
tbody td:last-child { border-right: 1px solid rgba(32,33,36,.08); border-radius: 0 4px 4px 0; }
tbody tr { box-shadow: var(--shadow-soft); }
tbody tr:hover td { background: #f8fbff; }
tbody tr.winner-row td { background: var(--winner-bg); border-top-color: var(--winner-border); border-bottom-color: var(--winner-border); }
td.name-cell, th:first-child { font-weight: 900; text-align: left; }
td.number-cell, td.rank-cell { text-align: right; }
th { text-align: right; }
th:first-child { text-align: left; }
td.text-cell { text-align: left; }
td.wide-cell { min-width: 130px; white-space: normal; }
td.first-rank-cell { font-weight: 900; color: var(--green); }
td.total-cell { font-weight: 900; }
td.empty-cell { padding: 26px; color: var(--text-muted); text-align: center; font-weight: 800; }

#summary-table { width: auto; min-width: 1500px; table-layout: auto; }
#summary-table th, #summary-table td { padding: 10px 10px; font-size: 12px; text-align: center; white-space: nowrap; }
#summary-table th:nth-child(1), #summary-table td:nth-child(1) { min-width: 120px; text-align: left; font-size: 13px; font-weight: 900; }
#summary-table th:nth-child(2), #summary-table td:nth-child(2) { min-width: 68px; font-weight: 900; }
#summary-table th:nth-child(3), #summary-table td:nth-child(3) { min-width: 62px; font-weight: 900; }
#summary-table .align-left { text-align: left; }
#summary-table .summary-group-header { padding: 8px 8px; color: var(--text-primary); background: #eef3f6; border-top: 1px solid rgba(32,33,36,.1); border-bottom: 1px solid rgba(32,33,36,.18); font-size: 11px; font-weight: 900; }
#summary-table .summary-header-cell { color: var(--text-primary); background: #fff; font-weight: 900; }
#summary-table .game20-header { color: var(--danger); background: var(--danger-dim); font-style: italic; font-weight: 900; }
#summary-table .summary-boundary-right { border-right: 1px solid rgba(32,33,36,.2) !important; }
#summary-table tbody tr.winner-row td { color: var(--green); background: var(--winner-bg); }

#game-detail-table th, #game-detail-table td { text-align: center; }
#game-detail-table td.name-cell, #game-detail-table th:first-child { text-align: center; }
#game-detail-table td.hero-cell { white-space: nowrap; }
#game-detail-table td.hero-cell, #game-detail-table th:nth-child(3) { min-width: 110px; }
.footer-note { margin-top: 28px; color: var(--text-muted); font-size: 12px; font-weight: 700; line-height: 1.7; text-align: center; }
.footer-note code { padding: 2px 6px; color: var(--text-secondary); background: rgba(255,255,255,.78); border: 1px solid rgba(32,33,36,.1); border-radius: 4px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }

@media (max-width: 900px) {
  .page-shell { width: min(100% - 24px, 1180px); padding: 24px 0 56px; }
  .hero { padding: 20px 12px 16px; }
  .section-title { padding: 13px 14px; font-size: 15px; }
  .day-tab, .game-tab { min-height: 48px; padding: 0 13px; }
  .mini-section-title { margin-left: 14px; margin-right: 14px; }
  .game-current { display: block; padding-left: 14px; padding-right: 14px; }
  .game-meta { justify-content: flex-start; margin-top: 12px; }
  .table-wrap { width: calc(100% - 16px); }
}

@media (max-width: 640px) {
  body::before, body::after { opacity: .42; }
  .hero h1 { font-size: 34px; }
  .lead { font-size: 14px; }
  .meta-line { gap: 6px; }
  .meta-line span { min-height: 28px; padding: 0 10px; font-size: 11px; }
  .day-tabs, .game-tabs { justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; }
  .day-tab, .game-tab { flex: 0 0 auto; }
  table { min-width: 660px; }
  #summary-table { min-width: 1300px; }
  #game-detail-table { min-width: 1040px; }
  thead th, tbody td { padding: 9px 8px; font-size: 12px; }
}
