/* ==========================================================================
   学习空间 · 样式表
   ========================================================================== */

:root {
  /* ---- 底色：浅冷灰，不用纯白，大面积看久了不刺眼 ---- */
  --bg: #f4f7fb;
  --bg-soft: #eef2f8;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --surface-sunken: #f2f5fa;

  /* ---- 文字：墨蓝黑 + 两级灰 ---- */
  --text: #131c2e;
  --text-soft: #4c5c74;
  --text-faint: #7d8ba3;

  /* ---- 描边：浅灰蓝，靠明度分层 ---- */
  --border: #e2e8f1;
  --border-strong: #c9d5e5;
  --hairline: rgba(19, 28, 46, 0.07);

  /* ---- 主色：青，压到白底可读的深度；亮色下 hover 走"变深" ---- */
  --brand: #0891b2;
  --brand-dark: #0e7490;
  --brand-soft: rgba(8, 145, 178, 0.08);
  --brand-ring: rgba(8, 145, 178, 0.26);

  /* ---- 副色：紫罗兰，与青色成对做渐变 ---- */
  --violet: #7c3aed;
  --accent: #b45309;
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.07);
  --success: #059669;

  /* ---- 光效：亮色下不再"发光"，只留一层淡淡氛围 ---- */
  --glow-cyan: rgba(8, 145, 178, 0.22);
  --glow-cyan-soft: rgba(8, 145, 178, 0.1);
  --glow-violet: rgba(124, 58, 237, 0.18);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 2px rgba(19, 28, 46, 0.06);
  --shadow: 0 1px 2px rgba(19, 28, 46, 0.05), 0 16px 36px -22px rgba(19, 28, 46, 0.3);
  --shadow-lg: 0 2px 6px rgba(19, 28, 46, 0.07), 0 28px 56px -28px rgba(19, 28, 46, 0.34);

  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "SFMono-Regular", "JetBrains Mono", "Cascadia Mono", ui-monospace,
    Menlo, Consolas, "Courier New", monospace;
  --header-h: 66px;
  --maxw: 1120px;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.nav-open {
  overflow: hidden;
}

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

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  color: var(--brand-dark);
}

button {
  font: inherit;
  color: inherit;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 650;
  letter-spacing: -0.012em;
  line-height: 1.3;
}

p {
  margin: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 10px 16px;
  background: var(--brand);
  color: #ffffff;
  z-index: 100;
}

.skip-link:focus {
  left: 12px;
  top: 12px;
}

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

/* ============================ Header ============================ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(8, 12, 20, 0.82);
  backdrop-filter: saturate(150%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  flex-shrink: 0;
}

.brand:hover {
  color: var(--text);
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(140deg, #06b6d4, #6366f1 52%, #a855f7);
  color: #ffffff;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 8px -4px rgba(8, 145, 178, 0.5), 0 4px 14px -8px rgba(19, 28, 46, 0.18);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-text strong {
  font-size: 16px;
  font-weight: 680;
  letter-spacing: 0.01em;
}

.brand-text em {
  font-size: 11.5px;
  font-style: normal;
  color: var(--text-faint);
  letter-spacing: 0.04em;
}

.primary-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
}

.primary-nav a {
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 14.5px;
  color: var(--text-soft);
  transition: background 0.16s ease, color 0.16s ease;
}

.primary-nav a:hover {
  background: var(--bg-soft);
  color: var(--text);
}

.primary-nav a.active {
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 600;
}

.header-side {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-soft);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}

.icon-btn:hover {
  background: var(--bg-soft);
  color: var(--text);
}

.nav-toggle {
  display: none;
}

.user-slot {
  display: flex;
  align-items: center;
  gap: 8px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 650;
  display: grid;
  place-items: center;
  border: 1px solid rgba(34, 211, 238, 0.24);
}

.user-menu {
  position: relative;
}

.user-menu > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 10px 3px 3px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 14px;
}

.user-menu > summary::-webkit-details-marker {
  display: none;
}

.user-menu[open] > summary {
  border-color: var(--border-strong);
}

.user-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 190px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 60;
}

.user-menu-panel .panel-head {
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}

.user-menu-panel .panel-head strong {
  display: block;
  font-size: 14px;
}

.user-menu-panel .panel-head span {
  font-size: 12px;
  color: var(--text-faint);
}

.menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 0;
  background: transparent;
  font-size: 14px;
  color: var(--text-soft);
  cursor: pointer;
}

.menu-item:hover {
  background: var(--bg-soft);
  color: var(--text);
}

.search-bar {
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.search-bar form {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-faint);
}

.search-bar input {
  flex: 1;
  border: 0;
  background: transparent;
  font-size: 16px;
  color: var(--text);
  outline: none;
  padding: 4px 0;
}

.search-bar input::placeholder {
  color: var(--text-faint);
}

.text-btn {
  border: 0;
  background: transparent;
  color: var(--text-soft);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
}

.text-btn:hover {
  color: var(--text);
  background: var(--bg-soft);
}

/* ============================ Layout ============================ */

#app {
  display: block;
  min-height: calc(100vh - var(--header-h) - 180px);
}

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 40px 24px 64px;
}

.container-narrow {
  max-width: 760px;
}

.page-head {
  margin-bottom: 28px;
}

.page-head h1 {
  font-size: 30px;
  margin-bottom: 8px;
}

.page-head p {
  color: var(--text-soft);
  font-size: 15.5px;
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 18px;
}

.section-title h2 {
  font-size: 19px;
}

.layout-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 296px;
  gap: 44px;
  align-items: start;
}

/* ============================ Hero ============================ */

.hero {
  padding: 56px 0 44px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}

.hero-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand);
  background: var(--brand-soft);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 18px;
}

.hero h1 {
  font-size: clamp(30px, 4.4vw, 44px);
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

.hero h1 .underline {
  background: linear-gradient(transparent 62%, rgba(34, 211, 238, 0.24) 62%);
  padding: 0 2px;
}

.hero p {
  max-width: 620px;
  color: var(--text-soft);
  font-size: 17px;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px dashed var(--border-strong);
}

.hero-stat {
  display: flex;
  flex-direction: column;
}

.hero-stat b {
  font-size: 22px;
  font-weight: 680;
  letter-spacing: -0.01em;
}

.hero-stat span {
  font-size: 13px;
  color: var(--text-faint);
}

/* ============================ 文章列表 ============================ */

.post-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.post-card {
  position: relative;
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 26px;
  color: inherit;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

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

.post-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-faint);
  margin-bottom: 10px;
}

.post-card h3 {
  font-size: 21px;
  margin-bottom: 8px;
  transition: color 0.16s ease;
}

.post-card:hover h3 {
  color: var(--brand-dark);
}

.post-card .excerpt {
  color: var(--text-soft);
  font-size: 15px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.badge-draft {
  font-size: 12px;
  color: var(--accent);
  background: rgba(240, 179, 100, 0.12);
  border: 1px solid rgba(240, 179, 100, 0.34);
  padding: 1px 8px;
  border-radius: 999px;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  font-size: 12.5px;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border-radius: 999px;
  padding: 3px 11px;
  transition: background 0.16s ease;
}

.tag-chip:hover {
  background: rgba(34, 211, 238, 0.16);
  color: var(--brand-dark);
}

.meta-sep {
  color: var(--border-strong);
}

.empty-state {
  text-align: center;
  padding: 72px 24px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text-soft);
}

.empty-state strong {
  display: block;
  font-size: 18px;
  color: var(--text);
  margin-bottom: 6px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 32px;
}

.pagination button {
  min-width: 38px;
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 14px;
  color: var(--text-soft);
  cursor: pointer;
}

.pagination button:hover:not(:disabled) {
  border-color: var(--border-strong);
  color: var(--text);
}

.pagination button.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
  font-weight: 600;
}

.pagination button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ============================ 侧栏 ============================ */

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: calc(var(--header-h) + 24px);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.card h3 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-bottom: 14px;
  font-weight: 620;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-cloud .tag-chip {
  font-size: 13px;
  padding: 4px 12px;
}

.tag-cloud .tag-chip .count {
  margin-left: 6px;
  opacity: 0.6;
  font-size: 11.5px;
}

.side-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.side-item {
  display: block;
  color: inherit;
}

.side-item:hover strong {
  color: var(--brand-dark);
}

.side-item strong {
  display: block;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.45;
  margin-bottom: 3px;
  transition: color 0.16s ease;
}

.side-item span {
  font-size: 12.5px;
  color: var(--text-faint);
}

.side-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.side-stats div {
  background: var(--surface-sunken);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.side-stats b {
  display: block;
  font-size: 18px;
  font-weight: 660;
}

.side-stats span {
  font-size: 12px;
  color: var(--text-faint);
}

/* ============================ 文章详情 ============================ */

.post-hero {
  max-width: 760px;
  margin: 0 auto;
  padding: 12px 0 0;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text-soft);
  margin-bottom: 24px;
}

.back-link:hover {
  color: var(--brand);
}

.post-title {
  font-size: clamp(27px, 4vw, 38px);
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-faint);
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}

.post-cover {
  width: 100%;
  border-radius: var(--radius);
  margin-bottom: 32px;
  border: 1px solid var(--border);
}

.post-body {
  font-size: 17px;
  line-height: 1.82;
  color: var(--text);
  overflow-wrap: break-word;
}

.post-body > *:first-child {
  margin-top: 0;
}

.post-body h2 {
  font-size: 24px;
  margin: 44px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.post-body h3 {
  font-size: 19.5px;
  margin: 34px 0 12px;
}

.post-body h4 {
  font-size: 17px;
  margin: 26px 0 10px;
}

.post-body p {
  margin: 0 0 18px;
}

.post-body ul,
.post-body ol {
  margin: 0 0 18px;
  padding-left: 24px;
}

.post-body li {
  margin-bottom: 8px;
}

.post-body li::marker {
  color: var(--brand);
}

.post-body a {
  border-bottom: 1px solid rgba(34, 211, 238, 0.42);
}

.post-body a:hover {
  border-bottom-color: var(--brand);
}

.post-body strong {
  font-weight: 660;
}

.post-body blockquote {
  margin: 24px 0;
  padding: 14px 20px;
  background: var(--brand-soft);
  border-left: 3px solid var(--brand);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-soft);
}

.post-body blockquote p:last-child {
  margin-bottom: 0;
}

.post-body code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1.5px 6px;
  color: #b45309;
}

.post-body pre {
  margin: 24px 0;
  padding: 18px 20px;
  background: #060b13;
  border-radius: var(--radius);
  overflow-x: auto;
  line-height: 1.65;
}

.post-body pre code {
  background: none;
  border: 0;
  padding: 0;
  color: #d3e2f5;
  font-size: 14px;
}

.post-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 15px;
  display: block;
  overflow-x: auto;
}

.post-body th,
.post-body td {
  border: 1px solid var(--border);
  padding: 10px 14px;
  text-align: left;
}

.post-body th {
  background: var(--surface-sunken);
  font-weight: 640;
}

.post-body hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 36px 0;
}

.post-body img {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin: 8px 0;
}

.post-body input[type="checkbox"] {
  margin-right: 6px;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 44px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.toc-card {
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 36px;
}

.toc-card h3 {
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 12px;
}

.toc-card ol {
  margin: 0;
  padding-left: 20px;
  font-size: 14.5px;
}

.toc-card li {
  margin-bottom: 6px;
  color: var(--text-soft);
}

.toc-card a {
  color: inherit;
}

.toc-card a:hover {
  color: var(--brand);
}

.toc-card li.level-3 {
  padding-left: 14px;
  font-size: 14px;
}

.related {
  margin-top: 56px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.related-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.related-item {
  display: block;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
  transition: border-color 0.16s ease, transform 0.16s ease;
}

.related-item:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  color: inherit;
}

.related-item strong {
  display: block;
  font-size: 15px;
  margin-bottom: 6px;
  line-height: 1.45;
}

.related-item span {
  font-size: 12.5px;
  color: var(--text-faint);
}

/* ============================ 标签页 ============================ */

.tag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

.tag-tile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: inherit;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.tag-tile:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
  color: inherit;
}

.tag-tile strong {
  font-size: 16px;
  font-weight: 620;
}

.tag-tile .num {
  font-size: 13px;
  color: var(--text-faint);
  background: var(--surface-sunken);
  border-radius: 999px;
  padding: 3px 10px;
}

.filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.filter-bar .label {
  font-size: 14px;
  color: var(--text-soft);
}

.filter-bar .clear {
  margin-left: auto;
  font-size: 13.5px;
}

/* ============================ 关于页 ============================ */

.about-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 44px 48px;
  box-shadow: var(--shadow-sm);
}

/* ============================ 登录 ============================ */

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 34px 34px 30px;
  box-shadow: var(--shadow);
}

.auth-card h1 {
  font-size: 24px;
  margin-bottom: 8px;
}

.auth-card .sub {
  color: var(--text-soft);
  font-size: 14.5px;
  margin-bottom: 24px;
}

/* ---------- 全屏登录页（未登录时整站只有这一屏） ---------- */

body.is-guest .site-header,
body.is-guest .site-footer {
  display: none;
}

body.is-guest #app {
  min-height: 100vh;
}

.login-screen {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 56px 24px 30px;
  overflow: hidden;
}

.login-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.login-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(8, 145, 178, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(8, 145, 178, 0.05) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(circle at 50% 42%, #000 8%, transparent 70%);
  mask-image: radial-gradient(circle at 50% 42%, #000 8%, transparent 70%);
}

.login-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(92px);
}

.login-glow-a {
  width: 420px;
  height: 420px;
  top: -130px;
  left: -90px;
  background: rgba(8, 145, 178, 0.12);
}

.login-glow-b {
  width: 380px;
  height: 380px;
  right: -70px;
  bottom: -150px;
  background: rgba(124, 58, 237, 0.1);
}

/* 整屏只有品牌和登录卡，单列居中 */
.login-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.login-intro {
  text-align: center;
}

.login-brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
}

.login-card {
  padding: 32px 30px 26px;
}

.login-card-head {
  margin-bottom: 22px;
  text-align: center;
}

.login-card-head h2 {
  font-size: 24px;
  margin: 0;
}

.login-alt {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-faint);
  text-align: center;
}

.link-btn {
  color: var(--brand-dark);
  border-bottom: 1px solid rgba(8, 145, 178, 0.35);
  padding-bottom: 1px;
}

.link-btn:hover {
  color: var(--brand);
  border-color: var(--brand);
}

/* ============================ 表单 ============================ */

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-soft);
  margin-bottom: 6px;
}

.field .hint {
  font-size: 12.5px;
  color: var(--text-faint);
  margin-top: 6px;
}

input[type="text"],
input[type="password"],
input[type="search"],
input[type="email"],
textarea,
select {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  font: inherit;
  font-size: 15px;
  color: var(--text);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

textarea {
  resize: vertical;
  line-height: 1.7;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-ring);
}

/* 密码框 + 显示/隐藏按钮 */
.input-wrap {
  position: relative;
}

.input-wrap input[type="password"],
.input-wrap input[type="text"] {
  padding-right: 46px;
}

.pw-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
}

.pw-toggle:hover {
  background: var(--bg-soft);
  color: var(--text);
}

.pw-toggle .pw-icon-hide {
  display: none;
}

.pw-toggle[aria-pressed="true"] .pw-icon-show {
  display: none;
}

.pw-toggle[aria-pressed="true"] .pw-icon-hide {
  display: block;
}

/* 校验没过的输入框 */
.field input.is-invalid,
.field input.is-invalid:focus {
  border-color: rgba(255, 107, 129, 0.62);
  box-shadow: 0 0 0 3px rgba(255, 107, 129, 0.13);
}

.field-opt {
  margin-left: 6px;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-faint);
}

/* 记住我 */
.auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 2px 0 18px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--text-soft);
  cursor: pointer;
  user-select: none;
}

.check-row input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--brand);
  cursor: pointer;
}

.check-row em {
  margin-left: 4px;
  font-style: normal;
  font-size: 12px;
  color: var(--text-faint);
}

.auth-row-note {
  font-size: 12px;
  color: var(--text-faint);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--brand);
  color: #ffffff;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.16s ease, transform 0.1s ease, border-color 0.16s ease;
}

.btn:hover {
  background: var(--brand-dark);
  color: #ffffff;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-block {
  width: 100%;
}

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

.btn-ghost:hover {
  background: var(--bg-soft);
  color: var(--text);
}

.btn-danger {
  background: transparent;
  border-color: rgba(255, 107, 129, 0.38);
  color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13.5px;
  border-radius: 8px;
}

.btn-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.form-error {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(255, 107, 129, 0.34);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  margin-bottom: 16px;
}

.form-note {
  font-size: 13px;
  color: var(--text-faint);
  text-align: center;
  margin-top: 18px;
}

/* ============================ 后台 ============================ */

.admin-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface-sunken);
  border-radius: 10px;
  margin-bottom: 26px;
  width: fit-content;
  flex-wrap: wrap;
}

.admin-tabs button {
  padding: 7px 16px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  font-size: 14.5px;
  color: var(--text-soft);
  cursor: pointer;
}

.admin-tabs button.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 620;
  box-shadow: var(--shadow-sm);
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: start;
}

.editor-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-bottom: 16px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.editor-toolbar .spacer {
  margin-left: auto;
}

.editor-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 6px;
}

.editor-split textarea {
  min-height: 460px;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.75;
}

.preview-pane {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  background: var(--surface);
  min-height: 460px;
  max-height: 720px;
  overflow-y: auto;
}

.preview-pane .post-body {
  font-size: 15.5px;
}

.preview-pane .post-body h2 {
  font-size: 20px;
  margin-top: 28px;
}

.preview-pane .post-body h3 {
  font-size: 17px;
  margin-top: 22px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 14.5px;
}

.admin-table th,
.admin-table td {
  padding: 13px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.admin-table th {
  background: var(--surface-sunken);
  font-size: 13px;
  font-weight: 620;
  color: var(--text-soft);
  letter-spacing: 0.02em;
}

.admin-table tr:last-child td {
  border-bottom: 0;
}

.admin-table td.title-cell strong {
  display: block;
  font-weight: 600;
  margin-bottom: 2px;
}

.admin-table td.title-cell span {
  font-size: 12.5px;
  color: var(--text-faint);
}

.attach-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}

.attach-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.attach-thumb {
  height: 118px;
  background: var(--surface-sunken);
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--text-faint);
  font-size: 12px;
}

.attach-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.attach-info {
  padding: 10px 12px;
  font-size: 12.5px;
  color: var(--text-soft);
  border-top: 1px solid var(--border);
}

.attach-info strong {
  display: block;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 3px;
  word-break: break-all;
  font-weight: 600;
}

.attach-actions {
  display: flex;
  gap: 6px;
  padding: 0 12px 12px;
}

.attach-actions button {
  flex: 1;
}

.dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 26px 20px;
  text-align: center;
  color: var(--text-soft);
  background: var(--surface-sunken);
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.dropzone:hover,
.dropzone.dragging {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.dropzone strong {
  display: block;
  color: var(--text);
  margin-bottom: 4px;
  font-size: 15px;
}

.upload-progress {
  height: 5px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
  margin-top: 12px;
}

.upload-progress i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--brand);
  transition: width 0.2s ease;
}

/* ============================ Toast ============================ */

.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
  pointer-events: none;
}

.toast {
  min-width: 220px;
  max-width: 340px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.55;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.22s ease;
}

.toast.error {
  background: #fef2f2;
  border-color: rgba(220, 38, 38, 0.28);
  color: #b91c1c;
}

.toast.success {
  background: #ecfeff;
  border-color: rgba(8, 145, 178, 0.3);
  color: #0e7490;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ============================ Skeleton / Loading ============================ */

.loading-block {
  padding: 60px 24px;
  text-align: center;
  color: var(--text-faint);
  font-size: 14.5px;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--brand);
  border-radius: 50%;
  margin: 0 auto 12px;
  animation: spin 0.7s linear infinite;
}

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

/* ============================ Footer ============================ */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  margin-top: 40px;
}

.footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 30px 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.footer-line {
  font-size: 14.5px;
  color: var(--text-soft);
}

.footer-meta {
  font-size: 13.5px;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-meta .dot {
  color: var(--border-strong);
}

/* ============================ 响应式 ============================ */

@media (max-width: 1000px) {
  .layout-main {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
  }

  .sidebar {
    position: static;
  }

  .admin-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .editor-split {
    grid-template-columns: 1fr;
  }

  .preview-pane {
    max-height: 420px;
  }
}

@media (max-width: 720px) {
  .header-inner {
    padding: 0 16px;
    gap: 12px;
  }

  .primary-nav {
    position: fixed;
    inset: var(--header-h) 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    margin: 0;
    padding: 12px 16px 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
  }

  body.nav-open .primary-nav {
    transform: none;
    opacity: 1;
    pointer-events: auto;
  }

  .primary-nav a {
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 15.5px;
  }

  .nav-toggle {
    display: grid;
  }

  .brand-text em {
    display: none;
  }

  .container {
    padding: 26px 16px 48px;
  }

  .hero {
    padding: 36px 0 30px;
    margin-bottom: 26px;
  }

  .hero-inner {
    padding: 0 16px;
  }

  .hero-meta {
    gap: 18px;
  }

  .post-card {
    padding: 20px;
    border-radius: var(--radius);
  }

  .post-card h3 {
    font-size: 19px;
  }

  .about-card {
    padding: 28px 22px;
    border-radius: var(--radius);
  }

  .post-body {
    font-size: 16.5px;
  }

  .admin-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .editor-card {
    padding: 18px;
    border-radius: var(--radius);
  }

  .toast-stack {
    left: 16px;
    right: 16px;
    bottom: 16px;
  }

  .toast {
    max-width: none;
  }

  .footer-inner {
    padding: 24px 16px;
  }
}
