:root {
  color-scheme: light;
  --ink: #131a16;
  --muted: #627067;
  --paper: #f5f4ee;
  --panel: rgba(255, 255, 255, 0.94);
  --line: #d9ded7;
  --green: #0f6b43;
  --green-dark: #0a3c28;
  --gold: #bd8f2f;
  --amber: #f5d681;
  --red: #aa493e;
  --blue: #2f6d93;
  --shadow: 0 20px 60px rgba(15, 27, 19, 0.18);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Noto Sans JP", system-ui, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(15, 107, 67, .08), transparent 340px),
    var(--paper);
}

button, input { font: inherit; }

button:disabled, input:disabled {
  cursor: not-allowed;
  opacity: .64;
}

.shell {
  min-height: 100vh;
  padding-bottom: 50px;
}

.hero {
  position: relative;
  min-height: 500px;
  color: white;
  background: url("./assets/racecourse-hero.png") center / cover no-repeat;
  overflow: hidden;
}

.hero__shade {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 72% 22%, rgba(245, 214, 129, .16), transparent 26%),
    linear-gradient(90deg, rgba(3, 16, 10, .92), rgba(4, 30, 17, .66) 48%, rgba(4, 24, 14, .14)),
    linear-gradient(0deg, rgba(8, 19, 12, .78), transparent 48%);
}

.topbar, .hero__content, .game-layout, .feature-band {
  position: relative;
  width: min(1180px, calc(100% - 32px));
  margin-inline: auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 22px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: white;
  text-decoration: none;
  font-weight: 900;
  letter-spacing: 0;
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255,255,255,.42);
  border-radius: 8px;
  background: rgba(255,255,255,.13);
}

.topbar__actions { display: flex; gap: 10px; }

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255,255,255,.34);
  border-radius: 8px;
  color: white;
  background: rgba(8, 27, 16, .42);
  cursor: pointer;
}

.icon-button:hover { background: rgba(8, 27, 16, .62); }

.icon-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hero__content {
  padding: 86px 0 126px;
  max-width: 1180px;
}

.eyebrow, .section-kicker {
  margin: 0 0 12px;
  color: #f4d681;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

h1 {
  max-width: 850px;
  margin: 0;
  font-size: clamp(38px, 6.8vw, 72px);
  line-height: 1.05;
  letter-spacing: 0;
}

.lead {
  max-width: 740px;
  margin: 22px 0 0;
  color: rgba(255,255,255,.90);
  font-size: 17px;
  line-height: 1.9;
}

.game-layout {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 16px;
  margin-top: -82px;
}

.panel {
  min-width: 0;
  border: 1px solid rgba(214, 219, 211, .88);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.status-panel {
  padding: 22px;
  align-self: start;
}

.scoreline {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.scoreline-single {
  grid-template-columns: 1fr;
}

.scoreline div {
  padding: 14px;
  border-radius: 8px;
  background: #f4f5ef;
}

.muted {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.scoreline strong {
  display: block;
  margin-top: 4px;
  font-size: 30px;
  line-height: 1;
}

.hint {
  min-height: 84px;
  margin: 18px 0 0;
  color: #37423b;
  line-height: 1.75;
}

.data-stats {
  display: grid;
  gap: 8px;
  margin: 20px 0 0;
}

.data-stats div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.data-stats dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.data-stats dd {
  margin: 0;
  font-weight: 900;
}

.affiliate-card {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #e4d6ad;
  border-radius: 8px;
  background: #fff8e5;
}

.affiliate-card[hidden] {
  display: none;
}

.affiliate-card span {
  width: fit-content;
  padding: 3px 7px;
  border-radius: 999px;
  color: #785915;
  background: #f2dda1;
  font-size: 11px;
  font-weight: 900;
}

.affiliate-card strong {
  color: var(--green-dark);
  font-size: 15px;
}

.affiliate-card p {
  margin: 0;
  color: #695d3f;
  font-size: 13px;
  line-height: 1.65;
}

.affiliate-card a {
  display: inline-flex;
  justify-content: center;
  min-height: 38px;
  align-items: center;
  border-radius: 8px;
  color: white;
  background: var(--green);
  text-decoration: none;
  font-size: 13px;
  font-weight: 900;
}

.fanza-banner {
  position: relative;
  margin: 18px auto 0;
  width: min(100%, 660px);
  padding: 10px;
  overflow: hidden;
  border: 1px solid rgba(19, 26, 22, .12);
  border-radius: 8px;
  background: rgba(255, 255, 255, .72);
}

.fanza-banner[hidden] {
  display: none;
}

.fanza-banner__pr {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 1;
  padding: 2px 6px;
  border-radius: 6px;
  color: #626a66;
  background: rgba(255, 255, 255, .86);
  font-size: 10px;
  font-weight: 900;
}

.fanza-banner__widget {
  display: grid;
  min-height: 80px;
  place-items: center;
}

.fanza-banner__widget ins,
.fanza-banner__widget iframe,
.fanza-banner__widget img {
  max-width: 100%;
}

.fanza-banner__fallback-link {
  display: grid;
  min-height: 64px;
  place-items: center;
  color: var(--green-dark);
  text-decoration: none;
  font-weight: 900;
}

.fanza-banner__note {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.play-panel {
  min-width: 0;
  padding: 22px;
}

.play-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.head-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.play-head h2 {
  margin: 0;
  font-size: 25px;
  line-height: 1.25;
}

.play-head .section-kicker {
  margin-bottom: 6px;
  color: var(--gold);
}

.ghost-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--green-dark);
  background: white;
  font-weight: 900;
  cursor: pointer;
}

.ghost-button:hover { border-color: var(--green); }

.guess-form label {
  display: block;
  margin-bottom: 9px;
  font-size: 13px;
  font-weight: 900;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 10px;
  align-items: start;
}

.combobox {
  position: relative;
  min-width: 0;
}

input {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 15px;
  background: white;
  color: var(--ink);
  outline: none;
}

input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(15, 107, 67, .13);
}

.primary-button {
  min-height: 52px;
  border: 0;
  border-radius: 8px;
  color: white;
  background: var(--green);
  font-weight: 900;
  cursor: pointer;
}

.primary-button:hover { background: var(--green-dark); }

.suggestions {
  position: absolute;
  inset-inline: 0;
  top: calc(100% + 8px);
  z-index: 10;
  max-height: 340px;
  overflow-y: auto;
  border: 1px solid rgba(15, 107, 67, .28);
  border-radius: 8px;
  background: white;
  box-shadow: 0 18px 42px rgba(14, 28, 18, .18);
}

.suggestion,
.suggestion-empty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 9px 12px;
  color: var(--ink);
  background: white;
  text-align: left;
}

.suggestion:last-child,
.suggestion-empty:last-child { border-bottom: 0; }

.suggestion { cursor: pointer; }

.suggestion:hover,
.suggestion.is-active {
  background: #eef6ee;
}

.suggestion span {
  font-weight: 900;
}

.suggestion small {
  color: var(--muted);
  font-weight: 800;
  white-space: nowrap;
}

.result-banner {
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid #e4c987;
  border-radius: 8px;
  background: #fff4d3;
  color: #4a3710;
  font-weight: 900;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.legend b {
  width: 10px;
  height: 10px;
  border-radius: 99px;
}

.hit-dot { background: #41a165; }
.near-dot { background: #d6a529; }
.arrow-dot { background: #3f82aa; }

.result-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 14px;
  min-height: 16px;
}

.result-grid span {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  color: white;
  font-size: 10px;
  font-weight: 900;
}

.grid-hit { background: #16834f; }
.grid-hot { background: #c09b2e; }
.grid-warm { background: #3f82aa; }
.grid-cold { background: #89918b; }

.guess-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.empty-state {
  min-height: 150px;
  display: grid;
  place-items: center;
  border: 1px dashed #cbd3ca;
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, .64);
  font-weight: 800;
}

.guess-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.guess-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #f8f9f5;
}

.guess-card__head h3 {
  margin: 2px 0 3px;
  font-size: 20px;
  line-height: 1.25;
}

.guess-card__head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.6;
}

.guess-card__label {
  color: var(--gold) !important;
  text-transform: uppercase;
}

.guess-card__head strong {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  border-radius: 8px;
  color: white;
  background: var(--green);
  font-size: 17px;
}

.clue-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(96px, 1fr));
  gap: 1px;
  background: var(--line);
}

.clue-tile {
  min-height: 86px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  padding: 10px;
  background: #f0f1ee;
}

.clue-tile span {
  color: rgba(19, 26, 22, .68);
  font-size: 11px;
  font-weight: 900;
}

.clue-tile strong {
  display: grid;
  gap: 4px;
  font-size: 15px;
  line-height: 1.2;
  word-break: keep-all;
}

.clue-tile em {
  font-style: normal;
  font-size: 18px;
}

.clue-tile.hit { background: #dff1df; color: #0d5c37; }
.clue-tile.near { background: #fff2c8; color: #725014; }
.clue-tile.miss { background: #f0f1ee; color: #58615a; }
.clue-tile.high,
.clue-tile.low { background: #e8f0f7; color: #24577d; }

.feature-band {
  display: grid;
  grid-template-columns: .92fr 1.08fr;
  gap: 24px;
  margin-top: 34px;
  align-items: start;
}

.feature-band h2 {
  margin: 0 0 10px;
  font-size: 26px;
}

.feature-band p {
  margin: 0;
  color: var(--muted);
  line-height: 1.9;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.mode-grid article {
  min-height: 124px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.mode-grid strong {
  display: block;
  margin-bottom: 8px;
  color: var(--green-dark);
}

.mode-grid span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(360px, calc(100% - 36px));
  padding: 12px 14px;
  border-radius: 8px;
  color: white;
  background: rgba(10, 60, 40, .96);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: .2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 900px) {
  .hero { min-height: 540px; }
  .hero__content { padding-top: 72px; }
  .game-layout, .feature-band { grid-template-columns: 1fr; }
  .game-layout { margin-top: -92px; }
  .mode-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .topbar, .hero__content, .game-layout, .feature-band {
    width: min(100% - 22px, 1180px);
  }
  .brand span:last-child { display: none; }
  .hero__content { padding-bottom: 132px; }
  .input-row { grid-template-columns: 1fr; }
  .primary-button { width: 100%; }
  .status-panel, .play-panel { padding: 16px; }
  .play-head { align-items: center; }
  .play-head h2 { font-size: 21px; }
  .head-actions { flex-direction: column; }
  .clue-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .suggestion { align-items: flex-start; flex-direction: column; gap: 2px; }
}
