:where(button, a[href], [role="button"], [role="tab"], [role="option"],
  input[type="button"], input[type="submit"], input[type="reset"],
  select, summary, label, .card-animation-menu, .character-identity) {
  -webkit-user-select: none;
  user-select: none;
}

:where(input:not([type]), input[type="text"], input[type="search"],
  input[type="email"], input[type="url"], input[type="tel"],
  input[type="password"], input[type="number"], textarea,
  [contenteditable]:not([contenteditable="false"])) {
  -webkit-user-select: text;
  user-select: text;
}

html {
  --site-font-family: 'Helvetica Neue', Helvetica, Arial, 'Noto Sans SC', 'Microsoft YaHei', 'PingFang SC', sans-serif;
  --site-viewport-height: 100vh;
  /* Width anchors the design; each main area scrolls within the viewport height. */
  font-size: calc(100vw * 16 / 1280);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  height: 100%;
  overflow: hidden;
  background: #e6e6e6;
}

@supports (height: 100dvh) {
  html { --site-viewport-height: 100dvh; }
}

html body,
html body[data-page] {
  font-family: var(--site-font-family);
  width: 80rem;
  height: var(--site-viewport-height);
  min-height: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body .site-header[data-shared-header] {
  height: 6.25rem;
  min-height: 6.25rem;
  gap: 0;
  padding: 0 1.875rem;
  flex-wrap: nowrap;
}

body .site-header[data-shared-header] .brand {
  gap: .625rem;
  font-size: 3rem;
}

body .site-header[data-shared-header] .site-nav {
  flex: none;
  order: 0;
  width: auto;
  height: 100%;
  margin-inline: auto;
  justify-content: flex-start;
}

body .site-header[data-shared-header] .site-nav > .nav-link,
body .site-header[data-shared-header] .nav-dropdown {
  flex: none;
}

body .site-header[data-shared-header] .nav-link {
  width: 5.75rem;
  padding: 0;
  font-size: 2.25rem;
}

body .site-header[data-shared-header] .nav-submenu {
  border-width: .0625rem;
}

body .site-header[data-shared-header] .nav-submenu-link {
  padding: .1875rem .5rem;
  font-size: 1.25rem;
}

body .site-header[data-shared-header] .site-search {
  flex: 0 0 12.5rem;
  order: 0;
  width: 12.5rem;
  min-width: 0;
  height: 2.5rem;
  margin-left: 0;
  padding: 0 .4375rem;
  gap: .3125rem;
}

body .site-header[data-shared-header] .site-search svg {
  width: 1.125rem;
  height: 1.125rem;
}

body .site-header[data-shared-header] .site-search input {
  font-size: 1.25rem;
}


body[data-page] {
  height: var(--site-viewport-height);
  display: flex;
  flex-direction: column;
}

@supports selector(::-webkit-scrollbar) {
  body[data-page="cards"] :is(.catalog, .detail-panel) { scrollbar-width: auto; }
  body[data-page="cards"] :is(.catalog, .detail-panel)::-webkit-scrollbar { width: .625rem; height: .625rem; }
  body[data-page="cards"] :is(.catalog, .detail-panel)::-webkit-scrollbar-thumb { border-radius: .3125rem; background: #aaa; }
}

body[data-page] .catalog-tools,
body[data-page] .filter-tools,
body[data-page] .detail-tools {
  height: 3.4375rem;
  flex-shrink: 0;
}

body[data-page] .catalog-search { gap: .3125rem; padding: 0 .4375rem; }
body[data-page] .catalog-search input { font-size: 1.25rem; line-height: 1.4; }
body[data-page] .catalog-search svg { width: 1.125rem; height: 1.125rem; }

body[data-page="member"] .member-back { align-self: flex-start; flex: none; }
body[data-page="member"] .member-layout,
body[data-page="calendar"] .calendar-layout {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-width: thin;
}

.member-lightbox { max-width: 95vw; max-height: 95vh; }
.member-lightbox img { max-width: 85vw; max-height: 83vh; margin-inline: auto; }

body :is(button, input, select, textarea) { font-family: inherit; }

body .site-header[data-shared-header],
body .site-header[data-shared-header] .site-search input,
body[data-page] .catalog-search input,
body .thumb-kind,
body #cards .thumb-kind,
body .kind-badge,
body .rarity {
  font-family: var(--site-font-family);
}

html body > main {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-width: thin;
  scrollbar-gutter: stable;
}

@supports selector(::-webkit-scrollbar) {
  html body > main,
  html body[data-page] > main[class],
  html body[data-page] .workspace { scrollbar-width: auto; }
  html body > main::-webkit-scrollbar,
  html body[data-page] > main[class]::-webkit-scrollbar,
  html body[data-page] .workspace::-webkit-scrollbar { width: .625rem; height: .625rem; }
  html body > main::-webkit-scrollbar-thumb,
  html body[data-page] > main[class]::-webkit-scrollbar-thumb,
  html body[data-page] .workspace::-webkit-scrollbar-thumb { border-radius: .3125rem; background: #aaa; }
}

html body:not([data-page]) main {
  width: 100%;
  margin: 0;
  padding: 2.8125rem 5.3125rem 2rem 7.1875rem;
  align-content: start;
  grid-auto-rows: max-content;
}

html body[data-page] .workspace {
  --filter-open-width: 12.5rem;
  margin-top: 0;
  padding-top: .625rem;
  grid-template-rows: minmax(0, 1fr);
  align-items: stretch;
  overflow-x: hidden;
  overflow-y: hidden;
  scrollbar-gutter: auto;
}

html body[data-page] .workspace :is(.catalog, .detail-panel, .filter-sidebar) {
  height: 100%;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable;
}

html body[data-page] .workspace :is(.catalog-tools, .detail-tools, .filter-tools) {
  position: static;
}

@supports selector(::-webkit-scrollbar) {
  html body[data-page] .workspace :is(.catalog, .detail-panel, .filter-sidebar) { scrollbar-width: auto; }
  html body[data-page] .workspace :is(.catalog, .detail-panel, .filter-sidebar)::-webkit-scrollbar { width: .625rem; height: .625rem; }
  html body[data-page] .workspace :is(.catalog, .detail-panel, .filter-sidebar)::-webkit-scrollbar-thumb { border-radius: .3125rem; background: #aaa; }
}

html body[data-page] .workspace .filter-sidebar { padding: 0 .75rem 1.5rem; }
html body[data-page] .workspace.filters-collapsed .filter-sidebar { padding-inline: .3125rem; }
html body[data-page] .workspace .filter-body { --filter-icon-max: 1.625rem; --filter-icon-gap: .25rem; }
html body[data-page] .workspace .filter-body :is(.attribute-option, .band-option, .character-option) { width: var(--filter-icon-size); height: var(--filter-icon-size); }
html body[data-page] .workspace .character-bands { gap: .25rem; }
html body[data-page] .workspace .filter-group { margin-bottom: 1.125rem; }
html body[data-page] .workspace .filter-group h2 { font-size: 1.25rem; line-height: 1.5rem; }
html body[data-page] .workspace .filter-group .filter-options { gap: .25rem; }
html body[data-page] .workspace .tag-option { height: 1.75rem; padding: 0 .25rem; font-size: 1.125rem; line-height: 1.75rem; }
html body[data-page] .workspace .card-rarity-options { grid-template-columns: repeat(3, 3.25rem); }
html body[data-page] .workspace .card-rarity-options .tag-option { width: 3.25rem; font-size: 1.25rem; }
html body[data-page] .workspace .card-source-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
html body[data-page] .workspace .month-selects { gap: .25rem; font-size: 1.125rem; }
html body[data-page] .workspace .month-selects select { height: 1.75rem; font-size: 1.125rem; }
html body[data-page] .workspace .month-selects select[data-period$="Year"] { width: 4.25rem; }
html body[data-page] .workspace .month-selects select[data-period$="Month"] { width: 2.5rem; }
html body[data-page] .workspace .period-separator { height: 1.25rem; font-size: 1.125rem; line-height: 1.25rem; }
html body[data-page] .workspace .difficulty-option { padding-inline: .125rem; font-size: .75rem; }
html body[data-page] .workspace .recruitment-character-placeholders { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .25rem; }

html body[data-page] :is(.character-layout, .profile-layout, .outfits-layout) {
  margin: 0;
  padding-top: .625rem;
  padding-bottom: 2rem;
  padding-left: 7.5rem;
  align-content: start;
  grid-auto-rows: minmax(43.125rem, max-content);
}

html body[data-page] .character-layout { padding-right: 11.25rem; }
html body[data-page] :is(.character-details, .profile-details, .outfits-details) { height: auto; min-height: 43.125rem; overflow: visible; }
html body[data-page] .calendar-layout { margin: 0; padding-top: .625rem; grid-auto-rows: minmax(max-content, 1fr); overflow-x: hidden; overflow-y: auto; }
html body[data-page] .calendar-side { overflow: visible; }

/* Content keeps its design margins; scrolling belongs to the full-width pane. */
html body > main { overflow-y: scroll; }
html body[data-page="member"] .member-layout {
  width: 100%; margin: 0; padding-inline: 6.75rem; overflow-y: scroll;
}
html body[data-page="support"] .support-layout {
  width: 100%; margin: 0; padding: 4.75rem 1.875rem 2rem;
  overflow-y: scroll;
}
html body[data-page] .workspace :is(.catalog, .detail-panel) { overflow-y: scroll; }

html body .bands-layout,
html body > main.voice-layout {
  position: relative; overflow: hidden; scrollbar-gutter: auto;
}
html body :is(.bands-main, .voice-content) {
  overflow-x: hidden; overflow-y: scroll; scrollbar-gutter: stable;
}
html body :is(.bands-sidebar, .voice-sidebar) {
  padding-left: 1.5625rem; padding-right: 0; scrollbar-width: none;
}
html body :is(.bands-sidebar, .voice-sidebar)::-webkit-scrollbar { display: none; }
html body .band-switch.active,
html body .voice-category[aria-pressed="true"] { transform: translateX(1.5625rem); }
html body .band-switch.active::after,
html body .voice-category[aria-pressed="true"]::after { content: none; }
.bands-layout::after,
.voice-layout::after {
  content: ''; position: absolute; z-index: 4;
  left: calc(12.5rem - .0625rem); top: var(--sidebar-tab-top, 0);
  width: 1.25rem; height: var(--sidebar-tab-height, 0);
  background: var(--purple); clip-path: polygon(0 0, 100% 50%, 0 100%);
  opacity: var(--sidebar-tip-visible, 0); pointer-events: none;
}
html body :is(.bands-main, .voice-content)::-webkit-scrollbar-thumb {
  border-radius: .3125rem; background: #aaa;
}
html body[data-page] :is(.profile-layout, .outfits-layout) { grid-template-columns: 28.75rem minmax(0, 1fr); }
html body[data-page] .calendar-layout,
html body[data-page="comics"] > main { overflow-y: scroll; }
html body[data-page="character-voice"] .voice-layout .character-page-back { top: 0; }
html body > main::-webkit-scrollbar-track,
html body[data-page] .workspace :is(.catalog, .detail-panel)::-webkit-scrollbar-track,
html body :is(.bands-main, .voice-content)::-webkit-scrollbar-track { background: #e6e6e6; }
