/* 灵游记2013 UI System v1.0 — 全站共享交互与呈现基线 */
:root {
  --ui-ink: #101a1b;
  --ui-ink-deep: #071113;
  --ui-paper: #eee7d7;
  --ui-paper-light: #faf7ef;
  --ui-jade: #739487;
  --ui-amber: #dfa94e;
  --ui-focus: #f2bd59;
  --ui-header: 62px;
  --ui-fast: 120ms;
  --ui-normal: 200ms;
  --ui-ease: cubic-bezier(.2,.7,.2,1);
}

html { scroll-padding-top: calc(var(--ui-header) + 18px); }
body { min-height: 100vh; accent-color: var(--ui-jade); }
[hidden] { display: none !important; }

/* 所有可操作对象必须有相同的五态反馈。 */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--ui-focus) !important;
  outline-offset: 3px;
  box-shadow: none;
}
:where(a, button, summary, [role="button"]) {
  -webkit-tap-highlight-color: rgba(223,169,78,.22);
  touch-action: manipulation;
}
:where(button, [role="button"]) { cursor: pointer; }
:where(a, button, summary, [role="button"]):active { transform: translateY(1px) scale(.99); }
:where(button, input, select, textarea):disabled,
[aria-disabled="true"] { cursor: not-allowed; opacity: .48; }

/* 顶部导航是全站位置指示器，不只是链接集合。 */
.site-header, .inner-header { height: var(--ui-header); min-height: var(--ui-header); }
.site-header nav a, .inner-header nav a {
  min-height: var(--ui-header);
  position: relative;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}
.site-header nav a::after, .inner-header nav a::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--ui-amber);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform var(--ui-normal) var(--ui-ease);
}
.site-header nav a:hover::after, .inner-header nav a:hover::after,
.site-header nav a[aria-current="page"]::after,
.inner-header nav a[aria-current="page"]::after { transform: scaleX(1); }
.site-header nav a[aria-current="page"], .inner-header nav a[aria-current="page"] { color: #fff; }
.brand { min-height: 44px; }
.brand:active { transform: none; }

.ui-scroll-progress {
  position: fixed;
  top: var(--ui-header);
  left: 0;
  z-index: 30;
  width: 100%;
  height: 2px;
  pointer-events: none;
  background: linear-gradient(90deg, var(--ui-amber) var(--ui-progress, 0%), transparent 0);
}

/* 数据页工具条保持紧凑，但点击区域不低于 44px。 */
.toolbar { box-shadow: 0 1px 0 rgba(16,26,27,.14); }
.control, .toolbar button, .directory-filters button, .result-filter { min-height: 44px; }
.control:hover { border-color: rgba(16,26,27,.42); }
.control:focus-visible { border-color: var(--ui-jade); background: #fffdf7; }
.directory-filters button, .result-filter {
  transition: color var(--ui-fast), background var(--ui-fast), border-color var(--ui-fast);
}

/* 高密度列表靠行强调，不堆叠卡片和阴影。 */
:where(.result-row, .entry-item, .guide-lines a, .directory-list a, .knowledge-routes a,
  .article-action-row a, .cross-links a, .map-card, .item-card, .monster-card) {
  transition: color var(--ui-normal), background var(--ui-normal), border-color var(--ui-normal),
    padding var(--ui-normal), transform var(--ui-fast);
}
:where(.result-row, .entry-item, .guide-lines a, .directory-list a, .knowledge-routes a,
  .article-action-row a, .cross-links a):focus-visible {
  position: relative;
  z-index: 2;
  background: rgba(115,148,135,.16);
}
.data-table tbody tr:focus-within { background: rgba(115,148,135,.16); }
.data-table th { position: sticky; top: 0; z-index: 2; }
.table-wrap { scrollbar-color: var(--ui-jade) rgba(16,26,27,.08); scrollbar-width: thin; }

/* 图标是识别线索，文字始终承担语义。 */
:where(.game-icon, .task-item-icon img, .result-item-icons img, .summary-item-icon,
  .item-icon, .monster-icon, .skill-icon) { flex: 0 0 auto; }
:where(.task-item-icon img, .result-item-icons img, .item-icon, .monster-icon, .skill-icon) {
  image-rendering: pixelated;
}

/* 内容页用阅读进度和目录当前态提升长文定位效率。 */
.toc a[aria-current="location"] {
  color: var(--ui-ink);
  font-weight: 700;
  transform: translateX(4px);
}
.toc a[aria-current="location"]::before { content: "— "; color: #a87529; }
.article-body :where(h2, h3) { scroll-margin-top: calc(var(--ui-header) + 24px); }
.article-body p { text-wrap: pretty; }

/* 统一轻量状态提示。 */
.ui-toast {
  position: fixed;
  right: 18px;
  bottom: 22px;
  z-index: 60;
  max-width: min(360px, calc(100vw - 36px));
  padding: .72rem 1rem;
  color: #f7f2e8;
  background: rgba(7,17,19,.96);
  border-left: 3px solid var(--ui-amber);
  box-shadow: 0 10px 30px rgba(0,0,0,.2);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity var(--ui-normal), transform var(--ui-normal);
  font-size: .78rem;
}
.ui-toast.is-visible { opacity: 1; transform: none; }

@media (max-width: 900px) {
  .site-header, .inner-header { padding-inline: 1rem; }
  .site-header nav, .inner-header nav { display: none; }
  .header-action { display: inline-flex; align-items: center; min-height: 44px; }
  body:has(.mobile-quick-nav) { padding-bottom: 62px; }
  .mobile-quick-nav {
    height: 62px;
    padding-bottom: env(safe-area-inset-bottom);
    background: rgba(7,17,19,.98);
    border-top: 1px solid rgba(255,255,255,.15);
    backdrop-filter: blur(14px);
  }
  .mobile-quick-nav a {
    min-width: 0;
    min-height: 58px;
    position: relative;
    gap: 1px;
    color: rgba(246,242,231,.66);
  }
  .mobile-quick-nav a[aria-current="page"] { color: #f4c66f; background: rgba(223,169,78,.08); }
  .mobile-quick-nav a[aria-current="page"]::before {
    content: "";
    position: absolute;
    top: 0;
    right: 24%;
    left: 24%;
    height: 2px;
    background: var(--ui-amber);
  }
  .ui-scroll-progress { top: var(--ui-header); }
}

@media (min-width: 2000px) {
  .home-page .hero-content { width: min(1320px, calc(100vw - 12rem)); }
  .home-page .finder-hero h1 { max-width: none; font-size: clamp(6rem, 3.7vw, 8rem); }
  .home-page .hero-subtitle { font-size: 1.35rem; }
  .home-page .hero-directory, .home-page .global-search, .home-page .quick-queries { max-width: 1320px; }
  .home-page .hero-directory a { min-height: 132px; padding-inline: 1.1rem; }
  .home-page .hero-directory strong { font-size: 1.65rem; }
  .home-page .hero-directory small, .home-page .hero-directory b { font-size: .78rem; }
  .home-page .global-search { min-height: 82px; font-size: 1.2rem; }
  .home-page .global-search button { min-height: 62px; padding-inline: 2rem; }
  .home-page .quick-queries { font-size: .95rem; }
}

@media (max-width: 680px) {
  :root { --ui-header: 56px; }
  .brand-mark { width: 30px; height: 30px; }
  .header-action { font-size: .7rem; }
  .finder-hero, .directory-hero, .data-hero, .article-hero { background-position: 66% center; }
  .toolbar { top: var(--ui-header); }
  .ui-toast { right: 12px; bottom: 76px; }
  .data-table th, .data-table td { padding-block: .7rem; }
}

@media (prefers-reduced-motion: reduce) {
  .ui-scroll-progress { display: none; }
}

/* v1.1 可见结构重构 ------------------------------------------------------ */
body {
  background-color: #e9e1d0;
  background-image: linear-gradient(rgba(16,26,27,.025) 1px, transparent 1px);
  background-size: 100% 28px;
}
.site-header, .inner-header {
  border-bottom-color: rgba(223,169,78,.35);
  background: rgba(6,16,18,.985);
}
.site-header::before, .inner-header::before {
  content: "资料库";
  position: absolute;
  left: max(1rem, calc((100vw - var(--content, 1180px)) / 2));
  bottom: -21px;
  padding: 2px 8px;
  color: #172323;
  background: var(--ui-amber);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .16em;
}

.finder-hero {
  min-height: calc(100svh - var(--ui-header));
  align-items: center;
  padding-top: 2.4rem;
  padding-bottom: 2.4rem;
  background-size: auto 112%, cover;
  background-position: right -5vw center, center;
}
.finder-hero::after {
  background: linear-gradient(90deg, #061012 0%, rgba(7,20,22,.98) 44%, rgba(5,14,18,.54) 74%, rgba(5,14,18,.15) 100%),
    linear-gradient(0deg, rgba(3,10,13,.86), transparent 60%);
}
.hero-content { width: min(860px, 100%); }
.finder-hero h1 { max-width: none; margin-top: .65rem; font-size: clamp(3.8rem, 5vw, 5.5rem); line-height: .94; white-space: nowrap; }
.hero-subtitle { margin-bottom: 1rem; font-size: 1rem; }
.hero-actions { display: none; }
.hero-directory {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  max-width: 860px;
  margin: 1.2rem 0 1rem;
  border-top: 1px solid rgba(255,255,255,.25);
  border-bottom: 1px solid rgba(255,255,255,.25);
}
.hero-directory a {
  min-width: 0;
  min-height: 94px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: .72rem .8rem;
  color: #f5f0e6;
  border-right: 1px solid rgba(255,255,255,.15);
  background: rgba(5,14,16,.54);
  transition: background .18s, padding .18s;
}
.hero-directory a:last-child { border-right: 0; }
.hero-directory a:hover, .hero-directory a:focus-visible { padding-bottom: 1rem; background: rgba(115,148,135,.3); }
.hero-directory a.primary { color: #17201f; background: var(--ui-amber); }
.hero-directory small { overflow: hidden; color: rgba(245,240,230,.55); font-size: .58rem; text-overflow: ellipsis; white-space: nowrap; }
.hero-directory .primary small { color: rgba(16,26,27,.62); }
.hero-directory strong { margin-top: .14rem; font-family: var(--display, serif); font-size: 1.15rem; font-weight: 400; }
.hero-directory b { position: absolute; right: .55rem; top: .45rem; color: rgba(245,240,230,.42); font-size: .62rem; font-weight: 400; }
.hero-directory .primary b { color: rgba(16,26,27,.5); }
.global-search { max-width: 860px; min-height: 64px; border-left: 4px solid var(--ui-amber); box-shadow: 0 22px 60px rgba(0,0,0,.32); }
.quick-queries { max-width: 860px; }
.hero-emblem { display: none; }

/* 首页始终是单屏查询台，查询状态在首屏内原位切换。 */
.home-page {
  height: 100svh;
  background: var(--ui-ink-deep);
}
.home-page:not([data-search-state]),
.home-page[data-search-state="idle"],
.home-page[data-search-state="loading"] { overflow: hidden; }
.home-page[data-search-state="results"] { height: auto; min-height: 100svh; overflow-x: hidden; overflow-y: auto; }
.home-page main { height: calc(100svh - var(--ui-header)); }
.home-page .finder-hero { height: 100%; min-height: 0; }
.home-page .ui-scroll-progress { display: none; }
.home-page .header-action { display: none; }
.home-page .global-search { max-width: 960px; margin-top: 1.7rem; }
.home-page .quick-queries { max-width: 960px; }
.home-page[data-search-state="loading"] .finder-hero,
.home-page[data-search-state="results"] .finder-hero { align-items: flex-start; }
.home-page[data-search-state="results"] main { height: auto; min-height: calc(100svh - var(--ui-header)); }
.home-page[data-search-state="results"] .finder-hero { height: auto; min-height: calc(100svh - var(--ui-header)); overflow: visible; padding-bottom: 3rem; }
.home-page[data-search-state="loading"] .hero-content,
.home-page[data-search-state="results"] .hero-content { display: flex; flex-direction: column; padding-top: clamp(.7rem, 2vh, 1.5rem); }
.home-page[data-search-state="loading"] .hero-content { height: 100%; }
.home-page[data-search-state="loading"] .eyebrow,
.home-page[data-search-state="results"] .eyebrow,
.home-page[data-search-state="loading"] .hero-subtitle,
.home-page[data-search-state="results"] .hero-subtitle { display: none; }
.home-page[data-search-state="loading"] .finder-hero h1,
.home-page[data-search-state="results"] .finder-hero h1 { margin: 0 0 .7rem; font-size: clamp(1.8rem, 2.4vw, 2.8rem); line-height: 1; }
.home-page[data-search-state="loading"] .finder-hero h1 br,
.home-page[data-search-state="results"] .finder-hero h1 br { display: none; }
.home-page[data-search-state="loading"] .global-search,
.home-page[data-search-state="results"] .global-search { flex: 0 0 auto; width: 100%; margin-top: 0; }
.home-page[data-search-state="loading"] .quick-queries,
.home-page[data-search-state="results"] .quick-queries { display: none; }
.home-page .search-results { min-height: 0; flex: 1; width: 100%; max-width: 960px; margin-top: .8rem; overflow: hidden; padding: 0; color: #f1ede3; background: rgba(7,17,19,.72); border: 0; border-top: 3px solid var(--ui-amber); box-shadow: 0 24px 70px rgba(0,0,0,.22); backdrop-filter: blur(12px); }
.home-page .search-result-content { height: 100%; padding: 1rem 1.2rem 1.4rem; }
.home-page[data-search-state="results"] .search-results { flex: none; overflow: visible; background: linear-gradient(180deg, rgba(7,17,19,.86), rgba(7,17,19,.66)); }
.home-page[data-search-state="results"] .search-result-content { height: auto; overflow: visible; }
.home-page .search-loading { height: 100%; min-height: 180px; display: flex; align-items: center; justify-content: center; gap: 1rem; color: #f3eee2; background: rgba(7,17,19,.96); }
.home-page .search-loading[hidden] { display: none; }
.search-loading strong { display: block; margin-top: .2rem; font-size: .95rem; font-weight: 500; }
.search-loading-mark { width: 34px; height: 34px; border: 2px solid rgba(223,169,78,.25); border-top-color: var(--ui-amber); border-radius: 50%; animation: search-spin .75s linear infinite; }
.global-search button:disabled { cursor: wait; opacity: .76; }
@keyframes search-spin { to { transform: rotate(360deg); } }

/* 深色资料层延续首屏场景，不形成突兀的白色内容块。 */
.home-page .search-results .section-kicker,
.home-page .search-results .result-kind { color: #dfb25f; }
.home-page .search-results .results-heading > p,
.home-page .search-results .result-row p,
.home-page .search-results .result-arrow,
.home-page .search-results .empty-results { color: rgba(241,237,227,.62); }
.home-page .search-results .result-filter { color: rgba(241,237,227,.66); }
.home-page .search-results .result-filter.active { color: #111b1b; background: var(--ui-amber); }
.home-page .search-results .result-list { border-top-color: rgba(241,237,227,.48); }
.home-page .search-results .result-row { border-bottom-color: rgba(241,237,227,.15); }
.home-page .search-results .result-row:hover,
.home-page .search-results .result-row:focus-visible { color: #fff; background: rgba(115,148,135,.17); }
.home-page .search-results .result-arrow b { color: #111b1b; background: var(--ui-amber); }
.home-page .search-results .result-item-icons img,
.home-page .search-results .summary-item-icon { background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.16); }
.home-page .search-results .material-summary { background: rgba(4,12,14,.72); border-top: 1px solid rgba(255,255,255,.1); border-right: 1px solid rgba(255,255,255,.1); border-bottom: 1px solid rgba(255,255,255,.1); }

/* 首页下半部分按“索引”而非营销卡片呈现。 */
.quick-entry, .latest-guides { padding-block: clamp(3.5rem, 7vw, 6rem); }
.quick-entry .section-heading, .latest-guides .section-heading { padding-bottom: 1.2rem; border-bottom: 3px solid var(--ui-ink); }
.entry-list { margin-top: 0; border-top: 0; }
.entry-item { min-height: 118px; }
.entry-item strong { font-size: 1.7rem; }
.newcomer-route { position: relative; border-top: 5px solid var(--ui-amber); }
.newcomer-route::before { content: "START HERE"; position: absolute; top: 14px; right: max(1rem, calc((100vw - 1180px) / 2)); color: rgba(255,255,255,.1); font-size: clamp(3rem,8vw,7rem); font-weight: 900; letter-spacing: -.04em; }

/* 资料页从大幅封面改为紧凑工作区。 */
.data-hero, .directory-hero {
  min-height: 238px;
  display: grid;
  align-content: end;
  padding-top: 3.2rem;
  padding-bottom: 2rem;
  border-bottom: 5px solid var(--ui-amber);
  background-position: center, right 22%;
  background-size: 100% 100%, auto 185%;
}
.data-hero h1, .directory-hero h1 { margin-bottom: .4rem; font-size: clamp(2.8rem, 4.5vw, 4.8rem); }
.data-main { padding-top: 0; }
.toolbar {
  margin-inline: -.8rem;
  padding: .8rem;
  background: rgba(238,231,215,.96);
  border-bottom: 1px solid rgba(16,26,27,.25);
  box-shadow: 0 10px 24px rgba(16,26,27,.06);
  backdrop-filter: blur(12px);
}
.control { min-height: 48px; border-color: rgba(16,26,27,.28); background: #fbf8ef; }
.result-line { min-height: 44px; align-items: center; margin: 0; border-bottom: 1px solid rgba(16,26,27,.2); }
.table-wrap { border-top: 3px solid var(--ui-ink); background: rgba(250,247,239,.54); }
.data-table tbody tr { transition: background .12s, box-shadow .12s; }
.data-table tbody tr:hover { background: #f8f2e3; box-shadow: inset 4px 0 var(--ui-jade); }

/* 图鉴网格呈现为连续档案墙。 */
:where(.item-grid, .monster-grid, .map-grid, .skill-grid) {
  gap: 1px !important;
  padding: 1px;
  background: rgba(16,26,27,.18);
}
:where(.item-card, .monster-card, .map-card, .skill-card) {
  background-color: var(--ui-paper-light) !important;
  border-color: transparent !important;
  box-shadow: none !important;
}
:where(.item-card, .monster-card, .map-card, .skill-card):hover {
  z-index: 1;
  box-shadow: inset 0 -4px var(--ui-amber) !important;
  transform: translateY(-2px);
}

/* 文章页是稳定的阅读画布。 */
.article-hero {
  min-height: 320px;
  display: grid;
  align-content: end;
  border-bottom: 5px solid var(--ui-amber);
}
.article-shell { grid-template-columns: 220px minmax(0, 760px); gap: clamp(2.5rem, 6vw, 5.5rem); }
.toc { top: calc(var(--ui-header) + 28px); border-top: 3px solid var(--ui-ink); }
.article-body { font-size: 1.03rem; line-height: 1.82; }
.article-body h2 { border-top-width: 3px; }
.article-body table { border-top: 3px solid var(--ui-ink); }

@media (max-width: 900px) {
  .site-header::before, .inner-header::before { display: none; }
  .finder-hero { min-height: auto; align-items: flex-start; padding-top: 3rem; }
  .hero-directory { grid-template-columns: repeat(4, 1fr); }
  .hero-directory a:nth-child(4) { border-right: 0; }
  .hero-directory a { border-bottom: 1px solid rgba(255,255,255,.15); }
}

@media (max-width: 680px) {
  .finder-hero { padding-top: 2.4rem; padding-bottom: 2rem; }
  .home-page main { height: calc(100svh - var(--ui-header) - 62px); }
  .finder-hero h1 { font-size: clamp(2.7rem, 10.5vw, 3.2rem); line-height: 1; white-space: normal; }
  .hero-directory { grid-template-columns: repeat(2, 1fr); }
  .hero-directory a { min-height: 76px; }
  .hero-directory a:nth-child(even) { border-right: 0; }
  .global-search { min-height: 58px; }
  .global-search kbd { display: none; }
  .home-page[data-search-state="loading"] .finder-hero h1,
  .home-page[data-search-state="results"] .finder-hero h1 { font-size: 1.65rem; }
  .home-page .search-results { margin-top: .6rem; }
  .home-page .search-result-content { padding: .8rem; }
  .home-page .results-heading { align-items: flex-start; gap: .35rem; }
  .home-page .results-heading h2 { font-size: 1.45rem; }
  .data-hero, .directory-hero { min-height: 205px; padding-bottom: 1.5rem; }
  .article-hero { min-height: 245px; }
  .entry-list { grid-template-columns: 1fr; }
  .entry-item:nth-child(n) { padding-inline: 0; border-right: 0; }
  .entry-item:nth-child(n):hover { padding-left: .7rem; }
}
