:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #e2e8f0;
  --text: #334155;
  --text-muted: #64748b;
  --line: #e2e8f0;
  --accent: #005A9C;
  --accent-strong: #004170;
  --accent-glow: rgba(0, 90, 156, 0.08);
  --red: #EF3340;
  --gold: #bf913c;
  --blue: #005A9C;
  --green: #248a3d;
  --radius: 20px;
  --max: 1120px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Kaku Gothic ProN", "Yu Gothic UI", Meiryo, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  letter-spacing: 0.02em;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

.container {
  width: min(100% - 32px, var(--max));
  margin: 0 auto;
}

/* ── Header ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--line);
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  flex-wrap: nowrap;
}

.brand {
  font-weight: 700;
  font-size: 17px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: opacity 0.2s;
  flex-shrink: 0;
}

.brand:hover { opacity: 0.8; }

.brand__logo {
  height: 36px;
  width: auto;
}

.brand__text {
  color: var(--text);
}

.brand__text span {
  color: var(--accent);
}

.nav {
  display: flex;
  gap: 4px;
  font-size: 13px;
  align-items: center;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar {
  display: none;
}

.nav a {
  padding: 6px 12px;
  border-radius: 8px;
  color: var(--text-muted);
  transition: all 0.2s;
  font-weight: 500;
  white-space: nowrap;
}

.nav a:hover,
.nav a.active {
  color: var(--text);
  background: var(--surface-2);
}

.nav a.active {
  color: var(--accent);
  background: var(--accent-glow);
}

/* Hamburger (Mobile) */
.menu-trigger {
  display: none;
  width: 28px;
  height: 22px;
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 100;
}

@media (max-width: 900px) {
  .menu-trigger { display: block; }
  .nav {
    display: none; /* simple toggle handled by JS */
    flex-direction: column;
    position: absolute;
    top: 60px;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
    padding: 16px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
  }
  body.is-menu-open .nav {
    display: flex;
    animation: slideDown 0.3s ease;
  }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.menu-trigger span {
  display: block;
  width: 100%;
  height: 2px;
  background-color: var(--text);
  position: absolute;
  left: 0;
  transition: 0.3s ease;
}

.menu-trigger span:nth-child(1) { top: 0; }
.menu-trigger span:nth-child(2) { top: 10px; }
.menu-trigger span:nth-child(3) { bottom: 0; }

body.is-menu-open .menu-trigger span:nth-child(1) {
  transform: translateY(10px) rotate(45deg);
}
body.is-menu-open .menu-trigger span:nth-child(2) { opacity: 0; }
body.is-menu-open .menu-trigger span:nth-child(3) {
  transform: translateY(-10px) rotate(-45deg);
}

/* ── Hero Main (Stadium Background) ── */
.hero-main {
  background: none;
  position: relative;
  color: #ffffff;
  padding: 120px 0 100px;
  overflow: hidden;
  text-align: center;
}

.hero-main::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url('../images/stadium_hero.png');
  background-size: cover;
  background-position: center;
  opacity: 0.65;
  filter: blur(2px) brightness(0.75);
  z-index: -1;
}

.hero-main::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0.7) 100%);
  z-index: 0;
  pointer-events: none;
}

.hero-main .hero__inner {
  z-index: 2;
  position: relative;
}

.hero-main h1 {
  font-size: clamp(28px, 5vw, 52px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
  font-weight: 800;
  color: #ffffff !important;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
}

.hero-main h1 .accent {
  color: var(--accent);
}

.hero-main .subtitle {
  color: rgba(255,255,255,0.9);
  font-size: clamp(15px, 1.6vw, 19px);
  max-width: 680px;
  margin: 0 auto 28px;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
}

.hero-main .label {
  font-size: 12px;
  color: #ff4d7a;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 12px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

/* ── Section & View Navigation ── */
.content-container {
  margin-top: 64px;
}

/* ── Quick Nav (Hero Menu) ── */
.quick-nav {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 24px 0;
}

.quick-nav a {
  padding: 8px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  backdrop-filter: blur(4px);
  transition: all 0.2s;
}

.quick-nav a:hover {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow);
}

.quick-nav a.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 15px var(--accent-glow), 0 0 5px var(--accent);
  transform: translateY(-1px);
}

.section {
  padding: 48px 0;
}

.section-label {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.section h2 {
  font-size: clamp(22px, 3vw, 34px);
  letter-spacing: -0.01em;
  margin-bottom: 24px;
  font-weight: 700;
}

/* ── Player Selector ── */
.player-selector {
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.player-selector label {
  font-weight: 600;
  color: var(--text);
  font-size: 14px;
}
.premium-select {
  padding: 10px 16px;
  font-size: 15px;
  font-family: inherit;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  min-width: 250px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 5px rgba(0,0,0,0.02);
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1em;
}
.premium-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ── Stats Tables ── */
.stats-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.02);
}

.stats-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 600px;
}

.stats-table thead th {
  text-align: center; /* default center for numbers */
  font-weight: 600;
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 10px;
  border-bottom: 2px solid var(--line);
  white-space: nowrap;
}

.stats-table tbody td {
  text-align: center; /* default center for numbers */
  padding: 12px 10px;
  border-bottom: 1px solid rgba(221, 213, 200, 0.7);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.stats-table tbody tr:last-child td {
  border-bottom: none;
}

.stats-table tbody tr:hover {
  background: rgba(215, 0, 53, 0.02);
}

/* Sortable Table */
.sortable-table th {
  cursor: pointer;
  user-select: none;
  transition: color 0.2s;
}
.sortable-table th:hover {
  color: var(--text);
}
.sortable-table th .sort-icon {
  display: inline-block;
  margin-left: 5px;
  font-size: 10px;
  width: 12px;
  opacity: 0.5;
}
.sortable-table th.active-sort {
  color: var(--accent);
  font-weight: 700;
}
.sortable-table th.active-sort .sort-icon {
  opacity: 1;
}

/* Links inside tables */
.player-link {
  color: var(--accent);
  font-weight: 600;
  transition: color 0.2s;
}
.player-link:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

/* ── Animation Classes ── */
.fade {
  animation: fadeIn 0.8s ease forwards;
}

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

.view-section {
  animation: viewFadeIn 0.3s ease forwards;
}

@keyframes viewFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Check active fix */
.fade.is-in {
  opacity: 1;
  transform: translateY(0);
}

/* ══════════════════════════════════════════════
   Responsive: Tablet (768px and below)
   ══════════════════════════════════════════════ */
@media (max-width: 768px) {
  .container {
    width: min(100% - 24px, var(--max));
  }

  .hero-main {
    padding: 72px 0 56px;
  }

  .hero-main h1 {
    font-size: clamp(22px, 6vw, 36px);
    margin-bottom: 12px;
  }

  .hero-main .subtitle {
    font-size: 14px;
    margin-bottom: 20px;
  }

  .content-container {
    margin-top: 40px;
  }

  .section {
    padding: 32px 0;
  }

  .section h2 {
    font-size: clamp(18px, 4vw, 26px);
    margin-bottom: 16px;
  }

  .section-label {
    font-size: 11px;
    margin-bottom: 6px;
  }

  .stats-card {
    padding: 16px;
    border-radius: 14px;
    margin-bottom: 16px;
  }

  .stats-table {
    font-size: 12px;
    min-width: 500px;
  }

  .stats-table thead th {
    padding: 10px 6px;
    font-size: 10px;
  }

  .stats-table tbody td {
    padding: 10px 6px;
  }

  .player-selector {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 16px;
  }

  .premium-select {
    min-width: 100%;
    font-size: 14px;
    padding: 10px 14px;
  }

  footer .nav {
    gap: 4px;
  }
  footer .nav a {
    font-size: 12px;
    padding: 5px 8px;
  }

  .quick-nav {
    gap: 5px;
  }
  .quick-nav a {
    padding: 7px 14px;
    font-size: 13px;
  }
}

/* ══════════════════════════════════════════════
   Responsive: Mobile (480px and below)
   ══════════════════════════════════════════════ */
@media (max-width: 480px) {
  .container {
    width: min(100% - 16px, var(--max));
  }

  .topbar__inner {
    height: 52px;
  }

  .brand__logo {
    height: 28px;
  }

  .brand {
    font-size: 14px;
    gap: 8px;
  }

  .hero-main {
    padding: 56px 0 40px;
  }

  .hero-main h1 {
    font-size: clamp(20px, 7vw, 28px);
    line-height: 1.25;
  }

  .hero-main .subtitle {
    font-size: 13px;
  }

  .hero-main .label {
    font-size: 10px;
    margin-bottom: 8px;
  }

  .content-container {
    margin-top: 28px;
  }

  .section {
    padding: 20px 0;
  }

  .section h2 {
    font-size: clamp(16px, 5vw, 22px);
    margin-bottom: 12px;
  }

  .stats-card {
    padding: 12px;
    border-radius: 12px;
    margin-bottom: 12px;
  }

  .stats-table {
    font-size: 11px;
    min-width: 420px;
  }

  .stats-table thead th {
    padding: 8px 4px;
    font-size: 9px;
    letter-spacing: 0.02em;
  }

  .stats-table tbody td {
    padding: 8px 4px;
  }

  .player-selector label {
    font-size: 13px;
  }

  .premium-select {
    padding: 8px 12px;
    font-size: 13px;
    border-radius: 10px;
  }

  footer .container {
    padding: 24px 0 !important;
  }

  footer .nav {
    gap: 2px;
    margin-bottom: 16px !important;
  }

  footer .nav a {
    font-size: 11px;
    padding: 4px 6px;
  }

  .quick-nav {
    gap: 8px;
    justify-content: flex-start;
    overflow-x: auto;
    padding: 4px 16px;
    -ms-overflow-style: none;
    scrollbar-width: none;
    margin: 16px -16px;
    width: calc(100% + 32px);
    display: flex;
    flex-wrap: nowrap;
  }
  .quick-nav::-webkit-scrollbar {
    display: none;
  }
  .quick-nav a {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 8px 14px;
    font-size: 13px;
  }
}

/* ══════════════════════════════════════════════
   Mobile menu adjustments for smaller screens
   ══════════════════════════════════════════════ */
@media (max-width: 900px) {
  .nav a {
    padding: 10px 16px;
    font-size: 14px;
    border-radius: 8px;
  }
  .nav a.active {
    color: var(--accent);
    background: var(--accent-glow);
    font-weight: 700;
  }

  /* Footer nav stays visible and wraps */
  footer .nav {
    display: flex !important;
    flex-direction: row;
    position: static;
    background: none;
    backdrop-filter: none;
    border-bottom: none;
    padding: 0;
    box-shadow: none;
    flex-wrap: wrap;
  }
  footer .nav a {
    font-size: 12px;
    padding: 6px 10px;
  }
}
