@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@500;600;700;800;900&family=Noto+Sans+JP:wght@400;500;600;700;800;900&display=swap');

:root {
  color-scheme:dark;
  --bg:#141517; --panel:#1b1c1f; --border:#303135; --text:#f3f2f0; --muted:#a2a4ac;
  --red:#ed3d40; --red-light:#ff9696; --green:#9bd4b5; --amber:#ffc199; --gray:#b3b3bd;
  --divider:#6b6c74; --link:#a9ceff; --focus:#ffd43d;
  --sans:'Noto Sans JP','Yu Gothic',Meiryo,sans-serif; --numbers:'Barlow Condensed','Arial Narrow',sans-serif;
  font:16px/1.7 var(--sans); color:var(--text); background:var(--bg);
}
* {box-sizing:border-box}
body,h1,h2,p,ul {margin:0}
a {color:inherit; text-decoration:none}
button,input,select {font:inherit}
button {cursor:pointer}
:is(button,a,input,select,[tabindex]):focus-visible {outline:4px solid #000; outline-offset:2px; box-shadow:0 0 0 2px var(--focus)}
[hidden] {display:none!important}
.sr-only {position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap}
.shell {width:min(1240px,calc(100% - 96px)); margin-inline:auto}
.skip {position:fixed; top:8px; left:8px; z-index:3; padding:8px 14px; background:var(--panel); transform:translateY(-150%)}
.skip:focus {transform:none}

.ticker {min-height:44px; display:flex; align-items:stretch; background:#111113; border-bottom:1px solid #333438}
.ticker-label {display:flex; align-items:center; gap:9px; background:#b9212b; padding:0 16px; font-size:.875rem; font-weight:700; z-index:1; white-space:nowrap; text-decoration:underline; text-underline-offset:.16em}
.broadcast {width:15px; height:13px; position:relative; display:inline-block; border:1.5px solid #fff; border-block-color:transparent; border-radius:50%}
.broadcast::after {content:''; position:absolute; width:5px; height:5px; border-radius:50%; background:#fff; inset:0; margin:auto}
.ticker-window {min-width:0; flex:1; overflow:hidden}
.ticker-track,.ticker-set,.ticker-item {display:flex; align-items:center; width:max-content; min-height:44px}
.ticker-track {animation:ticker 105s linear infinite; will-change:transform}
.ticker-item {padding-inline:18px; gap:12px; white-space:nowrap; border-right:1px solid var(--divider); font-size:.875rem}
.ticker-item b {font-weight:700}
.ticker-item .state {font-size:.875rem; gap:5px}
.ticker-item .state i {width:6px; height:6px}
.ticker-toggle {min-width:44px; min-height:44px; margin-left:auto; padding:0 10px; flex:none; color:#eeeef0; background:#191a1c; border:0; border-left:1px solid var(--divider); font-size:.875rem; text-decoration:underline; text-underline-offset:.16em}
.ticker-toggle:hover {background:#2a2b30; text-decoration-thickness:2px}
.ticker :is(a,button):focus-visible {outline:2px solid var(--focus); outline-offset:-4px; box-shadow:inset 0 0 0 6px #000}
.race-group {display:inline-flex; align-items:baseline; gap:6px; margin-right:12px; white-space:nowrap}
.race-group:last-child {margin-right:0}
.race-numbers {font-weight:700; font-variant-numeric:tabular-nums; color:var(--text)}
@keyframes ticker {to {transform:translateX(-50%)}}
@media(prefers-reduced-motion:reduce) {.ticker-track {animation:none} .ticker-window {overflow:auto} #ticker-repeat {display:none}}

.masthead {background:#18191b; border-bottom:1px solid #292a2d}
.nav {min-height:70px; display:flex; align-items:center; gap:64px}
.brand {display:inline-flex; align-items:center; gap:12px; flex:none; line-height:.95; font:800 1.72rem/.92 var(--numbers); letter-spacing:.045em; white-space:nowrap}
.brand b {color:var(--red-light); font-weight:800}
.brand small {display:block; font:700 .69rem/1 var(--sans); color:#b8b8bf; margin-top:5px; letter-spacing:.13em}
.brand-mark {flex:none; display:block; width:33px; height:30px; transform:skewX(-20deg); background:linear-gradient(90deg,var(--red) 0 18%,transparent 18% 29%,var(--red) 29% 54%,transparent 54% 66%,var(--red) 66%); clip-path:polygon(0 50%,25% 50%,25% 30%,60% 30%,60% 0,100% 0,100% 100%,0 100%)}
.nav nav {display:flex; align-self:stretch; gap:30px; white-space:nowrap}
.nav nav a {position:relative; display:grid; place-items:center; font-size:1rem; color:#d0d1d7; font-weight:700}
.nav nav a:hover,.nav nav a.current {color:var(--text)}
.nav nav a.current::after {content:''; background:var(--red); height:3px; position:absolute; inset:auto 0 0}
.clock {display:flex; align-items:baseline; gap:8px; margin-left:auto; white-space:nowrap; color:var(--muted); font-size:.875rem}
.clock time {font:600 1.45rem/1 var(--numbers); font-variant-numeric:tabular-nums; color:var(--text); min-width:6ch}
.clock-zone {font:600 .88rem/1 var(--numbers); letter-spacing:.1em}

.hero {min-height:384px; isolation:isolate; position:relative; overflow:hidden; border-bottom:1px solid #35343a; background:#141315}
.hero::before,.hero::after {position:absolute; content:''; inset:0; z-index:-1}
.hero::before {background:url('track.jpg') right 48%/cover no-repeat}
.hero::after {background:linear-gradient(90deg,#121216 0%,#121216e8 21%,#12121679 50%,#15131805 77%),linear-gradient(0deg,#141517ba,transparent 46%)}
.hero-inner {min-height:inherit; display:flex; align-items:center; padding-block:42px 48px}
.hero-content {position:relative; padding-left:23px}
.hero-content::before {position:absolute; inset:5px auto auto 0; width:3px; height:156px; background:var(--red); content:''}
.hero-date {display:flex; align-items:center; gap:9px; color:#e0dad9; font-size:.92rem; font-weight:700; letter-spacing:.07em; margin-bottom:13px}
.calendar-icon {display:inline-block; position:relative; width:15px; height:14px; border-radius:2px; border:1.5px solid var(--red-light)}
.calendar-icon::before {content:''; position:absolute; top:3px; inset-inline:0; border-top:1.5px solid var(--red-light)}
.calendar-icon::after {content:''; position:absolute; top:-3px; left:2px; width:7px; height:4px; border-inline:1.5px solid var(--red-light)}
.hero h1 {font-size:clamp(2.6rem,5vw,4.5rem); line-height:1.14; font-weight:900; letter-spacing:-.06em}
.hero h1 span {color:var(--red-light)}
.hero-copy {color:#e4e0e2; margin-block:19px 24px; font-size:1rem; font-weight:500; letter-spacing:.04em}
.primary {display:inline-flex; justify-content:center; align-items:center; min-height:48px; padding:8px 20px; background:#b9212b; border:1px solid #e74a51; border-radius:8px; color:white; font-weight:700; letter-spacing:.02em}
.primary:hover {background:#a9212b; text-decoration:underline}

.content {padding-bottom:64px}
.summary {display:grid; grid-template-columns:repeat(4,1fr); padding:0; list-style:none; margin:8px 0 40px; border-block:1px solid var(--divider)}
.summary li {min-width:0; display:flex; align-items:center; justify-content:space-between; gap:8px; min-height:64px; padding:8px 20px}
.summary li + li {border-left:1px solid var(--divider)}
.summary-label {display:flex; align-items:center; gap:8px; font-weight:700}
.status-dot {display:inline-block; flex:none; width:8px; height:8px; border-radius:50%; background:currentColor}
.state {display:inline-flex; align-items:center; gap:7px; white-space:nowrap; font-weight:700}
.open {color:var(--green)} .soon {color:var(--amber)} .closed,.cancelled {color:var(--red-light)} .off,.unknown,.planned {color:var(--gray)}
.summary strong {font:700 2.1rem/1 var(--numbers); font-variant-numeric:tabular-nums}
.summary li>div {display:flex; align-items:baseline; gap:5px; flex:none}
.summary li>div span {color:var(--muted)}
.section {scroll-margin-top:20px}
.section-head,.filter-line {display:flex; justify-content:space-between; align-items:center; gap:16px}
.section-head {margin-bottom:16px}
.section-head h2 {font-size:1.75rem; font-weight:700; letter-spacing:.02em; line-height:1.4; padding-left:12px; border-left:3px solid var(--red)}
.section-head p {margin:4px 0 0 15px; color:var(--muted)}
.date-switch {min-width:0; display:flex; margin:0; padding:0; border:0; gap:8px; white-space:nowrap}
.date-switch label {display:flex; align-items:center; justify-content:center; gap:6px; min-height:48px; color:#e2e2e6; background:var(--panel); border:1px solid var(--divider); border-radius:8px; padding:4px 10px; cursor:pointer}
.date-switch label:has(:checked) {border-color:#ff999f; background:#392326; color:#fff; font-weight:700}
.date-switch label:hover {background:#323338}
.date-switch input {width:16px; height:16px; margin:0; accent-color:#ff9299}
.date-switch label span {font-variant-numeric:tabular-nums; font-size:.875rem; color:#c5c5ce}
.filter-line {padding-bottom:12px}
.filter-control {display:flex; flex-wrap:wrap; align-items:center; gap:8px; font-weight:700}
.venue-filters {display:flex; flex-wrap:wrap; gap:16px}
.filter-control :is(input,select) {min-height:48px; border:1px solid #888994; border-radius:8px; color:var(--text); background:var(--panel); padding:8px 12px; font-weight:400}
.filter-control input {width:min(220px,100%)}
.select-wrap {position:relative; display:inline-flex}
.select-wrap::after {content:''; position:absolute; right:16px; top:18px; width:8px; height:8px; border:solid var(--text); border-width:0 2px 2px 0; transform:rotate(45deg); pointer-events:none}
.filter-control select {appearance:none; padding-right:40px; cursor:pointer}
.result-count,.data-note,.scroll-hint {font-size:.875rem; color:#babac3}
.result-count {flex:none; white-space:nowrap}
.scroll-hint {display:none; margin-bottom:4px}
.notice {padding:12px 16px; background:var(--panel); border-left:3px solid var(--amber); color:var(--text)}
.notice a,.notice button {margin-left:8px}
.data-note {margin-top:12px}
.table-scroll {overflow-x:auto}
.data-table {border-collapse:collapse; width:100%; font-size:1rem}
.data-table :is(th,td) {text-align:left; vertical-align:middle; padding:10px 14px; border-bottom:1px solid var(--divider)}
.data-table thead {background:#202125; color:#f0eff2; white-space:nowrap}
.data-table thead th {border-block:1px solid var(--divider); font-weight:700}
.data-table tbody th {font-weight:700}
.data-table tbody tr:nth-child(even) {background:#1b1c1f}
.data-table tbody tr:hover {background:#242528}
#race-table .data-table {min-width:35rem}
#race-table tbody th {width:48%}
.meeting-name {display:block; font-size:1.125rem}
.row-meta {display:block; font-size:.875rem; color:#c8c8d1; font-weight:400}
.next-race {white-space:nowrap; font-variant-numeric:tabular-nums}
.next-race strong {margin-left:4px}
.text-button {min-height:44px; background:transparent; border:0; padding:4px 0; white-space:nowrap}
.text-button,.data-table a,.notice a,.foot>div a,.dialog-links a {color:var(--link); text-decoration:underline; text-underline-offset:.18em}
:is(.data-table,.notice,.foot,.dialog-links) a:visited {color:#e5b4f8}
.text-button:hover,.data-table a:hover,.notice a:hover,.foot>div a:hover,.dialog-links a:hover {text-decoration-thickness:2px}
.venue-section {margin-top:48px}
.venue-table tbody th {width:13rem; white-space:nowrap}
.venue-table .race-group {margin-block:2px}
.venue-table a {display:inline-flex; align-items:center; min-height:44px}
footer {border-top:1px solid var(--divider); background:#18191b}
.foot {display:flex; justify-content:space-between; align-items:center; gap:20px; padding-block:26px}
.foot>div {display:flex; flex-wrap:wrap; gap:16px; font-size:.875rem}
.foot>div a {display:flex; align-items:center; min-height:44px}

dialog {width:min(610px,calc(100% - 24px)); max-height:calc(100% - 32px); padding:0; border:1px solid var(--divider); border-radius:8px; background:#1c1d20; color:var(--text)}
dialog::backdrop {background:#000b}
.dialog-head {position:sticky; top:0; z-index:1; display:flex; justify-content:space-between; gap:14px; padding:16px 20px; background:#222327; border-bottom:1px solid var(--divider)}
.dialog-head h2 {font-size:1.5rem}
.dialog-head p {color:#c8c8d1}
.close {width:44px; height:44px; color:var(--text); background:#313238; border:1px solid var(--divider); border-radius:8px; font-size:1.4rem}
.close:hover {background:#45464f}
#dialog-body,.dialog-links {padding:12px 20px}
#dialog-body table {min-width:23rem}
.dialog-links {display:flex; flex-wrap:wrap; gap:8px}
.dialog-links a {display:flex; align-items:center; min-height:44px; padding:4px 8px; border:1px solid var(--divider); border-radius:8px}
.race-links {display:flex; align-items:center; gap:10px; white-space:nowrap}
.race-links a {display:inline-flex; align-items:center; min-height:44px}
#entry-dialog {width:min(760px,calc(100% - 24px))}
.entry-content {padding:12px 20px 20px}
.entry-table {min-width:33rem; font-variant-numeric:tabular-nums}
.entry-table :is(th,td) {white-space:nowrap}
@media(max-width:1050px) {
  .shell {width:calc(100% - 56px)} .nav {gap:34px} .nav nav {gap:19px}
}
@media(max-width:760px) {
  .shell {width:calc(100% - 32px)} .ticker-label {padding-inline:10px} .ticker-toggle {padding-inline:8px}
  .nav {min-height:0; gap:0; display:grid; grid-template-columns:1fr auto; padding-top:13px}
  .nav nav {grid-row:2; grid-column:1/-1; min-width:0; overflow-x:auto; gap:16px; margin-top:9px; min-height:48px}
  .nav nav a {font-size:.875rem} .clock>span:first-child {display:none}
  .hero {min-height:365px} .hero::before {background-position:68% center} .hero::after {background:linear-gradient(90deg,#121216df 4%,#121216ac 51%,#12121640),linear-gradient(0deg,#141517b2,transparent 48%)}
  .hero-content {padding-left:14px} .hero-content::before {height:113px}
  .hero-inner {padding-block:34px} .hero-copy {margin-block:17px 22px}
  .summary {grid-template-columns:repeat(2,minmax(0,1fr)); margin:8px 0 32px}
  .summary li {min-height:52px; padding:8px 10px} .summary-label {gap:6px; font-size:.875rem} .summary strong {font-size:1.85rem}
  .summary li:nth-child(3) {border-left:0} .summary li:nth-child(n+3) {border-top:1px solid var(--divider)}
  .section-head h2 {font-size:1.5rem}
  .section-head p {font-size:.875rem}
  .section-head {flex-wrap:wrap}
  .date-switch label {padding-inline:8px}
  .data-table :is(th,td) {padding:8px 10px}
}
@media(max-width:630px) {
  .scroll-hint:not([hidden]) {display:block}
  #race-table {background:linear-gradient(90deg,transparent calc(100% - 12px),#0006); background-attachment:scroll}
  .venue-table tbody th {width:auto; white-space:normal; min-width:7em}
  .venue-filters {gap:8px}
  .foot {align-items:flex-start; flex-direction:column}
}
@media(max-width:380px) {
  .summary li {padding-inline:5px} .summary-label {gap:4px} .summary li>div {gap:2px}
  .nav nav {gap:12px} .clock {gap:4px}
}

.section-page {padding-block:24px 64px; min-height:70vh}
.page-crumb ol {display:flex; gap:10px; list-style:none; margin:0; padding:0; color:var(--muted); font-size:.875rem}
.page-crumb li + li::before {content:''; display:inline-block; width:6px; height:6px; transform:rotate(-45deg); border-right:1px solid currentColor; border-bottom:1px solid currentColor; margin:0 10px 2px 0}
.page-crumb a,.data-note a {color:var(--link); text-decoration:underline; text-underline-offset:.18em}
.page-title {padding-block:16px 24px}
.page-title h1 {font-size:clamp(2rem,4vw,2.75rem); line-height:1.35; font-weight:700; letter-spacing:.01em}
.page-title p {margin-top:8px; max-width:50rem; color:#d0d1d7}
.page-controls,.date-controls {display:flex; align-items:center; flex-wrap:wrap; gap:12px}
.page-controls {padding-block:4px 20px; border-bottom:1px solid var(--divider); margin-bottom:24px; column-gap:24px}
.filter-control :is(input[type='month'],input[type='date']) {width:auto; max-width:100%}
.outline-button {min-height:48px; padding:4px 12px; border:1px solid #888994; border-radius:8px; background:var(--panel); color:var(--text); font-weight:700}
.outline-button:hover {background:#323338; text-decoration:underline}
.page-table-head {display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:12px}
.page-table-head h2 {font-size:1.375rem; line-height:1.4}
.calendar-table {min-width:30rem}
.calendar-table th:first-child {white-space:nowrap}
.result-layout {display:grid; grid-template-columns:1fr 1fr; align-items:start; gap:24px}
.result-layout h3 {font-size:1.125rem; margin:8px 0}
.result-layout .numeric {text-align:right; font-variant-numeric:tabular-nums}
.result-layout td:nth-child(2) {white-space:nowrap}
.result-layout .payout-value {white-space:nowrap; font-weight:700}
.result-layout .table-scroll {min-width:0}
@media(max-width:720px) {
  .result-layout {grid-template-columns:1fr; gap:14px}
  .page-controls,.date-controls {gap:8px}
  .date-controls .filter-control {order:-1; width:100%}
}
