/* 视觉参考：牛皮纸底 + 颗粒 + 像素纯色物件 + 小号大写紧凑无衬线（Eagle「上传图片进行搜索.mp4」） */
:root {
  --bg: #a58c69;           /* 牛皮纸 */
  --bg-deep: #977f5e;      /* 视频底、输入框底 */
  --surface: #ad9573;
  --ink: #15110c;
  --muted: #4d3822;        /* 页脚那种棕色小字 */
  --line: #8a7253;
  --orange: #f3922f;
  --green: #28560c;
  --yellow: #ecd34a;
  --blue: #3a36ef;
  --accent: var(--blue);
  --accent-ink: #f4ecdc;
  --grain-opacity: .22;
  --sans: 'Inter Tight', 'Noto Sans SC', system-ui, -apple-system, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1d1712; --bg-deep: #15110c; --surface: #261e17; --ink: #efe4cf; --muted: #b39a78; --line: #3d3126;
    --green: #5fa532; --blue: #6c69ff; --accent-ink: #0d0b08; --grain-opacity: .12;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1d1712; --bg-deep: #15110c; --surface: #261e17; --ink: #efe4cf; --muted: #b39a78; --line: #3d3126;
  --green: #5fa532; --blue: #6c69ff; --accent-ink: #0d0b08; --grain-opacity: .12;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--ink);
  font: 15px/1.55 var(--sans);
  font-feature-settings: 'tnum';
}
/* 纸张颗粒：整页固定一层噪点 */
body::before {
  content: ''; position: fixed; inset: 0; z-index: 100; pointer-events: none;
  opacity: var(--grain-opacity); mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
a { color: inherit; }
img, video { display: block; max-width: 100%; }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
[hidden] { display: none !important; }

/* 参考片里那种两行大写小标签 */
.caps { text-transform: uppercase; letter-spacing: -.01em; font-weight: 500; line-height: 1.05; }
.label { font-size: 12px; text-transform: uppercase; letter-spacing: .01em; color: var(--muted); line-height: 1.25; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 28px;
  padding: 14px clamp(16px, 4vw, 48px);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; text-decoration: none; white-space: nowrap; letter-spacing: -.01em; }
.brand-mark { display: grid; grid-template-columns: repeat(2, 7px); gap: 0; }
.brand-mark i { width: 7px; height: 7px; display: block; }
.brand-mark i:nth-child(1) { background: var(--orange); }
.brand-mark i:nth-child(2) { background: var(--green); }
.brand-mark i:nth-child(3) { background: var(--yellow); }
.brand-mark i:nth-child(4) { background: var(--blue); }
.topnav { display: flex; gap: 22px; font-size: 13px; text-transform: uppercase; }
.topnav a { text-decoration: none; color: var(--muted); }
.topnav a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
#account { display: flex; align-items: center; gap: 8px; }
.avatar { width: 28px; height: 28px; background: var(--bg-deep); object-fit: cover; flex: none; display: grid; place-items: center; font-size: 12px; font-weight: 600; color: var(--ink); image-rendering: pixelated; }
.avatar-sm { width: 20px; height: 20px; font-size: 10px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border: 1px solid var(--ink); border-radius: 0;
  background: transparent; cursor: pointer; text-decoration: none; font-size: 13px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .01em; white-space: nowrap;
}
.btn:hover { background: var(--ink); color: var(--bg); }
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-primary:hover { background: transparent; color: var(--ink); }
.btn-accent { background: var(--blue); color: #f4ecdc; border-color: var(--blue); }
.btn-accent:hover { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn-ghost { border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: transparent; color: var(--ink); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

main { flex: 1; width: 100%; max-width: 1400px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 48px) 72px; outline: none; }

/* ---------- 首屏：像素舞台全屏铺在文字背后 ---------- */
body { overflow-x: clip; }
.hero {
  position: relative; isolation: isolate;
  margin-inline: calc(50% - 50vw);
  min-height: calc(100svh - 57px);
  display: flex; align-items: flex-end;
  margin-bottom: 40px;
}
.hero #stage { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; image-rendering: pixelated; }
.stage-label { position: absolute; z-index: 1; font-size: clamp(16px, 2vw, 26px); white-space: pre; pointer-events: none; }
.hero-inner {
  width: 100%; max-width: 1400px; margin: 0 auto;
  padding: 40px clamp(16px, 4vw, 48px) clamp(28px, 5vh, 56px);
}
.hero h1 {
  margin: 0 0 20px; font-size: clamp(40px, 6.4vw, 104px); line-height: .92; font-weight: 600;
  letter-spacing: -.04em; text-transform: uppercase; max-width: 9em;
}
.hero h1 .zh { display: block; font-size: .36em; letter-spacing: -.01em; margin-top: .45em; font-weight: 700; }
.hero p { margin: 0 0 28px; max-width: 30em; color: var(--muted); font-size: 15px; }
.flow { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; max-width: 460px; }
.flow h3 { margin: 0 0 8px; }
.flow ol { margin: 0; padding: 0; list-style: none; counter-reset: s; font-size: 13px; text-transform: uppercase; }
.flow li { counter-increment: s; padding: 4px 0; border-top: 1px solid var(--ink); display: flex; gap: 10px; }
.flow li::before { content: '0' counter(s); color: var(--muted); }
.flow s { color: var(--muted); }
.flow .is-new h3 { color: var(--blue); }
.hero-down { display: inline-block; margin-top: 28px; padding: 0; border: 0; background: none; cursor: pointer; }
.hero-down:hover { color: var(--ink); }

/* ---------- 筛选条 ---------- */
.toolbar { scroll-margin-top: 57px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 18px 0 14px; border-top: 1px solid var(--ink); }
.toolbar h2 { margin: 0 8px 0 0; font-size: 22px; font-weight: 600; letter-spacing: -.02em; text-transform: uppercase; }
.count { color: var(--muted); font-size: 13px; font-weight: 400; }
.search {
  flex: 1 1 200px; max-width: 300px; padding: 7px 0; border: 0; border-bottom: 1px solid var(--ink);
  background: transparent; border-radius: 0;
}
.search::placeholder { color: var(--muted); }
.seg { display: inline-flex; gap: 14px; font-size: 13px; text-transform: uppercase; }
.seg button { border: 0; background: none; padding: 2px 0; cursor: pointer; color: var(--muted); }
.seg button[aria-pressed="true"] { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
.seg + .seg { padding-left: 16px; border-left: 1px solid var(--line); }
.tags { display: flex; flex-wrap: wrap; gap: 4px 14px; padding-bottom: 20px; font-size: 13px; }
.tag { border: 0; background: none; padding: 0; color: var(--muted); cursor: pointer; text-decoration: none; }
.tag:hover, .tag[aria-pressed="true"] { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- 卡片网格 ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); gap: 36px 20px; }
.card { position: relative; display: flex; flex-direction: column; gap: 10px; }
.card-media { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--bg-deep); display: block; }
.card-media img, .card-media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.card-media video { opacity: 0; }
.card-media.playing video { opacity: 1; }
.badge {
  position: absolute; z-index: 1; font-size: 11px; line-height: 1; padding: 5px 7px;
  text-transform: uppercase; letter-spacing: .02em; font-weight: 500;
}
.badge-time { right: 0; bottom: 0; background: var(--ink); color: var(--bg); }
.badge-state { left: 0; top: 0; background: var(--orange); color: var(--ink); }
.badge-state.done { background: var(--green); color: #f4ecdc; }
.badge-private { left: 0; bottom: 0; background: var(--yellow); color: var(--ink); }
.card-more {
  position: absolute; z-index: 2; right: 0; top: 0; width: 32px; height: 32px; border: 0;
  background: var(--ink); color: var(--bg); cursor: pointer; font-size: 16px; line-height: 1; opacity: 0;
}
.card:hover .card-more, .card-more:focus-visible { opacity: 1; }
@media (hover: none) { .card-more { opacity: 1; } }
.card-title { margin: 0; font-weight: 500; font-size: 15px; line-height: 1.3; letter-spacing: -.01em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-title a { text-decoration: none; }
.card-meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; text-transform: uppercase; border-top: 1px solid var(--line); padding-top: 8px; }
.card-meta a { text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.card-meta .spacer { margin-left: auto; }

.empty { padding: 80px 0; text-align: center; color: var(--muted); }
.empty h3 { color: var(--ink); margin: 0 0 6px; font-weight: 600; }
.empty .btn { margin-top: 12px; }
.more-row { display: flex; justify-content: center; padding-top: 36px; }

/* ---------- 菜单 ---------- */
.menu {
  margin: 0; inset: auto; position: fixed; min-width: 230px; padding: 4px 0;
  border: 1px solid var(--ink); background: var(--bg); color: var(--ink); border-radius: 0;
  box-shadow: 6px 6px 0 var(--ink);
}
.menu button, .menu a {
  display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 14px; border: 0; background: none;
  text-align: left; cursor: pointer; text-decoration: none; font-size: 14px;
}
.menu button:hover:not(:disabled), .menu a:hover { background: var(--ink); color: var(--bg); }
.menu button:disabled { color: var(--muted); cursor: not-allowed; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.menu .danger { color: #9e1f10; }
.menu .hint { font-size: 12px; color: var(--muted); padding: 0 14px 6px; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: 10px 16px; font-size: 14px; z-index: 110;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 详情页 ---------- */
.detail { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); gap: clamp(24px, 4vw, 56px); padding-top: 36px; }
.player { width: 100%; background: var(--bg-deep); max-height: 76vh; }
.detail h1 { margin: 0 0 12px; font-size: clamp(24px, 3vw, 34px); line-height: 1.12; font-weight: 600; letter-spacing: -.025em; }
.detail .desc { white-space: pre-wrap; margin: 14px 0; }
.panel { border-top: 1px solid var(--ink); padding: 14px 0 22px; }
.panel h2 { font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: .02em; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; color: var(--muted); }
.panel .stack { display: grid; gap: 10px; }
.repo { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.repo:first-of-type { border-top: 0; }
.repo a.url { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.meta-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; color: var(--muted); font-size: 12px; text-transform: uppercase; }
.back { display: inline-block; margin-top: 18px; color: var(--muted); text-decoration: none; font-size: 13px; text-transform: uppercase; }
.back:hover { color: var(--ink); }

/* ---------- 表单 ---------- */
.form-page { max-width: 720px; margin: 0 auto; padding-top: 40px; }
.form-page h1 { font-size: clamp(30px, 4vw, 48px); margin: 0 0 8px; font-weight: 600; letter-spacing: -.03em; text-transform: uppercase; line-height: 1; }
.form-page > p { color: var(--muted); margin: 0 0 32px; }
.field { display: grid; gap: 6px; margin-bottom: 22px; }
.field > label, .field .label-t { font-size: 12px; text-transform: uppercase; letter-spacing: .02em; font-weight: 500; }
.field small { color: var(--muted); font-size: 12px; }
.input, .textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--ink); background: transparent; border-radius: 0; }
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.textarea { min-height: 96px; resize: vertical; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.check input { accent-color: var(--ink); width: 16px; height: 16px; }
.drop {
  display: grid; place-items: center; gap: 4px; text-align: center; padding: 44px 20px;
  border: 1px dashed var(--ink); cursor: pointer; color: var(--muted); font-size: 13px;
}
.drop strong { color: var(--ink); font-size: 16px; font-weight: 600; }
.drop.over { background: var(--yellow); color: var(--ink); border-style: solid; }
.drop-preview { width: 100%; background: var(--bg-deep); max-height: 380px; }
.progress { height: 8px; background: var(--bg-deep); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--blue); }
.error { color: #9e1f10; font-size: 14px; font-weight: 500; }

/* ---------- 说明页 ---------- */
.guide { max-width: 720px; margin: 0 auto; padding-top: 40px; }
.guide h1 { font-size: clamp(30px, 4vw, 48px); font-weight: 600; letter-spacing: -.03em; text-transform: uppercase; line-height: 1; }
.guide h2 { font-size: 13px; font-weight: 500; text-transform: uppercase; margin-top: 36px; padding-top: 12px; border-top: 1px solid var(--ink); }
.guide li { margin-bottom: 6px; }

dialog.panel { border: 1px solid var(--ink); background: var(--bg); color: var(--ink); padding: 20px 22px; max-width: 420px; box-shadow: 8px 8px 0 var(--ink); }
dialog::backdrop { background: rgb(21 17 12 / .35); }

.footer {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 28px clamp(16px, 4vw, 48px) 32px;
  color: var(--muted); font-size: 12px; text-transform: uppercase; line-height: 1.25;
}
.footer p { margin: 0; }
.footer .right { justify-self: end; max-width: 30em; }
.footer a { color: var(--ink); }

@media (max-width: 900px) {
  .detail { grid-template-columns: 1fr; }
  .topnav { display: none; }
}
@media (max-width: 520px) {
  .flow { grid-template-columns: 1fr; gap: 16px; }
  .topbar { gap: 12px; }
  .seg + .seg { padding-left: 0; border-left: 0; }
  .footer { grid-template-columns: 1fr; }
  .footer .right { justify-self: start; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
