/* ==========================================================
 * TFS 教学资源 · 样式
 * 视觉主题：多语种书房 —— 暖色纸张 + 四色瓷砖
 *   俄语 钴蓝（格热尔瓷） · 乌兹别克语 青绿（撒马尔罕瓷砖）
 *   中文 朱砂           · 英语 赭石金
 * ========================================================== */

:root {
  --paper: #F3EDE2;
  --paper-deep: #E8DFCD;
  --card: #FFFCF6;
  --ink: #1D1A16;
  --ink-2: #4A433B;
  --muted: #877D70;
  --line: #E1D6C3;
  --line-strong: #CEC0A7;

  --ru: #2446A3;
  --uz: #0A8580;
  --zh: #BE3A26;
  --en: #A8690F;

  --c: var(--ink);
  --c-soft: color-mix(in oklab, var(--c) 6%, var(--card));
  --c-mid: color-mix(in oklab, var(--c) 16%, var(--card));
  --c-deep: var(--ink);

  --display: "Prata", "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", Georgia, serif;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", Georgia, serif;
  --sans: "Golos Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, "Microsoft YaHei", monospace;

  --r-sm: 8px;
  --r: 14px;
  --r-lg: 22px;
  --shadow: 0 1px 0 rgba(29, 26, 22, .04), 0 12px 28px -20px rgba(29, 26, 22, .4);
  --shadow-lift: 0 2px 0 rgba(29, 26, 22, .04), 0 24px 44px -24px rgba(29, 26, 22, .5);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --maxw: 1200px;

  /* 中亚八角星纹样（用于背景） */
  --star: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56'%3E%3Cg fill='none' stroke='%23000' stroke-width='1'%3E%3Crect x='18' y='18' width='20' height='20'/%3E%3Crect x='18' y='18' width='20' height='20' transform='rotate(45 28 28)'/%3E%3Cpath d='M0 0l9 9M56 0l-9 9M0 56l9-9M56 56l-9-9'/%3E%3C/g%3E%3C/svg%3E");
}

[data-lang="ru"] { --c: var(--ru); }
[data-lang="uz"] { --c: var(--uz); }
[data-lang="zh"] { --c: var(--zh); }
[data-lang="en"] { --c: var(--en); }
[data-lang] {
  --c-soft: color-mix(in oklab, var(--c) 8%, var(--card));
  --c-mid: color-mix(in oklab, var(--c) 20%, var(--card));
  --c-deep: color-mix(in oklab, var(--c) 78%, black);
}

/* ---------- 基础 ---------- */

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(10, 133, 128, .07), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(190, 58, 38, .06), transparent 60%),
    var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: .28;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .12 0 0 0 0 .1 0 0 0 0 .08 0 0 0 .45 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: inherit; }
img, svg { display: block; }
button { font: inherit; color: inherit; }
code { font-family: var(--mono); font-size: .9em; }
:focus-visible { outline: 2px solid var(--c); outline-offset: 3px; border-radius: 6px; }
#app { flex: 1; outline: none; }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

.i { width: 1em; height: 1em; flex: none; }

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}
.eyebrow::before { content: ""; width: 28px; height: 1px; background: currentColor; }

/* ---------- 顶栏 ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in oklab, var(--paper) 84%, transparent);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  backdrop-filter: blur(12px) saturate(1.2);
  border-bottom: 1px solid transparent;
  transition: border-color .3s;
}
.site-header.scrolled { border-bottom-color: var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 64px; }

.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-name { font-family: var(--serif); font-weight: 700; font-size: 1.1rem; letter-spacing: .02em; }
.brand-mark { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; width: 22px; height: 22px; transition: transform .5s var(--ease); }
.brand-mark i { border-radius: 3px; }
.brand-mark i:nth-child(1) { background: var(--ru); }
.brand-mark i:nth-child(2) { background: var(--uz); }
.brand-mark i:nth-child(3) { background: var(--zh); }
.brand-mark i:nth-child(4) { background: var(--en); }
.brand:hover .brand-mark { transform: rotate(90deg); }

.site-nav { display: flex; gap: 4px; }
.site-nav a {
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 14.5px;
  text-decoration: none;
  color: var(--ink-2);
  transition: background .2s, color .2s;
}
.site-nav a:hover { background: var(--paper-deep); }
.site-nav a.on { background: var(--ink); color: var(--card); }

/* ---------- 首页 · 头图 ---------- */

.hero { position: relative; padding: 56px 0 36px; }
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--star);
  opacity: .06;
  -webkit-mask-image: radial-gradient(70% 90% at 75% 40%, #000, transparent 75%);
  mask-image: radial-gradient(70% 90% at 75% 40%, #000, transparent 75%);
  pointer-events: none;
}
.hero-grid {
  position: relative;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 56px;
  align-items: center;
}
.hero h1 {
  margin: 20px 0 22px;
  font-family: var(--serif);
  font-weight: 900;
  font-size: clamp(2.6rem, 6vw, 4.5rem);
  line-height: 1.12;
  letter-spacing: .01em;
}
.h1-accent {
  padding-bottom: .06em;
  background: linear-gradient(90deg, var(--ru) 0 25%, var(--uz) 25% 50%, var(--zh) 50% 75%, var(--en) 75%) left bottom / 100% .1em no-repeat;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.lead { max-width: 32em; margin: 0; font-size: 1.08rem; color: var(--ink-2); }
.lead strong { color: var(--ink); }

.stats { display: flex; flex-wrap: wrap; gap: 14px 34px; margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line); }
.stat b { display: block; font-family: var(--display); font-weight: 400; font-size: 2.1rem; line-height: 1; }
.stat span { font-size: 13px; color: var(--muted); }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding-bottom: 28px; }
.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  aspect-ratio: 1 / .84;
  padding: 18px 20px;
  border: 0;
  border-radius: var(--r-lg);
  background: color-mix(in oklab, var(--c) 90%, black);
  color: #fff;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  box-shadow:
    inset 0 0 0 7px rgba(255, 255, 255, .1),
    inset 0 0 0 8px rgba(255, 255, 255, .22),
    var(--shadow);
  transition: transform .45s var(--ease), box-shadow .45s var(--ease);
}
.tile:nth-child(2n) { margin-top: 28px; margin-bottom: -28px; }
.tile::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: var(--star);
  filter: invert(1);
  opacity: .08;
}
.tile::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(120% 90% at 100% 0%, rgba(255, 255, 255, .18), transparent 55%);
}
.tile:hover { transform: translateY(-5px) rotate(-.6deg); box-shadow: inset 0 0 0 7px rgba(255, 255, 255, .1), inset 0 0 0 8px rgba(255, 255, 255, .3), var(--shadow-lift); }
.tile-glyph {
  position: absolute;
  top: 6px;
  right: 18px;
  font-family: var(--display);
  font-size: clamp(3.6rem, 8vw, 6.2rem);
  line-height: 1.1;
  transition: transform .6s var(--ease);
}
.tile:hover .tile-glyph { transform: translateY(-4px) scale(1.06); }
.tile-native { display: block; font-family: var(--display); font-size: 1.35rem; line-height: 1.2; }
.tile-meta { display: block; margin-top: 4px; font-size: 13.5px; opacity: .88; }
.tile-sys { display: inline-block; margin-top: 10px; padding: 2px 8px; border-radius: 6px; background: rgba(255, 255, 255, .16); font-family: var(--mono); font-size: 11px; letter-spacing: .04em; }

/* ---------- 首页 · 筛选 ---------- */

.browser { padding-top: 56px; padding-bottom: 72px; scroll-margin-top: 64px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.section-head h2 { margin: 8px 0 0; font-family: var(--serif); font-size: 1.8rem; font-weight: 700; }

.filters {
  padding: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}
.filter-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }

.lang-tabs, .chips {
  display: flex;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px;
}
.lang-tabs::-webkit-scrollbar, .chips::-webkit-scrollbar { display: none; }

.lang-tab {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 6px 14px 6px 6px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  font-size: 15px;
  color: var(--ink-2);
  white-space: nowrap;
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
}
.lang-tab:hover { background: var(--paper); }
.lang-tab .g {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--c-soft);
  color: var(--c);
  font-family: var(--display);
  font-size: 14px;
  transition: background .2s, color .2s;
}
.lang-tab .n { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.lang-tab.on { background: var(--c); color: #fff; }
.lang-tab.on .g { background: rgba(255, 255, 255, .18); color: #fff; }
.lang-tab.on .n { color: rgba(255, 255, 255, .75); }

.search { position: relative; flex: 1 1 240px; max-width: 340px; }
.search .i { position: absolute; top: 50%; left: 14px; transform: translateY(-50%); color: var(--muted); font-size: 16px; }
.search input {
  width: 100%;
  padding: 10px 14px 10px 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; border-color: var(--ink-2); background: var(--card); box-shadow: 0 0 0 4px rgba(29, 26, 22, .07); }

.filter-rows { display: grid; gap: 10px; margin-top: 12px; padding: 12px 4px 2px; border-top: 1px dashed var(--line); }
.frow { display: flex; align-items: center; gap: 12px; min-width: 0; }
.flabel { flex: none; width: 104px; font-size: 13px; color: var(--muted); line-height: 1.35; }
.flabel small { display: block; font-family: var(--mono); font-size: 10.5px; letter-spacing: .02em; opacity: .85; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  font-size: 13.5px;
  color: var(--ink-2);
  white-space: nowrap;
  cursor: pointer;
  transition: background .2s, border-color .2s, color .2s;
}
.chip:hover { border-color: var(--line-strong); background: var(--paper); }
.chip .n { font-family: var(--mono); font-size: 11px; opacity: .65; }
.chip .i { font-size: 14px; }
.chip.on { background: var(--c); border-color: var(--c); color: #fff; }
.chip.zero { opacity: .42; }
.chip .mini {
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 3px;
  border-radius: 5px;
  background: var(--ec);
  color: #fff;
  font-family: var(--display);
  font-style: normal;
  font-size: 10px;
}

[data-ed="ru"] { --ec: var(--ru); }
[data-ed="uz"] { --ec: var(--uz); }
[data-ed="zh"] { --ec: var(--zh); }
[data-ed="en"] { --ec: var(--en); }

.result-bar { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; margin: 24px 2px 16px; font-size: 14px; color: var(--muted); }
.result-bar b { font-family: var(--display); font-weight: 400; font-size: 1.25rem; color: var(--ink); }
.linkish { padding: 0; border: 0; background: none; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.linkish:hover { color: var(--ink); }

/* ---------- 资源卡片 ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  grid-auto-flow: dense;
  gap: 18px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 250px;
  padding: 20px 20px 18px 28px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  overflow: hidden;
  isolation: isolate;
  transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .35s;
  animation: rise .6s var(--ease) backwards;
  animation-delay: calc(var(--i, 0) * 45ms);
}
.card::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 6px;
  background: var(--c);
  transition: width .35s var(--ease);
}
a.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); border-color: var(--line-strong); }
a.card:hover::before { width: 10px; }

.card-glyph {
  position: absolute;
  right: -4px;
  bottom: -40px;
  z-index: -1;
  font-family: var(--display);
  font-size: 150px;
  line-height: 1;
  color: var(--c);
  opacity: .06;
  pointer-events: none;
  transition: transform .6s var(--ease), opacity .35s;
}
a.card:hover .card-glyph { transform: translateY(-10px) rotate(-5deg); opacity: .11; }

.card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.type-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 8px;
  border-radius: 999px;
  background: var(--c-soft);
  color: var(--c-deep);
  font-size: 12.5px;
  font-weight: 500;
}
.card-lang { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; color: var(--muted); }
.feat { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--c-deep); }
.feat .i { color: var(--c); }

.card-title {
  margin: 2px 0 0;
  font-family: var(--display);
  font-weight: 700;
  font-synthesis: none;
  font-size: 1.32rem;
  line-height: 1.3;
}
.card-sub { margin: -4px 0 0; font-size: 14px; line-height: 1.5; color: var(--muted); }
.card-reason {
  display: -webkit-box;
  margin: 2px 0 0;
  overflow: hidden;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  font-size: 14.5px;
  color: var(--ink-2);
}
.card-reason strong { font-weight: 600; color: var(--ink); }

/* 「荐」字小印章 */
.seal {
  display: inline-grid;
  place-items: center;
  width: 19px;
  height: 19px;
  margin-right: 7px;
  border: 1.5px solid var(--c);
  border-radius: 4px;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 11px;
  line-height: 1;
  color: var(--c);
  vertical-align: 2px;
  transform: rotate(-4deg);
}

.card-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: auto; padding-top: 8px; }
.lvl {
  padding: 2px 8px;
  border: 1px solid color-mix(in oklab, var(--c) 38%, transparent);
  border-radius: 6px;
  background: var(--card);
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--c-deep);
}
.stage { font-size: 12px; color: var(--muted); margin-right: 4px; }
.ed {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px 2px 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  font-size: 12px;
  color: var(--ink-2);
}
.ed i {
  display: grid;
  place-items: center;
  min-width: 17px;
  height: 17px;
  padding: 0 2px;
  border-radius: 4px;
  background: var(--ec);
  color: #fff;
  font-family: var(--display);
  font-style: normal;
  font-size: 10px;
  line-height: 1;
}

.card.featured {
  grid-column: span 2;
  min-height: 290px;
  padding: 26px 28px 22px 34px;
  background: linear-gradient(135deg, var(--c-soft), var(--card) 62%);
}
.card.featured .card-title { font-size: 1.75rem; }
.card.featured .card-reason { -webkit-line-clamp: 4; max-width: 40em; font-size: 15.5px; }
.card.featured .card-glyph { right: 10px; bottom: -70px; font-size: 250px; opacity: .08; }

.empty {
  grid-column: 1 / -1;
  padding: 64px 20px;
  text-align: center;
  color: var(--muted);
  border: 2px dashed var(--line);
  border-radius: var(--r-lg);
}
.empty-glyph { font-family: var(--display); font-size: 4rem; line-height: 1; color: var(--line-strong); }
.empty p { margin: 14px 0; }

.issues {
  margin-bottom: 48px;
  padding: 14px 18px;
  border: 1px solid #E6B8A8;
  border-radius: var(--r);
  background: #FBEDE6;
  font-size: 14px;
  color: #7A2E1C;
}
.issues summary { cursor: pointer; font-weight: 600; }
.issues ul { margin: 10px 0 0; padding-left: 1.2em; }

/* ---------- 详情页 ---------- */

.detail { padding-top: 28px; padding-bottom: 80px; }
.back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font-size: 14px;
  color: var(--ink-2);
  text-decoration: none;
  transition: border-color .2s, transform .2s var(--ease);
}
.back:hover { border-color: var(--ink-2); transform: translateX(-2px); }

.d-hero {
  position: relative;
  margin-top: 18px;
  padding: clamp(28px, 5vw, 56px);
  border: 1px solid color-mix(in oklab, var(--c) 20%, transparent);
  border-radius: 28px;
  background: var(--c-soft);
  overflow: hidden;
  isolation: isolate;
  animation: rise .7s var(--ease) backwards;
}
.d-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background-image: var(--star);
  opacity: .05;
  -webkit-mask-image: linear-gradient(100deg, transparent 30%, #000 90%);
  mask-image: linear-gradient(100deg, transparent 30%, #000 90%);
}
.d-glyph {
  position: absolute;
  right: clamp(-10px, 3vw, 48px);
  bottom: -.22em;
  z-index: -1;
  font-family: var(--display);
  font-size: clamp(11rem, 26vw, 21rem);
  line-height: 1;
  color: var(--c);
  opacity: .13;
  pointer-events: none;
  animation: glyphIn 1.1s var(--ease) backwards .1s;
}
.d-kicker { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 14px; color: var(--ink-2); }
.d-kicker .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--line-strong); }
.d-title {
  max-width: 17em;
  margin: 18px 0 12px;
  font-family: var(--display);
  font-weight: 700;
  font-synthesis: none;
  font-size: clamp(2rem, 4.6vw, 3.3rem);
  line-height: 1.18;
}
.d-sub { max-width: 34em; margin: 0; font-size: 1.1rem; color: var(--ink-2); }
.d-author { margin: 14px 0 0; font-size: 14px; color: var(--muted); }

.d-levels { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.d-lvl {
  display: flex;
  flex-direction: column;
  padding: 8px 14px;
  border: 1px solid color-mix(in oklab, var(--c) 25%, transparent);
  border-radius: 12px;
  background: color-mix(in oklab, var(--card) 85%, transparent);
  line-height: 1.35;
}
.d-lvl b { font-family: var(--mono); font-size: 15px; font-weight: 500; color: var(--c-deep); }
.d-lvl span { font-size: 12px; color: var(--muted); }

.d-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: transform .2s var(--ease), background .2s, border-color .2s, box-shadow .2s;
}
.btn .i { font-size: 17px; }
.btn-primary { background: var(--c); color: #fff; box-shadow: 0 10px 22px -12px var(--c); }
.btn-primary:hover { background: var(--c-deep); transform: translateY(-1px); }
.btn-ghost { background: var(--card); border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink-2); transform: translateY(-1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

.d-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 44px; align-items: start; margin-top: 44px; }
.d-main > section + section { margin-top: 40px; }

.h-sec { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; font-family: var(--serif); font-size: 1.3rem; font-weight: 700; }
.h-sec::before { content: ""; width: 9px; height: 9px; background: var(--c); transform: rotate(45deg); }

.reason {
  position: relative;
  margin: 0;
  padding: 28px 30px 28px 70px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--card);
  box-shadow: var(--shadow);
  font-family: var(--serif);
  font-size: 1.12rem;
  line-height: 1.95;
}
.reason::before {
  content: "\201C";
  position: absolute;
  top: 10px;
  left: 18px;
  font-family: var(--display);
  font-size: 5rem;
  line-height: 1;
  color: var(--c);
}
.reason strong, .prose strong { font-weight: 700; background: linear-gradient(transparent 60%, var(--c-mid) 60%); }

.howto { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; counter-reset: h; }
.howto li {
  position: relative;
  padding: 14px 18px 14px 58px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  counter-increment: h;
}
.howto li::before {
  content: counter(h, decimal-leading-zero);
  position: absolute;
  top: 14px;
  left: 18px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--c);
}

.d-aside {
  position: sticky;
  top: 88px;
  padding: 22px 22px 20px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--card);
  box-shadow: var(--shadow);
}
.d-aside h3 { margin: 0 0 14px; font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .14em; color: var(--muted); }
.info { display: grid; grid-template-columns: auto 1fr; gap: 11px 16px; margin: 0; font-size: 14px; }
.info dt { color: var(--muted); white-space: nowrap; }
.info dd { display: flex; flex-wrap: wrap; gap: 5px; margin: 0; min-width: 0; overflow-wrap: anywhere; }

.tag {
  padding: 1px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  font-size: 12.5px;
  color: var(--ink-2);
  text-decoration: none;
  transition: border-color .2s, color .2s;
}
.tag:hover { border-color: var(--c); color: var(--c-deep); }

/* PDF 阅读器 */
.viewer { margin-top: 48px; scroll-margin-top: 80px; }
.viewer-frame { border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow-lift); border: 1px solid var(--ink); }
.viewer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px 10px 16px;
  background: var(--ink);
  color: var(--paper);
}
.viewer-bar .fname { display: flex; align-items: center; gap: 8px; min-width: 0; font-family: var(--mono); font-size: 12.5px; opacity: .85; }
.viewer-bar .fname span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-bar .tools { display: flex; flex: none; gap: 6px; }
.viewer-bar .tools a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 999px;
  font-size: 13px;
  color: var(--paper);
  text-decoration: none;
  transition: background .2s;
}
.viewer-bar .tools a:hover { background: rgba(255, 255, 255, .1); }
.viewer iframe { display: block; width: 100%; height: min(86vh, 1100px); border: 0; background: #525659; }
.viewer-note { margin: 10px 2px 0; font-size: 13px; color: var(--muted); }

.missing {
  padding: 44px 28px;
  border: 2px dashed var(--line-strong);
  border-radius: var(--r);
  background: repeating-linear-gradient(-45deg, transparent 0 12px, rgba(29, 26, 22, .018) 12px 24px);
  text-align: center;
  color: var(--ink-2);
}
.missing .i { margin: 0 auto 12px; font-size: 40px; color: var(--line-strong); }
.missing h3 { margin: 0 0 8px; font-family: var(--serif); font-size: 1.2rem; }
.missing p { margin: 4px 0; font-size: 14px; }
.missing code { padding: 2px 7px; border-radius: 5px; background: var(--paper-deep); }

/* 视频播放器 */
.player { margin-top: 48px; scroll-margin-top: 80px; }
.player-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--r);
  overflow: hidden;
  background: #111;
  box-shadow: var(--shadow-lift);
}
.player-frame iframe, .player-frame video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.player-poster {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  max-height: 70vh;
  border-radius: var(--r);
  overflow: hidden;
  isolation: isolate;
  background: var(--c-deep);
  color: #fff;
  text-decoration: none;
  box-shadow: var(--shadow-lift);
}
.player-poster.no-thumb { aspect-ratio: 21 / 9; }
.player-poster::before { content: ""; position: absolute; inset: 0; z-index: -3; background-image: var(--star); filter: invert(1); opacity: .08; }
.player-poster::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(transparent 45%, rgba(0, 0, 0, .55)); }
.player-poster img { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.player-poster:hover img { transform: scale(1.03); }
.poster-glyph { position: absolute; z-index: -2; font-family: var(--display); font-size: clamp(8rem, 20vw, 16rem); line-height: 1; opacity: .16; }
.poster-play {
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 0 10px rgba(255, 255, 255, .18), 0 18px 40px -12px rgba(0, 0, 0, .6);
  font-size: 34px;
  transition: transform .35s var(--ease);
}
.poster-play .i { margin-left: 5px; }
.player-poster:hover .poster-play { transform: scale(1.08); }
.poster-label { position: absolute; left: 22px; bottom: 16px; font-size: 14px; font-weight: 500; }

/* 网站卡片 */
.site-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 22px;
  align-items: center;
  margin-top: 48px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--card);
  box-shadow: var(--shadow);
}
.site-mono {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 18px;
  background: var(--c);
  color: #fff;
  font-family: var(--display);
  font-size: 2rem;
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, .14);
}
.site-domain { font-family: var(--mono); font-size: 1.15rem; font-weight: 500; overflow-wrap: anywhere; }
.site-url { margin-top: 2px; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.site-hint { margin: 10px 2px 0; font-size: 13px; color: var(--muted); }

/* 心得文章 */
.d-article {
  padding: clamp(24px, 4vw, 44px) clamp(20px, 4.5vw, 52px);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--card);
  box-shadow: var(--shadow);
}
.prose { font-size: 16.5px; line-height: 1.95; }
.prose > :first-child { margin-top: 0; }
.prose > p:first-child::first-letter {
  float: left;
  margin: .1em .14em 0 0;
  font-family: var(--serif);
  font-weight: 900;
  font-size: 3.3em;
  line-height: 1;
  color: var(--c);
}
.prose h2 { display: flex; align-items: baseline; gap: 10px; margin: 2em 0 .7em; font-family: var(--serif); font-size: 1.3rem; line-height: 1.4; }
.prose h2::before { content: "§"; font-family: var(--display); font-weight: 400; color: var(--c); }
.prose h3 { margin: 1.6em 0 .5em; font-family: var(--serif); font-size: 1.1rem; }
.prose p { margin: 0 0 1.1em; }
.prose ul, .prose ol { margin: 0 0 1.2em; padding-left: 1.5em; }
.prose li { margin: .35em 0; }
.prose li > ul, .prose li > ol { margin: .3em 0 0; }
.prose li::marker { color: var(--c); font-weight: 600; }
.prose blockquote {
  margin: 1.6em 0;
  padding: 14px 20px;
  border-left: 4px solid var(--c);
  border-radius: 0 12px 12px 0;
  background: var(--c-soft);
  color: var(--ink-2);
  font-size: 15.5px;
}
.prose blockquote p:last-child { margin-bottom: 0; }
.prose code { padding: 1px 6px; border-radius: 5px; background: var(--paper-deep); }
.prose a { color: var(--c-deep); text-underline-offset: 3px; }
.prose hr { margin: 2em 0; border: 0; border-top: 1px dashed var(--line-strong); }
.table-wrap { margin: 1.2em 0 1.6em; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.prose table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.6; }
.prose th { padding: 10px 14px; background: var(--c-soft); text-align: left; font-weight: 600; white-space: nowrap; }
.prose td { padding: 9px 14px; border-top: 1px solid var(--line); vertical-align: top; }
.prose td:first-child { font-weight: 600; white-space: nowrap; }

.related { margin-top: 72px; padding-top: 32px; border-top: 1px solid var(--line); }
.related .grid { margin-top: 4px; }
.related .card.featured { grid-column: auto; }

.notfound { padding: 90px 0; text-align: center; }
.notfound h1 { font-family: var(--serif); }

/* ---------- 录入助手 ---------- */

.page-head { padding: 44px 0 26px; }
.page-head h1 { margin: 12px 0 10px; font-family: var(--serif); font-weight: 900; font-size: clamp(2rem, 4vw, 2.8rem); line-height: 1.2; }
.page-head .lead { max-width: 44em; }

.add-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 32px; align-items: start; padding-bottom: 80px; }
.add-form {
  display: grid;
  gap: 24px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--card);
  box-shadow: var(--shadow);
}
.field { min-width: 0; margin: 0; padding: 0; border: 0; }
.field > .lab, .field legend { display: block; margin-bottom: 8px; padding: 0; font-size: 14px; font-weight: 600; }
.field .req { color: var(--zh); margin-left: 2px; }
.field .hint { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.add-form input[type="text"],
.add-form input[type="url"],
.add-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--paper);
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.add-form input:focus, .add-form textarea:focus { outline: none; border-color: var(--c); background: var(--card); box-shadow: 0 0 0 4px color-mix(in oklab, var(--c) 14%, transparent); }
.add-form textarea { min-height: 96px; resize: vertical; line-height: 1.65; }
.add-form textarea.tall { min-height: 280px; font-family: var(--mono); font-size: 13.5px; }
.inline-input { display: flex; gap: 8px; }
.inline-input input { flex: 1; }

.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt { position: relative; }
.opt input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.opt > span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--card);
  font-size: 14px;
  color: var(--ink-2);
  transition: background .2s, border-color .2s, color .2s;
}
.opt > span i { font-family: var(--display); font-style: normal; color: var(--c); }
.opt input:checked + span { background: var(--c); border-color: var(--c); color: #fff; }
.opt input:checked + span i { color: #fff; }
.opt input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }
.opt .n { font-family: var(--mono); font-size: 11px; opacity: .7; }

.add-out { position: sticky; top: 88px; display: grid; gap: 18px; }
.add-out .card { animation: none; min-height: 0; }
.add-missing { margin: 0; padding: 10px 14px; border-radius: 10px; background: #FBEDE6; color: #7A2E1C; font-size: 13.5px; }
.add-missing[hidden] { display: none; }

.code-box { overflow: hidden; border-radius: var(--r); background: #1E1B17; color: #EDE6D8; box-shadow: var(--shadow-lift); }
.code-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px 10px 16px; border-bottom: 1px solid rgba(255, 255, 255, .08); font-size: 13px; color: #BDB3A2; }
.code-box pre { max-height: 420px; margin: 0; padding: 16px; overflow: auto; font-family: var(--mono); font-size: 12.5px; line-height: 1.7; white-space: pre; }
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 13px;
  border: 0;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: transform .2s var(--ease);
}
.copy-btn:hover { transform: translateY(-1px); }
.copy-btn.done { background: #CFE8D5; }

.steps { margin: 0; padding: 18px 20px 18px 38px; border: 1px solid var(--line); border-radius: var(--r); background: var(--card); font-size: 14px; color: var(--ink-2); }
.steps li { margin: 4px 0; }
.steps code { padding: 1px 6px; border-radius: 5px; background: var(--paper-deep); }

/* ---------- 页脚 ---------- */

.site-footer { border-top: 1px solid var(--line); padding: 26px 0 34px; font-size: 13.5px; color: var(--muted); }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.footer-inner p { margin: 0; }
.brand.small { gap: 10px; font-family: var(--serif); font-weight: 700; color: var(--ink-2); }
.brand.small .brand-mark { width: 16px; height: 16px; gap: 1.5px; }
.brand.small .brand-mark i { border-radius: 2px; }

/* ---------- 动效 ---------- */

@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}
@keyframes glyphIn {
  from { opacity: 0; transform: translateY(40px) rotate(-4deg); }
  to { opacity: .13; transform: none; }
}
.intro .anim { animation: rise .85s var(--ease) backwards; animation-delay: calc(var(--d, 0) * 90ms); }

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

/* ---------- 响应式 ---------- */

@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; gap: 36px; }
  .tiles { grid-template-columns: repeat(4, 1fr); gap: 12px; padding-bottom: 0; }
  .tile { aspect-ratio: 1 / 1.1; padding: 14px 16px; }
  .tile:nth-child(2n) { margin-top: 0; margin-bottom: 0; }
  .tile-glyph { top: 4px; right: 14px; font-size: 3.4rem; }
  .tile-native { font-size: 1.15rem; }
  .tile-sys { display: none; }
  .d-layout { grid-template-columns: 1fr; gap: 32px; }
  .d-aside { position: static; }
  .add-grid { grid-template-columns: 1fr; }
  .add-out { position: static; }
}

@media (max-width: 680px) {
  .wrap { padding: 0 16px; }
  .hero { padding-top: 32px; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tile { padding: 14px; aspect-ratio: 1 / .74; }
  .tile-glyph { font-size: 3rem; }
  .tile-native { font-size: 1.1rem; }
  .player-poster { border-radius: var(--r-sm); }
  .poster-play { width: 64px; height: 64px; font-size: 26px; }
  .browser { padding-top: 36px; }
  .search { max-width: none; }
  .frow { flex-direction: column; align-items: stretch; gap: 6px; }
  .flabel { width: auto; }
  .flabel small { display: inline; margin-left: 6px; }
  .card.featured { grid-column: auto; padding: 20px 20px 18px 28px; }
  .card.featured .card-title { font-size: 1.45rem; }
  .reason { padding: 56px 20px 22px; }
  .reason::before { top: 6px; left: 16px; }
  .site-card { grid-template-columns: auto minmax(0, 1fr); }
  .site-card .btn { grid-column: 1 / -1; justify-content: center; }
  .viewer-bar { flex-wrap: wrap; }
  .field-row { grid-template-columns: 1fr; }
  .add-form { padding: 20px; }
  .brand-name { font-size: 1rem; }
}
