*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #0a0a0a;
  --card-bg: #141414;
  --accent: #e63946;
  --gold: #f4a623;
  --text: #f0f0f0;
  --text-dim: #888;
  --vs: #e63946;
}

body {
  font-family: 'Noto Sans JP', 'Oswald', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

.bg-noise {
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(255,255,255,0.015) 2px,
    rgba(255,255,255,0.015) 4px
  );
  pointer-events: none;
  z-index: 0;
}

/* ===== HEADER ===== */
.site-header {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 48px 20px 24px;
  background: linear-gradient(180deg, rgba(230,57,70,0.15) 0%, transparent 100%);
}

.site-header--compact {
  padding: 16px 20px 8px;
}

.event-title--compact {
  font-size: clamp(1.6rem, 5vw, 2.4rem);
}

.site-header--compact .event-subtitle {
  font-size: clamp(0.55rem, 1.2vw, 0.7rem);
  margin-top: 0;
}

.event-title {
  font-family: 'Oswald', sans-serif;
  font-size: clamp(3rem, 8vw, 6rem);
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text);
  text-shadow: 0 0 40px rgba(230,57,70,0.5), 0 0 80px rgba(230,57,70,0.2);
}

.event-subtitle {
  font-family: 'Oswald', sans-serif;
  font-size: clamp(0.8rem, 2vw, 1.1rem);
  letter-spacing: 0.4em;
  color: var(--gold);
  margin-top: 4px;
}

/* ===== HEADER LINK ===== */
.header-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

/* ===== MATCH NAV ===== */
.match-nav {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 0 16px 12px;
  max-width: 960px;
  margin: 0 auto;
}

.match-nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 20px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  background: var(--card-bg);
  text-decoration: none;
  color: var(--text-dim);
  transition: all 0.2s;
  flex: 1;
  max-width: 180px;
}

.match-nav-link:hover {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(230,57,70,0.08);
}

.match-nav-link.active {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(230,57,70,0.15);
  box-shadow: 0 0 20px rgba(230,57,70,0.15);
}

.nav-num {
  font-family: 'Oswald', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1;
  color: var(--accent);
}

.match-nav-link.active .nav-num {
  color: var(--gold);
}

.nav-label {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
}

@media (max-width: 600px) {
  .match-nav {
    gap: 4px;
    padding: 0 8px 12px;
  }

  .match-nav-link {
    padding: 8px 10px;
  }

  .nav-num {
    font-size: 1.1rem;
  }

  .nav-label {
    font-size: 0.6rem;
  }
}

/* ===== MATCHES ===== */
.matches-container {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 20px 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* ===== INDEX 2x2 グリッド ===== */
.matches-grid {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 8px 12px 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.matches-grid .match-card {
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.matches-grid .match-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(230,57,70,0.15);
}

.matches-grid .match-card a {
  text-decoration: none;
  color: inherit;
  display: block;
}

.matches-grid .match-label {
  padding: 4px 0;
  font-size: 0.7rem;
}

.matches-grid .match-body {
  padding: 10px 8px;
  gap: 6px;
}

.matches-grid .fighter-photo-wrap {
  width: 60px;
  border-width: 2px;
}

.matches-grid .fighter-photo-wrap--placeholder {
  font-size: 1.6rem;
}

.matches-grid .fighter {
  grid-template-rows: auto minmax(2em, auto) auto;
  gap: 4px;
}

.matches-grid .fighter-name {
  font-size: clamp(0.65rem, 1.5vw, 0.85rem);
  line-height: 1.2;
}

.matches-grid .fighter-odds {
  font-size: clamp(1.4rem, 3.5vw, 2rem);
}

.matches-grid .fighter-odds span {
  font-size: 0.45em;
}

.matches-grid .vs-text {
  font-size: 0.9rem;
}

.matches-grid .vs-divider::before,
.matches-grid .vs-divider::after {
  height: 10px;
}

/* index フッターもコンパクトに */
.index-page .site-footer {
  padding: 8px 20px;
  font-size: 0.65rem;
  gap: 6px;
}

.index-page .refresh-btn {
  padding: 4px 16px;
  font-size: 0.7rem;
}

@media (max-width: 600px) {
  .matches-grid {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 6px 8px 10px;
  }

  .matches-grid .match-body {
    padding: 8px 6px;
  }

  .matches-grid .fighter-photo-wrap {
    width: 50px;
  }

  .matches-grid .fighter-odds {
    font-size: clamp(1.2rem, 5vw, 1.6rem);
  }
}

/* Loading */
.loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
  font-family: 'Oswald', sans-serif;
  letter-spacing: 0.2em;
  font-size: 0.9rem;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(230,57,70,0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== MATCH CARD ===== */
.match-card {
  background: var(--card-bg);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  overflow: hidden;
  animation: fadeInUp 0.5s ease both;
}

.match-card:nth-child(1) { animation-delay: 0.1s; }
.match-card:nth-child(2) { animation-delay: 0.2s; }
.match-card:nth-child(3) { animation-delay: 0.3s; }
.match-card:nth-child(4) { animation-delay: 0.4s; }

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.match-label {
  background: var(--accent);
  color: #fff;
  text-align: center;
  padding: 6px 0;
  font-family: 'Oswald', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.25em;
  text-transform: uppercase;
}

.match-body {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 24px 16px;
  gap: 12px;
}

/* Fighter */
.fighter {
  display: grid;
  grid-template-rows: auto minmax(2.6em, auto) auto;
  align-items: start;
  justify-items: center;
  gap: 12px;
  text-align: center;
}

.fighter--left {
  justify-self: center;
}

.fighter--right {
  justify-self: center;
}

.fighter-photo-wrap {
  width: 120px;
  border-radius: 12px;
  overflow: hidden;
  border: 3px solid rgba(255,255,255,0.1);
  background: #222;
  flex-shrink: 0;
}

.fighter-photo-wrap img {
  width: 100%;
  height: auto;
  display: block;
}

.fighter-photo-wrap--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 2.4rem;
}

.fighter-name {
  font-weight: 900;
  font-size: clamp(0.95rem, 2.5vw, 1.25rem);
  line-height: 1.3;
  word-break: keep-all;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fighter-odds {
  font-family: 'Oswald', sans-serif;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
}

.fighter-odds span {
  font-size: 0.5em;
  color: var(--text-dim);
  font-weight: 400;
  margin-left: 2px;
}

/* VS divider */
.vs-divider {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.vs-divider::before,
.vs-divider::after {
  content: '';
  width: 2px;
  height: 24px;
  background: linear-gradient(to bottom, transparent, var(--accent), transparent);
}

.vs-text {
  font-family: 'Oswald', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--vs);
  text-shadow: 0 0 20px rgba(230,57,70,0.6);
}

/* ===== FOOTER ===== */
.site-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 20px;
  color: var(--text-dim);
  font-size: 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.refresh-btn {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 8px 24px;
  border-radius: 6px;
  font-family: 'Oswald', sans-serif;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.2s;
}

.refresh-btn:hover {
  background: var(--accent);
  color: #fff;
}

.refresh-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ===== ERROR ===== */
.error-msg {
  text-align: center;
  padding: 40px 20px;
  color: var(--accent);
  font-size: 0.9rem;
}

/* ===== RESPONSIVE (index) ===== */
@media (max-width: 600px) {
  .match-body {
    grid-template-columns: 1fr auto 1fr;
    padding: 20px 10px;
    gap: 8px;
  }

  .fighter-photo-wrap {
    width: 80px;
  }

  .vs-divider::before,
  .vs-divider::after {
    height: 16px;
  }

  .vs-text {
    font-size: 1.2rem;
  }
}

/* ============================================================
   個別試合ページ (.match-page)
   ============================================================ */

/* ヒーロー: ビューポート全体に選手カードを中央配置 */
.match-page .match-hero {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 16px 80px;
}

/* BOUT ラベル（上部に薄く表示） */
.match-hero-label {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Oswald', sans-serif;
  font-size: clamp(0.7rem, 1.5vw, 0.85rem);
  font-weight: 700;
  letter-spacing: 0.4em;
  color: var(--accent);
  opacity: 0.6;
}

/* カードを大きく表示 */
.match-page .match-card {
  background: transparent;
  border: none;
  border-radius: 0;
  width: 100%;
  max-width: 700px;
}

.match-page .match-label {
  display: none;
}

.match-page .match-body {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0;
  gap: 20px;
}

/* 写真をかなり大きく */
.match-page .fighter-photo-wrap {
  width: clamp(140px, 35vw, 260px);
  border-width: 3px;
  border-color: rgba(255,255,255,0.15);
}

.match-page .fighter-photo-wrap--placeholder {
  font-size: 4.5rem;
}

/* 名前を大きく・行揃え */
.match-page .fighter {
  grid-template-rows: auto minmax(3.6em, auto) auto;
}

.match-page .fighter-name {
  font-size: clamp(1.2rem, 3.5vw, 1.8rem);
  font-weight: 900;
}

/* オッズを大きく */
.match-page .fighter-odds {
  font-size: clamp(2.8rem, 8vw, 4.5rem);
}

/* VS を大きく */
.match-page .vs-text {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
}

.match-page .vs-divider::before,
.match-page .vs-divider::after {
  height: 36px;
}

/* ===== 下部フッター ===== */
.match-page-footer {
  position: relative;
  z-index: 1;
  padding: 20px 16px 24px;
  border-top: 1px solid rgba(255,255,255,0.04);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.mp-event-name {
  font-family: 'Oswald', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.2s;
}

.mp-event-name:hover {
  color: var(--text);
}

/* ナビ: index.htmlと同じカード型 */
.mp-nav {
  display: flex;
  justify-content: center;
  gap: 8px;
  max-width: 960px;
  width: 100%;
}

.mp-nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 20px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  background: var(--card-bg);
  text-decoration: none;
  color: var(--text-dim);
  transition: all 0.2s;
  flex: 1;
  max-width: 180px;
}

.mp-nav-link:hover {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(230,57,70,0.08);
}

.mp-nav-link.active {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(230,57,70,0.15);
  box-shadow: 0 0 20px rgba(230,57,70,0.15);
}

.mp-nav-num {
  font-family: 'Oswald', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1;
  color: var(--accent);
}

.mp-nav-link.active .mp-nav-num {
  color: var(--gold);
}

.mp-nav-label {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
}

.mp-meta {
  font-size: 0.7rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 8px;
}

.mp-refresh {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 4px 14px;
  border-radius: 6px;
  font-family: 'Oswald', sans-serif;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.mp-refresh:hover {
  background: var(--accent);
  color: #fff;
}

/* ===== 個別ページ レスポンシブ ===== */
@media (max-width: 600px) {
  .match-page .match-hero {
    padding: 16px 10px 60px;
  }

  .match-page .match-body {
    gap: 10px;
  }

  .match-page .fighter-photo-wrap {
    width: 110px;
  }

  .match-page .vs-divider::before,
  .match-page .vs-divider::after {
    height: 20px;
  }

  .match-page-footer {
    gap: 10px;
  }

  .mp-nav {
    gap: 4px;
  }

  .mp-nav-link {
    padding: 8px 10px;
  }

  .mp-nav-num {
    font-size: 1.1rem;
  }

  .mp-nav-label {
    font-size: 0.6rem;
  }
}
