
:root {
  --bg: #0f1217;
  --panel: #11151a;
  --panel-soft: #141920;
  --line: #303640;
  --line-soft: #272c34;
  --text: #f4f7fb;
  --muted: #a3a8b1;
  --cyan: #66d9ff;
  --green: #58e89a;
  --orange: #ff9f43;
  --red: #ff6b6b;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family:
    "Segoe UI", "Yu Gothic UI", "Hiragino Kaku Gothic ProN",
    "Meiryo", sans-serif;
}

body {
  background: linear-gradient(180deg, #0e1116 0%, #0f1217 100%);
}

button { font: inherit; }

.app-shell {
  width: min(1304px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 36px;
}

.site-header {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 12px;
}

.brand-wrap {
  display: flex;
  align-items: center;
  min-height: 52px;
}

.axis-logo {
  display: block;
  max-height: 49px;
  width: auto;
  max-width: 245px;
  object-fit: contain;
}

.brand-fallback {
  display: none;
  align-items: baseline;
  gap: 10px;
  letter-spacing: .08em;
}

.brand-axis {
  font-size: 35px;
  font-weight: 900;
}

.brand-system {
  font-size: 14px;
  color: var(--cyan);
  font-weight: 700;
  letter-spacing: .16em;
}


.selector-section {
  margin-top: 12px;
}

.section-title {
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 8px;
}

.venue-grid {
  display: grid;
  grid-template-columns: repeat(var(--venue-count, 2), minmax(0, 1fr));
  gap: 16px;
}

.race-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
}

.ui-btn,
.jump-btn {
  color: var(--text);
  background: #12161c;
  border: 1px solid #3a414c;
  border-radius: 8px;
  min-height: 32px;
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease;
}

.ui-btn:hover,
.jump-btn:hover {
  border-color: #68717e;
}

.ui-btn.active {
  font-weight: 900;
}

.venue-grid .ui-btn.active::before {
  content: "●";
  margin-right: 2px;
}

.race-grid .ui-btn.active::before {
  content: "▶";
  font-size: 10px;
  margin-right: 1px;
}

.ui-btn:disabled,
.jump-btn:disabled {
  opacity: .35;
  cursor: default;
}

.race-selector {
  margin-top: 20px;
}

.race-jump {
  display: grid;
  grid-template-columns: 315px 1fr 315px;
  gap: 18px;
  align-items: center;
  margin: 16px 0 26px;
}

.jump-current {
  text-align: center;
  font-weight: 900;
  font-size: 16px;
}

.jump-btn {
  min-height: 33px;
  font-weight: 700;
}

.race-heading {
  border-top: 1px solid var(--line-soft);
  padding-top: 18px;
  margin-top: 4px;
  margin-bottom: 14px;
}

.race-heading-main {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: baseline;
  font-size: 25px;
  font-weight: 900;
  letter-spacing: .01em;
}

.race-domain {
  margin-top: 5px;
  color: var(--muted);
  font-size: 15px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 15px;
  margin-bottom: 16px;
}

.summary-card {
  min-height: 82px;
  padding: 13px 12px 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 14px;
}

.summary-label {
  color: #9da3ad;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .06em;
  margin-bottom: 6px;
}

.summary-value {
  font-size: 18px;
  line-height: 1.25;
  font-weight: 900;
}

.cards-wrap {
  overflow-x: auto;
  scrollbar-width: thin;
}

.cards-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 15px;
  min-width: 1040px;
}

.rank-card {
  min-height: 300px;
  padding: 14px 12px 13px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
}

.rank-card.r1 {
  border-width: 2px;
  border-color: #31363d;
}

.rank-head {
  display: block;
}

.rank-label {
  color: #a4a8af;
  font-size: 11px;
  font-weight: 800;
  margin-bottom: 5px;
}

.horse-no {
  font-size: 20px;
  font-weight: 900;
  line-height: 1.1;
}

.horse-name {
  font-size: 18px;
  font-weight: 900;
  line-height: 1.25;
  min-height: 46px;
  margin-top: 2px;
}

.score-block {
  margin-top: 30px;
}

.score-label {
  color: #989da5;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .06em;
}

.score-value {
  transition: color .2s ease, text-shadow .2s ease;
  font-size: 38px;
  line-height: 1.08;
  font-weight: 900;
  margin-top: 4px;
  letter-spacing: -.02em;
}

.market-line {
  margin-top: 7px;
  padding-top: 11px;
  border-top: 1px solid #282d34;
  font-size: 15px;
  font-weight: 900;
}

.capture-line {
  margin-top: 6px;
  color: #7d8189;
  font-size: 10px;
}

.r1-alert-line {
  margin-top: 13px;
  font-size: 12px;
  font-weight: 900;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.structure-green { color: var(--green); }
.structure-yellow { color: #facc15; }
.structure-orange { color: var(--orange); }
.structure-red { color: var(--red); }
.expect-orange { color: var(--orange); }
.expect-red { color: var(--red); }

.role {
  align-self: flex-start;
  display: inline-block;
  margin-top: 13px;
  padding: 5px 8px;
  border: 1px solid #3a414a;
  border-radius: 999px;
  font-size: 10px;
  line-height: 1;
  font-weight: 900;
  color: #fff;
}

.result-line {
  margin-top: 11px;
  color: #858b94;
  font-size: 11px;
}


.error-box {
  margin-top: 20px;
  border: 1px solid #703838;
  background: #281718;
  color: #ffd1d1;
  padding: 12px 14px;
  border-radius: 10px;
}

.hidden { display: none; }

@media (max-width: 900px) {
  .race-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
  }

  .race-jump {
    grid-template-columns: 1fr auto 1fr;
  }
}

@media (max-width: 700px) {
  .app-shell {
    width: min(100% - 16px, 1304px);
    padding-top: 8px;
  }

  .site-header {
    min-height: 54px;
  }

  .axis-logo {
    max-width: 190px;
    max-height: 40px;
  }

  .brand-axis {
    font-size: 29px;
  }

  .updated {
    font-size: 10px;
  }

  .venue-grid {
    gap: 8px;
  }

  .race-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .race-jump {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 18px;
  }

  .jump-current {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  #prevRace {
    grid-column: 1;
    grid-row: 2;
  }

  #nextRace {
    grid-column: 2;
    grid-row: 2;
  }

  .race-heading-main {
    gap: 12px;
    font-size: 22px;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .cards-row {
    display: flex;
    gap: 10px;
    min-width: 0;
  }

  .rank-card {
    flex: 0 0 78vw;
    min-width: 255px;
  }
}
