html {
  scroll-behavior: smooth;
}

body[data-page="home"] .layout-shell {
  max-width: 1400px;
  margin-top: 12px;
}

body[data-page="home"] .main-content {
  flex: 1 1 auto;
  min-width: 0;
  padding: 16px 24px 28px;
}

body[data-page="home"] .site-intro {
  margin: 8px 0 20px;
}

body[data-page="home"] .subpage-title {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: clamp(1.65rem, 3vw, 2.35rem);
  line-height: 1.25;
  text-align: center;
}

body[data-page="home"] .site-intro-copy {
  max-width: 48rem;
  font-size: 1rem;
  line-height: 1.6;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.home-card {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 104px;
  padding: 16px;
  border: 2px solid var(--brand-light);
  border-radius: 16px;
  background: linear-gradient(180deg, #fff9fc 0%, #fff 100%);
  color: inherit;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(228, 71, 53, 0.08);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.home-card:hover,
.home-card:focus-visible,
.home-card.is-current {
  border-color: var(--brand);
  box-shadow: 0 7px 18px rgba(228, 71, 53, 0.14);
}

.home-card:hover {
  transform: translateY(-1px);
}

.home-card:focus-visible {
  outline: 3px solid rgba(23, 74, 126, 0.4);
  outline-offset: 2px;
}

.home-card-title {
  margin: 0;
  color: var(--accent);
  font-size: 1.12rem;
  line-height: 1.35;
}

.home-card-text {
  margin: 0;
  color: var(--text-main);
  font-size: 0.94rem;
  line-height: 1.5;
}

.catalog-section {
  min-width: 0;
  margin: 0 0 32px;
  scroll-margin-top: 16px;
}

.catalog-section:focus {
  outline: none;
}

.catalog-section:focus-visible {
  outline: 3px solid rgba(23, 74, 126, 0.28);
  outline-offset: 6px;
  border-radius: 12px;
}

.catalog-section-heading {
  position: relative;
  margin: 0 0 12px;
  padding: 0 2px 8px;
  border-bottom: 2px dashed var(--brand-light);
}

.catalog-section-kicker {
  margin: 0 0 2px;
  color: var(--brand);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.catalog-section-heading h2 {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 1.5rem;
  line-height: 1.3;
}

.catalog-section-heading p:not(.catalog-section-kicker) {
  max-width: 52rem;
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.catalog-index-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: 6px;
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 800;
  text-underline-offset: 0.18em;
}

.catalog-result-count {
  margin: 0 0 8px;
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.catalog-section [hidden] { display: none !important; }

.catalog-mobile { display: none; }

.catalog-detail summary { list-style: none; }
.catalog-detail summary::-webkit-details-marker { display: none; }
.catalog-detail[open] .character-open-icon { transform: rotate(180deg); }
.catalog-detail .character-detail {
  position: relative;
  z-index: 1;
  width: calc(312.5% + 16px);
  padding: 10px 0 2px;
  background: #fffafc;
}
.catalog-section[data-catalog-section="mini-games"] .catalog-detail .character-detail {
  width: calc(238% + 16px);
}
.catalog-detail .character-detail-item { grid-template-columns: minmax(5rem, 7rem) minmax(0, 1fr); }

.catalog-mobile .character-card > .character-card-supplement { padding-inline: 10px; }

.catalog-mobile .character-mobile-list-head,
.catalog-mobile .character-card-summary--with-value {
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
}

.catalog-mobile .character-card-value {
  display: block;
  word-break: keep-all;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
}

.catalog-mobile summary .character-card-supplement {
  grid-column: 1 / -1;
  padding: 0;
  font-weight: 400;
}

.catalog-mobile-column-label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 700;
}

.catalog-mobile details .character-card-name-cell::after {
  content: '▼';
  margin-left: 6px;
  color: var(--brand);
  font-size: 0.76rem;
}
.catalog-mobile details[open] .character-card-name-cell::after { content: '▲'; }

.character-search-panel,
.character-filter-panel,
.character-list-panel {
  padding-inline: 12px;
}

.catalog-section .character-search,
.catalog-section .character-filter-select,
.catalog-section .character-mobile-sort-button {
  min-height: 44px;
}

.catalog-section[data-catalog-section="characters"] .character-table {
  min-width: 760px;
}

.catalog-section[data-catalog-section="characters"] .character-table th:nth-child(1),
.catalog-section[data-catalog-section="characters"] .character-table td:nth-child(1) { width: 32%; }
.catalog-section[data-catalog-section="characters"] .character-table th:nth-child(2),
.catalog-section[data-catalog-section="characters"] .character-table td:nth-child(2) { width: 24%; }
.catalog-section[data-catalog-section="characters"] .character-table th:nth-child(3),
.catalog-section[data-catalog-section="characters"] .character-table td:nth-child(3) { width: 44%; }

.catalog-section[data-catalog-section="playable-forms"] .character-table {
  min-width: 820px;
}

.catalog-section[data-catalog-section="playable-forms"] .character-table th:nth-child(1),
.catalog-section[data-catalog-section="playable-forms"] .character-table td:nth-child(1) { width: 36%; }
.catalog-section[data-catalog-section="playable-forms"] .character-table th:nth-child(2),
.catalog-section[data-catalog-section="playable-forms"] .character-table td:nth-child(2) { width: 20%; }
.catalog-section[data-catalog-section="playable-forms"] .character-table th:nth-child(3),
.catalog-section[data-catalog-section="playable-forms"] .character-table td:nth-child(3) { width: 30%; }
.catalog-section[data-catalog-section="playable-forms"] .character-table th:nth-child(4),
.catalog-section[data-catalog-section="playable-forms"] .character-table td:nth-child(4) { width: 14%; }

.catalog-section[data-catalog-section="archive-battles"] .character-table {
  min-width: 760px;
}

.catalog-section[data-catalog-section="archive-battles"] .character-table th:nth-child(1),
.catalog-section[data-catalog-section="archive-battles"] .character-table td:nth-child(1) { width: 60%; }
.catalog-section[data-catalog-section="archive-battles"] .character-table th:nth-child(2),
.catalog-section[data-catalog-section="archive-battles"] .character-table td:nth-child(2) { width: 25%; }
.catalog-section[data-catalog-section="archive-battles"] .character-table th:nth-child(3),
.catalog-section[data-catalog-section="archive-battles"] .character-table td:nth-child(3) { width: 15%; }

.catalog-section[data-catalog-section="mini-games"] .character-table {
  min-width: 680px;
}

.catalog-section[data-catalog-section="mini-games"] .character-table th:nth-child(1),
.catalog-section[data-catalog-section="mini-games"] .character-table td:nth-child(1) { width: 42%; }
.catalog-section[data-catalog-section="mini-games"] .character-table th:nth-child(2),
.catalog-section[data-catalog-section="mini-games"] .character-table td:nth-child(2) { width: 26%; }
.catalog-section[data-catalog-section="mini-games"] .character-table th:nth-child(3),
.catalog-section[data-catalog-section="mini-games"] .character-table td:nth-child(3) { width: 32%; }

@media (max-width: 1279px) {
  .catalog-desktop { display: none; }
  .catalog-mobile { display: grid; }
  .catalog-mobile .character-detail { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 850px) {
  body[data-page="home"] .main-content {
    padding: 10px 16px 20px;
  }

  .home-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    margin-bottom: 18px;
  }

  .home-card {
    min-height: 78px;
    padding: 12px 14px;
  }

  .catalog-section {
    margin-bottom: 24px;
  }

  .character-filter-grid--two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  body[data-page="home"] .main-content {
    padding: 6px 8px 12px;
  }

  body[data-page="home"] .site-intro {
    margin: 6px 0 14px;
    padding-inline: 4px;
  }

  body[data-page="home"] .subpage-title {
    font-size: 1.45rem;
    text-align: left;
  }

  body[data-page="home"] .site-intro-copy {
    font-size: 0.9rem;
    text-align: left;
  }

  .home-card {
    min-height: 70px;
  }

  .home-card-title {
    font-size: 1.05rem;
  }

  .catalog-section-heading h2 {
    font-size: 1.3rem;
  }

  .catalog-section-heading p:not(.catalog-section-kicker) {
    font-size: 0.88rem;
  }

  .character-search-panel,
  .character-filter-panel,
  .character-list-panel {
    padding-inline: 6px;
  }

  .character-filter-grid--two {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .home-card {
    transition: none;
  }
}
