:root {
  color-scheme: light;
  --navy: #0D1526;
  --navy-2: #16213E;
  --gold: #D4AF37;
  --gold-light: #F0D688;
  --gold-dark: #B8901F;
  --cream: #FAF7F0;
  --ink: #1C2434;
  --muted: #6b6250;
  --border: #E7E1D2;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "Noto Sans JP", "Hiragino Sans", "Yu Gothic", sans-serif;
  background: var(--cream);
  color: var(--ink);
  line-height: 1.8;
}

a { color: inherit; }

img, svg { max-width: 100%; }

/* ===== header ===== */
.site-header {
  background: var(--navy);
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

.nav-wrap {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
}

.brand { display: flex; align-items: center; text-decoration: none; }
.brand .logo-mark-lockup { width: auto; height: 38px; flex-shrink: 0; }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 6px;
  width: 40px;
  height: 40px;
  padding: 0;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.nav-toggle span,
.nav-toggle span::before,
.nav-toggle span::after {
  content: "";
  display: block;
  width: 18px;
  height: 2px;
  background: #fff;
  position: relative;
  transition: transform 0.2s, opacity 0.2s;
}
.nav-toggle span::before { position: absolute; top: -6px; }
.nav-toggle span::after { position: absolute; top: 6px; }

.site-header nav ul {
  list-style: none;
  display: flex;
  gap: 22px;
  margin: 0;
  padding: 0;
}

.site-header nav a {
  color: #d8d3c4;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-decoration: none;
}
.site-header nav a:hover,
.site-header nav a.active { color: var(--gold-light); }
.site-header nav a.active { font-weight: 700; }

@media (max-width: 760px) {
  .nav-toggle { display: flex; }
  .site-header nav {
    display: none;
    width: 100%;
    padding: 0 20px 16px;
  }
  .site-header nav.nav-open { display: block; }
  .site-header nav ul { flex-direction: column; gap: 0; }
  .site-header nav ul li { border-top: 1px solid rgba(255,255,255,0.08); }
  .site-header nav ul li a { display: block; padding: 12px 4px; }
  .nav-wrap { flex-wrap: wrap; }
}

/* ===== hero ===== */
.hero {
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 60%, #1c2a4a 100%);
  color: #fff;
  padding: 56px 20px 64px;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute; right: -80px; top: -80px;
  width: 320px; height: 320px; border-radius: 50%;
  background: radial-gradient(circle, rgba(212,175,55,0.14) 0%, transparent 70%);
}
.hero-inner {
  max-width: 1100px; margin: 0 auto; position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: space-between; gap: 40px;
}
.hero-text { min-width: 0; }
.hero-logo {
  flex-shrink: 0;
  height: 340px; width: auto;
  opacity: 0.95;
}
@media (max-width: 900px) {
  .hero-logo { display: none; }
}
.eyebrow {
  display: inline-block;
  font-size: 11px; letter-spacing: 3px; color: var(--gold-light);
  border: 1px solid rgba(240,214,136,0.4);
  padding: 5px 12px; border-radius: 999px;
  margin-bottom: 20px;
}
.hero-title {
  font-size: clamp(26px, 6vw, 38px);
  font-weight: 900; line-height: 1.5; max-width: 640px; margin: 0;
  color: #fff;
}
.hero-title .accent { color: var(--gold-light); }
.hero-desc { margin-top: 18px; font-size: 14.5px; color: #c5c0ae; max-width: 520px; }
.hero-cta { margin-top: 30px; display: flex; gap: 14px; flex-wrap: wrap; }

.btn {
  display: inline-block;
  padding: 13px 26px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.5px;
  text-decoration: none;
  border: none;
  cursor: pointer;
}
.btn-primary { background: linear-gradient(135deg, var(--gold-light), var(--gold)); color: var(--navy); }
.btn-outline { border: 1px solid rgba(255,255,255,0.35); color: #fff; }

.stats-row { display: flex; gap: 32px; margin-top: 44px; flex-wrap: wrap; }
.stats-row .num { font-size: 24px; font-weight: 900; color: var(--gold-light); }
.stats-row .label { font-size: 10.5px; color: #a9a48f; letter-spacing: 1px; margin-top: 4px; }

/* ===== generic sections ===== */
main { max-width: 880px; margin: 0 auto; padding: 40px 20px; }
main.wide { max-width: 1100px; }

.section-head { text-align: center; margin-bottom: 32px; }
.section-eyebrow { font-size: 11px; color: var(--gold-dark); letter-spacing: 3px; font-weight: 700; }
.section-title { font-size: 22px; font-weight: 900; margin: 8px 0 0; color: var(--navy); }
.section-desc { font-size: 12.5px; color: var(--muted); margin-top: 8px; }

h1 { font-size: 24px; font-weight: 900; color: var(--navy); margin-top: 0; }
h2 { font-size: 18px; font-weight: 700; color: var(--navy); }

/* ===== race cards (top page) ===== */
.race-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 900px) { .race-grid { grid-template-columns: 1fr; } }

.race-card {
  background: #fff; border-radius: 14px; overflow: hidden;
  box-shadow: 0 4px 20px rgba(13,21,38,0.08);
  border: 1px solid rgba(13,21,38,0.06);
  text-decoration: none; color: inherit; display: block;
}
.race-card-head {
  background: var(--navy); color: #fff; padding: 14px 18px;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.race-venue { font-size: 12px; color: var(--gold-light); letter-spacing: 1px; }
.race-badge {
  font-size: 10px; background: var(--gold); color: var(--navy);
  padding: 3px 10px; border-radius: 999px; font-weight: 700; white-space: nowrap;
}
.race-badge.locked { background: rgba(255,255,255,0.15); color: #d8d3c4; }
.race-body { padding: 18px; }
.race-name { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.race-time { font-size: 12px; color: var(--muted); margin-bottom: 14px; }
.pick-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 0; border-top: 1px solid #f0ece0; font-size: 13px;
}
.pick-row:first-of-type { border-top: none; }
.pick-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 6px; font-size: 10.5px; font-weight: 900;
  color: #fff; margin-right: 8px;
}
.pick-mark.mark-1 { background: var(--gold-dark); }
.pick-mark.mark-2 { background: #8a8065; }
.pick-mark.mark-3 { background: #b8b2a0; }
.score { color: var(--gold-dark); font-weight: 700; font-size: 12px; }
.card-footer {
  padding: 12px 18px; border-top: 1px solid #f0ece0;
  font-size: 12px; color: var(--gold-dark); font-weight: 700; text-align: center;
}

/* ===== simple list of races (predictions_list) ===== */
.race-list { list-style: none; padding: 0; margin: 0; }
.race-list-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 16px; margin-bottom: 10px;
  text-decoration: none; color: inherit;
}
.race-list-main { min-width: 0; }
.race-list-date { font-size: 11.5px; color: var(--muted); }
.race-list-name { font-weight: 700; font-size: 14.5px; margin-top: 2px; }
.race-list-time { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.race-list-side { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.tag {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.tag-open { background: #e9f0e6; color: #3a6b3f; }
.tag-partial { background: #fbeecb; color: var(--gold-dark); }
.tag-hidden { background: #eee; color: #777; }

/* ===== tables ===== */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 1rem 0; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-size: 12px; font-weight: 700; }

/* ===== mode explainer box ===== */
.mode-box {
  background: #fff; border-radius: 14px; padding: 26px;
  border: 1px dashed var(--gold);
  display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap;
}
.mode-tag {
  font-size: 11px; font-weight: 700; background: var(--navy); color: var(--gold-light);
  padding: 4px 12px; border-radius: 999px; letter-spacing: 1px; white-space: nowrap;
}
.mode-box p { font-size: 13px; color: var(--muted); margin: 8px 0 0; }

/* ===== notices / forms ===== */
.notice {
  background: #fbeecb;
  border: 1px solid #f0d78a;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 16px;
  font-size: 14px;
}

.login-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.login-form input {
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  flex: 1 1 200px;
}
.login-form button {
  padding: 11px 22px;
  border: none;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  color: var(--navy);
  font-weight: 700;
  cursor: pointer;
}
.error { color: #b3261e; font-size: 13px; margin-top: 8px; }
.lock-hint { font-size: 12px; color: var(--muted); margin-top: 10px; }

[hidden] { display: none !important; }

/* ===== rationale popup (hidden trigger on race title) ===== */
.race-title-trigger { cursor: pointer; }

.rationale-modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(13,21,38,0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.rationale-modal-box {
  background: #fff; border-radius: 12px; padding: 24px;
  width: 100%; max-width: 360px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.rationale-modal-form input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 15px;
}
.rationale-modal-form input.shake {
  animation: rationale-shake 0.3s;
  border-color: #b3261e;
}
.rationale-modal-text { font-size: 14px; margin: 0; white-space: pre-wrap; }

@keyframes rationale-shake {
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ===== footer ===== */
.site-footer { background: var(--navy); color: #a9a48f; padding: 36px 20px 24px; margin-top: 40px; }
.footer-inner { max-width: 1100px; margin: 0 auto; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; font-size: 12px; }
.footer-links a { text-decoration: none; color: #c5c0ae; }
.footer-links a:hover { color: var(--gold-light); }
.footer-disclaimer { font-size: 11px; margin-top: 18px; color: #5f5a4c; line-height: 1.9; max-width: 1100px; margin-left: auto; margin-right: auto; }
