/* ==========================================================================
   英语学习资源库 — 样式表
   纯手写 CSS，无外部依赖，支持亮/暗主题与响应式布局
   ========================================================================== */

/* ---------- 主题变量 ---------- */
:root {
  color-scheme: light;

  --bg: #f4f6f8;
  --bg-grad: radial-gradient(1200px 600px at 12% -10%, #e8eeff 0%, transparent 60%),
             radial-gradient(900px 500px at 88% 0%, #e6f7f1 0%, transparent 55%);
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --surface-hover: #ffffff;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;

  --text: #101828;
  --text-2: #475467;
  --text-3: #98a2b3;
  --text-inv: #ffffff;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff4ff;
  --primary-border: #c7d7fe;

  --ok: #059669;
  --ok-soft: #ecfdf5;
  --warn: #b45309;
  --warn-soft: #fffbeb;
  --muted-soft: #f2f4f7;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 4px 12px -2px rgba(16, 24, 40, 0.08), 0 2px 6px -2px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 12px 28px -6px rgba(16, 24, 40, 0.14), 0 4px 10px -4px rgba(16, 24, 40, 0.06);

  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", "Noto Sans CJK SC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --header-h: 62px;
  --maxw: 1240px;
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0b0d11;
  --bg-grad: radial-gradient(1100px 550px at 10% -12%, #16224a 0%, transparent 58%),
             radial-gradient(900px 480px at 92% 0%, #0d2f2a 0%, transparent 52%);
  --surface: #14171d;
  --surface-2: #191d24;
  --surface-hover: #1a1e26;
  --border: #262c36;
  --border-strong: #333b48;

  --text: #e7eaf0;
  --text-2: #a5aebc;
  --text-3: #6f7887;
  --text-inv: #0b0d11;

  --primary: #6ea0ff;
  --primary-hover: #8ab3ff;
  --primary-soft: #17223c;
  --primary-border: #2b3f6b;

  --ok: #34d399;
  --ok-soft: #10281f;
  --warn: #fbbf24;
  --warn-soft: #2a2110;
  --muted-soft: #1b2029;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 16px -4px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 16px 36px -8px rgba(0, 0, 0, 0.7);
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    color-scheme: dark;

    --bg: #0b0d11;
    --bg-grad: radial-gradient(1100px 550px at 10% -12%, #16224a 0%, transparent 58%),
               radial-gradient(900px 480px at 92% 0%, #0d2f2a 0%, transparent 52%);
    --surface: #14171d;
    --surface-2: #191d24;
    --surface-hover: #1a1e26;
    --border: #262c36;
    --border-strong: #333b48;

    --text: #e7eaf0;
    --text-2: #a5aebc;
    --text-3: #6f7887;
    --text-inv: #0b0d11;

    --primary: #6ea0ff;
    --primary-hover: #8ab3ff;
    --primary-soft: #17223c;
    --primary-border: #2b3f6b;

    --ok: #34d399;
    --ok-soft: #10281f;
    --warn: #fbbf24;
    --warn-soft: #2a2110;
    --muted-soft: #1b2029;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 6px 16px -4px rgba(0, 0, 0, 0.55);
    --shadow-lg: 0 16px 36px -8px rgba(0, 0, 0, 0.7);
  }
}

/* ---------- 基础重置 ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

/* [hidden] 必须压过 .notice 等组件的 display，否则会出现空占位块 */
[hidden] { display: none !important; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 20px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  background-color: var(--bg);
  background-image: var(--bg-grad);
  background-repeat: no-repeat;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.25s ease, color 0.25s ease;
}

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; font-size: inherit; cursor: pointer; }
::selection { background: var(--primary); color: var(--text-inv); }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 99px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 22px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  font-size: 15.5px;
  letter-spacing: -0.02em;
  white-space: nowrap;
  flex-shrink: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  box-shadow: var(--shadow-sm);
}

.search-wrap {
  position: relative;
  flex: 1;
  max-width: 460px;
  margin-left: auto;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  font-size: 14px;
  pointer-events: none;
  display: grid;
  place-items: center;
}

#search {
  width: 100%;
  height: 38px;
  padding: 0 62px 0 34px;
  font-size: 13.5px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  transition: border-color 0.18s, background 0.18s, box-shadow 0.18s;
}

#search::placeholder { color: var(--text-3); }

#search:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.kbd-hint {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  padding: 1px 6px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  pointer-events: none;
}

#search:focus ~ .kbd-hint,
#search:not(:placeholder-shown) ~ .kbd-hint { opacity: 0; }

/* 主题切换 */
.theme-btn {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  font-size: 16px;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 50%;
  transition: all 0.18s;
}

.theme-btn:hover {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border-strong);
  transform: rotate(-12deg);
}

/* ---------- 主容器 ---------- */
.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 22px;
}

/* ---------- Hero ---------- */
.hero {
  padding: 54px 0 30px;
  text-align: center;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 12px;
  margin-bottom: 18px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-pill);
}

.hero h1 {
  font-size: clamp(28px, 4.4vw, 42px);
  letter-spacing: -0.03em;
  margin-bottom: 12px;
}

.hero h1 .grad {
  background: linear-gradient(100deg, var(--primary) 10%, #7c3aed 55%, #0d9488 95%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-sub {
  max-width: 620px;
  margin: 0 auto;
  font-size: 15px;
  color: var(--text-2);
}

.hero-stats {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.stat-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 7px 15px;
  font-size: 13px;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
}

.stat-pill b {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* 提示条 */
.notice {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  max-width: 900px;
  margin: 26px auto 0;
  padding: 13px 16px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-2);
  text-align: left;
  background: var(--warn-soft);
  border: 1px solid color-mix(in srgb, var(--warn) 26%, transparent);
  border-radius: var(--radius-md);
}

.notice-icon { flex-shrink: 0; font-size: 15px; line-height: 1.5; }
.notice b { color: var(--text); font-weight: 700; }

.notice code {
  padding: 1px 5px;
  font-family: var(--mono);
  font-size: 12px;
  background: color-mix(in srgb, var(--text) 8%, transparent);
  border-radius: 4px;
  word-break: break-all;
}

/* 严重告警（如下载地址未配置） */
.notice.danger {
  color: #b42318;
  background: #fef3f2;
  border-color: #fecdca;
}

.notice.danger b { color: #912018; }

:root[data-theme="dark"] .notice.danger {
  color: #fca5a5;
  background: #2d1616;
  border-color: #5b2323;
}

:root[data-theme="dark"] .notice.danger b { color: #fecaca; }

@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .notice.danger {
    color: #fca5a5;
    background: #2d1616;
    border-color: #5b2323;
  }
  :root[data-theme="auto"] .notice.danger b { color: #fecaca; }
}

/* ---------- 分区导航 ---------- */
.section-nav {
  position: sticky;
  top: var(--header-h);
  z-index: 90;
  display: flex;
  gap: 8px;
  padding: 12px 0;
  margin-bottom: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.section-nav::-webkit-scrollbar { display: none; }

.nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  transition: all 0.16s;
  white-space: nowrap;
}

.nav-pill:hover {
  color: var(--text);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.nav-pill.active {
  color: var(--text-inv);
  background: var(--text);
  border-color: var(--text);
}

.nav-pill .count {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  opacity: 0.6;
}

/* ---------- 过滤工具条 ---------- */
.filterbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0 22px;
  min-height: 40px;
}

.filter-label {
  font-size: 12.5px;
  color: var(--text-3);
  margin-right: 2px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  transition: all 0.16s;
}

.chip:hover { border-color: var(--border-strong); color: var(--text); }

.chip[aria-pressed="true"] {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: var(--primary-border);
  font-weight: 600;
}

.chip .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.chip .dot.ok { background: var(--ok); }
.chip .dot.warn { background: var(--warn); }
.chip .dot.muted { background: var(--text-3); }

.result-info {
  margin-left: auto;
  font-size: 12.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.result-info b { color: var(--text-2); font-weight: 700; }

.clear-btn {
  padding: 5px 12px;
  font-size: 12.5px;
  color: var(--text-2);
  background: transparent;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-pill);
}

.clear-btn:hover { color: var(--text); background: var(--surface); }

/* ---------- 分区 ---------- */
.section { margin-bottom: 54px; scroll-margin-top: calc(var(--header-h) + 60px); }

.section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.section-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  font-size: 19px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.section-title { font-size: 21px; letter-spacing: -0.02em; }

.section-desc {
  margin: 0 0 22px 52px;
  font-size: 13.5px;
  color: var(--text-3);
}

/* 分组 */
.group { margin-bottom: 26px; }

.group-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
  padding-left: 2px;
}

.group-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-2);
  letter-spacing: 0.01em;
}

.group-title::before {
  content: "";
  display: inline-block;
  width: 3px;
  height: 13px;
  margin-right: 8px;
  vertical-align: -1px;
  background: var(--primary);
  border-radius: 2px;
}

.group-hint { font-size: 12px; color: var(--text-3); }

/* ---------- 卡片网格 ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 12px;
}

/* ---------- 网站卡片 ---------- */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 16px 17px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.18s, border-color 0.18s, background 0.18s;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.card-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.card-avatar {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  border-radius: 10px;
  letter-spacing: -0.02em;
  box-shadow: var(--shadow-sm);
}

.card-title-wrap { flex: 1; min-width: 0; }

.card-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text);
}

.card-title a {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-title a:hover { color: var(--primary); }

.card-title .ext {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--text-3);
  transition: transform 0.16s, color 0.16s;
}

.card:hover .card-title .ext { color: var(--primary); transform: translate(1px, -1px); }

.card-alias {
  font-size: 12px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-desc {
  font-size: 13px;
  line-height: 1.68;
  color: var(--text-2);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card:hover .card-desc { -webkit-line-clamp: 6; line-clamp: 6; }

.card-foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
  padding-top: 3px;
}

/* 标签 */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.7;
  color: var(--text-2);
  background: var(--muted-soft);
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.tag.level { color: var(--primary); background: var(--primary-soft); font-weight: 600; }

.tag.access { font-weight: 600; }
.tag.access.ok { color: var(--ok); background: var(--ok-soft); }
.tag.access.warn { color: var(--warn); background: var(--warn-soft); }
.tag.access.muted { color: var(--text-3); background: var(--muted-soft); }

.tag.danger { color: #b42318; background: #fef3f2; font-weight: 600; }
:root[data-theme="dark"] .tag.danger { color: #fca5a5; background: #2d1616; }

.spacer { flex: 1; }

/* 收藏按钮 */
.fav-btn {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  font-size: 14px;
  line-height: 1;
  color: var(--text-3);
  background: transparent;
  border: none;
  border-radius: 7px;
  opacity: 0;
  transition: all 0.16s;
}

.card:hover .fav-btn,
.card:focus-within .fav-btn,
.fav-btn[aria-pressed="true"] { opacity: 1; }

.fav-btn:hover { background: var(--muted-soft); color: var(--warn); }
.fav-btn[aria-pressed="true"] { color: var(--warn); }

/* ---------- App 卡片 ---------- */
.card.app {
  border-color: color-mix(in srgb, var(--primary) 26%, var(--border));
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--primary-soft) 55%, var(--surface)) 0%, var(--surface) 46%);
}

.card.app:hover { border-color: var(--primary-border); }

.card.app.has-warning { border-color: color-mix(in srgb, var(--warn) 34%, var(--border)); }

.badge-official {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 7px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--ok);
  background: var(--ok-soft);
  border: 1px solid color-mix(in srgb, var(--ok) 30%, transparent);
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.badge-warn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 7px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--warn);
  background: var(--warn-soft);
  border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

/* 下载/商店按钮组 */
.platforms {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 3px;
}

.platform-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  font-size: 12.5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all 0.16s;
}

.platform-row:hover { border-color: var(--border-strong); background: var(--surface); }

.platform-os {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  min-width: 96px;
  font-weight: 700;
  font-size: 12px;
  color: var(--text);
}

.platform-meta {
  flex: 1;
  min-width: 0;
  font-size: 11.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-inv);
  background: var(--text);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  transition: all 0.16s;
  white-space: nowrap;
}

.btn:hover { background: var(--primary); color: #fff; transform: translateY(-1px); }

.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }

.btn.ghost {
  color: var(--text-2);
  background: var(--surface);
  border-color: var(--border-strong);
}

.btn.ghost:hover {
  color: var(--text);
  background: var(--surface-2);
  transform: none;
}

/* 未配置对象存储时的禁用态 */
.btn.unconfigured {
  color: var(--text-3);
  background: var(--muted-soft);
  border: 1px dashed var(--border-strong);
  cursor: not-allowed;
}

.btn.unconfigured:hover {
  color: var(--text-3);
  background: var(--muted-soft);
  transform: none;
}

/* 系统要求提示（如 Android 12+） */
.sys-req {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 7px 10px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.6;
  color: var(--warn);
  background: var(--warn-soft);
  border: 1px solid color-mix(in srgb, var(--warn) 26%, transparent);
  border-radius: var(--radius-sm);
}

/* 发布方 */
.publisher {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 8px 10px;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--text-3);
  background: var(--muted-soft);
  border-radius: var(--radius-sm);
}

.publisher b { color: var(--text-2); font-weight: 600; }

/* 安装说明折叠 */
.install-note {
  font-size: 12px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.install-note summary {
  padding: 7px 10px;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  list-style: none;
}

.install-note summary::-webkit-details-marker { display: none; }
.install-note summary::before { content: "▸ "; color: var(--text-3); }
.install-note[open] summary::before { content: "▾ "; }

.install-note .body {
  padding: 0 10px 10px;
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--text-2);
}

.install-note .body ol { margin: 6px 0 0; padding-left: 18px; }
.install-note .body li { margin-bottom: 3px; }

.install-note code {
  padding: 1px 5px;
  font-family: var(--mono);
  font-size: 11px;
  background: var(--muted-soft);
  border-radius: 4px;
  word-break: break-all;
}

/* ---------- 空状态 ---------- */
.empty {
  display: none;
  padding: 70px 20px;
  text-align: center;
  color: var(--text-3);
}

.empty.show { display: block; }
.empty-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.6; }
.empty h3 { font-size: 16px; color: var(--text-2); margin-bottom: 6px; }
.empty p { font-size: 13px; }

/* ---------- 加载 / 错误 ---------- */
.state {
  padding: 80px 24px;
  text-align: center;
}

.state h2 { font-size: 18px; margin-bottom: 10px; }
.state p { font-size: 14px; color: var(--text-2); max-width: 620px; margin: 0 auto 8px; }

.spinner {
  width: 30px;
  height: 30px;
  margin: 0 auto 18px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.error-box {
  max-width: 760px;
  margin: 0 auto;
  padding: 26px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.error-box h2 { font-size: 17px; margin-bottom: 10px; }
.error-box p { margin-bottom: 12px; font-size: 13.5px; color: var(--text-2); }
.error-box pre {
  padding: 12px 14px;
  margin: 10px 0;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow-x: auto;
}
.error-box .tip { font-size: 12.5px; color: var(--text-3); }

.error-box code {
  padding: 1px 6px;
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--muted-soft);
  border: 1px solid var(--border);
  border-radius: 5px;
  word-break: break-all;
}

.error-box pre code {
  padding: 0;
  background: none;
  border: none;
}

/* file:// 下的手动选择配置文件 */
.or-picker {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.or-picker input[type="file"] {
  font-size: 12.5px;
  color: var(--text-2);
}

.or-picker input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 6px 14px;
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-inv);
  background: var(--text);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.16s;
}

.or-picker input[type="file"]::file-selector-button:hover {
  background: var(--primary);
}

/* ---------- 页脚 ---------- */
.footer {
  margin-top: 30px;
  padding: 34px 0 46px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-3);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 26px;
  align-items: center;
  justify-content: space-between;
}

.footer a { color: var(--text-2); border-bottom: 1px solid var(--border-strong); padding-bottom: 1px; }
.footer a:hover { color: var(--primary); border-color: var(--primary); }

.footer code {
  padding: 1px 5px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-2);
  background: var(--muted-soft);
  border-radius: 4px;
}

/* ---------- 回到顶部 ---------- */
.to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 80;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  font-size: 17px;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: all 0.22s;
}

.to-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
.to-top:hover { color: var(--primary); border-color: var(--primary-border); }

/* ---------- 搜索高亮 ---------- */
mark {
  padding: 0 1px;
  color: inherit;
  background: color-mix(in srgb, var(--warn) 34%, transparent);
  border-radius: 3px;
}

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .hero { padding: 38px 0 22px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
}

@media (max-width: 720px) {
  body { font-size: 14.5px; }

  .topbar { gap: 10px; padding: 0 14px; }
  .brand span { display: none; }
  .kbd-hint { display: none; }
  #search { padding-right: 14px; }

  .container { padding: 0 14px; }

  .hero { padding: 30px 0 18px; }
  .hero-stats { gap: 7px; }
  .stat-pill { padding: 6px 12px; font-size: 12px; }

  .grid { grid-template-columns: 1fr; gap: 10px; }
  .section { margin-bottom: 40px; }
  .section-desc { margin-left: 0; }
  .section-title { font-size: 18.5px; }

  .result-info { margin-left: 0; width: 100%; }

  .platform-row { flex-wrap: wrap; }
  .platform-os { min-width: auto; }
  .platform-meta { flex-basis: 100%; order: 3; }

  .card-desc { -webkit-line-clamp: 4; line-clamp: 4; }
  .card:hover .card-desc { -webkit-line-clamp: 4; line-clamp: 4; }
  .fav-btn { opacity: 1; }
}

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

/* ---------- 打印 ---------- */
@media print {
  .topbar, .section-nav, .filterbar, .to-top, .fav-btn, .theme-btn { display: none !important; }
  body { background: #fff; color: #000; }
  .card { break-inside: avoid; box-shadow: none; border: 1px solid #ddd; }
  .card-desc { -webkit-line-clamp: unset; line-clamp: unset; }
}
