/* ============================================================
   山月 · 个人博客 全站样式
   配色：纸感米白 + 墨黑正文 + 朱砂点缀；深色模式为深灰夜色
   ============================================================ */

/* ============ hidden 属性兜底 ============ */
/* HTML 的 hidden 属性等价于 display:none，但它是浏览器默认样式（优先级最低），
   会被任何类选择器上的 display 声明覆盖掉。本站多个容器自带 display:grid/flex
   （如 .category-grid、.tag-cloud），若不强制，设置 hidden 后元素仍会占位，
   表现为「点了筛选却像只刷新了页面」。这里统一兜底。 */
[hidden] { display: none !important; }

/* ============ 设计变量 ============ */
:root {
  --bg: #faf8f3;
  --bg-soft: #f1ede2;
  --text: #29261f;
  --text-soft: #6f6a5d;
  --text-faint: #9b9585;
  --accent: #b5543a;
  --accent-deep: #96422d;
  --accent-soft: rgba(181, 84, 58, 0.08);
  --border: #e6e1d2;
  --pre-bg: #2b2823;
  --code-bg: #efeade;
  --card-hover-shadow: 0 10px 30px rgba(41, 38, 31, 0.07);
  --font-serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", Georgia, serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Code", Consolas, "SF Mono", Menlo, monospace;
}
[data-theme="dark"] {
  --bg: #1b1d21;
  --bg-soft: #23262b;
  --text: #d9d5ca;
  --text-soft: #a29d91;
  --text-faint: #6e6a60;
  --accent: #d98d6f;
  --accent-deep: #e2a288;
  --accent-soft: rgba(217, 141, 111, 0.10);
  --border: #33363c;
  --pre-bg: #14161a;
  --code-bg: #26292f;
  --card-hover-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

/* ============ 基础 ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color 0.35s ease, color 0.35s ease;
  animation: page-in 0.6s ease both;
}
@keyframes page-in { from { opacity: 0; } to { opacity: 1; } }
::selection { background: var(--accent); color: #faf8f3; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; background: none; border: none; color: inherit; }
.container { max-width: 720px; margin: 0 auto; padding: 0 24px; }

/* ============ 头部 ============ */
.site-header { padding: 30px 0 26px; }
.header-inner { display: flex; align-items: center; gap: 32px; }
.site-title { display: flex; align-items: center; gap: 10px; font-family: var(--font-serif); font-size: 1.22rem; font-weight: 700; letter-spacing: 0.06em; white-space: nowrap; flex: none; }
.site-title .seal {
  width: 27px; height: 27px; border-radius: 7px;
  background: var(--accent); color: #faf8f3;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.9rem; font-weight: 600;
  transition: background-color 0.35s ease;
}
.main-nav { display: flex; gap: 26px; margin-left: auto; }
.main-nav a { font-size: 0.92rem; color: var(--text-soft); transition: color 0.2s; position: relative; white-space: nowrap; }
.main-nav a:hover { color: var(--accent); }
.main-nav a.active { color: var(--accent); }
.main-nav a.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -6px;
  height: 2px; border-radius: 2px; background: var(--accent);
}
.theme-toggle {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-soft);
  transition: color 0.2s, border-color 0.2s, transform 0.2s;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); transform: rotate(15deg); }
.theme-toggle svg { width: 16px; height: 16px; }
.icon-moon { display: none; }
[data-theme="dark"] .icon-moon { display: block; }
[data-theme="dark"] .icon-sun { display: none; }

/* ============ 首页 · 站点介绍 ============ */
.hero { padding: 76px 0 60px; }
.hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(2.1rem, 6vw, 2.9rem);
  font-weight: 700; line-height: 1.4; letter-spacing: 0.02em;
}
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p { margin-top: 18px; color: var(--text-soft); font-size: 1.05rem; max-width: 34em; }

/* ============ 搜索、重点入口与文章列表 ============ */
.home-tools { padding: 0 0 34px; }
.search-form { display: flex; gap: 10px; align-items: center; }
.search-form label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.search-form input { flex: 1; min-width: 0; padding: 11px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-soft); color: var(--text); font: inherit; }
.search-form button { padding: 10px 18px; border-radius: 8px; background: var(--accent); color: #fff; }
.home-entrances { display: flex; gap: 18px; margin-top: 16px; color: var(--accent); font-size: .9rem; }
.featured-section { padding-bottom: 34px; }
.featured-section .post-item { padding-top: 18px; padding-bottom: 18px; }
/* ============ 首页 / 标签过滤 · 文章列表 ============ */
.section-title {
  display: flex; align-items: center; gap: 16px;
  font-family: var(--font-serif); font-size: 1.05rem; font-weight: 600;
  letter-spacing: 0.18em; color: var(--text);
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.post-list { padding-bottom: 72px; }
.post-item { display: block; padding: 30px 18px; margin: 0 -18px; border-radius: 12px; border-top: 1px solid var(--border); transition: background-color 0.25s ease; }
.post-item:first-child { border-top: none; }
.post-item:hover { background: var(--accent-soft); }
.post-meta { display: flex; align-items: center; font-size: 0.82rem; color: var(--text-faint); }
.post-meta time { font-family: var(--font-mono); letter-spacing: 0.04em; }
.post-tags { display: flex; gap: 8px; margin-left: auto; }
.tag-pill {
  font-size: 0.75rem; color: var(--text-soft);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 1px 11px;
  transition: color 0.2s, border-color 0.2s;
  cursor: pointer;
}
.post-item:hover .tag-pill, .archive-item:hover .tag-pill { border-color: var(--accent); color: var(--accent); }
.post-title {
  margin-top: 10px;
  font-family: var(--font-serif); font-size: 1.38rem; font-weight: 600; line-height: 1.5;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-repeat: no-repeat; background-size: 0% 1.5px; background-position: 0 100%;
  transition: color 0.25s, background-size 0.35s ease;
  width: fit-content;
}
.post-item:hover .post-title { color: var(--accent); background-size: 100% 1.5px; }
.post-excerpt { margin-top: 8px; color: var(--text-soft); font-size: 0.95rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ============ 文章页 ============ */
.post-view { padding-top: 26px; }
.post-header { padding: 26px 0 36px; border-bottom: 1px solid var(--border); }
.post-header .post-meta { font-size: 0.85rem; }
.post-header h1 {
  margin-top: 14px;
  font-family: var(--font-serif);
  font-size: clamp(1.7rem, 4.6vw, 2.25rem);
  font-weight: 700; line-height: 1.45; letter-spacing: 0.01em;
}
.post-header .post-info { margin-top: 14px; font-size: 0.85rem; color: var(--text-faint); }

/* —— Markdown 渲染区排版 —— */
.markdown { padding: 40px 0 24px; }
.markdown p { margin: 1.3em 0; }
.markdown h2 {
  margin: 2.4em 0 1em;
  font-family: var(--font-serif); font-size: 1.42rem; font-weight: 600; line-height: 1.5;
  display: flex; align-items: center; gap: 11px;
}
.markdown h2::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--accent); flex: none; }
.markdown h3 { margin: 2em 0 0.9em; font-family: var(--font-serif); font-size: 1.15rem; font-weight: 600; }
.markdown h4 { margin: 1.8em 0 0.8em; font-weight: 600; }
.markdown strong { font-weight: 600; }
.markdown em { font-style: normal; border-bottom: 2px solid var(--accent-soft); }
.markdown a {
  color: var(--accent);
  background-image: linear-gradient(var(--accent-soft), var(--accent-soft));
  background-repeat: no-repeat; background-size: 100% 1px; background-position: 0 100%;
  padding-bottom: 1px;
  transition: background-size 0.3s ease;
}
.markdown a:hover { background-size: 100% 100%; }
.markdown img { max-width: 100%; border-radius: 12px; display: block; margin: 1.5em auto; }
.markdown ul, .markdown ol { margin: 1.2em 0; padding-left: 1.5em; }
.markdown li { margin: 0.5em 0; }
.markdown li::marker { color: var(--accent); }
.markdown blockquote {
  margin: 1.8em 0; padding: 14px 20px;
  border-left: 3px solid var(--accent); border-radius: 0 10px 10px 0;
  background: var(--bg-soft); color: var(--text-soft);
  font-family: var(--font-serif);
}
.markdown blockquote p { margin: 0.3em 0; }
.markdown code.inline, .markdown :not(pre) > code {
  font-family: var(--font-mono); font-size: 0.86em;
  background: var(--code-bg); color: var(--accent-deep);
  padding: 2px 7px; border-radius: 5px;
}
.markdown pre {
  margin: 1.8em 0; padding: 20px 22px;
  background: var(--pre-bg); border-radius: 12px;
  overflow-x: auto; line-height: 1.75;
  box-shadow: var(--card-hover-shadow);
}
.markdown pre code { font-family: var(--font-mono); font-size: 0.86rem; color: #d6d2c8; background: none; padding: 0; }

/* —— Mermaid 流程图 —— */
.mermaid-diagram {
  margin: 2em 0;
  display: flex;
  justify-content: center;
  overflow-x: auto;
  padding: 8px 0;
}
.mermaid-diagram svg { max-width: 100%; height: auto; }
.mermaid-diagram { min-width: 0; }
.mermaid-diagram svg { min-width: 100%; }

/* —— highlight.js 主题（跟随站点纸感配色，明暗通用，代码块底色始终为深色） —— */
.hljs-comment, .hljs-quote { color: #87806f; font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-section, .hljs-doctag, .hljs-name, .hljs-meta { color: #d98d6f; }
.hljs-string, .hljs-regexp, .hljs-addition, .hljs-attribute, .hljs-meta .hljs-string { color: #a4b87c; }
.hljs-number, .hljs-symbol, .hljs-bullet, .hljs-link, .hljs-selector-attr, .hljs-selector-pseudo { color: #8ab4c8; }
.hljs-title, .hljs-title.function_, .hljs-built_in, .hljs-builtin-name, .hljs-selector-id, .hljs-selector-class { color: #e0b589; }
.hljs-attr, .hljs-variable, .hljs-template-variable, .hljs-type, .hljs-property, .hljs-params, .hljs-title.class_ { color: #c9a26d; }
.hljs-tag { color: #d6d2c8; }
.hljs-deletion { color: #d98d6f; }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 600; }

.markdown table { width: 100%; margin: 1.8em 0; border-collapse: collapse; font-size: 0.92rem; }
.markdown th, .markdown td { padding: 10px 14px; border: 1px solid var(--border); text-align: left; }
.markdown th { font-family: var(--font-serif); font-weight: 600; background: var(--bg-soft); white-space: nowrap; }
.markdown tr:nth-child(even) td { background: var(--accent-soft); }
.markdown hr { border: none; margin: 2.6em auto; width: 88px; height: 1px; background: var(--border); position: relative; }
.markdown hr::after {
  content: "❋"; position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg); padding: 0 12px; color: var(--text-faint); font-size: 0.8rem;
}

/* —— 上一篇 / 下一篇 —— */
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 44px 0 72px; }
.post-nav a {
  border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px;
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s;
}
.post-nav a:hover { border-color: var(--accent); box-shadow: var(--card-hover-shadow); transform: translateY(-2px); }
.post-nav .nav-label { font-size: 0.78rem; color: var(--text-faint); }
.post-nav .nav-title { margin-top: 6px; font-family: var(--font-serif); font-size: 0.98rem; font-weight: 600; line-height: 1.5; }
.post-nav a:hover .nav-title { color: var(--accent); }
.post-nav a.next { text-align: right; }
.post-nav-empty { border: 1px dashed transparent; padding: 16px 18px; }

.related-section { padding-bottom: 72px; }
.related-section .post-item { padding-top: 18px; padding-bottom: 18px; }
.back-to-top { position: fixed; right: 22px; bottom: 24px; width: 40px; height: 40px; border: 1px solid var(--border); border-radius: 50%; background: var(--bg-soft); color: var(--accent); opacity: 0; pointer-events: none; transition: opacity .2s; }
.back-to-top.visible { opacity: 1; pointer-events: auto; }
/* ============ 内页公共标题（归档 / 标签） ============ */
.page-header { padding: 30px 0 8px; }
.page-title {
  font-family: var(--font-serif); font-size: clamp(1.55rem, 4vw, 1.95rem);
  font-weight: 700; letter-spacing: 0.05em;
  display: flex; align-items: baseline; gap: 14px;
}
.page-title .count { font-family: var(--font-sans); font-size: 0.85rem; font-weight: 400; color: var(--text-faint); letter-spacing: 0.02em; }
.page-sub { font-family: var(--font-sans); font-size: 0.9rem; font-weight: 400; color: var(--text-soft); margin: 8px 0 0; line-height: 1.7; }

/* ============ 分类专栏（categories.html） ============ */
.category-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px; padding: 40px 0 72px;
}
.category-card {
  display: flex; flex-direction: column; gap: 8px;
  padding: 22px 24px; border: 1px solid var(--border);
  background: var(--bg-soft); text-decoration: none;
  transition: border-color .18s ease, transform .18s ease;
}
.category-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.category-name {
  font-family: var(--font-serif); font-size: 1.18rem; font-weight: 600;
  color: var(--text); margin: 0; letter-spacing: 0.04em;
}
.category-count { font-family: var(--font-sans); font-size: 0.78rem; font-weight: 400; color: var(--text-faint); }

/* 文章卡片上的专栏标记：与 .tag-pill 同风格（圆角描边），但用朱砂色区分层级。
   用 <span> 承载（不能是 <a>：卡片本身就是锚点，锚点不可嵌套），
   故需自己声明 cursor 与 line-height，避免被卡片锚点的行高影响。 */
.category-pill {
  font-family: var(--font-sans); font-size: 0.75rem;
  color: var(--accent); background: var(--accent-soft);
  border: 1px solid transparent; border-radius: 999px;
  padding: 1px 11px; white-space: nowrap; cursor: pointer;
  transition: border-color 0.2s;
}
.category-pill:hover { border-color: var(--accent); }
/* 专栏标记自己 hover 时不要被 .post-item:hover 的规则染色，保持层次 */
.post-item:hover .category-pill { color: var(--accent); border-color: transparent; }
.post-item:hover .category-pill:hover { border-color: var(--accent); }

/* ============ 归档页 ============ */
.archive-wrap { padding-bottom: 72px; }
.year-group { margin-top: 40px; }
.year-head { display: flex; align-items: baseline; gap: 14px; }
.year-head h2 { font-family: var(--font-serif); font-size: 1.45rem; font-weight: 700; }
.year-head .year-count { font-size: 0.8rem; color: var(--text-faint); }
.year-head::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.archive-list { list-style: none; margin-top: 6px; }
.archive-item {
  display: flex; align-items: center; gap: 18px;
  padding: 11px 12px; margin: 0 -12px; border-radius: 8px;
  transition: background-color 0.2s ease;
}
.archive-item:hover { background: var(--accent-soft); }
.archive-item time { font-family: var(--font-mono); font-size: 0.82rem; color: var(--text-faint); flex: none; width: 46px; }
.archive-item .a-title { font-family: var(--font-serif); font-size: 1.02rem; font-weight: 600; min-width: 0; transition: color 0.2s; }
.archive-item:hover .a-title { color: var(--accent); }
.archive-item .post-tags { margin-left: auto; flex: none; }

/* ============ 标签页 ============ */
.tag-cloud { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 14px; padding: 48px 0 72px; }
.cloud-pill {
  font-family: var(--font-serif); font-size: 1rem; font-weight: 600;
  color: var(--text-soft);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 5px 20px;
  transition: color 0.2s, border-color 0.2s, background-color 0.2s;
}
.cloud-pill[data-size="md"] { font-size: 1.1rem; padding: 6px 22px; }
.cloud-pill[data-size="lg"] { font-size: 1.22rem; padding: 8px 26px; }
.cloud-pill sup { font-family: var(--font-sans); font-size: 0.68rem; font-weight: 400; color: var(--text-faint); margin-left: 4px; }
.cloud-pill:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.tag-filter-head { display: flex; align-items: center; gap: 12px; padding: 14px 0 24px; }
.tag-filter-head .tf-title { font-family: var(--font-serif); font-size: 1.18rem; font-weight: 600; }
.tag-filter-head .tf-count { font-size: 0.85rem; color: var(--text-faint); }
.tf-clear {
  margin-left: auto; font-size: 0.83rem; color: var(--text-faint);
  border: 1px solid var(--border); border-radius: 999px; padding: 3px 15px;
  transition: color 0.2s, border-color 0.2s;
}
.tf-clear:hover { color: var(--accent); border-color: var(--accent); }

/* ============ 关于页 ============ */
.about-wrap { padding-bottom: 72px; }
.about-header { display: flex; align-items: center; gap: 26px; padding: 44px 0 36px; border-bottom: 1px solid var(--border); }
.avatar {
  width: 86px; height: 86px; border-radius: 24px; flex: none;
  background: linear-gradient(135deg, var(--bg-soft), var(--accent-soft));
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-serif); font-size: 2.3rem; font-weight: 700; color: var(--accent);
}
.about-intro h1 { font-family: var(--font-serif); font-size: 1.9rem; font-weight: 700; }
.about-bio { margin-top: 2px; color: var(--text-soft); }
.about-links { margin-top: 12px; display: flex; gap: 20px; font-size: 0.9rem; }
.about-links a { color: var(--text-faint); transition: color 0.2s; }
.about-links a:hover { color: var(--accent); }

/* ============ 文章目录（TOC） ============ */
.markdown h2, .markdown h3 { scroll-margin-top: 24px; }

/* 宽屏：右侧悬浮目录 */
.toc-sidebar {
  position: fixed;
  top: 132px;
  left: calc(50% + 398px);
  width: 200px;
  max-height: calc(100vh - 170px);
  overflow-y: auto;
  border-left: 1px solid var(--border);
  padding-left: 18px;
  display: none;
  scrollbar-width: thin;
}
.toc-sidebar .toc-title {
  font-family: var(--font-serif);
  font-size: 0.85rem;
  letter-spacing: 0.22em;
  color: var(--text-faint);
  margin-bottom: 10px;
}
.toc-item {
  display: block;
  font-size: 0.85rem;
  color: var(--text-soft);
  padding: 4px 0 4px 10px;
  line-height: 1.5;
  border-left: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.toc-item.toc-h3 { padding-left: 24px; font-size: 0.8rem; }
.toc-item:hover { color: var(--accent); }
.toc-item.active { color: var(--accent); border-left-color: var(--accent); }

/* 窄屏：文章头部下方的可折叠目录 */
.toc-mobile {
  margin: 22px 0 4px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-soft);
}
.toc-mobile summary {
  cursor: pointer;
  list-style: none;
  padding: 12px 18px;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 9px;
  user-select: none;
}
.toc-mobile summary::before { content: "☰"; font-size: 0.8rem; color: var(--accent); }
.toc-mobile summary::-webkit-details-marker { display: none; }
.toc-mobile nav { padding: 2px 18px 14px; }
.toc-mobile .toc-item { padding: 3px 0 3px 10px; }

@media (min-width: 1250px) {
  .toc-sidebar { display: block; }
  .toc-mobile { display: none; }
}

/* ============ 加载 / 错误 / 空状态 ============ */
.state-notice {
  padding: 80px 20px; text-align: center;
  color: var(--text-faint); font-size: 0.95rem;
}
.state-notice.error { color: var(--text-soft); }
.state-notice a { color: var(--accent); border-bottom: 1px solid var(--accent-soft); padding-bottom: 1px; }
.state-notice a:hover { border-color: var(--accent); }

/* ============ 页脚 ============ */
.site-footer { border-top: 1px solid var(--border); padding: 44px 0 64px; text-align: center; }
.site-footer p { font-size: 0.85rem; color: var(--text-faint); }
.site-footer p + p { margin-top: 6px; }
.site-footer .hint { font-size: 0.78rem; opacity: 0.75; }
.site-footer a { color: var(--text-faint); border-bottom: 1px solid var(--border); transition: color 0.2s, border-color 0.2s; }
.site-footer a:hover { color: var(--accent); border-color: var(--accent); }

/* ============ 移动端适配 ============ */
@media (max-width: 640px) {
  .site-header { padding: 20px 0 16px; }
  .header-inner { flex-wrap: wrap; gap: 12px 10px; }
  .site-title { font-size: 1.08rem; gap: 8px; }
  .main-nav {
    order: 3; width: 100%; margin-left: 0;
    gap: 18px; padding-top: 10px;
    border-top: 1px solid var(--border);
  }
  .main-nav a { font-size: 0.88rem; }
  .main-nav a.active::after { bottom: -4px; }
  .theme-toggle { width: 30px; height: 30px; flex: none; margin-left: auto; }
  .hero { padding: 52px 0 42px; }
  .post-item { padding: 24px 14px; margin: 0 -14px; }
  .post-meta { flex-wrap: wrap; gap: 8px; }
  .post-tags { margin-left: 0; width: 100%; }
  .archive-item .post-tags { display: none; }
  .archive-item { gap: 14px; }
  .about-header { flex-direction: column; align-items: flex-start; gap: 18px; padding: 34px 0 28px; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav a.next { text-align: left; }
  .markdown pre, .markdown table { max-width: 100%; overflow-x: auto; display: block; }
  .markdown img, .mermaid-diagram { max-width: 100%; overflow-x: auto; }
  .home-entrances { flex-wrap: wrap; }
  .site-footer { padding-bottom: 96px; }
}

/* 公安联网备案图标（页脚） */
.site-footer .beian-icon { height: 14px; width: 14px; vertical-align: -2px; margin-right: 4px; }

/* ============ 账户登录与顶栏状态 ============ */
.theme-toggle-right { margin-left: auto; }
.auth-user-bar {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.82rem; color: var(--text-soft); flex: none;
}
.auth-user-name {
  max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--text-soft);
}
.logout-btn {
  font-size: 0.78rem; color: var(--text-faint);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 2px 10px;
  transition: color 0.2s, border-color 0.2s, background-color 0.2s;
}
.logout-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

.login-wrap {
  padding: 56px 24px 96px;
  display: flex; justify-content: center;
}
.login-card {
  width: 100%; max-width: 420px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 32px 34px;
  box-shadow: var(--card-hover-shadow);
}
.login-head { text-align: center; }
.login-seal {
  width: 48px; height: 48px; margin: 0 auto 14px;
  border-radius: 12px; background: var(--accent); color: #faf8f3;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-serif); font-size: 1.45rem; font-weight: 700;
}
.login-head h1 {
  font-family: var(--font-serif); font-size: 1.6rem; font-weight: 700; letter-spacing: 0.04em;
}
.login-sub { margin-top: 8px; font-size: 0.88rem; color: var(--text-soft); }
.auth-tabs {
  margin-top: 22px; padding: 4px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
}
.auth-tabs[hidden], .login-field[hidden] { display: none; }
.auth-tab {
  padding: 7px 12px; border-radius: 7px;
  font-size: 0.9rem; font-weight: 500; color: var(--text-soft);
  transition: color 0.2s, background-color 0.2s;
}
.auth-tab:hover { color: var(--text); }
.auth-tab.active {
  background: var(--accent); color: #faf8f3; font-weight: 600;
}
.login-form { margin-top: 22px; display: flex; flex-direction: column; gap: 15px; }
.login-form[hidden], .login-signed-in[hidden], .login-error[hidden] { display: none; }
.login-field { display: flex; flex-direction: column; gap: 6px; }
.login-field label { font-size: 0.85rem; color: var(--text-soft); }
.login-field input {
  width: 100%; padding: 11px 14px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg); color: var(--text); font: inherit; font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.login-field input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.login-error {
  font-size: 0.85rem; color: var(--accent);
  background: var(--accent-soft); border: 1px solid var(--accent);
  border-radius: 8px; padding: 8px 12px;
}
.login-submit {
  display: inline-flex; align-items: center; justify-content: center;
  width: 100%; padding: 11px 18px; margin-top: 4px;
  border-radius: 10px; background: var(--accent); color: #faf8f3;
  font-size: 0.95rem; font-weight: 600; letter-spacing: 0.06em;
  transition: background-color 0.2s, opacity 0.2s;
}
.login-submit:hover { background: var(--accent-deep); }
.login-submit:disabled { opacity: 0.65; cursor: not-allowed; }
.login-signed-in { margin-top: 28px; text-align: center; font-size: 0.95rem; color: var(--text-soft); }
.login-signed-in strong { color: var(--text); font-family: var(--font-serif); }
.login-actions { margin-top: 20px; display: flex; flex-direction: column; gap: 10px; }
.login-secondary {
  width: 100%; padding: 10px 18px;
  border: 1px solid var(--border); border-radius: 10px;
  color: var(--text-soft); font-size: 0.9rem;
  transition: color 0.2s, border-color 0.2s;
}
.login-secondary:hover { color: var(--accent); border-color: var(--accent); }

@media (max-width: 640px) {
  .auth-user-bar { gap: 6px; }
  .auth-user-name { max-width: 76px; font-size: 0.78rem; }
  .logout-btn { padding: 2px 9px; font-size: 0.75rem; white-space: nowrap; }
  .login-wrap { padding: 36px 18px 72px; }
  .login-card { padding: 28px 22px; }
}
