/* 主题变量统一由 ../../shared/tokens.css 提供 */

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: var(--font-sans);
}

a,
button,
input,
select {
  color: inherit;
  font: inherit;
}

a {
  text-decoration: none;
}

button {
  cursor: pointer;
}

.page {
  position: relative;
  min-height: 100vh;
  isolation: isolate;
  overflow-x: hidden;
}

.page::before,
.page::after {
  position: fixed;
  inset: 0;
  z-index: -2;
  content: "";
  pointer-events: none;
}

.page::before {
  background: var(--page-bg) center top / cover no-repeat;
}

.page::after {
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(6, 11, 15, 0.7) 0%, rgba(6, 11, 15, 0.18) 26%, rgba(6, 11, 15, 0.84) 73%, #071017 100%),
    radial-gradient(ellipse at 22% 24%, rgba(0, 0, 0, 0.5), transparent 42%),
    radial-gradient(ellipse at 82% 8%, rgba(10, 17, 22, 0.72), transparent 34%);
}

.home-page {
  --page-bg: url("../assets/bg-home.webp");
}

.archive-page {
  --page-bg: url("../assets/bg-archive.webp");
}

.archive-page::after {
  background:
    linear-gradient(180deg, rgba(6, 11, 15, 0.78) 0%, rgba(6, 11, 15, 0.52) 25%, rgba(6, 11, 15, 0.9) 67%, #071017 100%),
    radial-gradient(ellipse at 19% 21%, rgba(0, 0, 0, 0.42), transparent 36%);
}

.site-header {
  position: relative;
  z-index: 7;
  display: grid;
  grid-template-columns: minmax(250px, 1fr) auto minmax(250px, 1fr);
  align-items: center;
  height: 92px;
  padding: 0 clamp(38px, 4.7vw, 82px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  overflow: hidden;
  border: 1px solid rgba(244, 200, 121, 0.68);
  border-radius: 50%;
  background: rgba(255, 236, 184, 0.18);
  box-shadow: 0 0 18px rgba(255, 179, 71, 0.22), inset 0 0 10px rgba(255, 246, 207, 0.18);
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-name {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--gold);
}

.brand-line {
  width: 1px;
  height: 17px;
  background: rgba(244, 200, 121, 0.32);
}

.brand-tagline {
  font-size: 14px;
  color: rgba(255, 228, 177, 0.82);
  white-space: nowrap;
}

.main-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(34px, 4vw, 62px);
  white-space: nowrap;
}

.main-nav a {
  position: relative;
  padding: 10px 0 18px;
  color: rgba(255, 241, 210, 0.72);
  font-size: 17px;
  text-decoration: none;
  transition: color 180ms ease, text-shadow 180ms ease;
}

.main-nav a:hover,
.main-nav a.active {
  color: var(--gold);
  text-shadow: 0 0 16px rgba(244, 200, 121, 0.24);
}

.main-nav a.active::before,
.main-nav a.active::after {
  position: absolute;
  left: 50%;
  content: "";
  transform: translateX(-50%);
}

.main-nav a.active::before {
  bottom: 6px;
  width: 64px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.main-nav a.active::after {
  bottom: 1px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--gold);
  box-shadow: 0 0 16px rgba(233, 182, 110, 0.86);
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 26px;
}

.search-button {
  position: relative;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.search-button::before {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 15px;
  height: 15px;
  content: "";
  border: 2px solid rgba(255, 244, 221, 0.95);
  border-radius: 50%;
}

.search-button::after {
  position: absolute;
  top: 23px;
  left: 23px;
  width: 11px;
  height: 2px;
  content: "";
  background: rgba(255, 244, 221, 0.95);
  border-radius: 99px;
  transform: rotate(45deg);
  transform-origin: left center;
}

.login-button,
.action-button,
.filter-chip,
.filter-more,
.card-action,
.pager-button,
.sort-select select {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 230, 180, 0.1), rgba(72, 51, 33, 0.18));
  box-shadow: inset 0 0 18px rgba(255, 234, 190, 0.035), 0 8px 22px rgba(0, 0, 0, 0.14);
  backdrop-filter: blur(12px);
}

.login-button {
  min-width: 136px;
  padding: 10px 18px;
  border-radius: 10px;
  text-align: center;
  color: var(--gold-hot);
}

.login-button:hover,
.action-button:hover,
.filter-more:hover,
.card-action:hover,
.pager-button:hover,
.pager-button.active,
.filter-chip:hover,
.filter-chip.active {
  border-color: var(--border-hot);
  background: linear-gradient(180deg, rgba(247, 189, 109, 0.76), rgba(172, 97, 34, 0.58));
  color: #fff4da;
}

.hero {
  display: flex;
  align-items: flex-start;
  min-height: 340px;
  padding: clamp(32px, 6vh, 72px) clamp(38px, 4.4vw, 74px) 22px;
}

.hero-copy {
  width: min(700px, 48vw);
}

.hero h1,
.archive-hero h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 500;
  color: #ffe9c0; /* 回退色 */
  letter-spacing: 0;
  background: linear-gradient(176deg, #fff6e0 0%, #ffe6b0 52%, var(--xh-gold) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 3px 20px rgba(0, 0, 0, 0.48)) drop-shadow(0 0 18px rgba(244, 200, 121, 0.2));
}

.hero h1 {
  font-size: clamp(52px, 5vw, 82px);
  line-height: 1.08;
}

.hero-kicker {
  margin: 22px 0 14px;
  color: var(--gold-hot);
  font-family: var(--font-serif);
  font-size: clamp(20px, 1.55vw, 28px);
}

.hero-text {
  max-width: 580px;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.85;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 30px;
}

.action-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  min-width: 190px;
  min-height: 48px;
  padding: 0 24px;
  border-radius: 8px;
  color: rgba(247, 229, 195, 0.88);
  font-size: 16px;
}

.action-button.primary {
  min-width: 220px;
  border-color: rgba(255, 217, 151, 0.62);
  background: var(--xh-grad-gold);
  color: #fff8e6;
  box-shadow: 0 11px 28px rgba(220, 125, 40, 0.23), inset 0 0 18px rgba(255, 246, 222, 0.1);
}

.home-dock,
.archive-tools,
.weekly-panel,
.villager-card {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(39, 35, 29, 0.72), rgba(23, 28, 28, 0.76));
  box-shadow: 0 18px 42px var(--shadow), inset 0 0 24px rgba(255, 234, 190, 0.03);
  backdrop-filter: blur(16px);
}

.home-dock {
  width: calc(100% - clamp(76px, 8.8vw, 148px));
  margin: 0 auto;
  padding: 14px 14px 12px;
  border-radius: 14px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto;
  align-items: center;
  gap: 18px;
}

.search-field {
  position: relative;
  display: block;
  min-width: 0;
}

.search-field input {
  width: 100%;
  height: 46px;
  padding: 0 18px 0 48px;
  color: var(--text);
  outline: 0;
  border: 1px solid rgba(233, 182, 110, 0.24);
  border-radius: 999px;
  background: rgba(9, 15, 17, 0.42);
}

.search-field input::placeholder {
  color: rgba(247, 229, 195, 0.46);
}

.search-field input:focus {
  border-color: var(--border-hot);
  box-shadow: 0 0 0 3px rgba(233, 182, 110, 0.1);
}

.search-glyph {
  position: absolute;
  left: 20px;
  top: 50%;
  width: 15px;
  height: 15px;
  z-index: 1;
  border: 2px solid var(--gold);
  border-radius: 50%;
  transform: translateY(-57%);
}

.search-glyph::after {
  position: absolute;
  right: -7px;
  bottom: -5px;
  width: 8px;
  height: 2px;
  content: "";
  background: var(--gold);
  transform: rotate(45deg);
}

.filter-list {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.filter-chip,
.filter-more {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-width: 86px;
  height: 38px;
  padding: 0 18px;
  border-radius: 12px;
  color: rgba(247, 229, 195, 0.82);
  white-space: nowrap;
}

.filter-chip {
  background: linear-gradient(180deg, rgba(255, 230, 180, 0.08), rgba(40, 34, 25, 0.38));
}

.filter-chip.active {
  color: #2b1a0e;
  background: linear-gradient(180deg, #ffd392, #df9550);
  box-shadow: 0 8px 20px rgba(222, 141, 65, 0.24);
}

.weekly-panel {
  display: grid;
  grid-template-columns: 280px 1fr;
  align-items: center;
  gap: 22px;
  margin-top: 12px;
  padding: 18px 22px;
  border-radius: 12px;
}

.weekly-panel h2,
.section-heading h2 {
  margin: 0;
  color: var(--gold-hot);
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 600;
}

.spotlight-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 42px;
}

.spotlight-card {
  min-width: 0;
  padding: 10px 22px;
  border-left: 1px solid rgba(233, 182, 110, 0.18);
}

.spotlight-card:first-child {
  border-left: 0;
}

.spotlight-id,
.card-id {
  color: var(--gold-dim);
  font-size: 13px;
}

.spotlight-name {
  margin-top: 5px;
  color: var(--gold-hot);
  font-family: var(--font-serif);
  font-size: 20px;
}

.spotlight-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.archive-preview,
.archive-shell {
  width: calc(100% - clamp(76px, 8.8vw, 148px));
  margin: 24px auto 40px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.section-heading small {
  margin-left: 10px;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 400;
}

.section-heading a {
  color: var(--gold-hot);
  white-space: nowrap;
}

.card-grid {
  display: grid;
  gap: 20px;
}

.preview-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.archive-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.villager-card {
  min-width: 0;
  padding: 18px 20px 14px;
  border-radius: var(--xh-radius-md);
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.villager-card:hover {
  border-color: var(--xh-border-hot);
  box-shadow: var(--xh-shadow-lg), var(--xh-glow-gold);
  transform: translateY(-2px);
}

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  min-height: 58px;
}

.card-top > div:first-child {
  min-width: 0;
  flex: 1 1 auto;
}

.card-name {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 4px 0 0;
  color: var(--gold-hot);
  font-family: var(--font-serif);
  font-size: 24px;
  line-height: 1.1;
  white-space: nowrap;
}

.card-name::before {
  width: 2px;
  height: 24px;
  content: "";
  background: var(--gold-hot);
  box-shadow: 0 0 10px rgba(242, 190, 120, 0.45);
}

.card-role {
  flex: 0 0 104px;
  color: rgba(247, 229, 195, 0.7);
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.4;
  text-align: right;
}

.card-lines {
  display: grid;
  gap: 7px;
  margin: 12px 0 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(233, 182, 110, 0.13);
}

.card-line {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
  color: rgba(247, 229, 195, 0.72);
  font-size: 14px;
  line-height: 1.45;
}

.card-line strong {
  color: var(--gold-hot);
  font-weight: 600;
  white-space: nowrap;
}

.card-line span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.card-footer {
  display: grid;
  grid-template-columns: minmax(76px, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.card-zone {
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-zone::before {
  content: "♧";
  margin-right: 7px;
  color: var(--gold-hot);
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.card-action {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-width: 66px;
  height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  color: var(--gold-hot);
  font-size: 13px;
  white-space: nowrap;
}

.preview-grid .villager-card {
  padding-right: 15px;
  padding-left: 15px;
}

.preview-grid .card-top {
  gap: 10px;
}

.preview-grid .card-name {
  font-size: 22px;
}

.preview-grid .card-role {
  flex-basis: 92px;
  font-size: 15px;
}

.preview-grid .card-footer {
  grid-template-columns: 1fr;
  gap: 10px;
}

.preview-grid .card-zone {
  white-space: normal;
}

.preview-grid .card-actions {
  justify-content: flex-start;
}

.preview-grid .card-action {
  min-width: 58px;
  padding: 0 8px;
}

.archive-shell {
  margin-top: 18px;
}

.archive-hero {
  max-width: 720px;
  margin: 0 0 26px;
  padding-top: 10px;
}

.archive-hero h1 {
  font-size: clamp(36px, 3.2vw, 52px);
}

.archive-hero p {
  margin: 10px 0 0;
  color: var(--gold-hot);
  font-family: var(--font-serif);
  font-size: 18px;
}

.archive-tools {
  margin-bottom: 22px;
  padding: 18px;
  border-radius: 14px;
}

.archive-toolbar {
  grid-template-columns: minmax(310px, 1fr) auto 132px;
}

.sort-select {
  position: relative;
  display: block;
}

.sort-select select {
  width: 100%;
  height: 38px;
  padding: 0 34px 0 14px;
  color: var(--gold-hot);
  outline: 0;
  border-radius: 8px;
  appearance: none;
}

.sort-select::after {
  position: absolute;
  top: 50%;
  right: 14px;
  content: "⌄";
  color: var(--gold-hot);
  transform: translateY(-56%);
  pointer-events: none;
}

.result-count {
  margin: 14px 0 0;
  color: var(--gold-hot);
  font-size: 14px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 24px 0 0;
}

.pager-button {
  min-width: 48px;
  height: 42px;
  padding: 0 12px;
  border-radius: 8px;
  color: rgba(247, 229, 195, 0.78);
}

.pager-button[disabled] {
  cursor: not-allowed;
  opacity: 0.42;
}

.empty-state {
  margin: 32px 0;
  text-align: center;
  color: var(--muted);
}

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

@media (max-width: 1320px) {
  .main-nav {
    gap: 28px;
  }

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

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

  .toolbar,
  .archive-toolbar {
    grid-template-columns: 1fr;
  }

  .filter-list {
    flex-wrap: wrap;
  }

  .filter-more,
  .sort-select {
    width: fit-content;
  }

  .weekly-panel {
    grid-template-columns: 1fr;
  }

  .spotlight-list {
    gap: 14px;
  }
}

@media (max-width: 960px) {
  .site-header {
    grid-template-columns: 1fr auto;
    height: auto;
    min-height: 72px;
    padding: 16px 24px;
  }

  .main-nav {
    order: 3;
    grid-column: 1 / -1;
    justify-content: flex-start;
    gap: 18px;
    margin-top: 8px;
    overflow-x: auto;
  }

  .main-nav a {
    font-size: 15px;
  }

  .search-button {
    display: none;
  }

  .hero {
    min-height: 300px;
    padding: 28px 24px 18px;
  }

  .hero-copy {
    width: min(100%, 640px);
  }

  .home-dock,
  .archive-preview,
  .archive-shell {
    width: calc(100% - 48px);
  }

  .spotlight-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 640px) {
  .page::before {
    background-position: center top;
  }

  .site-header {
    padding: 14px 18px;
  }

  .brand-name {
    font-size: 24px;
  }

  .brand-line,
  .brand-tagline {
    display: none;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .login-button {
    min-width: auto;
    padding: 8px 12px;
    font-size: 13px;
  }

  .hero h1 {
    font-size: 42px;
  }

  .hero-kicker {
    font-size: 18px;
  }

  .hero-text {
    font-size: 14px;
  }

  .hero-actions,
  .filter-list,
  .card-actions,
  .section-heading {
    gap: 10px;
  }

  .action-button {
    width: 100%;
  }

  .home-dock,
  .archive-preview,
  .archive-shell {
    width: calc(100% - 28px);
  }

  .home-dock,
  .archive-tools {
    padding: 12px;
  }

  .filter-chip {
    flex: 1 1 calc(50% - 6px);
    min-width: 0;
  }

  .weekly-panel {
    padding: 16px;
  }

  .spotlight-list,
  .preview-grid,
  .archive-grid {
    grid-template-columns: 1fr;
  }

  .spotlight-card {
    padding: 10px 0;
    border-left: 0;
    border-top: 1px solid rgba(233, 182, 110, 0.14);
  }

  .spotlight-card:first-child {
    border-top: 0;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .card-footer {
    grid-template-columns: 1fr;
  }

  .card-actions {
    flex-wrap: wrap;
  }

  .card-action {
    flex: 1 1 auto;
  }

  .pagination {
    flex-wrap: wrap;
  }
}

/* ============================================================
   真实数据卡片：等高对齐 —— 中段吃掉剩余高度，元素与按钮齐底
   ============================================================ */
.villager-card {
  display: flex;
  flex-direction: column;
}

.card-lines {
  flex: 1;
  align-content: start;
}

/* 性能：列表卡片数量多（每页 12 张），逐帧 backdrop 模糊导致滚动卡顿；
   卡片底色接近实色，关掉模糊肉眼几乎无差 */
.villager-card {
  backdrop-filter: none;
}
