/* 页首 / 页尾样式，对应 dev-v2 site-header.tsx / site-footer.tsx。
   由 chrome.js 注入的标记使用；页面不要重写这些类。 */

*, *::before, *::after { box-sizing: border-box; }
html { min-width: 320px; -webkit-text-size-adjust: 100%; scrollbar-width: thin; }
body {
  min-height: 100svh; margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-sans); font-size: 16px; line-height: 1.47; letter-spacing: 0;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  display: flex; flex-direction: column;
}
body > main { flex: 1 0 auto; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 1000; height: var(--nav-h);
  border-bottom: 1px solid var(--line-soft); background: var(--header-bg);
  -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
}
.site-header__inner { max-width: 1280px; height: 100%; margin: 0 auto; padding: 0 22px; display: flex; align-items: center; gap: 26px; }
.site-header__burger { display: none; width: 40px; height: 40px; margin-left: -8px; place-items: center; border: 0; border-radius: 50%; background: none; color: var(--text); }
.site-header__burger:hover { background: var(--line-soft); }
.brand { display: flex; flex: none; align-items: center; gap: 8px; font-size: 18px; font-weight: 600; color: var(--text); }
.brand img { width: 24px; height: 24px; }
.nav { display: flex; flex: 1; align-items: center; gap: 2px; }
.nav__link { position: relative; white-space: nowrap; border-radius: 8px; padding: 6px 11px; font-size: 13px; color: var(--text-2); transition: background .2s, color .2s; }
.nav__link:hover { background: var(--line-soft); color: var(--text); }
.nav__link.is-active { background: var(--line-soft); color: var(--text); font-weight: 600; }
.nav__link--strong { font-weight: 600; color: var(--text); }
.nav__new { margin-left: 5px; padding: 1px 5px; border-radius: 4px; background: linear-gradient(135deg, #aef431, #32f5d4); color: #0b1a00; font-size: 9px; font-weight: 700; letter-spacing: .05em; vertical-align: 1px; }
.nav__flame { position: absolute; right: 3px; top: 1px; color: #f97316; animation: flame 2.4s ease-in-out infinite; }
.nav__register {
  display: flex; flex: none; align-items: center; gap: 6px; height: 30px; margin-left: 6px; padding: 0 13px;
  border: 1px solid var(--gold-border); border-radius: var(--r-pill); background: var(--gold-tint);
  font-size: 13px; font-weight: 500; color: var(--gold); white-space: nowrap; transition: background .2s;
}
.nav__register:hover { background: var(--gold-tint-strong); }
.site-search {
  display: flex; flex: 1 1 200px; min-width: 0; max-width: 360px; height: 34px; align-items: center; gap: 8px;
  padding: 0 13px; border: 1px solid transparent; border-radius: var(--r-pill); background: var(--bg-soft); color: var(--text-2);
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.site-search:focus-within { border-color: var(--accent); background: var(--bg-elevated); box-shadow: 0 0 0 4px var(--accent-ring); }
.site-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 13px; color: var(--text); }
.site-search input::placeholder { color: var(--text-3); }
.site-header__right { display: flex; flex: none; align-items: center; gap: 10px; }
.icon-btn {
  position: relative; display: grid; width: 34px; height: 34px; place-items: center; padding: 0;
  border: 1px solid var(--line); border-radius: 50%; background: var(--bg-elevated); color: var(--text-2); transition: background .2s, color .2s, border-color .2s;
}
.icon-btn:hover { border-color: transparent; background: var(--bg-soft); color: var(--text); }
.icon-btn__badge {
  position: absolute; right: -4px; top: -4px; display: grid; min-width: 18px; height: 18px; place-items: center; padding: 0 4px;
  border-radius: 9px; background: var(--accent-solid); color: #fff; font-size: 10.5px; font-weight: 600; line-height: 1; box-shadow: 0 0 0 2px var(--bg);
}
.chain-pill {
  display: flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-pill);
  background: var(--bg-elevated); font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap;
}
.chain-pill i { width: 8px; height: 8px; border-radius: 50%; background: #f0b90b; }
.avatar { display: grid; flex: none; place-items: center; border-radius: 50%; color: #fff; font-weight: 600; line-height: 1; background: linear-gradient(135deg, #0071e3, #6b4ce0); }
.avatar--34 { width: 34px; height: 34px; font-size: 13px; }
.avatar--36 { width: 36px; height: 36px; font-size: 14px; }
.avatar-btn { display: grid; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%; background: none; place-items: center; }
.avatar-btn:hover { opacity: .9; }
.btn-signin { height: 34px; padding: 0 14px; border: 0; border-radius: var(--r-pill); background: var(--accent-solid); color: #fff; font-size: 13px; font-weight: 500; }
.btn-signin:hover { opacity: .9; }

.account { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 1100; width: min(260px, calc(100vw - 28px)); padding: 8px;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--menu-bg); box-shadow: var(--shadow-card); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
}
.menu[hidden] { display: none; }
.menu__head { display: flex; align-items: flex-start; gap: 12px; padding: 8px 9px 10px; }
.menu__who { flex: 1; min-width: 0; }
.menu__name { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.menu__name b { min-width: 0; overflow: hidden; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.menu__tag { flex: none; padding: 1px 6px; border: 1px solid var(--accent-border-strong); border-radius: var(--r-pill); background: var(--accent-tint); color: var(--accent); font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.menu__addr { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-family: var(--font-mono); font-size: 12px; color: var(--text-3); }
.menu__icon { display: grid; width: 20px; height: 20px; place-items: center; padding: 0; border: 0; border-radius: 4px; background: none; color: var(--text-3); }
.menu__icon:hover { background: var(--bg-soft); color: var(--text); }
.menu__theme { display: grid; width: 32px; height: 32px; flex: none; place-items: center; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--text-2); }
.menu__theme:hover { background: var(--bg-soft); color: var(--text); }
.menu__sep { height: 1px; margin: 6px 0; background: var(--line-soft); }
.menu__item { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px; border: 0; border-radius: var(--r-sm); background: none; color: var(--text); font-size: 13px; font-weight: 500; text-align: left; }
.menu__item:hover { background: var(--bg-soft); }
.menu__item small { font-size: 12px; font-weight: 400; color: var(--text-3); }
.menu__item--muted { justify-content: flex-start; gap: 8px; color: var(--text-2); }

.drawer-scrim { position: fixed; inset: var(--nav-h) 0 0; z-index: 1001; background: rgba(15, 15, 17, .4); }
.drawer {
  position: absolute; inset: 100% 0 auto; z-index: 1002; max-height: calc(100dvh - var(--nav-h)); overflow-y: auto; padding: 12px 12px 16px;
  border-bottom: 1px solid var(--line); background: var(--menu-bg); box-shadow: var(--shadow-card); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
}
.drawer[hidden], .drawer-scrim[hidden] { display: none; }
.drawer .site-search { max-width: none; height: 40px; margin-bottom: 8px; }
.drawer__link { display: flex; min-height: 44px; align-items: center; gap: 6px; padding: 0 12px; border-radius: var(--r-sm); font-size: 15px; font-weight: 500; color: var(--text); }
.drawer__link:hover { background: var(--bg-soft); }
.drawer .nav__register { width: 100%; height: 44px; margin: 8px 0 0; border-radius: var(--r-sm); font-size: 14px; }

@media (max-width: 1180px) { .nav__link--collapse { display: none; } }
@media (max-width: 980px) { .site-header .site-search { display: none; } }
@media (max-width: 760px) {
  .site-header__inner { gap: 12px; padding: 0 16px; }
  .site-header__burger { display: grid; }
  .nav, .chain-pill { display: none; }
  .site-header__right { margin-left: auto; }
  .icon-btn, .avatar-btn { width: 40px; height: 40px; }
}
@media (min-width: 761px) { .drawer, .drawer-scrim { display: none !important; } }
@keyframes flame { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .75; transform: scale(.92); } }
@media (prefers-reduced-motion: reduce) { .nav__flame { animation: none; } * { transition: none !important; } }

/* ---------- footer ---------- */
.site-footer { flex: none; margin-top: 0; padding: 56px 0 40px; border-top: 1px solid var(--line); background: var(--bg-soft); font-size: 13.5px; color: var(--text-2); }
.site-footer__inner { max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }
.site-footer__grid { display: grid; grid-template-columns: 1.4fr repeat(4, 1fr); gap: 28px 32px; padding-bottom: 36px; border-bottom: 1px solid var(--line); }
.site-footer .brand { margin-bottom: 12px; font-size: 17px; }
.site-footer .brand img { width: 22px; height: 22px; }
.site-footer__about { max-width: 260px; margin: 0; line-height: 1.6; }
.site-footer h4 { margin: 0 0 14px; font-size: 13px; font-weight: 600; color: var(--text); }
.site-footer__col a { display: block; padding: 4px 0; color: var(--text-2); transition: color .2s; }
.site-footer__col a:hover { color: var(--text); }
.site-footer__bottom { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px; padding-top: 24px; color: var(--text-3); }
.site-footer__status { display: inline-flex; align-items: center; gap: 7px; }
.site-footer__status i { width: 7px; height: 7px; border-radius: 50%; background: var(--verified); }
@media (max-width: 820px) { .site-footer__grid { grid-template-columns: 1fr 1fr; } .site-footer__grid > :first-child { grid-column: 1 / -1; } }
@media (max-width: 760px) { .site-footer { padding: 40px 0 32px; } .site-footer__inner { padding: 0 16px; } .site-footer__col a { display: flex; min-height: 40px; align-items: center; } }
@media (max-width: 480px) { .site-footer__bottom { flex-direction: column; align-items: flex-start; gap: 10px; } }

/* 宽屏：body[data-wide] 开启，页首 / 页尾与正文一起放宽（对应线上 SiteHeader 的 fullWidth） */
body[data-wide] .site-header__inner { max-width: none; padding: 0 clamp(22px, 3vw, 48px); }
body[data-wide] .site-footer__inner { max-width: 1760px; padding: 0 clamp(20px, 3vw, 48px); }
