/* ============================================================
   CatHub 设计系统
   ------------------------------------------------------------
   设计意图：
     · 这是一个"看猫"的站点，所以**照片是主角**，界面 chrome 必须退后。
       暖中性色做底、橙色作品牌色，让照片自己发光。
     · 手机优先：默认样式就是窄屏的，宽屏靠 min-width 逐级增强。
     · 动效克制：只做"有物理感"的位移与淡入，统一尊重 prefers-reduced-motion。
   ============================================================ */

/* ---------------------------------------------------------- 令牌 */

:root {
  --bg: #fbf9f7;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-2: #f7f4f1;
  --surface-3: #f1ece7;
  --border: #ebe4dd;
  --border-strong: #ddd3c9;
  --ink: #1a1714;
  --ink-2: #5c554e;
  --ink-3: #8d857c;
  --brand: #f97316;
  --brand-2: #fb923c;
  --brand-soft: #fff1e6;
  --brand-ink: #9a3412;
  --link: #0b6bcb;
  --link-hover: #0958a8;
  --ok: #15803d;
  --ok-soft: #e8f7ed;
  --warn: #b45309;
  --danger: #dc2626;
  --danger-soft: #fdeceb;
  --add-bg: #e7f8ed;
  --del-bg: #fdecea;
  --hunk-bg: #e8f2ff;

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --r-xl: 26px;
  --r-pill: 999px;
  --shadow-1: 0 1px 2px rgba(26, 23, 20, .05), 0 1px 3px rgba(26, 23, 20, .04);
  --shadow-2: 0 2px 8px rgba(26, 23, 20, .06), 0 8px 24px -8px rgba(26, 23, 20, .10);
  --shadow-3: 0 12px 40px -12px rgba(26, 23, 20, .22);
  --ring: 0 0 0 3px rgba(249, 115, 22, .18);

  --header-h: 58px;
  --bottom-nav-h: 60px;
  --wrap: 1200px;
  --gutter: 16px;

  --ease: cubic-bezier(.22, .61, .36, 1);
  --ease-bounce: cubic-bezier(.34, 1.56, .64, 1);
  --dur-fast: .14s;
  --dur: .24s;
  --dur-slow: .5s;

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

/* 深色模式：重新定一套暖黑，而不是简单反色 —— 保证照片依然好看 */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131110;
    --bg-elevated: #1b1918;
    --surface: #1b1918;
    --surface-2: #232020;
    --surface-3: #2c2827;
    --border: #302c2a;
    --border-strong: #433d3a;
    --ink: #f6f3f0;
    --ink-2: #b5aca4;
    --ink-3: #837a72;
    --brand: #fb923c;
    --brand-2: #fdba74;
    --brand-soft: #2a1c12;
    --brand-ink: #fdba74;
    --link: #6cb2f7;
    --link-hover: #8cc4ff;
    --ok: #4ade80;
    --ok-soft: #10261a;
    --danger: #f87171;
    --danger-soft: #2a1414;
    --add-bg: #10231a;
    --del-bg: #26131a;
    --hunk-bg: #12233b;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-2: 0 2px 10px rgba(0, 0, 0, .45);
    --shadow-3: 0 16px 48px -12px rgba(0, 0, 0, .7);
  }
}

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

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

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* 给手机底部导航留位置（含 iPhone home indicator 安全区） */
  padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
  overflow-x: hidden;
}

@media (min-width: 900px) { body { padding-bottom: 0; } }

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; font-weight: 700; letter-spacing: -.015em; }
h1 { font-size: clamp(1.6rem, 5.2vw, 2.5rem); }
h2 { font-size: clamp(1.15rem, 3.4vw, 1.5rem); }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }

a { color: var(--link); text-decoration: none; transition: color var(--dur-fast) var(--ease); }
a:hover { color: var(--link-hover); }

img { max-width: 100%; height: auto; }

code, pre, .mono { font-family: var(--mono); font-size: .85em; }
code { background: var(--surface-3); padding: .15em .4em; border-radius: 6px; word-break: break-word; }
pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px 16px;
  overflow: auto;
  line-height: 1.55;
  margin: 0 0 1em;
}
pre code { background: none; padding: 0; }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--brand-soft); color: var(--brand-ink); }

@media (min-width: 900px) {
  ::-webkit-scrollbar { width: 12px; height: 12px; }
  ::-webkit-scrollbar-thumb { background: var(--border-strong); border: 3px solid var(--bg); border-radius: 999px; }
  ::-webkit-scrollbar-thumb:hover { background: var(--ink-3); }
}

/* ---------------------------------------------------------- 布局 */

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
@media (min-width: 700px) { :root { --gutter: 24px; } }

main { padding: 18px 0 36px; min-height: 60vh; }
@media (min-width: 900px) { main { padding: 26px 0 72px; } }

.layout, .layout-wide { display: grid; gap: 20px; align-items: start; }
@media (min-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; }
  .layout-wide { grid-template-columns: 250px minmax(0, 1fr); gap: 28px; }
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: rgba(251, 249, 247, .82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
@media (prefers-color-scheme: dark) { .site-header { background: rgba(19, 17, 16, .82); } }
.site-header.is-scrolled { border-bottom-color: var(--border); box-shadow: 0 1px 12px -6px rgba(26, 23, 20, .18); }

.header-inner { height: 100%; display: flex; align-items: center; gap: 12px; }

.brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 800; font-size: 1.05rem; letter-spacing: -.02em;
  color: var(--ink); flex-shrink: 0;
}
.brand:hover { color: var(--ink); }
.brand .paw { font-size: 1.35rem; line-height: 1; transition: transform var(--dur) var(--ease-bounce); }
.brand:hover .paw { transform: rotate(-12deg) scale(1.12); }

.header-search { flex: 1; max-width: 380px; display: none; }
@media (min-width: 700px) { .header-search { display: block; } }
.header-search input {
  width: 100%; height: 36px; padding: 0 14px;
  font-size: .875rem; font-family: inherit; color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-pill);
  transition: all var(--dur) var(--ease);
}
.header-search input::placeholder { color: var(--ink-3); }
.header-search input:focus { outline: none; background: var(--surface); border-color: var(--brand); box-shadow: var(--ring); }

.header-nav { display: none; align-items: center; gap: 4px; margin-left: auto; }
@media (min-width: 900px) { .header-nav { display: flex; } }
.header-nav a {
  padding: 7px 11px; border-radius: var(--r-sm); font-size: .875rem; font-weight: 500;
  color: var(--ink-2); white-space: nowrap;
  transition: all var(--dur-fast) var(--ease);
}
.header-nav a:hover { color: var(--ink); background: var(--surface-2); }

.user-chip { display: inline-flex; align-items: center; gap: 7px; }
.avatar {
  width: 24px; height: 24px; border-radius: 50%;
  display: inline-grid; place-items: center;
  font-size: 11px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  flex-shrink: 0; box-shadow: 0 0 0 2px var(--surface);
}

.nav-toggle {
  margin-left: auto; width: 38px; height: 38px;
  display: grid; place-items: center;
  border: 1px solid var(--border); background: var(--surface);
  border-radius: var(--r-sm); color: var(--ink); font-size: 1.1rem; cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
}
.nav-toggle:active { transform: scale(.94); }
@media (min-width: 900px) { .nav-toggle { display: none; } }

/* 下拉菜单用 max-height 展开，不需要 JS 测高度 */
.mobile-menu {
  position: fixed; inset: var(--header-h) 0 auto 0; z-index: 49;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-2);
  overflow: hidden; max-height: 0; opacity: 0;
  transition: max-height var(--dur) var(--ease), opacity var(--dur-fast) var(--ease);
}
.mobile-menu.is-open { max-height: 380px; opacity: 1; }
.mobile-menu .menu-inner { padding: 12px var(--gutter) 18px; display: grid; gap: 6px; }
.mobile-menu a {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px;
  border-radius: var(--r-sm); color: var(--ink); font-weight: 500; font-size: .95rem;
}
.mobile-menu a:active { background: var(--surface-2); }
.mobile-menu input {
  width: 100%; height: 44px; padding: 0 14px;
  border-radius: var(--r-sm); border: 1px solid var(--border);
  background: var(--surface-2); color: var(--ink); font-size: 1rem; font-family: inherit;
}
@media (min-width: 900px) { .mobile-menu { display: none; } }

/* ---------------------------------------------------------- 底部导航（手机） */

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 48;
  height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(255, 255, 255, .9);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--border);
}
@media (prefers-color-scheme: dark) { .bottom-nav { background: rgba(27, 25, 24, .92); } }
@media (min-width: 900px) { .bottom-nav { display: none; } }
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: .65rem; font-weight: 500; color: var(--ink-3);
  transition: color var(--dur-fast) var(--ease);
}
.bottom-nav a .ico { font-size: 1.25rem; line-height: 1; transition: transform var(--dur) var(--ease-bounce); }
.bottom-nav a:active .ico { transform: scale(.86); }
.bottom-nav a.is-active { color: var(--brand); }
.bottom-nav a.is-active .ico { transform: translateY(-1px); }

/* ---------------------------------------------------------- 按钮 */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 0 16px;
  font-family: inherit; font-size: .875rem; font-weight: 600; line-height: 1;
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  cursor: pointer; white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur) var(--ease),
    background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.btn:hover { background: var(--surface-3); border-color: var(--ink-3); color: var(--ink); }
.btn:active { transform: scale(.97); }

.btn-primary {
  color: #fff;
  background: linear-gradient(180deg, var(--brand-2), var(--brand));
  border-color: transparent;
  box-shadow: 0 1px 2px rgba(249, 115, 22, .3), 0 6px 18px -8px rgba(249, 115, 22, .7);
}
.btn-primary:hover {
  color: #fff;
  background: linear-gradient(180deg, var(--brand), #ea6a0b);
  box-shadow: 0 2px 6px rgba(249, 115, 22, .35), 0 10px 26px -10px rgba(249, 115, 22, .8);
}
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: .8125rem; }
.btn-lg { min-height: 48px; padding: 0 26px; font-size: 1rem; border-radius: var(--r); }
.btn-block { display: flex; width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

.btn-star .ico { display: inline-block; transition: transform var(--dur) var(--ease-bounce); }
.btn-star:hover .ico { transform: translateY(-3px) rotate(-12deg) scale(1.15); }
.btn-star.is-on { color: var(--brand-ink); background: var(--brand-soft); border-color: var(--brand); }

/* ---------------------------------------------------------- 卡片 */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-1);
  margin-bottom: 18px;
  overflow: hidden;
}
.card-header {
  display: flex; align-items: center; gap: 9px;
  padding: 13px 16px; font-weight: 700; font-size: .9375rem;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border-bottom: 1px solid var(--border);
}
.card-body { padding: 16px; }
.card-body > :first-child { margin-top: 0; }
.card-body > :last-child { margin-bottom: 0; }

/* ---------------------------------------------------------- 首页 Hero */

.hero {
  position: relative;
  margin: 0 0 22px;
  padding: clamp(28px, 7vw, 62px) 18px clamp(26px, 6vw, 50px);
  border-radius: var(--r-xl);
  overflow: hidden;
  text-align: center;
  background:
    radial-gradient(120% 100% at 15% 0%, var(--brand-soft) 0%, transparent 55%),
    radial-gradient(100% 90% at 85% 10%, #eaf4ff 0%, transparent 50%),
    var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-2);
}
@media (prefers-color-scheme: dark) {
  .hero {
    background:
      radial-gradient(120% 100% at 15% 0%, rgba(249, 115, 22, .16) 0%, transparent 55%),
      radial-gradient(100% 90% at 85% 10%, rgba(59, 130, 246, .12) 0%, transparent 50%),
      var(--surface);
  }
}
/* 猫爪底纹：内联 SVG，零外部请求 */
.hero::before {
  content: '';
  position: absolute; inset: 0; pointer-events: none; opacity: .55;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='%23f97316' fill-opacity='.07'%3E%3Cellipse cx='30' cy='26' rx='7' ry='9'/%3E%3Cellipse cx='46' cy='20' rx='7' ry='9'/%3E%3Cellipse cx='62' cy='26' rx='7' ry='9'/%3E%3Cpath d='M46 36c-11 0-20 8-20 18 0 8 6 12 13 11 4-1 7-1 12 0 7 1 13-3 13-11 0-10-9-18-18-18z'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 120px 120px;
  mask-image: linear-gradient(180deg, #000 0%, transparent 85%);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 85%);
}
.hero > * { position: relative; }

.hero-badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 14px; margin-bottom: 16px;
  font-size: .78rem; font-weight: 600; color: var(--brand-ink);
  background: var(--brand-soft);
  border: 1px solid rgba(249, 115, 22, .25);
  border-radius: var(--r-pill);
}
.hero-badge .dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--brand);
  animation: pulse 2.4s var(--ease) infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(249, 115, 22, .55); }
  70% { box-shadow: 0 0 0 9px rgba(249, 115, 22, 0); }
  100% { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0); }
}

.hero h1 {
  margin: 0 auto 14px; max-width: 16em;
  font-size: clamp(1.75rem, 7.4vw, 3.1rem);
  font-weight: 800; letter-spacing: -.03em; line-height: 1.15;
}
.hero h1 .accent {
  background: linear-gradient(100deg, var(--brand) 10%, var(--brand-2) 60%, var(--brand) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  background-size: 200% auto; animation: shine 6s linear infinite;
}
@keyframes shine { to { background-position: 200% center; } }

.hero-lead {
  max-width: 34em; margin: 0 auto 26px;
  font-size: clamp(.95rem, 3.6vw, 1.0625rem);
  color: var(--ink-2); line-height: 1.75;
}
.hero-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* 照片带：直接把站点的真实内容当视觉主体，比任何插画都有说服力 */
.hero-photos { display: flex; justify-content: center; gap: 10px; margin-top: 30px; }
.hero-photos a {
  flex: 0 1 120px; min-width: 0;
  border-radius: var(--r); overflow: hidden;
  box-shadow: var(--shadow-2); border: 2px solid var(--surface);
  transform: rotate(var(--tilt, 0deg)) translateY(var(--lift, 0px));
  transition: transform var(--dur-slow) var(--ease), box-shadow var(--dur-slow) var(--ease);
}
.hero-photos a:nth-child(1) { --tilt: -4deg; --lift: 8px; }
.hero-photos a:nth-child(2) { --tilt: 2deg; --lift: -2px; }
.hero-photos a:nth-child(3) { --tilt: -1deg; --lift: 4px; }
.hero-photos a:nth-child(4) { --tilt: 3deg; --lift: -4px; }
.hero-photos a:nth-child(5) { --tilt: -3deg; --lift: 6px; }
.hero-photos a:nth-child(6) { --tilt: 1deg; --lift: 0px; }
.hero-photos a:hover { transform: rotate(0) translateY(-10px) scale(1.06); box-shadow: var(--shadow-3); z-index: 2; }
.hero-photos img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--surface-3); }
.hero-photos a:nth-child(n+4) { display: none; }
@media (min-width: 560px) { .hero-photos a:nth-child(4) { display: block; } }
@media (min-width: 760px) { .hero-photos a:nth-child(5) { display: block; } }
@media (min-width: 900px) { .hero-photos a:nth-child(6) { display: block; } .hero-photos a { flex-basis: 138px; } }

/* ---------------------------------------------------------- 统计 */

.stat-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 0 0 22px; }
@media (min-width: 560px) { .stat-row { grid-template-columns: repeat(5, 1fr); gap: 12px; } }
.stat {
  padding: 14px 10px; text-align: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: var(--shadow-1);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.stat b {
  display: block; font-size: clamp(1.25rem, 5vw, 1.6rem); font-weight: 800;
  letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--ink);
}
.stat span { font-size: .72rem; color: var(--ink-3); font-weight: 500; }

/* ---------------------------------------------------------- 猫仓列表 */

.repo-list { list-style: none; margin: 0; padding: 0; }
.repo-item {
  display: flex; gap: 13px; align-items: flex-start;
  padding: 15px 16px; border-bottom: 1px solid var(--border);
  transition: background var(--dur-fast) var(--ease);
}
.repo-item:last-child { border-bottom: none; }
.repo-item:hover { background: var(--surface-2); }
.repo-item:active { background: var(--surface-3); }

/* 封面缩略图 = 这只猫的"头像"，让列表一眼可辨 */
.repo-thumb {
  width: 54px; height: 54px; flex-shrink: 0;
  border-radius: var(--r-sm); overflow: hidden;
  background: linear-gradient(135deg, var(--surface-3), var(--surface-2));
  box-shadow: var(--shadow-1);
  display: grid; place-items: center; font-size: 1.5rem;
}
.repo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.repo-main { min-width: 0; flex: 1; }
.repo-item h3 {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin: 0 0 3px; font-size: 1rem; font-weight: 700;
}
.repo-item h3 .owner { color: var(--ink-3); font-weight: 500; }
.repo-item p {
  margin: 0 0 8px; font-size: .8375rem; color: var(--ink-2); line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.repo-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: .75rem; color: var(--ink-3); }
.repo-meta .chip { display: inline-flex; align-items: center; gap: 4px; }
.repo-side {
  display: flex; flex-direction: column; gap: 4px; align-items: flex-end;
  text-align: right; font-size: .75rem; color: var(--ink-3); white-space: nowrap;
}

.breed-dot {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  margin-right: 5px; vertical-align: -1px;
}

/* ---------------------------------------------------------- 猫仓页头 */

.repo-head { padding: 14px 0 0; }
.repo-title {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 0 0 12px; font-size: clamp(1.1rem, 4.2vw, 1.35rem); font-weight: 400;
}
.repo-title .owner { color: var(--link); font-weight: 500; }
.repo-title .name { font-weight: 700; color: var(--ink); }
.repo-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.repo-actions .btn { flex: 1 1 auto; }
@media (min-width: 700px) { .repo-actions .btn { flex: 0 0 auto; } }

.tabs {
  display: flex; gap: 2px; margin-top: 18px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 13px; font-size: .875rem; font-weight: 500; color: var(--ink-2);
  white-space: nowrap; border-bottom: 2px solid transparent;
  transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); font-weight: 700; border-bottom-color: var(--brand); }
.tab .count {
  min-width: 20px; padding: 1px 6px; font-size: .7rem; font-weight: 600; text-align: center;
  color: var(--ink-2); background: var(--surface-3); border-radius: var(--r-pill);
}
.tab.active .count { color: var(--brand-ink); background: var(--brand-soft); }

/* ---------------------------------------------------------- 文件树 */

.file-table { width: 100%; border-collapse: collapse; }
.file-table td, .file-table th {
  padding: 10px 12px; font-size: .875rem; text-align: left;
  border-bottom: 1px solid var(--border);
}
.file-table thead td, .file-table th {
  font-size: .75rem; font-weight: 600; color: var(--ink-3); background: var(--surface-2);
}
.file-table tr:last-child td { border-bottom: none; }
.file-table tbody tr { transition: background var(--dur-fast) var(--ease); }
.file-table tbody tr:hover { background: var(--surface-2); }
.file-icon { width: 34px; text-align: center; font-size: 1rem; }
.file-commit { color: var(--ink-3); font-size: .8125rem; }
.file-commit a { color: var(--ink-2); }
.file-commit a:hover { color: var(--link); }
.file-time { text-align: right; white-space: nowrap; color: var(--ink-3); font-size: .78rem; width: 1%; }
@media (max-width: 620px) {
  .file-table th:nth-child(3), .file-table td:nth-child(3),
  .file-table th:nth-child(4), .file-table td:nth-child(4) { display: none; }
}

/* ---------------------------------------------------------- README / 文章 */

.readme {
  padding: 20px 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: var(--shadow-1);
  overflow-wrap: break-word;
}
@media (min-width: 700px) { .readme { padding: 30px 36px; } }

.readme h1, .article h1 { font-size: clamp(1.4rem, 5vw, 1.9rem); }
.readme h2, .article h2 {
  margin-top: 1.8em; padding-bottom: .35em;
  font-size: clamp(1.1rem, 4vw, 1.35rem); border-bottom: 1px solid var(--border);
}
.readme h3, .article h3 { margin-top: 1.5em; font-size: 1.05rem; }
.readme > :first-child, .article > :first-child { margin-top: 0; }

.readme table, .article table {
  width: 100%; border-collapse: collapse; margin: 1.2em 0; font-size: .875rem;
  display: block; overflow-x: auto; white-space: nowrap;
}
@media (min-width: 700px) { .readme table, .article table { display: table; white-space: normal; } }
.readme th, .article th, .readme td, .article td { padding: 8px 12px; border: 1px solid var(--border); text-align: left; }
.readme th, .article th { background: var(--surface-2); font-weight: 600; }

.readme blockquote, .article blockquote {
  margin: 1.2em 0; padding: 2px 16px; color: var(--ink-2);
  border-left: 3px solid var(--brand); background: var(--brand-soft);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
}
.readme ul, .readme ol, .article ul, .article ol { padding-left: 1.4em; }
.readme li, .article li { margin: .3em 0; }
.readme img, .article img { border-radius: var(--r); box-shadow: var(--shadow-1); }

.article { max-width: 46rem; }
.article-lead { font-size: 1.0625rem; color: var(--ink-2); }

/* 医疗内容免责声明 */
.disclaimer {
  display: flex; gap: 10px; padding: 12px 14px; margin: 0 0 20px;
  font-size: .8125rem; line-height: 1.6; color: var(--warn);
  background: rgba(180, 83, 9, .07);
  border: 1px solid rgba(180, 83, 9, .25);
  border-radius: var(--r);
}

/* ---------------------------------------------------------- 提交与 diff */

.commit-list { list-style: none; margin: 0; padding: 0; }
.commit-item {
  display: flex; gap: 11px; padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  transition: background var(--dur-fast) var(--ease);
}
.commit-item:last-child { border-bottom: none; }
.commit-item:hover { background: var(--surface-2); }
.commit-graph { color: var(--border-strong); font-family: var(--mono); padding-top: 2px; user-select: none; }
.commit-main { min-width: 0; flex: 1; }
.commit-title { font-weight: 600; font-size: .9375rem; overflow-wrap: break-word; }
.commit-sub { margin-top: 3px; font-size: .75rem; color: var(--ink-3); }

.sha {
  display: inline-block; padding: 1px 6px;
  font-family: var(--mono); font-size: .72rem; color: var(--ink-2);
  background: var(--surface-3); border-radius: 5px;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.sha:hover { background: var(--brand-soft); color: var(--brand-ink); }

.diff-file {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); overflow: hidden; margin-bottom: 14px; box-shadow: var(--shadow-1);
}
.diff-file-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px; font-size: .8125rem;
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.diff-body { overflow-x: auto; }
.diff-body pre { margin: 0; border: none; border-radius: 0; padding: 0; background: none; font-size: .78rem; line-height: 1.6; }
.diff-line { display: block; padding: 0 12px; white-space: pre; }
.diff-add { background: var(--add-bg); }
.diff-del { background: var(--del-bg); }
.diff-hunk { background: var(--hunk-bg); color: var(--ink-2); }
.diff-meta { color: var(--ink-3); }
.diffstat { font-family: var(--mono); font-size: .75rem; white-space: nowrap; }
.diffstat .add { color: var(--ok); font-weight: 600; }
.diffstat .del { color: var(--danger); font-weight: 600; }

.blame-table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: .75rem; }
.blame-table td { padding: 3px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.blame-who { width: 1%; white-space: nowrap; color: var(--ink-3); border-right: 1px solid var(--border); }
.blame-num { width: 1%; text-align: right; color: var(--ink-3); user-select: none; border-right: 1px solid var(--border); }
.blame-code { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------------------------------------------------------- 照片墙 */

.photo-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px; list-style: none; margin: 0 0 20px; padding: 0;
}
@media (min-width: 620px) { .photo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; } }
@media (min-width: 900px) { .photo-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .photo-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

.photo-card {
  position: relative; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r);
  overflow: hidden; box-shadow: var(--shadow-1);
  animation: fadeUp var(--dur-slow) var(--ease) both;
  animation-delay: calc(var(--i, 0) * 26ms);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
@media (hover: hover) {
  .photo-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-3); }
  .photo-card:hover img { transform: scale(1.06); }
}

.photo-media { position: relative; display: block; overflow: hidden; background: var(--surface-3); }
.photo-media img {
  display: block; width: 100%; aspect-ratio: 1; object-fit: cover;
  transition: transform var(--dur-slow) var(--ease), opacity var(--dur-slow) var(--ease);
}
.photo-media.is-loading::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, .35) 50%, transparent 80%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* 丑度徽章浮在图片角上，比塞进文字里更醒目 */
.ugly-badge {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  display: inline-flex; align-items: center; gap: 3px;
  padding: 3px 9px; font-size: .7rem; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, #f43f5e, #f97316);
  border-radius: var(--r-pill);
  box-shadow: 0 2px 8px rgba(244, 63, 94, .4);
}

.photo-body { padding: 10px 11px 11px; }
.photo-caption {
  margin: 0 0 6px; font-size: .8125rem; line-height: 1.5; color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.photo-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  font-size: .7rem; color: var(--ink-3);
}

/* ---------------------------------------------------------- 上传区 */

.upload-zone {
  display: grid; place-items: center; gap: 6px; padding: 28px 18px; text-align: center;
  color: var(--ink-2);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 2px dashed var(--border-strong); border-radius: var(--r); cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.upload-zone:hover { border-color: var(--brand); color: var(--brand-ink); background: var(--brand-soft); }
.upload-zone.dragover {
  border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink);
  transform: scale(1.01); box-shadow: var(--shadow-2);
}
.upload-zone .big-ico { font-size: 2.2rem; line-height: 1; }

/* ---------------------------------------------------------- 工单与提案 */

.issue-list { list-style: none; margin: 0; padding: 0; }
.issue-item {
  display: flex; gap: 11px; padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  transition: background var(--dur-fast) var(--ease);
}
.issue-item:last-child { border-bottom: none; }
.issue-item:hover { background: var(--surface-2); }
.issue-icon { font-size: 1rem; line-height: 1.5; }
.issue-icon.open { color: var(--ok); }
.issue-icon.closed { color: var(--ink-3); }
.issue-main { min-width: 0; flex: 1; }
.issue-title { font-size: .9375rem; font-weight: 600; overflow-wrap: break-word; }
.issue-sub { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 3px; font-size: .75rem; color: var(--ink-3); }

.comment {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); margin-bottom: 14px; overflow: hidden; box-shadow: var(--shadow-1);
}
.comment-head { padding: 10px 15px; font-size: .8125rem; color: var(--ink-2); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.comment-body { padding: 15px; }
.comment-body > :first-child { margin-top: 0; }
.comment-body > :last-child { margin-bottom: 0; }

/* ---------------------------------------------------------- 表单 */

.field { margin-bottom: 18px; }
label { display: block; margin-bottom: 7px; font-size: .875rem; font-weight: 600; color: var(--ink); }
.hint { margin: -2px 0 8px; font-size: .78rem; color: var(--ink-3); line-height: 1.55; }

input[type="text"], input[type="number"], input[type="date"], input[type="file"],
input[type="email"], input[type="password"], select, textarea {
  width: 100%; min-height: 42px; padding: 9px 13px;
  font-family: inherit; font-size: 1rem; /* ≥16px：iOS 聚焦时不放大页面 */
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  -webkit-appearance: none; appearance: none;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
input[type="file"] { padding: 8px; font-size: .875rem; background: var(--surface-2); }
textarea { min-height: 130px; line-height: 1.7; resize: vertical; }
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238d857c' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; padding-right: 34px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input[type="checkbox"] { width: auto; min-height: auto; accent-color: var(--brand); }

.form-row { display: grid; gap: 16px; }
@media (min-width: 620px) { .form-row { grid-template-columns: 1fr 1fr; } }

/* ---------------------------------------------------------- 标签与提示 */

.label {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; font-size: .7rem; font-weight: 600; line-height: 1.7;
  color: var(--ink-2); background: var(--surface-3); border-radius: var(--r-pill); white-space: nowrap;
}
.label-open { color: var(--ok); background: var(--ok-soft); }
.label-closed, .label-merged { color: #7c3aed; background: #f3ecff; }
@media (prefers-color-scheme: dark) { .label-closed, .label-merged { color: #c4a8ff; background: #241b3a; } }
.label-ugly { color: #fff; background: linear-gradient(135deg, #f43f5e, #f97316); }

.flash {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 13px 15px; margin-bottom: 18px; font-size: .875rem;
  border-radius: var(--r); border: 1px solid;
  animation: slideDown var(--dur) var(--ease) both;
}
.flash-ok { color: var(--ok); background: var(--ok-soft); border-color: rgba(21, 128, 61, .3); }
.flash-err { color: var(--danger); background: var(--danger-soft); border-color: rgba(220, 38, 38, .3); }

/* ---------------------------------------------------------- 攻略 */

.guide-toc { position: sticky; top: calc(var(--header-h) + 16px); }
.guide-toc ul { list-style: none; margin: 0; padding: 0; font-size: .8375rem; }
.guide-toc li { margin: 0 0 2px; }
.guide-toc a { display: block; padding: 6px 10px; border-radius: var(--r-sm); color: var(--ink-2); transition: all var(--dur-fast) var(--ease); }
.guide-toc a:hover { background: var(--surface-2); color: var(--ink); }
.guide-toc a.is-current { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }

/* ---------------------------------------------------------- 空状态与页脚 */

.empty { display: grid; place-items: center; gap: 6px; padding: 52px 20px; text-align: center; color: var(--ink-3); }
.empty .big { font-size: 3rem; line-height: 1; animation: float 4s var(--ease) infinite; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.empty h3 { margin: 6px 0 0; color: var(--ink); }

.site-footer {
  margin-top: 28px; padding: 22px 0 30px;
  font-size: .75rem; color: var(--ink-3); border-top: 1px solid var(--border);
}
.site-footer .wrap { display: flex; flex-direction: column; gap: 6px; }
@media (min-width: 700px) { .site-footer .wrap { flex-direction: row; justify-content: space-between; align-items: center; } }

/* ---------------------------------------------------------- 工具类 */

.muted { color: var(--ink-3); }
.small { font-size: .78rem; }
.center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mt-2 { margin-top: 16px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.flex { display: flex; align-items: center; gap: 8px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 22px 0 10px; }
.section-title h2 { margin: 0; font-size: 1.05rem; }

/* ---------------------------------------------------------- 进场动效 */

@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

.animate { animation: fadeUp var(--dur-slow) var(--ease) both; animation-delay: calc(var(--d, 0) * 60ms); }

/* ============================================================ 顶栏账户区
   刻意放在 .header-nav 之外：那个导航窄于 900px 会隐藏，
   把登录入口放进去会导致"手机上找不到登录"。
   这里让账户区独占 margin-left:auto，导航不再抢。 */
.header-nav { margin-left: 0; }
.header-auth { margin-left: auto; display: flex; align-items: center; gap: 6px; }
@media (max-width: 899px) { .header-auth { margin-left: auto; } }
.header-auth .header-signin { padding: 7px 11px; border-radius: var(--r-sm); font-size: .875rem; font-weight: 500; color: var(--ink-2); }
.header-auth .header-signin:hover { color: var(--ink); background: var(--surface-2); }
/* 窄屏隐藏重复的"新建猫仓"（菜单里已有），避免顶栏拥挤 */
@media (max-width: 640px) { .header-new { display: none; } }

.avatar-img { border-radius: 50%; display: block; flex-shrink: 0; background: var(--surface-2); }
.user-menu .avatar-img { box-shadow: 0 0 0 1px var(--border); }

/* details/summary 实现的下拉：不需要一行 JS，禁用 JS 也能用 */
.user-menu { position: relative; }
.user-menu > summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 8px 4px 4px; border-radius: 999px; border: 1px solid transparent;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary:hover { background: var(--surface-2); border-color: var(--border); }
.user-menu[open] > summary { background: var(--surface-2); border-color: var(--border); }
.user-menu-name { font-size: .875rem; font-weight: 500; color: var(--ink-2); max-width: 9ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 640px) { .user-menu-name { display: none; } }

.user-menu .menu {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 60;
  min-width: 224px; padding: 6px;
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: 0 12px 32px -12px rgba(26, 23, 20, .28);
}
.user-menu .menu-head {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--border);
}
.user-menu .menu a,
.user-menu .menu button {
  display: block; width: 100%; text-align: left;
  padding: 8px 10px; border: 0; background: none; cursor: pointer;
  border-radius: var(--r-sm); font-size: .875rem; font-family: inherit; color: var(--ink-2);
}
.user-menu .menu a:hover,
.user-menu .menu button:hover { background: var(--surface-2); color: var(--ink); }

/* ============================================================ 公开用户主页 */
.profile-head { display: flex; align-items: center; gap: 20px; margin-top: 24px; flex-wrap: wrap; }
.profile-avatar { box-shadow: 0 0 0 1px var(--border), 0 6px 20px -8px rgba(26,23,20,.28); }
.profile-meta h1 { font-size: 26px; margin: 0 0 4px; letter-spacing: -.02em; }
.profile-username { font-weight: 600; color: var(--ink-2); }
.profile-stats { display: flex; gap: 32px; flex-wrap: wrap; }
.profile-stat { display: flex; flex-direction: column; }
.profile-stat strong { font-size: 22px; line-height: 1.2; }
.profile-stat span { font-size: 12px; }
