/* LU4 shared base styles */

:root {
  --bg: #212121;
  --surface: #303030;
  --surface-muted: #262626;
  --surface-raised: #363636;
  --surface-deep: #171717;
  --surface-panel: #2a2a2a;
  --surface-ink: #1f1f1f;
  --surface-mid: #292929;
  --border: #3c3c3c;
  --text: #ffffff;
  --text-muted: #aeaeae;
  --text-soft: #8e8e8e;
  --accent: #33ffa7;
  --accent-strong: #90ffd2;
  --accent-soft: rgba(51, 255, 167, 0.12);
  --brand: var(--accent);
  --link: #33ffa7;
  --link-hover: #90ffd2;
  --header-bg: #212121;
  --header-text: #ffffff;
  --radius: 12px;
  --radius-control: 10px;
  --radius-sm: 8px;
  --radius-table: 6px;
  --radius-chip: 7px;
  --radius-panel: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
  --font: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei",
    sans-serif;
  --mono: ui-monospace, "Cascadia Code", "Consolas", monospace;
  --text-h1: clamp(1.85rem, 3.2vw, 2.4rem);
  --text-h2: clamp(1.15rem, 2.5vw, 1.28rem);
  --text-h3: 1.05rem;
  /* 版心：窄文 / 默认宽 / 图鉴表 / 超宽表 */
  --max: 44rem;
  --wide: 70rem;
  --content-guide: 56rem;
  --content-guide-nav: 13rem;
  --content-standard: 72rem;
  --content-table: 90rem;
  --content-catalog: 92rem;
  --content-wide-table: 96rem;
  /* 全站壳：顶栏与主栏共用边距，避免各页各写一版 */
  --page-pad-x: max(1rem, env(safe-area-inset-left));
  --page-pad-x-end: max(1rem, env(safe-area-inset-right));
  --page-pad-y: 1.5rem;
  --page-pad-bottom: 3rem;
  --page-gap: 1rem;
  --header-pad-y: 0.75rem;
  --header-pad-y-compact: 0.65rem;
  --header-pad-y-entity: 0.55rem;
  /* 图鉴表 / 列表壳共用色阶 */
  --table-head-bg: #242424;
  --table-row: #202020;
  --table-row-alt: #232323;
  --table-row-hover: #292f2c;
  --table-line: #2c2c2c;
  --panel-head-bg: linear-gradient(90deg, var(--surface-mid), #303030);
}

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

html {
  scroll-behavior: smooth;
  min-height: 100%;
  background-color: var(--bg);
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    linear-gradient(180deg, rgba(51, 255, 167, 0.035), rgba(51, 255, 167, 0) 18rem),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.018) 0, rgba(255, 255, 255, 0.018) 1px, transparent 1px, transparent 18px);
  background-repeat: no-repeat, repeat;
}

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  color: var(--link-hover);
}

a:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  z-index: 100;
  padding: 0.5rem 1rem;
  border: 1px solid rgba(51, 255, 167, 0.35);
  border-radius: var(--radius-control);
  background: var(--surface-panel);
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus {
  left: 0.5rem;
  top: 0.5rem;
}

/*
 * 顶栏契约（全站唯一壳）：
 * - 基类：site-header site-header--dashboard
 * - 修饰：--compact（列表/工具/长文）、--entity（详情页矮标题）
 * - --guide 仅为历史别名，等同 --dashboard，新页不要单独用
 */
.site-header {
  background: var(--header-bg);
  color: var(--header-text);
  padding: var(--header-pad-y) 0 calc(var(--header-pad-y) + 0.05rem);
  border-bottom: 1px solid #2d2d2d;
  box-shadow: none;
}

.site-header__inner {
  max-width: var(--wide);
  margin: 0 auto;
  padding-left: var(--page-pad-x);
  padding-right: var(--page-pad-x-end);
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1.5rem;
  align-items: center;
}

.site-header__brand {
  min-width: 0;
}

.site-header__tools {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.65rem;
}

.site-header h1 {
  margin: 0;
  font-size: var(--text-h1);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.08;
}

.site-header .tagline {
  margin: 0;
  font-size: 0.86rem;
  opacity: 0.88;
  font-weight: 400;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.site-header .eyebrow {
  color: var(--accent);
}

.site-header--dashboard,
.site-header--guide,
.site-header--entity {
  padding: var(--header-pad-y) 0 calc(var(--header-pad-y) + 0.05rem);
}

.site-header--compact {
  padding: var(--header-pad-y-compact) 0 calc(var(--header-pad-y-compact) + 0.05rem);
}

.site-header--compact h1 {
  margin-bottom: 0;
  font-size: 1.55rem;
}

.site-header--compact .eyebrow {
  margin-bottom: 0.12rem;
  font-size: 0.68rem;
}

.site-header--entity {
  padding: var(--header-pad-y-entity) 0 calc(var(--header-pad-y-entity) + 0.05rem);
}

.site-header--entity .site-header__brand .eyebrow {
  margin-bottom: 0.12rem;
}

.site-header--entity .site-header__brand h1 {
  margin: 0;
  font-size: clamp(1.45rem, 2.6vw, 1.85rem);
  line-height: 1.2;
}

.site-header__brand > .tagline:not(.tagline--qq) {
  display: none;
}

.site-header .tagline.tagline--qq {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: clamp(4.5rem, 6vw, 5.25rem);
  height: clamp(4rem, 5.5vw, 4.75rem);
  margin-top: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  opacity: 1;
  color: rgba(51, 255, 167, 0.9);
  text-decoration: none;
  transition: color 0.18s ease, transform 0.18s ease, opacity 0.18s ease;
}

.site-header .tagline.tagline--qq:hover {
  color: var(--accent-strong);
  opacity: 1;
  transform: translateY(-1px) scale(1.02);
}

.site-header .tagline.tagline--qq::before {
  content: "";
  width: 100%;
  height: 100%;
  display: block;
  background: currentColor;
  -webkit-mask: url("Hedgehog in New Pants.svg") center / contain no-repeat;
  mask: url("Hedgehog in New Pants.svg") center / contain no-repeat;
}

.layout {
  max-width: var(--max);
  margin: 0 auto;
  padding: var(--page-pad-y) var(--page-pad-x) var(--page-pad-bottom);
  padding-right: var(--page-pad-x-end);
}

.layout--wide {
  max-width: var(--wide);
}

/* 图鉴 / 超宽表：宽度档，边距仍走全站 token */
.layout--catalog {
  max-width: min(100%, var(--content-catalog));
}

.layout--table {
  max-width: min(100%, var(--content-wide-table));
}

.section {
  margin-bottom: 2rem;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.65rem;
}

.section-heading h2 {
  margin: 0;
  font-size: var(--text-h2);
  line-height: 1.25;
}

.section-heading h2.eyebrow {
  margin: 0;
  font-size: 0.74rem;
  line-height: 1;
}

.section-heading--compact {
  margin-bottom: 0.35rem;
}

.section-heading--compact h3 {
  margin: 0;
  font-size: var(--text-h3);
}

.section-heading .eyebrow {
  margin-bottom: 0;
}

.button {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.55rem;
  padding: 0.58rem 0.9rem;
  border: 1px solid rgba(51, 255, 167, 0.34);
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--accent);
  font: inherit;
  line-height: 1;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
}

.button:hover {
  color: var(--accent-strong);
  background: #2a5545;
}

.button--primary {
  background: #1f3d32;
  border-color: var(--accent);
  color: var(--accent);
}

.button--primary:hover {
  background: #2a5545;
  color: var(--accent-strong);
}

.button--ghost {
  background: transparent;
}

/* 全站筛选 pill：搜索 / 装备图鉴 / 任务图鉴共用 */
.filter-pills,
.eq-chips,
.qb-chips,
.search-type-pills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.filter-pill,
.eq-chip,
.qb-chip,
.search-type-pills button,
.search-facet-pills button,
.eq-tab {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.9rem;
  flex: 0 0 auto;
  padding: 0.22rem 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: #a8b8b0;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.filter-pill:hover,
.filter-pill:focus-visible,
.eq-chip:hover,
.eq-chip:focus-visible,
.qb-chip:hover,
.qb-chip:focus-visible,
.search-type-pills button:hover,
.search-type-pills button:focus-visible,
.search-facet-pills button:hover,
.search-facet-pills button:focus-visible,
.eq-tab:hover,
.eq-tab:focus-visible {
  border-color: rgba(51, 255, 167, 0.42);
  color: #e4f4ec;
  outline: none;
}

.filter-pill.is-active,
.eq-chip.is-active,
.qb-chip.is-active,
.search-type-pills button.is-active,
.search-facet-pills button.is-active,
.eq-tab.is-active {
  border-color: rgba(51, 255, 167, 0.55);
  background: rgba(51, 255, 167, 0.12);
  color: var(--accent);
}

.eq-tab {
  min-height: 2.1rem;
  padding: 0.3rem 0.85rem;
  font-size: 0.86rem;
  font-weight: 700;
}

/* 图鉴工具条与输入控件 */
.catalog-toolbar,
.eq-toolbar,
.qb-toolbar {
  margin: 0 0 1.1rem;
  padding: 0.85rem 1rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.eq-toolbar {
  display: grid;
  gap: 0.7rem;
}

.catalog-input,
.eq-input,
.eq-select,
.qb-input,
.qb-select {
  width: 100%;
  min-height: 2.25rem;
  box-sizing: border-box;
  padding: 0.35rem 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.22);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
}

/* 图鉴表壳：任务图鉴 / 新手村任务等共用 */
.catalog-table-shell,
.qb-table-shell,
.quest-table-shell {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-ink);
  box-shadow: none;
}

.catalog-input:focus-visible,
.eq-input:focus-visible,
.eq-select:focus-visible,
.qb-input:focus-visible,
.qb-select:focus-visible {
  border-color: rgba(51, 255, 167, 0.45);
  outline: none;
}

/* 空态 / 加载态共用 */
.entity-empty,
.entity-error,
.search-empty,
.spellbook-empty,
.class-change-empty,
.sq-loading,
.sq-error,
.qb-empty {
  margin: 0;
  padding: 1.15rem 1rem;
  border: 1px dashed rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.qb-empty {
  text-align: center;
  padding: 1.5rem 1rem !important;
}

.spellbook-empty {
  text-align: center;
}

.sq-error,
.entity-error {
  color: #f0a8a8;
  border-color: rgba(240, 168, 168, 0.35);
}

.resource-tile {
  position: relative;
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.resource-tile__flag {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.7rem;
  padding: 0.14rem 0.68rem;
  border: 1px solid rgba(255, 240, 120, 0.42);
  border-radius: 999px;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 250, 170, 0.92), rgba(255, 212, 67, 0.98) 56%, rgba(255, 150, 0, 0.98) 100%);
  color: #3a1d00;
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1;
  white-space: nowrap;
  box-shadow:
    0 10px 22px rgba(0, 0, 0, 0.34),
    0 0 0 2px rgba(255, 188, 46, 0.18),
    0 0 18px rgba(255, 214, 92, 0.2);
  transform: rotate(6deg);
}

.resource-tile__flag::before {
  content: "!";
  position: absolute;
  top: -0.32rem;
  right: -0.24rem;
  width: 1rem;
  height: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #ff3f1f;
  color: #fff7ea;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 4px 10px rgba(255, 63, 31, 0.32);
}

.resource-tile__flag::after {
  content: "";
  position: absolute;
  inset: -0.22rem;
  border-radius: 999px;
  border: 1px dashed rgba(255, 218, 110, 0.34);
  opacity: 0.9;
}

/* 首页「本站」角标：站内工具 / 图鉴页。有角标时给标题留右侧空间。 */
.resource-tile:has(.resource-tile__flag) h4 {
  padding-right: 3.4rem;
}

.resource-tile h3,
.resource-tile h4 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  line-height: 1.35;
}

.resource-tile h4 {
  font-weight: 700;
}

.resource-tile p {
  margin: 0 0 0.7rem;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.resource-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
}

.resource-groups {
  display: grid;
  gap: 1rem;
}

.resource-group {
  min-width: 0;
}

.resource-group > h3 {
  margin: 0 0 0.65rem;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.resource-board--compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.inline-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.inline-links a {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--surface-muted);
  text-decoration: none;
  font-weight: 700;
}

.resource-tile--wide {
  grid-column: span 2;
}

.page-hint {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: calc(max(1rem, env(safe-area-inset-bottom)) + 6.6rem);
  z-index: 140;
  width: min(18rem, calc(100vw - 2rem));
  padding: 0.72rem 0.95rem;
  border: 1px solid rgba(51, 255, 167, 0.22);
  border-radius: var(--radius);
  background: rgba(24, 24, 24, 0.94);
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.35;
  text-align: left;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.34);
  opacity: 0;
  visibility: hidden;
  transform: translateY(0.6rem);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
  pointer-events: none;
}

.page-hint.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

@media (max-width: 920px) {
  .resource-board {
    grid-template-columns: 1fr 1fr;
  }

  .resource-tile--wide {
    grid-column: span 2;
  }
}

@media (max-width: 760px) {
  .site-header__inner {
    grid-template-columns: 1fr;
    gap: 0.9rem;
  }

  .site-header__brand {
    padding-right: 4.6rem;
  }

  .site-header__tools {
    position: absolute;
    top: 0;
    right: var(--page-pad-x-end);
    align-items: flex-end;
    width: auto;
    gap: 0.4rem;
  }

  .site-header .tagline.tagline--qq {
    width: 3.1rem;
    height: 3.1rem;
  }

  .site-header--dashboard,
  .site-header--guide,
  .site-header--compact {
    padding: var(--header-pad-y-compact) 0 calc(var(--header-pad-y-compact) + 0.05rem);
  }

  .site-header--entity {
    padding: 0.5rem 0 0.55rem;
  }
}

@media (max-width: 620px) {
  .section-heading {
    display: block;
  }

  .resource-board {
    grid-template-columns: 1fr;
  }

  .resource-tile--wide {
    grid-column: auto;
  }
}

@media (max-width: 520px) {
  .site-header__brand {
    padding-right: 3.9rem;
  }

  .site-header .tagline.tagline--qq {
    width: 2.7rem;
    height: 2.7rem;
  }
}


/* ── shared FAQ (home + guide) ─────────────────────────────────────── */
.faq {
  display: grid;
  gap: 0.6rem;
}

.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.15rem 0.25rem;
}

.faq-item > summary {
  cursor: pointer;
  padding: 0.75rem 0.85rem;
  color: var(--text);
  font-size: 1rem;
  font-weight: 750;
  line-height: 1.45;
  list-style: none;
}

.faq-item > summary::-webkit-details-marker {
  display: none;
}

.faq-item > summary::after {
  content: "▾";
  float: right;
  color: var(--text-muted);
  transition: transform 0.15s ease;
}

.faq-item[open] > summary::after {
  transform: rotate(-180deg);
}

.faq-item__body {
  padding: 0 0.85rem 0.85rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.75;
}

.faq-item__body p {
  margin: 0;
}

.faq-item__body strong {
  color: var(--text);
  font-weight: 650;
}

.faq-item__body p + p {
  margin-top: 0.5rem;
}

/* ── floating chrome (back-to-top / home) ─────────────────────────── */
.floating-actions {
  position: fixed;
  right: max(0.75rem, env(safe-area-inset-right));
  bottom: max(0.75rem, env(safe-area-inset-bottom));
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  align-items: center;
}

.floating-action,
.back-to-top {
  width: 2.7rem;
  height: 2.7rem;
  border: 1px solid rgba(51, 255, 167, 0.28);
  border-radius: 999px;
  background: rgba(31, 61, 50, 0.94);
  color: var(--accent);
  font-size: 1.05rem;
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
  text-decoration: none;
  transition: opacity 0.18s ease, transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.floating-action {
  color: var(--text-muted);
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(46, 46, 46, 0.94);
}

.floating-action:hover,
.floating-action:focus-visible,
.back-to-top:hover,
.back-to-top:focus-visible {
  border-color: rgba(51, 255, 167, 0.3);
}

.floating-action:hover,
.floating-action:focus-visible {
  color: var(--text);
  background: #323232;
}

.back-to-top:hover,
.back-to-top:focus-visible {
  background: #2a5545;
  color: var(--accent-strong);
}

.floating-action:focus-visible,
.back-to-top:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.back-to-top {
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(0.4rem);
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
