/* ============================================================================
   个人网站样式 —— 单文件、无外部依赖、深色主题
   ========================================================================== */

:root {
  --bg: #0a0e16;
  --bg-alt: #0e1421;
  --surface: #131b2b;
  --surface-2: #182136;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #e8eefb;
  --text-dim: #a7b4cc;
  --muted: #7c8aa5;
  --accent: #5b8cff;
  --accent-2: #2ee6c5;
  --accent-soft: rgba(91, 140, 255, 0.14);
  --danger: #ff6b81;
  --ok: #35d39a;
  --warn: #f5b544;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 18px 40px -24px rgba(0, 0, 0, 0.9);
  --wrap: 1100px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC",
          "PingFang SC", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "Cascadia Code", Consolas,
          "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

/* 关键兜底：作者样式里的 display（如 .login-wrap{display:grid}）会盖掉
   浏览器默认的 [hidden]{display:none}，导致 hidden 元素照样渲染。
   后台登录页与控制台同屏出现就是这个原因。 */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; scroll-padding-top: 84px; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(1100px 520px at 12% -8%, rgba(91, 140, 255, 0.16), transparent 60%),
    radial-gradient(900px 480px at 92% 4%, rgba(46, 230, 197, 0.10), transparent 62%);
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 0.6em; font-weight: 650; letter-spacing: -0.01em; }
p { margin: 0 0 1em; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button, input, textarea, select { font: inherit; color: inherit; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 22px; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.dot-sep { color: var(--muted); margin: 0 0.45em; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ------------------------------- 顶部导航 ------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px);
  background: rgba(10, 14, 22, 0.72);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s, background 0.25s;
}
.site-header.is-stuck { border-bottom-color: var(--border); background: rgba(10, 14, 22, 0.92); }

.header-inner { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 16px; }

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 650; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #08111f; font-weight: 800; font-size: 15px;
}

.nav { display: flex; align-items: center; gap: 4px; }
.nav a {
  color: var(--text-dim); padding: 8px 13px; border-radius: 999px; font-size: 14.5px;
  transition: color 0.2s, background 0.2s;
}
.nav a:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); text-decoration: none; }
.nav a.is-active { color: var(--text); background: var(--accent-soft); }
.nav-cta { border: 1px solid var(--border-strong); color: var(--text) !important; }

.nav-toggle {
  display: none; width: 40px; height: 40px; border-radius: 10px;
  background: transparent; border: 1px solid var(--border); cursor: pointer;
  padding: 10px; flex-direction: column; justify-content: space-between;
}
.nav-toggle span { display: block; height: 2px; background: var(--text-dim); border-radius: 2px; }

/* --------------------------------- 首屏 --------------------------------- */
.hero { padding: 72px 0 56px; }
.hero-inner { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 48px; align-items: center; }

.pill {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--accent-2);
  background: rgba(46, 230, 197, 0.09);
  border: 1px solid rgba(46, 230, 197, 0.24);
  padding: 5px 13px; border-radius: 999px; margin: 0 0 20px;
}
.pill::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent-2); box-shadow: 0 0 0 3px rgba(46, 230, 197, 0.18);
}

.hero h1 { font-size: clamp(30px, 5.2vw, 52px); margin-bottom: 14px; }
.hero-hi { display: block; font-size: 0.5em; font-weight: 500; color: var(--muted); letter-spacing: 0.02em; margin-bottom: 6px; }
.hero-name {
  background: linear-gradient(100deg, #ffffff 8%, var(--accent) 52%, var(--accent-2) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-title { font-size: 17px; color: var(--text-dim); margin-bottom: 16px; }
.hero-summary { font-size: 17px; color: var(--text-dim); max-width: 56ch; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 26px 0 22px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: 11px; border: 1px solid transparent;
  font-size: 15px; font-weight: 560; cursor: pointer; text-align: center;
  transition: transform 0.15s, background 0.2s, border-color 0.2s, opacity 0.2s;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-primary { background: linear-gradient(135deg, var(--accent), #4a6fe0); color: #fff; box-shadow: 0 10px 24px -14px rgba(91, 140, 255, 0.95); }
.btn-ghost { background: rgba(255, 255, 255, 0.04); border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.08); }
.btn-mini { padding: 6px 12px; font-size: 13px; border-radius: 8px; background: rgba(255, 255, 255, 0.06); border-color: var(--border); }
.btn-danger { background: rgba(255, 107, 129, 0.12); border-color: rgba(255, 107, 129, 0.35); color: #ffb3be; }
.btn-danger:hover { background: rgba(255, 107, 129, 0.2); }

.contact-row { display: flex; flex-wrap: wrap; gap: 9px; }
.contact-row a, .contact-row span.chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13.5px; color: var(--text-dim);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  padding: 6px 13px; border-radius: 999px;
}
.contact-row a:hover { color: var(--text); border-color: var(--border-strong); text-decoration: none; }
.contact-row .chip-label { color: var(--muted); }

.hero-card {
  background: linear-gradient(180deg, var(--surface), rgba(19, 27, 43, 0.6));
  border: 1px solid var(--border); border-radius: 22px;
  padding: 28px 24px; box-shadow: var(--shadow); text-align: center;
}
.avatar-ring {
  width: 148px; height: 148px; margin: 0 auto 18px; border-radius: 50%; padding: 4px;
  background: conic-gradient(from 140deg, var(--accent), var(--accent-2), var(--accent));
}
.avatar { width: 100%; height: 100%; border-radius: 50%; background: var(--surface-2); }
.hero-card-loc { color: var(--text-dim); font-size: 14px; margin-bottom: 18px; }

.fact-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; text-align: left; }
.fact-list.is-single { grid-template-columns: 1fr; }
.fact-list > div { background: rgba(255, 255, 255, 0.035); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; }
.fact-list dt { font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.fact-list dd { margin: 0; font-size: 17px; font-weight: 640; }

/* --------------------------------- 区块 --------------------------------- */
.section { padding: 76px 0; }
.section-alt { background: linear-gradient(180deg, rgba(255, 255, 255, 0.018), transparent 70%); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-head { max-width: 62ch; margin-bottom: 38px; }
.eyebrow { font-size: 12.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); font-weight: 640; margin-bottom: 10px; }
.section-head h2 { font-size: clamp(24px, 3.2vw, 34px); margin-bottom: 10px; }
.section-sub { color: var(--text-dim); font-size: 16px; margin: 0; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.panel h3 { font-size: 16px; margin-bottom: 16px; }

.about-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 34px; align-items: start; }
.prose p { color: var(--text-dim); font-size: 16.5px; }
.prose p:last-child { margin-bottom: 0; }

.kv li { display: flex; justify-content: space-between; gap: 14px; padding: 11px 0; border-bottom: 1px dashed var(--border); font-size: 14.5px; }
.kv li:last-child { border-bottom: 0; padding-bottom: 0; }
.kv .k { color: var(--muted); }
.kv .v { text-align: right; font-weight: 560; }

/* --------------------------------- 技能 --------------------------------- */
.skill-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(238px, 1fr)); gap: 16px; }
.skill-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; transition: border-color 0.2s, transform 0.2s; }
.skill-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.skill-card h3 { font-size: 14px; color: var(--accent-2); letter-spacing: 0.02em; margin-bottom: 14px; }
.tags { display: flex; flex-wrap: wrap; gap: 7px; }
.tag { font-size: 13px; color: var(--text-dim); background: rgba(255, 255, 255, 0.045); border: 1px solid var(--border); padding: 4px 10px; border-radius: 7px; }

/* --------------------------------- 经历 --------------------------------- */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(180deg, var(--accent), transparent); }
.timeline li { position: relative; padding: 0 0 30px 12px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: ""; position: absolute; left: -26px; top: 8px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--bg); border: 2px solid var(--accent);
}
.tl-period { font-size: 13px; color: var(--accent); font-weight: 600; letter-spacing: 0.02em; }
.tl-role { font-size: 18px; font-weight: 620; margin: 5px 0 2px; }
.tl-company { color: var(--muted); font-size: 14.5px; margin-bottom: 12px; }
.tl-points li { position: relative; padding-left: 18px; color: var(--text-dim); font-size: 15.5px; margin-bottom: 6px; }
.tl-points li::before { content: "▹"; position: absolute; left: 0; color: var(--accent); }

/* --------------------------------- 项目 --------------------------------- */
.project-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.project-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s; }
.project-card:hover { border-color: rgba(91, 140, 255, 0.4); transform: translateY(-3px); box-shadow: var(--shadow); }
.project-card h3 { font-size: 18px; margin-bottom: 10px; }
.project-card p { color: var(--text-dim); font-size: 15px; }
.project-highlight { font-size: 13.5px; color: var(--accent-2); background: rgba(46, 230, 197, 0.08); border-left: 3px solid var(--accent-2); padding: 7px 12px; border-radius: 0 8px 8px 0; margin: 0 0 16px; }
.project-card .tags { margin-bottom: 18px; }
.project-links { margin-top: auto; display: flex; flex-wrap: wrap; gap: 14px; font-size: 14px; font-weight: 550; }

/* --------------------------------- 代码 --------------------------------- */
.code-shell { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.code-tabs { display: flex; gap: 4px; padding: 10px 12px 0; overflow-x: auto; border-bottom: 1px solid var(--border); background: rgba(0, 0, 0, 0.16); }
.code-tab {
  flex: 0 0 auto; background: transparent; border: 0; border-bottom: 2px solid transparent;
  color: var(--muted); padding: 10px 14px; font-size: 14px; cursor: pointer; white-space: nowrap;
  border-radius: 8px 8px 0 0; transition: color 0.2s, background 0.2s;
}
.code-tab:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.code-tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); background: rgba(91, 140, 255, 0.09); }

.code-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 20px 0; }
.code-meta { display: flex; align-items: center; gap: 10px; }
.code-meta strong { font-size: 16.5px; }
.lang-badge { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); background: var(--accent-soft); border: 1px solid rgba(91, 140, 255, 0.28); padding: 3px 9px; border-radius: 999px; }
.code-actions { display: flex; align-items: center; gap: 12px; }
.code-file { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.code-desc { padding: 10px 20px 16px; margin: 0; color: var(--text-dim); font-size: 14.5px; border-bottom: 1px solid var(--border); }

.code-body { display: flex; background: #080c14; max-height: 560px; overflow: auto; }
.gutter {
  flex: 0 0 auto; padding: 16px 12px 16px 18px; text-align: right;
  font-family: var(--mono); font-size: 13px; line-height: 1.68;
  color: #3d4a63; background: rgba(255, 255, 255, 0.017);
  border-right: 1px solid var(--border); white-space: pre; user-select: none;
}
.code-pre { margin: 0; padding: 16px 20px; overflow: visible; flex: 1 1 auto; }
.code-pre code { font-family: var(--mono); font-size: 13px; line-height: 1.68; white-space: pre; color: #c7d3e8; }

.tok-comment { color: #5d6b85; font-style: italic; }
.tok-string { color: #8fd694; }
.tok-keyword { color: #ff8fc7; }
.tok-literal { color: #ffb86b; }
.tok-number { color: #ffb86b; }
.tok-function { color: #7ab8ff; }
.tok-property { color: #9fd0ff; }
.tok-operator { color: #8c9ab5; }
.tok-punctuation { color: #8c9ab5; }
.tok-builtin { color: #6fe3d0; }
.tok-decorator { color: #ffd479; }
.tok-key { color: #7ab8ff; }
.tok-tag { color: #ff8fc7; }
.tok-attr { color: #ffd479; }
.tok-variable { color: #ffb86b; }
.tok-regex { color: #6fe3d0; }
.tok-atrule { color: #ff8fc7; }
.tok-color { color: #ffb86b; }
.tok-doctype { color: #5d6b85; }

/* -------------------------------- 投递表单 ------------------------------- */
.upload-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { margin-bottom: 16px; display: flex; flex-direction: column; gap: 7px; }
.field label { font-size: 13.5px; color: var(--text-dim); font-weight: 550; }
.req { color: var(--danger); }
.field input, .field textarea, .admin-input, .admin-select {
  width: 100%; background: rgba(0, 0, 0, 0.26); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 13px; font-size: 15px; outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field input:focus, .field textarea:focus, .admin-input:focus, .admin-select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.field textarea { resize: vertical; min-height: 84px; }
.field input::placeholder, .field textarea::placeholder { color: #5f6c85; }

.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius);
  padding: 30px 20px; text-align: center; cursor: pointer;
  transition: border-color 0.2s, background 0.2s; background: rgba(255, 255, 255, 0.015);
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--accent); background: var(--accent-soft); outline: none; }
.dropzone.is-over { border-color: var(--accent-2); background: rgba(46, 230, 197, 0.09); }
.dz-icon { width: 34px; height: 34px; color: var(--accent); margin: 0 auto 10px; }
.dz-title { margin: 0 0 6px; font-size: 15.5px; }
.dz-title strong { color: var(--accent); }
.dz-hint { margin: 0; font-size: 13px; color: var(--muted); }

.file-list { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.file-list li {
  display: flex; align-items: center; gap: 12px; font-size: 14px;
  background: rgba(255, 255, 255, 0.035); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 9px 13px;
}
.file-list .fname { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list .fsize { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.file-list .fdel { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1; padding: 0 2px; }
.file-list .fdel:hover { color: var(--danger); }
.file-list .file-bad { color: var(--danger); font-size: 12.5px; }

.upload-foot { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 20px; flex-wrap: wrap; }
.notice { margin: 0; font-size: 13px; color: var(--muted); max-width: 60ch; }

.progress { margin-top: 16px; height: 7px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.progress-bar { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 0.2s; }

.form-msg { margin: 14px 0 0; font-size: 14.5px; min-height: 1.4em; }
.form-msg.is-ok { color: var(--ok); }
.form-msg.is-error { color: var(--danger); }

/* --------------------------------- 页脚 --------------------------------- */
.site-footer { border-top: 1px solid var(--border); padding: 40px 0; background: var(--bg-alt); }
.footer-inner { display: flex; justify-content: space-between; gap: 28px; flex-wrap: wrap; }
.footer-name { font-weight: 650; margin-bottom: 4px; }
.footer-right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.contact-row.small a, .contact-row.small span.chip { font-size: 12.5px; padding: 4px 10px; }

/* --------------------------------- Toast -------------------------------- */
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translate(-50%, 16px);
  background: var(--surface-2); border: 1px solid var(--border-strong);
  color: var(--text); padding: 11px 20px; border-radius: 999px; font-size: 14px;
  box-shadow: var(--shadow); opacity: 0; transition: opacity 0.22s, transform 0.22s;
  z-index: 200; pointer-events: none;
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------ 滚动出现动画 ----------------------------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.55s ease, transform 0.55s ease; }
.reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ============================ 管理后台专用样式 ============================ */
.admin-body { background: var(--bg); min-height: 100vh; }
.admin-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 0; flex-wrap: wrap; }
.admin-title { display: flex; align-items: center; gap: 12px; }
.admin-title h1 { font-size: 20px; margin: 0; }
.admin-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow); }
.login-card h1 { font-size: 21px; margin-bottom: 6px; }
.login-hint { font-size: 13.5px; color: var(--muted); margin-bottom: 22px; }
.login-card .field { margin-bottom: 18px; }
.hint-box { font-size: 13px; color: var(--text-dim); background: rgba(91, 140, 255, 0.08); border: 1px solid rgba(91, 140, 255, 0.22); border-radius: var(--radius-sm); padding: 11px 13px; margin-bottom: 18px; line-height: 1.55; }
.hint-box code { font-family: var(--mono); font-size: 12.5px; background: rgba(0, 0, 0, 0.3); padding: 1px 6px; border-radius: 5px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px 18px; }
.stat .stat-label { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.stat .stat-value { font-size: 24px; font-weight: 660; font-variant-numeric: tabular-nums; }
.stat.is-accent .stat-value { color: var(--accent-2); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar .admin-input { max-width: 280px; }
.toolbar .admin-select { width: auto; min-width: 120px; }
.spacer { flex: 1 1 auto; }

.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: auto; }
table.subs { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 860px; }
table.subs th, table.subs td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
table.subs thead th { position: sticky; top: 0; background: var(--surface-2); font-size: 12.5px; color: var(--muted); font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; z-index: 2; }
table.subs tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
table.subs tbody tr.is-new td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.cell-name { font-weight: 600; }
.cell-sub { font-size: 12.5px; color: var(--muted); }
.cell-file { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.msg-cell { max-width: 260px; color: var(--text-dim); font-size: 13.5px; }
.row-actions { display: flex; gap: 7px; flex-wrap: wrap; }

.badge { font-size: 11.5px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-dim); white-space: nowrap; }
.badge-new { color: var(--accent); border-color: rgba(91, 140, 255, 0.35); background: var(--accent-soft); }
.badge-read { color: var(--ok); border-color: rgba(53, 211, 154, 0.3); background: rgba(53, 211, 154, 0.1); }
.badge-archived { color: var(--muted); }
.badge-kind { font-family: var(--mono); text-transform: uppercase; font-size: 10.5px; }

.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 18px; font-size: 14px; color: var(--text-dim); }
.empty { padding: 46px 20px; text-align: center; color: var(--muted); }

/* --------------------------------- 响应式 -------------------------------- */
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; gap: 34px; }
  .hero-card { max-width: 420px; }
  .about-grid { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; }
  .footer-right { text-align: left; align-items: flex-start; }
}

@media (max-width: 720px) {
  .nav-toggle { display: flex; }
  .nav {
    position: absolute; top: 68px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 2px;
    background: var(--bg-alt); border-bottom: 1px solid var(--border);
    padding: 12px 18px 18px; display: none;
  }
  .nav.is-open { display: flex; }
  .nav a { padding: 11px 14px; border-radius: var(--radius-sm); }
  .field-row { grid-template-columns: 1fr; }
  .section { padding: 56px 0; }
  .hero { padding: 44px 0 40px; }
  .fact-list { grid-template-columns: 1fr 1fr; }
  .gutter { display: none; }
  .upload-foot { flex-direction: column; align-items: stretch; }
  .upload-foot .btn { width: 100%; }
}

/* ============================================================================
   管理后台：标签页、访客记录（2026-10-08 新增）
   ========================================================================== */

.admin-tabs {
  display: flex;
  gap: 4px;
  margin: 18px 0 20px;
  border-bottom: 1px solid var(--border, #23303f);
}

.admin-tabs .tab {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted, #8b9bb0);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  padding: 10px 16px;
  transition: color .15s ease, border-color .15s ease;
}

.admin-tabs .tab:hover { color: var(--text, #e6edf7); }

.admin-tabs .tab.is-active {
  color: var(--accent, #4f9cf9);
  border-bottom-color: var(--accent, #4f9cf9);
}

/* ------------------------------ 统计卡片补充 ------------------------------ */
.stat-hint {
  font-size: 11px;
  color: var(--muted, #8b9bb0);
  margin-top: 4px;
}

.stat.is-warn {
  grid-column: 1 / -1;
  color: #f0b429;
  font-size: 13px;
  padding: 12px 16px;
  background: rgba(240, 180, 41, .08);
  border: 1px solid rgba(240, 180, 41, .3);
}

/* --------------------------------- 图表 --------------------------------- */
.visit-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin: 18px 0 22px;
}

.chart-card {
  background: var(--surface, #111823);
  border: 1px solid var(--border, #23303f);
  border-radius: 10px;
  padding: 14px 16px;
}

.chart-card.chart-wide { grid-column: 1 / -1; }

.chart-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted, #8b9bb0);
  margin: 0 0 10px;
  letter-spacing: .3px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(88px, 34%) 1fr auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 12px;
}

.bar-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text, #e6edf7);
}

.bar-track {
  display: block;
  height: 7px;
  background: rgba(255, 255, 255, .06);
  border-radius: 4px;
  overflow: hidden;
}

.bar-fill {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent, #4f9cf9), #a855f7);
}

.bar-value {
  font-variant-numeric: tabular-nums;
  color: var(--muted, #8b9bb0);
  min-width: 26px;
  text-align: right;
}

/* ------------------------------- 趋势柱状 ------------------------------- */
.trend {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 110px;
  padding-top: 8px;
}

.trend-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  height: 100%;
  min-width: 0;
}

.trend-bar {
  width: 100%;
  max-width: 34px;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, var(--accent, #4f9cf9), #2f6cc0);
  transition: opacity .15s ease;
}

.trend-col:hover .trend-bar { opacity: .75; }

.trend-label {
  font-size: 10px;
  color: var(--muted, #8b9bb0);
  margin-top: 5px;
  white-space: nowrap;
}

/* ------------------------------ 访客表格 ------------------------------ */
.visits-table td { vertical-align: top; }

.visits-table tr.is-bot { opacity: .55; }

.cell-details summary {
  cursor: pointer;
  color: var(--accent, #4f9cf9);
  font-size: 12px;
  list-style: none;
}

.cell-details summary::-webkit-details-marker { display: none; }
.cell-details summary::before { content: '▸ '; }
.cell-details[open] summary::before { content: '▾ '; }

.details-body {
  margin-top: 6px;
  max-width: 420px;
  word-break: break-all;
  display: grid;
  gap: 4px;
}

/* ---------------------------- 状态码徽章配色 ---------------------------- */
.badge-ok     { background: rgba(46, 160, 67, .18);  color: #3fb950; }
.badge-warn   { background: rgba(240, 180, 41, .18); color: #f0b429; }
.badge-danger { background: rgba(248, 81, 73, .18);  color: #f85149; }

@media (max-width: 640px) {
  .visit-charts { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: minmax(70px, 40%) 1fr auto; }
  .trend-label { transform: rotate(-60deg); transform-origin: center; }
}

/* ============================================================================
   CSP 安全的动态尺寸（2026-10-08）

   站点的 CSP 是 style-src 'self'，内联 style 属性会被浏览器拦掉：
     Refused to apply inline style ... violates style-src 'self'
   所以 element.style.width = '40%' 这类写法一律不生效。实测影响：
     - 首页上传进度条（#progressBar）从来没有显示过进度
     - 后台访客记录的柱状图 / 趋势图柱子宽度为 0，完全看不见

   解法：把百分比量化成 5% 一档，用 data-w / data-h 属性选择器表达，
   由 CSS 决定尺寸 —— 既不用放宽 CSP，也不影响可读性。
   JS 侧统一用 pctClass() 取档（见 public/js/admin.js 与 main.js）。
   ========================================================================== */

.offscreen {
  position: fixed;
  top: -1000px;
  left: -1000px;
  opacity: 0;
  pointer-events: none;
}

#progressBar,
.bar-fill,
.trend-bar {
  transition: width .25s ease, height .25s ease;
}

/* 宽度档位（进度条、榜单条） */
[data-w="0"] { width: 0%; }
[data-w="5"] { width: 5%; }
[data-w="10"] { width: 10%; }
[data-w="15"] { width: 15%; }
[data-w="20"] { width: 20%; }
[data-w="25"] { width: 25%; }
[data-w="30"] { width: 30%; }
[data-w="35"] { width: 35%; }
[data-w="40"] { width: 40%; }
[data-w="45"] { width: 45%; }
[data-w="50"] { width: 50%; }
[data-w="55"] { width: 55%; }
[data-w="60"] { width: 60%; }
[data-w="65"] { width: 65%; }
[data-w="70"] { width: 70%; }
[data-w="75"] { width: 75%; }
[data-w="80"] { width: 80%; }
[data-w="85"] { width: 85%; }
[data-w="90"] { width: 90%; }
[data-w="95"] { width: 95%; }
[data-w="100"] { width: 100%; }

/* 高度档位（趋势柱） */
[data-h="0"] { height: 0%; }
[data-h="5"] { height: 5%; }
[data-h="10"] { height: 10%; }
[data-h="15"] { height: 15%; }
[data-h="20"] { height: 20%; }
[data-h="25"] { height: 25%; }
[data-h="30"] { height: 30%; }
[data-h="35"] { height: 35%; }
[data-h="40"] { height: 40%; }
[data-h="45"] { height: 45%; }
[data-h="50"] { height: 50%; }
[data-h="55"] { height: 55%; }
[data-h="60"] { height: 60%; }
[data-h="65"] { height: 65%; }
[data-h="70"] { height: 70%; }
[data-h="75"] { height: 75%; }
[data-h="80"] { height: 80%; }
[data-h="85"] { height: 85%; }
[data-h="90"] { height: 90%; }
[data-h="95"] { height: 95%; }
[data-h="100"] { height: 100%; }

/* ============================================================================
   CSP：内联样式会被拦截（2026-10-08）

   站点的 CSP 是 style-src 'self'，不仅 JS 的 element.style 无效，
   **HTML 里的 style="..." 属性和 <style> 块同样会被浏览器拒绝**：
     Refused to apply inline style ... violates style-src 'self'
   实测这些样式从来没生效过（登录按钮不是满宽、404 页排版错乱等）。
   统一改成工具类。
   ========================================================================== */

.w-full { width: 100%; }
.m-0 { margin: 0; }
.mt-18 { margin-top: 18px; }
.mt-24 { margin-top: 24px; }
.panel-narrow { max-width: 480px; text-align: center; }
.title-xl { font-size: 44px; margin-bottom: 8px; }
.busy-title { margin: 0 0 10px; }

/* 429/503 页（原先写在 busy.html 的 <style> 里，被 CSP 拦掉） */
.busy-wrap {
  min-height: 70vh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 40px 20px;
}
.busy-code {
  font-size: clamp(64px, 14vw, 120px);
  font-weight: 800;
  line-height: 1;
  margin: 0 0 8px;
  background: linear-gradient(120deg, var(--accent, #4f9cf9), #a855f7);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
