:root {
  --ink: #143a32;
  --ink-soft: #1b493e;
  --ink-lift: #285f4f;
  --cream: #f5f3e8;
  --cream-bright: #fffdf6;
  --cream-muted: #d5ddcf;
  --totoro-green: #2f9d8d;
  --leaf-green: #91c66f;
  --gold: #c9bc6f;
  --danger: #e06a6a;
  --line: rgba(245, 243, 232, 0.14);
  --glass: rgba(15, 55, 46, 0.66);
  --glass-card: rgba(27, 73, 62, 0.52);
  --shadow: 0 24px 70px rgba(4, 31, 25, 0.3);
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text",
    "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI",
    "Microsoft YaHei", "Source Han Sans SC", "Noto Sans CJK SC", sans-serif;
  --font-serif: "Iowan Old Style", Baskerville, "Songti SC", STSong,
    "Source Han Serif SC", "Noto Serif CJK SC", FangSong, SimSun, serif;
  --ease-out: cubic-bezier(0.2, 0.72, 0.25, 1);
  --ease-soft: cubic-bezier(0.22, 1, 0.36, 1);
  --motion-fast: 160ms;
  --motion-ui: 240ms;
  --motion-page: 380ms;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { min-height: 100%; scroll-behavior: smooth; background: var(--ink); }

body {
  position: relative;
  min-height: 100vh;
  isolation: isolate;
  color: var(--cream);
  background:
    radial-gradient(circle at 82% 8%, rgba(201, 188, 111, 0.16), transparent 26rem),
    radial-gradient(circle at 7% 28%, rgba(109, 160, 70, 0.17), transparent 30rem),
    linear-gradient(150deg, #153c33 0%, #0d2c26 52%, #214d40 100%);
  background-attachment: fixed;
  font-family: var(--font-sans);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::after {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image: radial-gradient(rgba(255, 253, 246, 0.13) 0.5px, transparent 0.8px);
  background-size: 4px 4px;
  content: "";
  opacity: 0.1;
  pointer-events: none;
}

.grain { display: none; }

h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }

::selection { color: #0f3029; background: var(--leaf-green); }
:focus-visible { outline: 2px solid var(--leaf-green); outline-offset: 3px; }

a { color: inherit; text-decoration: none; }
button, input, select, textarea { color: inherit; font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 26px;
  background: rgba(13, 44, 38, 0.82);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.brand {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--cream-bright);
  font-weight: 650;
  letter-spacing: 0.02em;
}

.brand-mark {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--leaf-green), #2f7a4d);
  color: #0f3029;
  font-weight: 800;
  box-shadow: 0 8px 22px rgba(145, 198, 111, 0.24);
}

.brand-mark::after {
  position: absolute;
  inset: -4px;
  border-radius: 15px;
  background: radial-gradient(circle, rgba(145, 198, 111, 0.35), transparent 68%);
  content: "";
  opacity: 0;
  animation: brand-breathe 3.6s var(--ease-soft) infinite;
  pointer-events: none;
}

@keyframes brand-breathe {
  0%, 100% { opacity: 0; transform: scale(0.92); }
  50% { opacity: 1; transform: scale(1.05); }
}

.brand-text { font-family: var(--font-serif); font-size: 17px; }

.nav { display: flex; align-items: center; flex-wrap: wrap; gap: 3px; }
.nav a {
  position: relative;
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--cream-muted);
  font-size: 14px;
  transition: color var(--motion-fast) ease;
}
.nav a::after {
  position: absolute;
  right: 12px;
  bottom: 4px;
  left: 12px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--leaf-green), transparent);
  content: "";
  transform: scaleX(0);
  transform-origin: center;
  transition: transform var(--motion-ui) var(--ease-out);
}
.nav a:hover { color: var(--cream-bright); }
.nav a:hover::after,
.nav a.active::after { transform: scaleX(1); }
.nav a.active { color: var(--cream-bright); background: rgba(145, 198, 111, 0.1); }
.nav .blog-link { color: var(--gold); }
.nav .logout { color: var(--danger); }

@media (max-width: 860px) {
  .topbar { padding: 12px 16px; }
  .nav {
    flex-wrap: nowrap;
    order: 3;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { white-space: nowrap; }
}

.page {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 34px 22px 64px;
  animation: page-in var(--motion-page) var(--ease-out) both;
}

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

.page-title {
  margin: 4px 0 24px;
  font-family: var(--font-serif);
  font-size: clamp(26px, 3.4vw, 34px);
  font-weight: 550;
  letter-spacing: 0.04em;
}

.card {
  position: relative;
  overflow: hidden;
  background: var(--glass-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  margin-bottom: 20px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition:
    border-color var(--motion-ui) ease,
    box-shadow var(--motion-ui) ease,
    transform var(--motion-ui) var(--ease-out);
}

.card::before {
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(145, 198, 111, 0.35), transparent);
  content: "";
  pointer-events: none;
}

.card:hover {
  border-color: rgba(145, 198, 111, 0.3);
  box-shadow: 0 30px 80px rgba(3, 25, 20, 0.4);
  transform: translateY(-2px);
}

.card.narrow { max-width: 640px; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.card-head h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 550;
  letter-spacing: 0.03em;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.stat { text-align: center; padding: 20px 14px; }
.stat-num {
  font-family: var(--font-serif);
  font-size: clamp(28px, 3vw, 34px);
  font-weight: 600;
  color: var(--leaf-green);
  text-shadow: 0 0 26px rgba(145, 198, 111, 0.2);
}
.stat-label { color: var(--cream-muted); font-size: 13px; margin-top: 4px; letter-spacing: 0.06em; }

.two-col { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

.list { list-style: none; margin: 0; padding: 0; }
.list-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line);
  min-width: 0;
  transition: background-color var(--motion-fast) ease;
}
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: rgba(145, 198, 111, 0.05); }
.list-row .keyword { overflow-wrap: anywhere; }
.keyword { font-weight: 600; overflow-wrap: anywhere; }
.meta { color: var(--cream-muted); font-size: 12px; }
.empty { color: var(--cream-muted); }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(245, 243, 232, 0.08);
}
.badge-on { background: rgba(145, 198, 111, 0.16); color: #c7e6a8; border-color: rgba(145, 198, 111, 0.24); }
.badge-off { background: rgba(255, 255, 255, 0.06); color: var(--cream-muted); }
.badge-ok { background: rgba(201, 188, 111, 0.16); color: var(--gold); border-color: rgba(201, 188, 111, 0.26); }
.badge-event { background: rgba(47, 157, 141, 0.18); color: #9fe0d3; border-color: rgba(47, 157, 141, 0.28); }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 11px 9px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--cream-muted); font-weight: 500; font-size: 12px; white-space: nowrap; letter-spacing: 0.05em; }
.table tbody tr { transition: background-color var(--motion-fast) ease; }
.table tbody tr:hover { background: rgba(145, 198, 111, 0.05); }
.table .keyword { max-width: 300px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.inline-form { display: inline; margin: 0; }
.mono { font-family: "Cascadia Mono", Consolas, monospace; font-size: 12px; word-break: break-all; }
.err { color: var(--danger); font-size: 12px; }
.old-price { color: var(--cream-muted); text-decoration: line-through; }
.new-price { color: var(--leaf-green); font-weight: 600; }
.item-link {
  display: inline-block;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
  color: #a9d6b7;
  transition: color var(--motion-fast) ease;
}
.item-link:hover { color: var(--cream-bright); }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 18px; }
.metric-line { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.chart-box { position: relative; height: 300px; }
.chart-box-radar { height: 340px; max-width: 520px; margin: 0 auto; }
.json-block {
  background: rgba(4, 20, 15, 0.55);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  overflow-x: auto;
  font-size: 12px;
  max-height: 320px;
}

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 17px;
  font-size: 14px;
  cursor: pointer;
  color: var(--cream);
  background: rgba(255, 255, 255, 0.05);
  transition:
    background-color var(--motion-fast) ease,
    border-color var(--motion-fast) ease,
    transform var(--motion-ui) var(--ease-out),
    box-shadow var(--motion-ui) ease;
}
.btn::after {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -45%;
  width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255, 253, 246, 0.14), transparent);
  content: "";
  transform: skewX(-18deg) translateX(0);
  transition: transform 520ms var(--ease-out);
  pointer-events: none;
}
.btn:hover { background: rgba(255, 255, 255, 0.09); border-color: rgba(145, 198, 111, 0.3); transform: translateY(-1px); }
.btn:hover::after { transform: skewX(-18deg) translateX(320%); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: linear-gradient(145deg, var(--leaf-green), #2f7a4d);
  border: 0;
  color: #0f3029;
  font-weight: 700;
  box-shadow: 0 10px 26px rgba(92, 140, 70, 0.24);
}
.btn-primary:hover { background: linear-gradient(145deg, #a5d77f, #358c58); color: #0f3029; }
.btn-ghost { background: transparent; }
.btn-danger { background: rgba(224, 106, 106, 0.12); border-color: rgba(224, 106, 106, 0.34); color: #f0a6a6; }
.btn-danger:hover { background: rgba(224, 106, 106, 0.2); }
.btn-sm { padding: 5px 11px; font-size: 12px; border-radius: 9px; }
.btn-row { display: flex; gap: 10px; }

.stack { display: flex; flex-direction: column; gap: 13px; }
.stack label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--cream-muted); }
.stack label.check { flex-direction: row; align-items: center; gap: 8px; }

input, select {
  background: rgba(5, 22, 16, 0.62);
  color: var(--cream);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  width: 100%;
  transition: border-color var(--motion-fast) ease, box-shadow var(--motion-fast) ease;
}
input:focus, select:focus {
  border-color: var(--leaf-green);
  box-shadow: 0 0 0 3px rgba(145, 198, 111, 0.14);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

.alert { padding: 11px 15px; border-radius: 12px; margin-bottom: 14px; font-size: 14px; border: 1px solid transparent; }
.alert-ok { background: rgba(145, 198, 111, 0.12); border-color: rgba(145, 198, 111, 0.28); color: #c7e6a8; }
.alert-error { background: rgba(224, 106, 106, 0.12); border-color: rgba(224, 106, 106, 0.34); color: #f0a6a6; }
.hint { color: var(--cream-muted); font-size: 12.5px; line-height: 1.65; margin: 11px 0 0; }

.login-wrap { display: flex; justify-content: center; padding-top: 64px; }
.login-card { max-width: 430px; width: 100%; padding: 34px 32px; text-align: center; }
.login-title { margin: 0 0 8px; font-family: var(--font-serif); font-size: 27px; font-weight: 550; }
.login-sub { color: var(--cream-muted); margin: 0 0 20px; font-size: 14px; }
.login-card .stack { text-align: left; }

.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  color: var(--cream-muted);
  font-size: 12px;
  padding: 22px;
  border-top: 1px solid var(--line);
}

details summary { cursor: pointer; color: var(--leaf-green); margin: 12px 0; transition: color var(--motion-fast) ease; }
details summary:hover { color: var(--cream-bright); }

/* 低性能入场动效：仅 transform/opacity，尊重系统减弱动效设置 */
html.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 480ms var(--ease-soft),
    transform 480ms var(--ease-soft);
}
html.js .reveal.revealed {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  html.js .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .page { animation: none; }
  .brand-mark::after { animation: none; opacity: 0; }
  .btn::after { display: none; }
  .card, .btn { transition: none; }
  .card:hover, .btn:hover { transform: none; }
}
