﻿/* ==========================================================================
   星河资源库 · 主样式 v2
   布局重排：sticky 侧栏 / 网格骨架 / 统一间距与字号 / 移动端可操作顶栏
   ========================================================================== */

:root {
  color-scheme: dark;

  --bg: #0d0f13;
  --bg-soft: #11141a;
  --panel: #171b21;
  --panel-2: #1c212a;
  --panel-3: #212734;

  --line: #242a33;
  --line-strong: #333c47;

  --text: #eff1f5;
  --text-2: #c2c8d2;
  --muted: #8b93a0;
  --faint: #6b7481;

  --lime: #c3f56b;
  --lime-deep: #93c04f;
  --lime-ink: #1b2810;
  --gold: #f2d66b;

  --radius-lg: 16px;
  --radius: 12px;
  --radius-sm: 8px;

  --shadow: 0 18px 42px #00000059;
  --sidebar-w: 244px;
  --mobbar-h: 52px;

  /* 间距刻度 */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 20px;
  --s6: 24px;
  --s7: 32px;
  --s8: 44px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
}

body {
  margin: 0;
  background:
    radial-gradient(1200px 620px at 78% -12%, #1b2a1c66, transparent 70%),
    var(--bg);
  color: var(--text);
  font-family: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }

/* 统一焦点样式 */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* ============================= 骨架 ============================= */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  align-items: start;
  min-height: 100dvh;
}

main {
  width: 100%;
  max-width: 1580px;
  margin-inline: auto;
  padding: 0 clamp(16px, 2.6vw, 44px);
}

/* ============================= 侧栏 ============================= */

.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  padding: var(--s7) var(--s4) var(--s5);
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #14181e, #101318);
  display: flex;
  flex-direction: column;
  gap: var(--s4);
  overflow-y: auto;
  overscroll-behavior: contain;
  z-index: 9;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: 0 var(--s1);
  font-size: 19px;
  font-weight: 800;
  letter-spacing: .5px;
  line-height: 1.2;
}

.brand-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: var(--radius);
  background: var(--lime);
  color: var(--lime-ink);
  font-size: 26px;
  box-shadow: 0 8px 22px #c3f56b26;
}

.brand small {
  display: block;
  margin-top: 3px;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 2.4px;
  color: var(--faint);
}

.nav-label {
  margin: var(--s7) var(--s2) 0;
  font-size: 10px;
  letter-spacing: 2px;
  color: #5d6572;
}

#side-nav {
  display: flex;
  flex-direction: column;
  gap: var(--s1);
  margin-top: calc(var(--s4) * -1);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--s3);
  width: 100%;
  padding: 11px var(--s3);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: none;
  color: #9aa2af;
  text-align: left;
  font-size: 13px;
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}

.nav-item > span {
  min-width: 18px;
  text-align: center;
  font-size: 15px;
  opacity: .85;
}

.nav-item:hover { background: #1a1f27; color: var(--text-2); }

.nav-item.active {
  background: linear-gradient(100deg, #25301d, #1d2420);
  border-color: #3d4d2b;
  color: var(--lime);
  font-weight: 600;
}

.nav-item i {
  margin-left: auto;
  padding: 1px 7px;
  border-radius: 20px;
  background: #2e3a22;
  color: #b7d08a;
  font-size: 10px;
  font-style: normal;
}

.nav-item.active i { background: #3a4a29; color: var(--lime); }

.sidebar-note {
  margin-top: var(--s4);
  padding: 14px var(--s3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #14181e80;
  color: #c3c9d2;
  font-size: 11px;
  line-height: 1.7;
}

.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--lime);
  vertical-align: middle;
  margin-right: 6px;
  box-shadow: 0 0 0 3px #c3f56b1a;
}

.sidebar-note p {
  margin: var(--s2) 0 0;
  font-size: 10px;
  line-height: 1.9;
  color: var(--faint);
}

.sidebar-bottom {
  margin-top: auto;
  padding: var(--s5) var(--s1) 0;
  color: #6f7884;
  font-size: 10px;
  line-height: 1.7;
}

.sidebar-bottom small {
  display: block;
  margin-top: 6px;
  font-size: 9px;
  letter-spacing: 1px;
  color: #4b525d;
}

/* ============================= 顶栏 ============================= */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  min-height: 72px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.breadcrumb { color: var(--faint); }
.breadcrumb span { padding: 0 10px; color: #3c434e; }
.breadcrumb strong { font-weight: 500; color: var(--text-2); }

.topbar-actions { display: flex; align-items: center; gap: var(--s4); }
.top-link { color: var(--muted); font-size: 12px; }
.top-link:hover { color: var(--text); }

/* ============================= Hero ============================= */

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr);
  margin-top: var(--s6);
  min-height: clamp(272px, 25vw, 356px);
  border: 1px solid #2a3530;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background:
    radial-gradient(ellipse at 84% 88%, #2b3f2b66, transparent 62%),
    linear-gradient(120deg, #171d1d, #151a1d);
}

.hero-copy {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--s3);
  padding: clamp(24px, 2.4vw, 40px);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1.9px;
  color: var(--lime);
}

.eyebrow span {
  width: 5px;
  height: 5px;
  background: var(--lime);
  border-radius: 1px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(26px, 3.1vw, 42px);
  line-height: 1.28;
  letter-spacing: -.8px;
  font-weight: 900;
}

.hero h1 span { color: var(--lime); }

.hero p {
  margin: 0;
  max-width: 34em;
  color: #9aa79f;
  font-size: 13px;
  line-height: 1.85;
}

.primary-button {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: var(--s6);
  margin-top: var(--s1);
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  background: var(--lime);
  color: #1f2e14;
  font-size: 13px;
  font-weight: 700;
  transition: background .18s ease, transform .18s ease;
}

.primary-button:hover { background: #d6ff95; transform: translateY(-1px); }
.primary-button span { font-size: 15px; }

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s4);
  margin-top: var(--s1);
  font-size: 10px;
  color: #78867c;
}

/* Hero 右侧插画 */
.hero-art {
  position: relative;
  min-height: 100%;
  overflow: hidden;
  background: radial-gradient(ellipse at center, #5d7e3440, transparent 66%);
}

.orbit {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 340px;
  height: 340px;
  border: 1px solid #82915a1f;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.orbit-two { width: 250px; height: 250px; }

.art-caption {
  position: absolute;
  right: 20px;
  top: 20px;
  z-index: 1;
  font-size: 9px;
  line-height: 1.6;
  letter-spacing: 1.8px;
  color: #829372;
}

.art-caption b { display: block; font-size: 18px; color: #bdd0a0; }

.pixel-scene {
  position: absolute;
  inset: 46px 18px 30px;
  overflow: hidden;
  mask-image: linear-gradient(to bottom, #000 82%, transparent);
}

.moon {
  position: absolute;
  top: 12px;
  left: 42%;
  width: 74px;
  height: 74px;
  background: #d7ee9b;
  box-shadow: 0 0 60px #c4f56b3d;
  clip-path: polygon(15% 0, 85% 0, 85% 15%, 100% 15%, 100% 85%, 85% 85%, 85% 100%, 15% 100%, 15% 85%, 0 85%, 0 15%, 15% 15%);
}

.mountain {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 20px;
  height: 150px;
  clip-path: polygon(0 65%, 15% 65%, 15% 45%, 25% 45%, 25% 25%, 35% 25%, 35% 0, 45% 0, 45% 25%, 55% 25%, 55% 45%, 65% 45%, 65% 60%, 80% 60%, 80% 40%, 90% 40%, 90% 60%, 100% 60%, 100% 100%, 0 100%);
}

.mountain.back { background: #47603e; transform: translate(35px, -35px); opacity: .7; }
.mountain.front { background: #2c4334; bottom: 0; transform: scaleX(-1); }

.ground {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 48px;
  background: repeating-linear-gradient(90deg, #354b34 0 20px, #30432d 20px 40px);
  border-top: 7px solid #8caa50;
}

.portal {
  position: absolute;
  bottom: 44px;
  left: 47%;
  width: 82px;
  height: 116px;
  border: 11px solid #a3bc68;
  border-bottom: 0;
  background: linear-gradient(#b2da65, #e0ff9d);
  box-shadow: 0 0 38px #c3f56b55;
  clip-path: polygon(15% 0, 85% 0, 85% 10%, 100% 10%, 100% 100%, 0 100%, 0 10%, 15% 10%);
}

.portal span {
  display: block;
  margin: 18px 14px;
  width: 9px;
  height: 9px;
  background: #f4ffd9;
  box-shadow: 22px 22px #e4ffb4, 6px 50px #eaffcb;
}

.pixel-player {
  position: absolute;
  bottom: 47px;
  left: 34%;
  width: 13px;
  height: 17px;
  background: #dfb07a;
  box-shadow: 0 -13px #d5a278, 0 -21px #543c2b, -6px 4px #bacc92, 6px 4px #bacc92, 0 15px #506054, -5px 27px #27332b, 6px 27px #27332b;
}

.spark { position: absolute; color: #def4a3; font-size: 18px; }
.s1 { left: 18%; top: 16px; }
.s2 { right: 8%; top: 84px; font-size: 11px; }
.s3 { left: 30%; top: 82px; font-size: 11px; }

.floating-label {
  position: absolute;
  right: 16px;
  bottom: 44px;
  padding: 11px 14px;
  border: 1px solid #5c704640;
  border-radius: var(--radius-sm);
  background: #1c251dea;
  font-size: 11px;
  box-shadow: var(--shadow);
  transform: rotate(-6deg);
}

.floating-label > span { color: var(--lime); margin-right: 4px; }

.floating-label small {
  display: block;
  margin: 4px 0 0 18px;
  font-size: 7px;
  letter-spacing: 1.6px;
  color: #7b8f70;
}

.art-number {
  position: absolute;
  bottom: 14px;
  left: 26%;
  font-size: 8px;
  letter-spacing: 1.8px;
  color: #65765b;
}

/* ============================= 快捷入口 ============================= */

.collection-shortcuts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s3);
  margin: var(--s5) 0 var(--s3);
  scroll-margin-top: 90px;
}

.collection-shortcuts button {
  display: flex;
  align-items: center;
  gap: var(--s3);
  min-width: 0;
  padding: 14px;
  border: 1px solid #2c353c;
  border-radius: var(--radius);
  background: linear-gradient(120deg, #1c2421, #171c21);
  color: #dfe7e3;
  text-align: left;
  transition: border-color .18s ease, transform .18s ease, background .18s ease;
}

.collection-shortcuts button:nth-child(2) { background: linear-gradient(120deg, #1e2630, #181c23); }
.collection-shortcuts button:nth-child(3) { background: linear-gradient(120deg, #251f33, #1a1b23); }
.collection-shortcuts button:nth-child(4) { background: linear-gradient(120deg, #2c2426, #201c22); }

.collection-shortcuts button:hover { border-color: #77975a; transform: translateY(-2px); }
.collection-shortcuts button.selected { border-color: var(--lime-deep); box-shadow: 0 0 0 1px #c3f56b33 inset; }

.shortcut-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border: 1px solid #778f5940;
  border-radius: var(--radius-sm);
  background: #ffffff05;
  color: var(--lime);
  font-size: 17px;
}

.collection-shortcuts strong { display: block; font-size: 12px; font-weight: 600; line-height: 1.5; }

.collection-shortcuts small {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  line-height: 1.6;
  color: #82918e;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collection-shortcuts i { margin-left: auto; font-size: 13px; font-style: normal; color: #7b8e79; }

/* ============================= 提示条 ============================= */

.notice {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin: var(--s4) 0 var(--s6);
  padding: 12px var(--s4);
  border: 1px solid #272d31;
  border-radius: var(--radius);
  background: #161a1e;
}

.notice-icon { color: var(--lime); font-size: 15px; }

.notice p {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin: 0;
  font-size: 11px;
  line-height: 1.75;
  color: #8b939c;
}

.notice strong { color: #cbd1d7; font-weight: 600; }
.notice-arrow { margin-left: auto; color: #7d8791; font-size: 12px; }

/* ============================= 资源区 ============================= */

.library { scroll-margin-top: 88px; }

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s4);
  margin-bottom: var(--s4);
}

.section-kicker {
  margin-bottom: 6px;
  font-size: 10px;
  letter-spacing: 1.9px;
  color: #737c86;
}

.section-heading h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -.3px;
}

.section-heading h2 span {
  margin-left: var(--s2);
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}

.library-label { color: #7d8881; font-size: 11px; white-space: nowrap; }

/* 吸顶筛选栏：滚动时仍可筛选与搜索 */
.library-dock {
  position: sticky;
  top: 0;
  z-index: 7;
  margin: 0 calc(var(--s2) * -1);
  padding: var(--s3) var(--s2) 0;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #0d0f13f5 62%, #0d0f13e8);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  padding-bottom: var(--s3);
}

.tabs { display: flex; flex-wrap: wrap; gap: var(--s1); }

.tab {
  padding: 8px 13px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: #939aa6;
  font-size: 12px;
  white-space: nowrap;
  transition: background .16s ease, color .16s ease;
}

.tab:hover { background: #1e232b; color: var(--text-2); }
.tab.active { background: var(--lime); border-color: var(--lime); color: #24321a; font-weight: 600; }

.search-wrap {
  display: flex;
  align-items: center;
  gap: var(--s2);
  width: min(320px, 100%);
  height: 38px;
  padding: 0 11px;
  border: 1px solid #2b3039;
  border-radius: var(--radius-sm);
  background: #14181e;
  transition: border-color .16s ease, box-shadow .16s ease;
}

.search-wrap:focus-within { border-color: #5c7343; box-shadow: 0 0 0 3px #c3f56b14; }
.search-wrap > span { font-size: 19px; line-height: 1; color: #7d8491; }

.search-wrap input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: none;
  color: var(--text);
  font-size: 12px;
  outline: none;
}

.search-wrap input::placeholder { color: #636b77; }
.search-wrap input::-webkit-search-cancel-button { filter: invert(.6); }

.search-wrap kbd {
  padding: 0 5px;
  border: 1px solid #343a44;
  border-radius: 4px;
  color: #6d7682;
  font-size: 10px;
  line-height: 16px;
}

.platform-filters {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 0 0 var(--s3);
}

.platform-filters > span:first-child { margin-right: 4px; font-size: 11px; color: #7d8b92; }

.platform-filters button {
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 20px;
  background: none;
  color: #8f9da7;
  font-size: 11px;
  transition: background .16s ease, color .16s ease, border-color .16s ease;
}

.platform-filters button:hover { background: #1e2629; }
.platform-filters button.active { background: #253222; border-color: #475c38; color: var(--lime); }

.filter-tip { margin-left: auto; font-size: 10px; color: #5d7079; }

.active-filter {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin: 0 0 var(--s3);
  padding: 8px 12px;
  border: 1px solid #3e4f33;
  border-radius: var(--radius-sm);
  background: #26332240;
  color: #bbcfab;
  font-size: 11px;
}

.active-filter button {
  margin-left: auto;
  border: 0;
  background: none;
  color: #a5b990;
  font-size: 11px;
}

.filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  padding: var(--s3) 0;
  color: var(--muted);
  font-size: 11px;
}

.filter-row label { display: flex; align-items: center; gap: var(--s2); }

.filter-row select {
  max-width: 120px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #171b21;
  color: var(--text-2);
  font-size: 11px;
  cursor: pointer;
}

/* ============================= 卡片网格 ============================= */

.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: clamp(12px, 1.4vw, 22px);
  align-items: stretch;
}

.resource-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid #2b3038;
  border-radius: 14px;
  background: var(--panel);
  overflow: hidden;
  cursor: pointer;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.resource-card:hover {
  transform: translateY(-3px);
  border-color: #7d9a58;
  box-shadow: 0 16px 34px #00000059;
}

.card-art {
  position: relative;
  aspect-ratio: 16 / 10;
  height: auto;
  overflow: hidden;
  background: linear-gradient(150deg, var(--sky, #2a3a2c), var(--land, #1c2620));
  isolation: isolate;
}

/* 无自定义封面时保留的极简装饰层（生成封面会覆盖） */
.card-art:before,
.card-art:after { display: none; }

.resource-cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 2;
}

.art-lines {
  position: absolute;
  inset: 0;
  opacity: .1;
  background: repeating-linear-gradient(0deg, transparent 0 3px, #000 3px 4px);
}

.card-badge {
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 3;
  padding: 4px 8px;
  border: 1px solid #ffffff1f;
  border-radius: 5px;
  background: #101720b8;
  backdrop-filter: blur(6px);
  color: #e6f6d2;
  font-size: 10px;
}

.card-category {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 3;
  padding: 3px 8px;
  border: 1px solid #ffffff1a;
  border-radius: 5px;
  background: #101720b8;
  color: #e0e6e8;
  font-size: 10px;
}

/* 主题色备用（无生成封面时生效） */
.meadow { --sky: #718c65; --land: #455c38; --sun: #e7d79b; --hill: #2d4d3d; }
.city   { --sky: #252743; --land: #382348; --sun: #d47bb1; --hill: #141c31; }
.space  { --sky: #141e36; --land: #343f62; --sun: #a3bdd4; --hill: #1a263a; }
.violet { --sky: #39334e; --land: #66527d; --sun: #c3aad7; --hill: #3e354d; }
.desert { --sky: #a47759; --land: #73523e; --sun: #f3d29c; --hill: #644439; }
.forest { --sky: #3b635c; --land: #203e39; --sun: #b7c595; --hill: #1b3633; }
.ocean  { --sky: #274658; --land: #345c6d; --sun: #9dc9d3; --hill: #173c50; }
.dusk   { --sky: #885f70; --land: #b97f6d; --sun: #f3c48e; --hill: #513c53; }

.card-body {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  flex: 1;
  padding: 14px var(--s4) 0;
}

.card-platform {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
  font-size: 10px;
  color: #97ada4;
}

.card-platform > span:first-child {
  max-width: 64%;
  padding: 3px 8px;
  border: 1px solid #52664530;
  border-radius: 20px;
  background: #29372d;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-platform > span:last-child { color: #879ba7; white-space: nowrap; }

.card-body h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.55;
  min-height: calc(1.55em * 2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-subtitle {
  margin: 0;
  font-size: 12px;
  line-height: 1.7;
  min-height: calc(1.7em * 2);
  color: #8595a0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 23px;
  max-height: 23px;
  overflow: hidden;
}

.tag {
  padding: 3px 7px;
  border-radius: 4px;
  background: #232b34;
  color: #9fabB6;
  color: #9fabb6;
  font-size: 10px;
  white-space: nowrap;
}

.card-version {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  margin-top: auto;
  padding-top: var(--s2);
  font-size: 10px;
  color: #7a8c98;
}

.card-version > span {
  max-width: 55%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-version > span:last-child { max-width: 45%; color: #9bb28a; text-align: right; }

.card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
  margin: var(--s3) var(--s4) 0;
  padding: 11px 0;
  border-top: 1px solid #2a313a;
  color: #8b95a1;
  font-size: 11px;
}

.card-open {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border: 1px solid #52693c66;
  border-radius: 6px;
  background: #27331f;
  color: #d7edbd;
  font-size: 11px;
  transition: background .16s ease, border-color .16s ease;
}

.card-open:hover { background: #33422a; border-color: #7d9a58; }
.card-open span { color: var(--lime); }

/* 载入骨架 */
.skeleton-card {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  padding-bottom: var(--s4);
  border: 1px solid #232932;
  border-radius: 14px;
  overflow: hidden;
  background: #151920;
}

.sk-art {
  display: block;
  aspect-ratio: 16 / 10;
  background: linear-gradient(100deg, #1b2029 20%, #242b35 45%, #1b2029 70%);
  background-size: 220% 100%;
  animation: sk 1.35s ease-in-out infinite;
}

.sk-line {
  display: block;
  height: 10px;
  margin: 0 var(--s4);
  border-radius: 4px;
  background: #1f252e;
}

.sk-line.w70 { width: 70%; }
.sk-line.w50 { width: 50%; }

@keyframes sk {
  0% { background-position: 120% 0; }
  100% { background-position: -40% 0; }
}

/* 空状态 */
#empty-state {
  margin-top: var(--s4);
  padding: 56px var(--s4);
  border: 1px dashed #333b45;
  border-radius: var(--radius);
  background: #14181d;
  text-align: center;
}

#empty-state > div { font-size: 32px; color: var(--lime); }
#empty-state h3 { margin: var(--s3) 0 var(--s1); font-size: 17px; }
#empty-state p { margin: 0 0 var(--s4); font-size: 12px; color: var(--muted); }

.secondary-button {
  padding: 9px 15px;
  border: 1px solid #4c5c39;
  border-radius: 6px;
  background: #232b20;
  color: var(--lime);
  font-size: 12px;
}

.library.is-loading #empty-state { display: none !important; }

.collection-end {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s3);
  margin: var(--s7) 0;
  color: #59634e;
  font-size: 10px;
}

.collection-end span { color: #6c7580; font-size: 11px; }

footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  padding: var(--s6) 0 var(--s7);
  border-top: 1px solid #252932;
  color: #737c86;
  font-size: 11px;
}

footer > span:first-child { color: #bcc3ca; }
footer small { margin-left: var(--s3); color: #626c77; font-size: 10px; }
footer > span:last-child { font-size: 10px; }

/* ============================= 详情弹窗 ============================= */

dialog {
  width: min(760px, calc(100% - 28px));
  max-height: 88dvh;
  padding: 0;
  border: 1px solid #3a424a;
  border-radius: var(--radius-lg);
  background: #171b21;
  color: var(--text);
  overflow-y: auto;
  overscroll-behavior: contain;
  box-shadow: 0 30px 110px #000000a6;
}

dialog[open] { animation: dlg .18s ease-out; }

@keyframes dlg {
  from { opacity: 0; transform: translateY(8px) scale(.99); }
  to { opacity: 1; transform: none; }
}

dialog::backdrop { background: #070a0ebf; backdrop-filter: blur(7px); }

/* 悬浮关闭按钮：高度 0 的吸顶条，不占内容空间，长内容滚动时始终可点 */
.dialog-bar {
  position: sticky;
  top: 0;
  z-index: 6;
  display: flex;
  justify-content: flex-end;
  height: 0;
  padding: 0 10px;
}

.close-dialog {
  margin-top: 10px;
  width: 32px;
  height: 32px;
  border: 1px solid #ffffff2b;
  border-radius: 50%;
  background: #10141ad9;
  color: #fff;
  font-size: 20px;
  line-height: 1;
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 14px #00000059;
}

.close-dialog:hover { background: #1e242ccc; }

.dialog-body { padding: var(--s5) var(--s6) var(--s6); }

.dialog-body h2 { margin: 0 0 var(--s3); font-size: 21px; line-height: 1.5; }

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11px;
  color: #9ca5b0;
}

.detail-meta > span {
  padding: 4px 9px;
  border: 1px solid #35414b;
  border-radius: 20px;
  background: #202831;
}

.detail-meta > span:empty { display: none; }

.detail-description {
  margin: var(--s4) 0;
  color: #a9b8c5;
  font-size: 13px;
  line-height: 1.95;
  white-space: pre-line;
}

.dialog-body h3 {
  margin: var(--s6) 0 var(--s3);
  padding-top: var(--s4);
  border-top: 1px solid #2c343d;
  font-size: 14px;
}

.dialog-body h3 small { color: var(--faint); font-weight: 400; letter-spacing: 1px; }

.demo-warning {
  padding: 10px 12px;
  border: 1px solid #c3f56b2b;
  border-radius: 6px;
  background: #c3f56b0c;
  color: #b5c89d;
  font-size: 12px;
  line-height: 1.8;
}

.download-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2);
  margin-top: var(--s2);
  padding: 12px 14px;
  border: 1px solid #313942;
  border-radius: var(--radius-sm);
  background: #191e25;
}

.download-provider { flex: 1; min-width: 90px; font-size: 13px; }

.code-button {
  padding: 7px 10px;
  border: 1px solid #3b434c;
  border-radius: 6px;
  background: #242b34;
  color: #bac3ce;
  font-size: 11px;
}

.download-button {
  padding: 8px 13px;
  border: 0;
  border-radius: 6px;
  background: var(--lime);
  color: #24371a;
  font-size: 12px;
  font-weight: 600;
}

.download-button:hover { background: #d6ff95; }
.download-button:disabled { background: #2c332a; color: #8d9a80; cursor: not-allowed; }

.instructions {
  padding-left: var(--s5);
  color: #9da7b2;
  font-size: 13px;
  line-height: 2;
}

.installation-empty {
  padding: 12px;
  border-radius: var(--radius-sm);
  background: #20272c;
  font-size: 12px;
}

.feedback-button {
  padding: 8px 0;
  border: 0;
  background: none;
  color: #a8b891;
  font-size: 12px;
}

.detail-footer {
  margin-top: var(--s4);
  padding-top: var(--s3);
  border-top: 1px solid #2c333c;
  color: #677582;
  font-size: 11px;
  line-height: 1.9;
}

/* ============================= Toast ============================= */

#toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 20;
  max-width: min(90vw, 420px);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  background: #d8f5bb;
  color: #1f3114;
  font-size: 12px;
  box-shadow: 0 14px 44px #00000059;
  opacity: 0;
  transform: translate(-50%, 14px);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}

#toast.visible { opacity: 1; transform: translate(-50%, 0); }

/* ============================= 响应式 ============================= */

/* 中等桌面：收窄侧栏与内边距 */
@media (max-width: 1280px) {
  :root { --sidebar-w: 216px; }
  .hero h1 { font-size: clamp(25px, 2.9vw, 34px); }
  .collection-shortcuts { gap: var(--s2); }
}

@media (max-width: 1180px) {
  .resource-grid { grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); }
  .library-label { display: none; }
  .filter-tip { display: none; }
}

/* 平板 / 手机：侧栏变吸顶操作条 */
@media (max-width: 1000px) {
  .shell { display: block; }

  .sidebar {
    position: sticky;
    top: 0;
    height: auto;
    min-height: 0;
    padding: 9px 14px;
    flex-direction: row;
    align-items: center;
    gap: var(--s3);
    border-right: 0;
    border-bottom: 1px solid #222833;
    background: #0f1217f2;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    overflow: visible;
    z-index: 10;
  }

  .brand { flex: 0 0 auto; font-size: 15px; gap: var(--s2); }
  .brand-icon { width: 30px; height: 30px; flex-basis: 30px; font-size: 20px; border-radius: 8px; }
  .brand small { display: none; }

  .nav-label,
  .sidebar-note,
  .sidebar-bottom,
  .shop-sidebar { display: none; }

  #side-nav {
    flex-direction: row;
    gap: 6px;
    margin: 0 0 0 auto;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  #side-nav::-webkit-scrollbar { display: none; }

  .nav-item {
    width: auto;
    padding: 7px 11px;
    border: 1px solid #262d36;
    background: #151920;
    color: #9aa2af;
    font-size: 12px;
    white-space: nowrap;
  }

  .nav-item > span { font-size: 12px; }
  .nav-item i { display: none; }
  .nav-item.active { background: #253222; border-color: #475c38; color: var(--lime); }

  main { padding: 0 16px; }

  .topbar { min-height: 52px; font-size: 11px; }
  .breadcrumb { display: none; }
  .topbar-actions { margin-left: auto; gap: var(--s3); }

  .hero { grid-template-columns: 1fr; margin-top: var(--s4); min-height: 0; }
  .hero-art { display: none; }
  .hero-copy { padding: 22px 18px; gap: var(--s2); }
  .hero h1 { font-size: clamp(23px, 6vw, 30px); }
  .hero p { font-size: 12px; }

  .collection-shortcuts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); }
  .collection-shortcuts small { white-space: normal; }

  /* 分类已在顶栏，隐藏重复的 tabs */
  .tabs { display: none; }

  .library-dock {
    top: var(--mobbar-h);
    margin: 0 -16px;
    padding: var(--s3) 16px 0;
  }

  .toolbar { padding-bottom: var(--s2); }
  .search-wrap { width: 100%; max-width: none; height: 40px; }

  .platform-filters {
    flex-wrap: nowrap;
    gap: 6px;
    padding-bottom: var(--s2);
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .platform-filters::-webkit-scrollbar { display: none; }
  .platform-filters > span:first-child { margin-right: 2px; white-space: nowrap; }
  .platform-filters button { flex: 0 0 auto; font-size: 11px; padding: 6px 10px; }

  .resource-grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }

  .notice { margin-bottom: var(--s5); }
  .notice p { font-size: 11px; }

  footer { flex-direction: column; align-items: flex-start; gap: var(--s2); }

  /* 详情变全屏面板 */
  dialog {
    width: 100%;
    max-width: none;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  .dialog-body { padding: var(--s4) var(--s4) var(--s6); }
  .dialog-body h2 { font-size: 18px; }
}

/* 小屏手机：单列卡片 */
@media (max-width: 620px) {
  .resource-grid { grid-template-columns: 1fr; }
  .card-art { aspect-ratio: 16 / 9; }
  .library-dock { margin: 0 -16px; }
  .filter-row { font-size: 11px; }
  .section-heading h2 { font-size: 20px; }
  .collection-shortcuts strong { font-size: 11px; }
  .collection-shortcuts small { font-size: 10px; }

  /* 资源卡在手机上改为横向紧凑列表：一屏可看 5-6 条，滚动长度减半
     规则全部限定在 .resource-card 内，避免影响详情弹窗里的封面 */
  .resource-card { flex-direction: row; align-items: stretch; }
  .resource-card > .card-art {
    flex: 0 0 38%;
    width: 38%;
    aspect-ratio: auto;
    min-height: 100%;
  }
  .resource-card > .card-body { padding: 11px 12px 0; gap: 5px; }
  .resource-card .card-body h3 { font-size: 13px; line-height: 1.5; min-height: 0; }
  .resource-card .card-platform { font-size: 10px; }
  .resource-card .card-platform > span:first-child { max-width: 70%; padding: 2px 7px; }
  .resource-card .card-subtitle { font-size: 11px; line-height: 1.6; min-height: 0; }
  .resource-card .tags { display: none; }
  .resource-card .card-version { font-size: 10px; padding-top: 2px; }
  .resource-card .card-version > span { max-width: 60%; }
  .resource-card .card-version > span:last-child { max-width: 40%; }
  .resource-card .card-bottom { margin: 8px 12px 0; padding: 9px 0; font-size: 10px; }
  .resource-card .card-open { padding: 6px 9px; font-size: 10px; gap: 4px; }
  .resource-card .auto-cover-copy { right: 10%; gap: 5px; }
  .resource-card .auto-cover-copy strong { font-size: 13px; line-height: 1.35; }
  .resource-card .auto-cover-top,
  .resource-card .auto-cover-caption { display: none; }
  .resource-card .card-category { display: none; }
  .resource-card .card-badge { font-size: 8px; padding: 2px 5px; }

  /* 快速入口改为单行滑动条，给列表让出首屏空间 */
  .collection-shortcuts {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(180px, 1fr);
    gap: var(--s2);
    padding-bottom: var(--s1);
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .collection-shortcuts::-webkit-scrollbar { display: none; }
  .collection-shortcuts button { padding: 11px 12px; }
  .collection-shortcuts i { display: none; }
}

@media (max-width: 400px) {
  main { padding: 0 12px; }
  .library-dock { margin: 0 -12px; padding-left: 12px; padding-right: 12px; }
  .hero-copy { padding: 18px 14px; }
  .hero h1 { font-size: 22px; }
  .shortcut-icon { display: none; }
  .nav-item { padding: 6px 9px; font-size: 11px; }
  .brand { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}



