/* ── Reset & Base ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f5f5f5;
  --white: #ffffff;
  --border: #e4e5e9;
  --text: #111318;
  --text-2: #4a4d5a;
  --text-3: #9195a1;
  --accent: #111318;
  --today-dot: #111318;
  --radius-card: 16px;
  --radius-pill: 8px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .07);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, .08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, .10);
}

html {
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ── Skip link (accessibility) ── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  background: var(--text);
  color: #fff;
  padding: .5rem 1rem;
  border-radius: 6px;
  font-size: .85rem;
}

.skip-link:focus {
  top: 1rem;
}

/* ─────────────────────────────────────────
   HEADER
───────────────────────────────────────── */
.site-header {
  background: rgba(255, 255, 255, 0.7);
  border-bottom: 1px solid rgba(255, 255, 255, 0.5);
  position: sticky;
  top: 0;
  z-index: 200;
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.03);
}

/* ─────────────────────────────────────────
   STICKY TOC NAV BAR
───────────────────────────────────────── */
.toc-sticky-wrap {
  position: sticky;
  top: 0;
  /* JS overrides this dynamically at runtime */
  z-index: 150;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 4px 20px rgba(31, 38, 135, 0.04);
  padding: 0.6rem 0;
}

.toc-sticky {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  overflow-x: auto;
  scrollbar-width: none;
  /* Firefox */
}

.toc-sticky::-webkit-scrollbar {
  display: none;
}

.toc-sticky-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-3);
  flex-shrink: 0;
  white-space: nowrap;
}

.toc-sticky-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: nowrap;
}

.toc-pill {
  display: inline-block;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-2);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(0, 0, 0, 0.07);
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.toc-pill:hover {
  background: rgba(255, 255, 255, 1);
  color: var(--text);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.toc-pill.is-active {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.toc-pill--yd {
  border-style: dashed;
  color: var(--text-3);
}

.toc-pill--yd.is-active {
  background: var(--text-2);
  color: #fff;
  border-color: var(--text-2);
}

.header-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: .9rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: .55rem;
}

.brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text);
  flex-shrink: 0;
}

.date-chip {
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: .4rem;
  background: var(--bg);
  padding: .35rem .75rem;
  border-radius: 20px;
  border: 1px solid var(--border);
}

.date-chip i {
  font-size: .7rem;
}

/* Game nav — horizontal tab-style row inside the sticky header */
.game-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.25rem;
  padding: 0.6rem 2rem;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  flex-wrap: wrap;
  overflow-x: auto;
  scrollbar-width: none;
}

.game-nav::-webkit-scrollbar {
  display: none;
}

.game-nav-link {
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-3);
  padding: 0.4rem 1rem;
  border-radius: 999px;
  transition: background 0.2s ease, color 0.2s ease, font-weight 0.1s ease;
  white-space: nowrap;
}

.game-nav-link:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-2);
}

.game-nav-link.is-active {
  color: var(--text);
  font-weight: 700;
  background: rgba(0, 0, 0, 0.06);
}

/* ─────────────────────────────────────────
   PAGE LAYOUT
───────────────────────────────────────── */
.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 2.5rem 2rem 5rem;
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

/* ─────────────────────────────────────────
   GAME BLOCK
───────────────────────────────────────── */
.game-block {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.game-heading {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--text);
  padding-bottom: .6rem;
  border-bottom: 1.5px solid var(--border);
}

/* ─────────────────────────────────────────
   MODE SECTION
───────────────────────────────────────── */
.mode-section {
  display: flex;
  flex-direction: column;
  gap: .7rem;
}

.mode-heading {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-3);
}

/* ─────────────────────────────────────────
   DAY PAIR GRID (Masonry Layout)
───────────────────────────────────────── */
.day-pair {
  column-count: 2;
  column-gap: 1.5rem;
  display: block;
}

.mode-wrapper {
  break-inside: avoid;
  margin-bottom: 1.5rem;
}

@media (max-width: 620px) {
  .day-pair {
    column-count: 1;
  }
}

/* ─────────────────────────────────────────
   CHARACTER CARD
───────────────────────────────────────── */
.char-card {
  background: var(--white);
  border-radius: var(--radius-card);
  border: 2px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ─────────────────────────────────────────
   CARD HERO (portrait + name)
───────────────────────────────────────── */
.card-hero {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.4rem 1.4rem 1.1rem;
  border-bottom: 1px solid var(--border);
}

.portrait-wrap {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.portrait-wrap.no-img {
  background: var(--bg);
}

.char-portrait {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

.portrait-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--border);
  font-size: 2rem;
}

.hero-info {
  flex: 1;
  min-width: 0;
}

.slot-label {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-3);
  margin-bottom: .25rem;
}

.slot-label.today-label {
  color: var(--text);
}

.char-name {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.char-meta {
  font-size: .8rem;
  color: var(--text-3);
  margin-top: .2rem;
  font-weight: 500;
}

/* ─────────────────────────────────────────
   CARD SECTIONS (quote / stats / emoji / audio)
───────────────────────────────────────── */
.card-section {
  padding: 1rem 1.4rem;
  border-bottom: 1px solid var(--border);
}

.card-section:last-child {
  border-bottom: none;
}

.section-label {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--text-3);
  margin-bottom: .55rem;
  display: flex;
  align-items: center;
  gap: .35rem;
}

.section-label i {
  font-size: .6rem;
}

/* Stats */
.stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
}

.stat-pill {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: .5rem .75rem;
  min-width: 72px;
}

.stat-pill span {
  font-size: .6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-3);
  margin-bottom: .15rem;
}

.stat-pill strong {
  font-size: .88rem;
  font-weight: 600;
  color: var(--text);
}

/* Quote */
.char-quote {
  font-size: .9rem;
  font-style: italic;
  color: var(--text-2);
  line-height: 1.65;
  position: relative;
  padding-left: 1.1rem;
}

.quote-icon {
  position: absolute;
  left: 0;
  top: .1rem;
  font-size: .65rem;
  color: var(--text-3);
}

/* Skill */
.skill-section {}

.skill-name {
  font-size: .96rem;
  font-weight: 600;
  color: var(--text);
}

.skill-type {
  font-size: .78rem;
  color: var(--text-3);
  margin-top: .2rem;
}

.skill-ult {
  font-size: .78rem;
  color: var(--text-3);
  margin-top: .15rem;
}

/* Emoji */
.emoji-section {}

.emoji-row {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.emoji-chip {
  font-size: 1.5rem;
  line-height: 1;
  padding: .4rem .5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.text-chip {
  font-size: .82rem;
  font-weight: 500;
  color: var(--text-2);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .35rem .65rem;
  display: flex;
  align-items: center;
}

/* Audio */
.audio-section {}

.audio-section audio {
  width: 100%;
  height: 36px;
  display: block;
  border-radius: 8px;
  accent-color: var(--text);
}

.va-credit {
  font-size: .74rem;
  color: var(--text-3);
  margin-top: .4rem;
}

/* ─────────────────────────────────────────
   FOOTER
───────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 1.5rem 2rem;
  font-size: .8rem;
  color: var(--text-3);
  border-top: 1px solid var(--border);
  background: var(--white);
}

.site-footer strong {
  color: var(--text-2);
  font-weight: 600;
}

/* ─────────────────────────────────────────
   RESPONSIVE
───────────────────────────────────────── */
@media (max-width: 760px) {
  .header-inner {
    padding: .75rem 1.25rem;
  }

  .page {
    padding: 1.5rem 1.25rem 4rem;
  }

  .card-hero {
    gap: .8rem;
  }

  .portrait-wrap {
    width: 80px;
    height: 80px;
  }

  .char-name {
    font-size: 1.05rem;
  }
}

/* ── Footer Grid ── */
.custom-footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem 2rem;
  text-align: left;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

@media (min-width: 640px) {
  .custom-footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 768px) {
  .custom-footer-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.custom-footer-grid a {
  color: var(--text-2);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.2s ease, text-decoration 0.2s ease;
  line-height: 1.4;
  display: inline-block;
}

.custom-footer-grid a:hover {
  color: var(--accent);
  text-decoration: underline;
}