/*
 * Nebula 3.0 — Midnight Workbench
 * A restrained glass terminal theme for emlog.
 */

:root {
  color-scheme: dark;
  --accent: #7ee787;
  --accent-rgb: 126, 231, 135;
  --accent-strong: var(--accent);
  --syntax-blue: #82aaff;
  --syntax-purple: #c792ea;
  --syntax-amber: #ffcb6b;
  --syntax-red: #ff7b8b;
  --syntax-cyan: #7fdbca;
  --danger: #ff6b7a;

  --bg: #07100e;
  --bg-deep: #040906;
  --bg-raised: #0b1512;
  --surface: #0e1916;
  --surface-2: #12201b;
  --surface-3: #172720;
  --glass: rgba(10, 22, 18, 0.72);
  --glass-strong: rgba(12, 25, 21, 0.9);
  --glass-soft: rgba(255, 255, 255, 0.035);
  --line: rgba(210, 255, 225, 0.11);
  --line-strong: rgba(210, 255, 225, 0.2);
  --line-accent: rgba(var(--accent-rgb), 0.42);

  --text: #eef8f2;
  --text-soft: #a9bcb1;
  --text-dim: #71877a;
  --text-inverse: #06100a;
  --code-comment: #657b70;

  --shadow-panel: 0 24px 70px rgba(0, 0, 0, 0.34);
  --shadow-float: 0 32px 110px rgba(0, 0, 0, 0.5);
  --shadow-inner: inset 0 1px 0 rgba(255, 255, 255, 0.055);

  --radius-control: 9px;
  --radius-panel: 16px;
  --radius-shell: 24px;
  --header-h: 76px;
  --sidebar-w: 304px;
  --max: 1280px;
  --blur: blur(22px) saturate(135%);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-ui: cubic-bezier(0.2, 0, 0, 1);
  --font-ui: "MiSans", "HarmonyOS Sans SC", "Source Han Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "Maple Mono", "Cascadia Code", "JetBrains Mono", "SFMono-Regular", Consolas, monospace;

  /* Compatibility aliases used by markdown.css and plugins */
  --border: var(--line);
  --border-strong: var(--line-strong);
}

html[data-theme="light"] {
  color-scheme: light;
  --accent-strong: #24763a;
  --syntax-blue: #315cbb;
  --syntax-purple: #7c3ba8;
  --syntax-amber: #8b5a00;
  --syntax-red: #b4233a;
  --syntax-cyan: #08766d;
  --bg: #edf3ef;
  --bg-deep: #e3ece6;
  --bg-raised: #f6faf7;
  --surface: #fbfdfb;
  --surface-2: #f3f8f4;
  --surface-3: #eaf2ec;
  --glass: rgba(249, 253, 250, 0.72);
  --glass-strong: rgba(253, 255, 253, 0.92);
  --glass-soft: rgba(12, 38, 24, 0.035);
  --line: rgba(20, 53, 35, 0.12);
  --line-strong: rgba(20, 53, 35, 0.22);
  --line-accent: rgba(36, 118, 58, 0.34);
  --text: #13251a;
  --text-soft: #435c4d;
  --text-dim: #687d70;
  --text-inverse: #09210f;
  --code-comment: #6b7e72;
  --shadow-panel: 0 20px 60px rgba(30, 69, 44, 0.1);
  --shadow-float: 0 30px 90px rgba(30, 69, 44, 0.16);
  --shadow-inner: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 22px);
}

body.nb-body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.7;
  letter-spacing: 0.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.nb-lock {
  overflow: hidden;
}

::selection {
  background: rgba(var(--accent-rgb), 0.26);
  color: var(--text);
}

a {
  color: var(--accent-strong);
  text-decoration: none;
  transition:
    color 160ms var(--ease-ui),
    border-color 160ms var(--ease-ui),
    background-color 160ms var(--ease-ui),
    opacity 160ms var(--ease-ui),
    transform 160ms var(--ease-ui);
}

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

button,
input,
textarea,
select {
  color: inherit;
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

ul,
ol {
  margin: 0;
  padding: 0;
}

hr {
  margin: 16px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

:where(a, button, input, textarea, select, [tabindex]):focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.nb-skip-link {
  position: fixed;
  z-index: 2000;
  top: 10px;
  left: 14px;
  padding: 10px 15px;
  border-radius: var(--radius-control);
  background: var(--accent);
  color: var(--text-inverse);
  font-weight: 800;
  transform: translateY(-160%);
  transition: transform 160ms var(--ease-ui);
}

.nb-skip-link:focus {
  transform: none;
}

.nb-container {
  width: min(var(--max), calc(100% - 40px));
  margin-inline: auto;
}

/* ---------- Atmospheric canvas ---------- */
.nb-bg {
  position: fixed;
  z-index: -2;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(900px 620px at 8% -8%, rgba(var(--accent-rgb), 0.12), transparent 62%),
    radial-gradient(760px 540px at 98% 90%, rgba(255, 189, 92, 0.065), transparent 66%),
    linear-gradient(145deg, var(--bg-deep), var(--bg) 46%, var(--bg-raised));
}

.nb-grid {
  position: absolute;
  inset: 0;
  opacity: 0.32;
  background-image:
    linear-gradient(rgba(200, 255, 218, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(200, 255, 218, 0.035) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: linear-gradient(to bottom, #000 0, rgba(0, 0, 0, 0.78) 55%, transparent 100%);
}

html[data-theme="light"] .nb-grid {
  opacity: 0.55;
  background-image:
    linear-gradient(rgba(20, 80, 42, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 80, 42, 0.045) 1px, transparent 1px);
}

.nb-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.2;
  animation: nb-drift 18s ease-in-out infinite;
}

.nb-glow-a {
  width: 420px;
  height: 420px;
  top: 12%;
  left: -230px;
  background: var(--accent);
}

.nb-glow-b {
  width: 300px;
  height: 300px;
  right: -150px;
  bottom: 3%;
  background: #d79b47;
  animation-delay: -8s;
}

.nb-noise {
  position: absolute;
  inset: 0;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.75'/%3E%3C/svg%3E");
}

@keyframes nb-drift {
  0%,
  100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(35px, -28px, 0) scale(1.06); }
}

.nb-progress {
  position: fixed;
  z-index: 1200;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  transform: scaleX(0);
  transform-origin: left center;
  background: linear-gradient(90deg, var(--accent), var(--syntax-amber));
  box-shadow: 0 0 18px rgba(var(--accent-rgb), 0.5);
  will-change: transform;
}

/* ---------- Header / navigation ---------- */
.nb-header {
  position: sticky;
  z-index: 300;
  top: 0;
  height: var(--header-h);
  padding-top: 10px;
  pointer-events: none;
}

.nb-header-shell {
  pointer-events: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--glass);
  box-shadow: var(--shadow-inner);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  transition:
    background-color 220ms var(--ease-ui),
    border-color 220ms var(--ease-ui),
    box-shadow 220ms var(--ease-ui),
    transform 220ms var(--ease-ui);
}

.nb-header.is-scrolled .nb-header-shell {
  border-color: var(--line-strong);
  background: var(--glass-strong);
  box-shadow: var(--shadow-panel), var(--shadow-inner);
}

.nb-header-inner {
  display: flex;
  align-items: center;
  min-height: 54px;
  padding: 0 8px 0 12px;
  gap: 16px;
}

.nb-brand {
  flex: 0 1 auto;
  min-width: 0;
}

.nb-logo {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 11px;
  color: var(--text);
}

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

.nb-logo-mark {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  overflow: hidden;
  border: 1px solid var(--line-accent);
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(var(--accent-rgb), 0.14), transparent 65%),
    var(--surface-2);
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.035);
  color: var(--accent);
  font-family: var(--font-mono);
}

.nb-logo-mark::before {
  content: ">";
  transform: translate(-3px, -1px);
  font-size: 15px;
  font-weight: 800;
}

.nb-logo-mark::after {
  content: "_";
  position: absolute;
  left: 19px;
  bottom: 8px;
  font-size: 12px;
  font-weight: 900;
  animation: nb-cursor 1.2s steps(1) infinite;
}

.nb-logo-mark i {
  position: absolute;
  inset: 4px;
  border-top: 1px solid rgba(var(--accent-rgb), 0.08);
  pointer-events: none;
}

@keyframes nb-cursor {
  0%,
  46% { opacity: 1; }
  47%,
  100% { opacity: 0; }
}

.nb-logo-text {
  display: grid;
  min-width: 0;
  line-height: 1.15;
}

.nb-logo-text strong {
  overflow: hidden;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.91rem;
  font-weight: 720;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nb-logo-text strong > span {
  color: var(--accent-strong);
}

.nb-logo-text small {
  overflow: hidden;
  max-width: 150px;
  margin-top: 3px;
  color: var(--text-dim);
  font-size: 0.66rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nb-logo-img {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
}

.nb-logo-img img {
  width: auto;
  max-width: 172px;
  height: 34px;
}

.nb-nav {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.nb-nav-list {
  display: flex;
  align-items: center;
  gap: 2px;
  list-style: none;
}

.nb-nav-item {
  position: relative;
}

.nb-nav-list > .nb-nav-item {
  display: flex;
  align-items: center;
}

.nb-nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 11px;
  border-radius: var(--radius-control);
  color: var(--text-soft);
  font-size: 0.84rem;
  font-weight: 650;
  white-space: nowrap;
}

.nb-nav-link:hover,
.nb-nav-link[aria-current="page"] {
  background: var(--glass-soft);
  color: var(--text);
}

.nb-nav-link[aria-current="page"]::before {
  width: 5px;
  height: 5px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.7);
  content: "";
}

.header-avatar {
  width: 24px;
  height: 24px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  object-fit: cover;
}

.nb-submenu-toggle {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 34px;
  margin-left: -7px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
}

.nb-submenu-toggle:hover {
  background: var(--glass-soft);
  color: var(--text);
}

.nb-submenu-toggle svg {
  transition: transform 180ms var(--ease-ui);
}

.nb-nav-item.is-open > .nb-submenu-toggle svg {
  transform: rotate(180deg);
}

.nb-dropdown {
  position: absolute;
  z-index: 60;
  top: calc(100% + 9px);
  left: 0;
  display: grid;
  min-width: 190px;
  max-width: 280px;
  padding: 7px;
  list-style: none;
  visibility: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: var(--glass-strong);
  box-shadow: var(--shadow-float), var(--shadow-inner);
  opacity: 0;
  transform: translateY(7px) scale(0.98);
  transform-origin: top left;
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  transition:
    opacity 160ms var(--ease-ui),
    visibility 160ms var(--ease-ui),
    transform 160ms var(--ease-ui);
}

.nb-nav-item:hover > .nb-dropdown,
.nb-nav-item:focus-within > .nb-dropdown,
.nb-nav-item.is-open > .nb-dropdown {
  visibility: visible;
  opacity: 1;
  transform: none;
}

.nb-dropdown .nb-nav-link {
  width: 100%;
  min-height: 40px;
  padding-inline: 11px;
}

.nb-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.nb-icon-btn,
.nb-search-trigger {
  min-width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-soft);
  cursor: pointer;
  transition:
    color 160ms var(--ease-ui),
    border-color 160ms var(--ease-ui),
    background-color 160ms var(--ease-ui),
    transform 160ms var(--ease-ui);
}

.nb-icon-btn {
  display: inline-grid;
  place-items: center;
  padding: 0;
}

.nb-search-trigger {
  display: inline-flex;
  align-items: center;
  min-width: 126px;
  padding: 0 8px 0 11px;
  gap: 8px;
}

.nb-search-trigger > span {
  font-size: 0.78rem;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 0 6px;
  border: 1px solid var(--line-strong);
  border-bottom-color: rgba(255, 255, 255, 0.23);
  border-radius: 6px;
  background: var(--glass-soft);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  line-height: 1;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.18);
}

.nb-search-trigger kbd {
  margin-left: auto;
}

.nb-icon-btn:hover,
.nb-search-trigger:hover {
  border-color: var(--line-accent);
  background: rgba(var(--accent-rgb), 0.075);
  color: var(--accent-strong);
}

.nb-menu-btn {
  display: none;
}

html[data-theme="dark"] .icon-sun,
html[data-theme="light"] .icon-moon {
  display: none;
}

.nb-nav-mask {
  position: fixed;
  z-index: 280;
  inset: 0;
  visibility: hidden;
  background: rgba(2, 8, 5, 0.58);
  opacity: 0;
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  transition:
    opacity 200ms var(--ease-ui),
    visibility 200ms var(--ease-ui);
}

.nb-nav-mask.is-open {
  visibility: visible;
  opacity: 1;
}

/* ---------- Command palette ---------- */
.nb-search {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: start center;
  padding: min(14vh, 130px) 18px 24px;
  visibility: hidden;
  background: rgba(2, 7, 5, 0.62);
  opacity: 0;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  transition:
    opacity 200ms var(--ease-ui),
    visibility 200ms var(--ease-ui);
}

html[data-theme="light"] .nb-search {
  background: rgba(219, 230, 222, 0.7);
}

.nb-search.is-open {
  visibility: visible;
  opacity: 1;
}

.nb-search-panel {
  width: min(650px, 100%);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: var(--glass-strong);
  box-shadow: var(--shadow-float), var(--shadow-inner);
  transform: translateY(-12px) scale(0.985);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  transition: transform 240ms var(--ease);
}

.nb-search.is-open .nb-search-panel {
  transform: none;
}

.nb-search-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px 14px;
}

.nb-search-overline {
  color: var(--accent-strong);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.15em;
}

.nb-search-head h2 {
  margin: 3px 0 0;
  font-size: 1.15rem;
  line-height: 1.3;
}

.nb-search-close {
  min-width: 44px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--glass-soft);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  cursor: pointer;
}

.nb-search-form {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  margin: 0 14px;
  padding: 7px 7px 7px 15px;
  border: 1px solid var(--line-accent);
  border-radius: 13px;
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.055);
  color: var(--accent-strong);
}

.nb-search-form input {
  width: 100%;
  min-height: 48px;
  padding: 0 12px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.92rem;
}

.nb-search-form input::placeholder {
  color: var(--text-dim);
}

.nb-search-form button {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 14px;
  gap: 8px;
  border: 0;
  border-radius: 9px;
  background: var(--accent);
  color: var(--text-inverse);
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.nb-search-tip {
  display: flex;
  padding: 12px 22px 18px;
  gap: 18px;
  color: var(--text-dim);
  font-size: 0.72rem;
}

.nb-search-tip span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ---------- Main layout ---------- */
.nb-main {
  padding: 22px 0 84px;
}

.nb-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--sidebar-w);
  align-items: start;
  gap: 24px;
}

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

.nb-layout-reading > .nb-sidebar {
  display: none;
}

.nb-content {
  min-width: 0;
}

/* ---------- Hero workbench ---------- */
.nb-hero {
  margin-bottom: 32px;
}

.nb-workbench {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-shell);
  background: var(--glass);
  box-shadow: var(--shadow-panel), var(--shadow-inner);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
}

.nb-workbench::before {
  position: absolute;
  z-index: 0;
  top: -180px;
  left: 18%;
  width: 470px;
  height: 310px;
  border-radius: 50%;
  background: rgba(var(--accent-rgb), 0.09);
  filter: blur(70px);
  content: "";
  pointer-events: none;
}

.nb-workbench-bar {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(150px, auto) 1fr auto;
  align-items: center;
  min-height: 48px;
  border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.12);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

html[data-theme="light"] .nb-workbench-bar {
  background: rgba(20, 53, 35, 0.025);
}

.nb-workbench-tab {
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  padding: 0 18px;
  gap: 8px;
  border-right: 1px solid var(--line);
  border-top: 2px solid var(--accent);
  background: var(--glass-soft);
  color: var(--text-soft);
}

.nb-workbench-tab svg {
  color: var(--syntax-amber);
}

.nb-workbench-tab i {
  width: 5px;
  height: 5px;
  margin-left: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.nb-workbench-path {
  overflow: hidden;
  padding: 0 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nb-branch {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 18px;
  gap: 7px;
  border-left: 1px solid var(--line);
}

.nb-branch > span {
  color: var(--accent-strong);
  font-size: 0.95rem;
}

.nb-hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(310px, 0.88fr);
  align-items: stretch;
  min-height: 390px;
}

.nb-hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: clamp(38px, 5vw, 66px);
}

.nb-hero-kicker {
  display: inline-flex;
  align-items: center;
  margin-bottom: 18px;
  gap: 8px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.nb-hero-kicker i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.1), 0 0 14px rgba(var(--accent-rgb), 0.55);
}

.nb-hero-kicker span {
  color: var(--line-strong);
}

.nb-hero-title {
  max-width: 760px;
  margin: 0;
  color: var(--text);
  font-size: clamp(2.45rem, 5vw, 4.55rem);
  font-weight: 760;
  line-height: 1.06;
  letter-spacing: -0.055em;
  text-wrap: balance;
}

.nb-hero-title::first-letter {
  color: var(--accent-strong);
}

.nb-hero-description {
  max-width: 600px;
  margin: 22px 0 0;
  color: var(--text-soft);
  font-size: clamp(0.98rem, 1.5vw, 1.08rem);
  line-height: 1.85;
}

.nb-hero-actions {
  display: flex;
  flex-wrap: wrap;
  margin-top: 30px;
  gap: 10px;
}

.nb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 17px;
  gap: 9px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-size: 0.84rem;
  font-weight: 760;
  cursor: pointer;
  transition:
    transform 160ms var(--ease-ui),
    color 160ms var(--ease-ui),
    background-color 160ms var(--ease-ui),
    border-color 160ms var(--ease-ui),
    box-shadow 160ms var(--ease-ui);
}

.nb-btn-primary {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 12px 28px rgba(var(--accent-rgb), 0.16);
  color: var(--text-inverse);
}

.nb-btn-primary:hover {
  background: color-mix(in srgb, var(--accent) 88%, white);
  color: var(--text-inverse);
  transform: translateY(-2px);
}

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

.nb-btn-ghost:hover {
  border-color: var(--line-accent);
  background: rgba(var(--accent-rgb), 0.065);
  color: var(--accent-strong);
  transform: translateY(-2px);
}

.nb-hero-stats {
  display: flex;
  flex-wrap: wrap;
  margin-top: 34px;
  gap: 8px 20px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.65rem;
}

.nb-hero-stats span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.nb-hero-stats strong {
  color: var(--text-soft);
  font-weight: 700;
}

.nb-hero-stats span:last-child strong {
  color: var(--accent-strong);
  font-size: 0.58rem;
}

.nb-editor {
  align-self: center;
  min-width: 0;
  margin: 30px 30px 30px 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  background: rgba(4, 11, 8, 0.78);
  box-shadow: 0 22px 55px rgba(0, 0, 0, 0.28), var(--shadow-inner);
  transform: perspective(1000px) rotateY(-1.5deg);
}

html[data-theme="light"] .nb-editor {
  background: #122019;
  color-scheme: dark;
}

.nb-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 0 14px;
  border-bottom: 1px solid rgba(220, 255, 230, 0.09);
  background: rgba(255, 255, 255, 0.025);
  color: #82978b;
  font-family: var(--font-mono);
  font-size: 0.68rem;
}

.nb-editor-state {
  color: #75c77e;
  font-size: 0.61rem;
}

.nb-code-block {
  padding: 20px 0 22px;
  color: #dce8e0;
  font-family: var(--font-mono);
  font-size: clamp(0.7rem, 1.1vw, 0.8rem);
  line-height: 2;
}

.nb-code-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  min-height: 26px;
  padding-right: 16px;
}

.nb-code-row:hover {
  background: rgba(255, 255, 255, 0.025);
}

.nb-code-row > i {
  padding-right: 13px;
  color: #40534a;
  font-style: normal;
  text-align: right;
  user-select: none;
}

.nb-code-row code {
  overflow: hidden;
  color: #dce8e0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.syn-purple { color: #c792ea; font-weight: 500; }
.syn-blue { color: #82aaff; font-weight: 500; }
.syn-key { color: #89ddff; }
.syn-string { color: #c3e88d; }
.syn-green { color: #7ee787; }
.syn-number { color: #f78c6c; }
.syn-muted { color: #728779; }

.nb-code-comment code {
  color: #60766a;
  font-style: italic;
}

.nb-caret {
  display: inline-block;
  width: 7px;
  height: 1.1em;
  margin-left: 4px;
  vertical-align: -0.18em;
  background: var(--accent);
  animation: nb-cursor 1.2s steps(1) infinite;
}

/* ---------- Context / toolbar ---------- */
.nb-context {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  min-height: 150px;
  margin-bottom: 28px;
  padding: 34px 38px;
  gap: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-shell);
  background: var(--glass);
  box-shadow: var(--shadow-inner);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
}

.nb-context h1 {
  margin: 6px 0 0;
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1.15;
  letter-spacing: -0.04em;
}

.nb-context-count {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.nb-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 16px;
}

.nb-toolbar-left {
  display: grid;
  gap: 4px;
}

.nb-section-kicker {
  color: var(--accent-strong);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.nb-section-title {
  margin: 0;
  color: var(--text);
  font-size: 1.35rem;
  line-height: 1.3;
  letter-spacing: -0.025em;
}

.nb-filter-wrap {
  display: flex;
  align-items: center;
  gap: 9px;
}

.nb-filter-label {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.64rem;
}

.nb-filter {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--glass);
}

.nb-filter button {
  min-height: 36px;
  padding: 0 11px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  transition:
    color 150ms var(--ease-ui),
    background-color 150ms var(--ease-ui);
}

.nb-filter button:hover {
  color: var(--text);
}

.nb-filter button.is-active {
  background: rgba(var(--accent-rgb), 0.11);
  color: var(--accent-strong);
}

/* ---------- Explorer post list ---------- */
.nb-posts {
  overflow: hidden;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius-shell);
  background: var(--glass);
  box-shadow: var(--shadow-panel), var(--shadow-inner);
  -webkit-backdrop-filter: blur(15px) saturate(120%);
  backdrop-filter: blur(15px) saturate(120%);
}

.nb-card {
  position: relative;
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  min-height: 172px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.008);
  transition:
    background-color 190ms var(--ease-ui),
    transform 190ms var(--ease-ui);
}

.nb-card:first-child {
  border-radius: 17px 17px 0 0;
}

.nb-card:last-child {
  border-bottom: 0;
  border-radius: 0 0 17px 17px;
}

.nb-card:only-child {
  border-radius: 17px;
}

.nb-card.has-cover {
  grid-template-columns: 192px minmax(0, 1fr);
}

.nb-card.is-featured.has-cover {
  grid-template-columns: minmax(220px, 0.78fr) minmax(0, 1.22fr);
  min-height: 246px;
}

.nb-card.is-top::after {
  position: absolute;
  top: 0;
  right: 0;
  width: 42px;
  height: 42px;
  border-radius: 0 0 0 100%;
  background: rgba(var(--accent-rgb), 0.055);
  content: "";
  pointer-events: none;
}

.nb-card.is-hidden {
  display: none;
}

.nb-card-gutter {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 25px;
  gap: 7px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(90deg, transparent 49%, rgba(var(--accent-rgb), 0.045) 50%, transparent 51%);
}

.nb-ln {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
}

.nb-file-ext {
  color: rgba(var(--accent-rgb), 0.45);
  font-family: var(--font-mono);
  font-size: 0.58rem;
}

.nb-card-cover {
  position: relative;
  min-height: 172px;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: var(--surface-2);
}

.nb-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.82) contrast(1.03);
  transition:
    transform 500ms var(--ease),
    filter 300ms var(--ease-ui);
}

.nb-cover-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(4, 12, 8, 0.02), rgba(4, 12, 8, 0.32));
  pointer-events: none;
}

html[data-theme="light"] .nb-cover-shade {
  background: linear-gradient(135deg, transparent, rgba(17, 53, 31, 0.12));
}

.nb-card-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 22px 24px 19px;
}

.nb-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  min-height: 24px;
  margin-bottom: 8px;
  gap: 7px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.65rem;
}

.nb-meta-path {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 6px;
}

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

.nb-sort a,
.nb-pill a,
.nb-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border: 1px solid rgba(var(--accent-rgb), 0.15);
  border-radius: 6px;
  background: rgba(var(--accent-rgb), 0.055);
  color: var(--accent-strong);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
}

.nb-top-flag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border: 1px solid rgba(255, 196, 102, 0.18);
  border-radius: 6px;
  background: rgba(255, 196, 102, 0.075);
  color: var(--syntax-amber);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 800;
}

.nb-window-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--glass-soft);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
}

.nb-card-title {
  max-width: 730px;
  margin: 0 0 9px;
  font-size: clamp(1.08rem, 2vw, 1.36rem);
  font-weight: 730;
  line-height: 1.42;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.is-featured .nb-card-title {
  font-size: clamp(1.3rem, 2.4vw, 1.68rem);
}

.nb-card-title a {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.nb-card-title a:hover {
  color: var(--accent-strong);
}

.nb-card-excerpt {
  display: -webkit-box;
  overflow: hidden;
  max-width: 760px;
  color: var(--text-soft);
  font-size: 0.86rem;
  line-height: 1.75;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.nb-card-excerpt p {
  margin: 0;
}

.nb-card-excerpt :is(img, pre, code, table, iframe, video, audio) {
  display: none !important;
}

.nb-card-foot {
  display: flex;
  align-items: center;
  min-height: 32px;
  margin-top: 14px;
  gap: 12px;
}

.nb-card-tags {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  min-width: 0;
  max-height: 28px;
  overflow: hidden;
  gap: 6px;
}

.nb-tag,
a.tags,
a.tags-side {
  display: inline-flex;
  align-items: center;
  max-width: 150px;
  min-height: 25px;
  padding: 0 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--glass-soft);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nb-tag:hover,
a.tags:hover,
a.tags-side:hover {
  border-color: var(--line-accent);
  color: var(--accent-strong);
}

.nb-card-signals {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 12px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.61rem;
}

.nb-card-more {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 32px;
  gap: 6px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 750;
}

.nb-card-more svg {
  transition: transform 180ms var(--ease-ui);
}

.nb-card-more:hover {
  color: var(--accent-strong);
}

.nb-card-more:hover svg {
  transform: translateX(3px);
}

.nb-filter-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  margin-top: 12px;
  gap: 10px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-panel);
  background: var(--glass);
  color: var(--text-dim);
  font-size: 0.86rem;
}

.nb-filter-empty > span {
  color: var(--accent-strong);
  font-family: var(--font-mono);
  font-weight: 800;
}

/* ---------- Sidebar / inspector ---------- */
.nb-sidebar {
  position: sticky;
  top: calc(var(--header-h) + 12px);
  display: block;
  max-height: calc(100dvh - var(--header-h) - 28px);
  padding: 7px 18px;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: var(--radius-shell);
  background: var(--glass);
  box-shadow: var(--shadow-inner);
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
  -webkit-backdrop-filter: blur(15px) saturate(120%);
  backdrop-filter: blur(15px) saturate(120%);
}

.nb-sidebar:empty {
  display: none;
}

.nb-widget {
  position: relative;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}

.nb-widget:last-child {
  border-bottom: 0;
}

.nb-widget-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 13px;
}

.nb-widget-title h3 {
  display: inline-flex;
  align-items: center;
  margin: 0;
  gap: 8px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 780;
  letter-spacing: 0.05em;
}

.nb-widget-title h3::before {
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.4);
  content: "";
}

.nb-widget-list {
  color: var(--text-soft);
  font-size: 0.79rem;
  list-style: none;
}

.nb-widget-list > li {
  min-width: 0;
}

.nb-widget-list > li + li {
  margin-top: 9px;
}

.nb-widget-list a {
  color: var(--text-soft);
}

.nb-widget-list a:hover {
  color: var(--accent-strong);
}

.nb-widget-link {
  display: flex;
  align-items: center;
  min-height: 34px;
  gap: 9px;
}

.nb-widget-link img,
.rounded {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 7px;
  object-fit: cover;
}

.bloggerinfo {
  display: grid;
  justify-items: center;
  padding: 8px 4px 3px;
  text-align: center;
}

.bloggerinfo-img {
  width: 74px;
  height: 74px;
  border: 1px solid var(--line-accent);
  border-radius: 22px;
  object-fit: cover;
  box-shadow: 0 0 0 5px rgba(var(--accent-rgb), 0.055);
}

.bloginfo-name {
  margin-top: 13px;
  color: var(--text);
  font-size: 0.95rem;
}

.bloginfo-descript {
  margin-top: 5px;
  color: var(--text-dim);
  font-size: 0.75rem;
  line-height: 1.65;
}

.tag-container {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tag-container > span {
  font-size: inherit !important;
  line-height: inherit !important;
}

.log-classify-f,
.log-classify-c {
  list-style: none;
}

.log-classify-f > li > a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
}

.log-classify-c {
  margin: 3px 0 7px 10px;
  padding-left: 12px;
  border-left: 1px solid var(--line);
}

.log-classify-c a {
  display: block;
  padding: 5px 0;
  color: var(--text-dim);
  font-size: 0.74rem;
}

.side-cover-image,
.nb-side-cover {
  position: relative;
  min-height: 92px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-2);
}

.side-cover-image img,
.nb-side-cover img {
  width: 100%;
  height: 92px;
  object-fit: cover;
  opacity: 0.7;
  transition: transform 300ms var(--ease);
}

.side-title-container,
.nb-side-cover-title {
  position: absolute;
  inset: auto 0 0;
  padding: 24px 11px 9px;
  background: linear-gradient(transparent, rgba(3, 9, 6, 0.92));
}

.side-title-container a,
.nb-side-cover-title a {
  display: -webkit-box;
  overflow: hidden;
  color: #effaf2;
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.side-comment-list .comment-info,
.side-twitter-item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  column-gap: 9px;
}

.comment-info_img {
  grid-row: span 2;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 9px;
  object-fit: cover;
}

.comm-lates-name {
  overflow: hidden;
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logcom-latest-time {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.58rem;
}

.side-comment-list a,
.side-twitter-content {
  grid-column: 1 / -1;
  display: -webkit-box;
  margin-top: 7px;
  overflow: hidden;
  color: var(--text-soft);
  font-size: 0.72rem;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

#calendar {
  min-height: 120px;
  overflow: auto;
}

#calendar table {
  width: 100%;
  border-collapse: collapse;
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  text-align: center;
}

#calendar th,
#calendar td {
  padding: 5px 2px;
}

#calendar a {
  color: var(--accent-strong);
}

.nb-input,
.nb-select,
.nb-widget input[type="search"],
.nb-widget input[type="text"],
.nb-widget input[type="email"],
.nb-widget input[type="password"],
.nb-widget textarea,
.nb-widget select {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  outline: 0;
  background: var(--surface-2);
  color: var(--text);
  transition:
    border-color 160ms var(--ease-ui),
    box-shadow 160ms var(--ease-ui),
    background-color 160ms var(--ease-ui);
}

.nb-input::placeholder,
textarea::placeholder,
input::placeholder {
  color: var(--text-dim);
}

.nb-input:focus,
.nb-select:focus,
.nb-widget input:focus,
.nb-widget textarea:focus,
.nb-widget select:focus {
  border-color: var(--line-accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.07);
}

.nb-widget form {
  display: flex;
  gap: 7px;
}

.nb-widget input[type="submit"],
.nb-widget button[type="submit"] {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line-accent);
  border-radius: var(--radius-control);
  background: rgba(var(--accent-rgb), 0.1);
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 750;
  cursor: pointer;
}

/* ---------- Article reader ---------- */
.nb-article {
  min-width: 0;
}

.nb-article-header {
  position: relative;
  overflow: hidden;
  margin-bottom: 24px;
  padding: clamp(38px, 6vw, 72px);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-shell);
  background:
    linear-gradient(120deg, rgba(var(--accent-rgb), 0.075), transparent 42%),
    var(--glass);
  box-shadow: var(--shadow-panel), var(--shadow-inner);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
}

.nb-article-header::before {
  position: absolute;
  top: 20px;
  right: 25px;
  color: rgba(var(--accent-rgb), 0.1);
  font-family: var(--font-mono);
  font-size: clamp(3.8rem, 9vw, 8rem);
  font-weight: 900;
  line-height: 1;
  content: "</>";
  pointer-events: none;
}

.nb-article-path,
.nb-article-meta {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 16px;
  gap: 8px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.68rem;
}

.nb-article-title {
  position: relative;
  z-index: 1;
  max-width: 950px;
  margin: 0;
  color: var(--text);
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 760;
  line-height: 1.12;
  letter-spacing: -0.05em;
  text-wrap: balance;
}

.nb-article-info {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 25px;
  gap: 14px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

.nb-article-info-left {
  display: flex;
  flex-wrap: wrap;
  gap: 9px 16px;
}

.nb-article-info a {
  color: var(--text-soft);
}

.nb-article-cover {
  position: relative;
  z-index: 1;
  margin: 34px -18px -18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.nb-article-cover img {
  width: 100%;
  max-height: 600px;
  object-fit: cover;
}

.nb-article-layout {
  display: grid;
  grid-template-columns: minmax(0, 820px) 240px;
  justify-content: center;
  align-items: start;
  gap: 24px;
}

.nb-article-main {
  min-width: 0;
}

.nb-markdown,
.markdown.nb-markdown {
  position: relative;
  overflow: hidden;
  padding: clamp(28px, 5vw, 58px);
  border: 1px solid var(--line);
  border-radius: var(--radius-shell);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: var(--shadow-inner);
}

.nb-markdown::before {
  position: absolute;
  top: 0;
  left: clamp(28px, 5vw, 58px);
  width: 72px;
  height: 2px;
  background: var(--accent);
  content: "";
}

.nb-article-tags {
  display: flex;
  flex-wrap: wrap;
  margin-top: 14px;
  padding: 16px 18px;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--glass);
}

.nb-toc-wrap {
  position: sticky;
  top: calc(var(--header-h) + 18px);
}

.nb-toc {
  max-height: calc(100dvh - var(--header-h) - 40px);
  padding: 17px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--glass);
  box-shadow: var(--shadow-inner);
  -webkit-backdrop-filter: blur(15px);
  backdrop-filter: blur(15px);
  scrollbar-width: thin;
}

.nb-toc-title {
  display: flex;
  align-items: center;
  margin: 0 0 12px;
  gap: 8px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 800;
}

.nb-toc-title::before {
  color: var(--accent-strong);
  content: "#";
}

.nb-toc-list {
  display: grid;
  gap: 2px;
}

.nb-toc-list a {
  position: relative;
  display: -webkit-box;
  overflow: hidden;
  padding: 6px 8px 6px 12px;
  border-left: 1px solid var(--line);
  color: var(--text-dim);
  font-size: 0.7rem;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.nb-toc-list a:hover {
  color: var(--text);
}

.nb-toc-list a.is-active {
  border-left-color: var(--accent);
  background: linear-gradient(90deg, rgba(var(--accent-rgb), 0.09), transparent);
  color: var(--accent-strong);
}

.nb-toc-list .toc-h3 {
  padding-left: 22px;
}

.nb-toc-list .toc-h4 {
  padding-left: 32px;
  font-size: 0.65rem;
}

.nb-neighbor {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 14px;
  gap: 12px;
}

.nb-neighbor:empty {
  display: none;
}

.prev-log,
.next-log {
  min-width: 0;
}

.next-log {
  text-align: right;
}

.neighbor-link {
  display: flex;
  flex-direction: column;
  min-height: 92px;
  padding: 16px 18px;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--glass);
}

.neighbor-link:hover {
  border-color: var(--line-accent);
  background: rgba(var(--accent-rgb), 0.045);
}

.neighbor-dir {
  color: var(--accent-strong);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 750;
}

.neighbor-title {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text-soft);
  font-size: 0.8rem;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

/* ---------- Comments / forms ---------- */
.nb-comments {
  margin-top: 28px;
}

.nb-comment-post,
.commentform,
#commentform {
  padding: 19px;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--glass);
  box-shadow: var(--shadow-inner);
}

.nb-comment-form {
  display: grid;
  gap: 12px;
}

.nb-comment-form textarea,
#comment {
  min-height: 148px;
  padding: 14px 15px;
  resize: vertical;
  line-height: 1.7;
}

.nb-field,
.nb-field-group {
  display: grid;
  gap: 6px;
}

.nb-field-label,
.nb-comment-form label {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
}

#comment-info.comment-info {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.captcha-container {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 9px;
}

.captcha-container img,
#captcha {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

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

.cancel-reply,
#cancel-reply,
.com-reply,
.comment-replay-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--glass-soft);
  color: var(--text-dim);
  font-size: 0.68rem;
  cursor: pointer;
}

#cancel-reply {
  display: none;
}

.com-reply:hover,
.comment-replay-btn:hover,
#cancel-reply:hover {
  border-color: var(--line-accent);
  color: var(--accent-strong);
}

.nb-comment-header {
  margin: 30px 0 13px;
  color: var(--text);
  font-size: 0.98rem;
}

.nb-comment-login {
  display: flex;
  align-items: center;
  padding: 18px;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--glass);
}

.nb-comment-login > span {
  color: var(--accent-strong);
  font-family: var(--font-mono);
  font-weight: 800;
}

.nb-comment-login p {
  flex: 1;
  margin: 0;
  color: var(--text-soft);
  font-size: 0.82rem;
}

.nb-comment-header b {
  font-weight: 720;
}

.nb-comment {
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: start;
  margin-top: 12px;
  gap: 12px;
}

.nb-comment > .avatar img {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  object-fit: cover;
}

.comment-infos {
  min-width: 0;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--glass);
}

.comment-infos > b {
  color: var(--text);
  font-size: 0.78rem;
}

.comment-time {
  margin-left: 7px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.59rem;
}

.comment-content {
  margin-top: 8px;
  overflow-wrap: anywhere;
  color: var(--text-soft);
  font-size: 0.8rem;
  line-height: 1.7;
}

.comment-content p {
  margin: 0.5em 0;
}

.comment-reply {
  margin-top: 9px;
}

.comment-children {
  grid-column: 2 / -1;
  margin-left: 10px;
}

.comment-children::before {
  position: absolute;
  top: -12px;
  left: -25px;
  width: 20px;
  height: 34px;
  border-bottom: 1px solid var(--line);
  border-left: 1px solid var(--line);
  border-radius: 0 0 0 10px;
  content: "";
}

/* ---------- Pagination ---------- */
.nb-pagination,
.pagination,
#pagenavi {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 20px;
  gap: 7px;
}

.nb-pagination a,
.nb-pagination span,
.pagination a,
.pagination span,
#pagenavi a,
#pagenavi span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 42px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--glass);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 730;
}

.nb-pagination a:hover,
.pagination a:hover,
#pagenavi a:hover {
  border-color: var(--line-accent);
  color: var(--accent-strong);
}

.nb-pagination span,
.pagination span,
#pagenavi span {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--text-inverse);
}

/* ---------- Empty / error / password ---------- */
.nb-empty,
.nb-error {
  padding: clamp(42px, 8vw, 82px) 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-shell);
  background: var(--glass);
  text-align: center;
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
}

.nb-code-line {
  margin: 0 0 6px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.c-g {
  margin-right: 6px;
  color: var(--accent-strong);
}

.c-cmt {
  color: var(--code-comment);
}

.nb-empty-icon,
.nb-error-code {
  margin-bottom: 10px;
  color: var(--accent-strong);
  font-family: var(--font-mono);
  font-size: clamp(2.2rem, 7vw, 4.8rem);
  font-weight: 850;
  letter-spacing: -0.07em;
  line-height: 1;
}

.nb-empty h3,
.nb-error h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.35rem, 3vw, 2rem);
}

.nb-empty p,
.nb-error p {
  margin: 10px auto 0;
  color: var(--text-dim);
}

.nb-error-page {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px;
  place-items: center;
}

.nb-error {
  width: min(680px, 100%);
  border-style: solid;
  box-shadow: var(--shadow-float), var(--shadow-inner);
}

.nb-error-shell {
  width: min(680px, 100%);
}

.nb-error.nb-window {
  width: 100%;
  padding: 0;
  overflow: hidden;
  border-style: solid;
}

.nb-error-body {
  padding: clamp(42px, 8vw, 76px) 24px;
  text-align: center;
}

.nb-error-actions {
  display: flex;
  justify-content: center;
  margin-top: 24px;
  gap: 10px;
}

.nb-pw-form {
  display: grid;
  width: min(380px, 100%);
  margin: 24px auto 0;
  gap: 12px;
  text-align: left;
}

/* ---------- Footer / status bar / float ---------- */
.nb-footer {
  margin-top: 18px;
  padding: 0 0 28px;
}

.nb-footer-inner,
.nb-footer-shell {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--glass);
  box-shadow: var(--shadow-inner);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.nb-footer-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 25px 28px;
  gap: 22px;
}

.nb-footer-brand strong {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.86rem;
}

.nb-footer-brand p {
  max-width: 520px;
  margin: 6px 0 0;
  color: var(--text-dim);
  font-size: 0.75rem;
}

.nb-footer-meta {
  color: var(--text-dim);
  font-size: 0.72rem;
  text-align: right;
}

.nb-footer-meta a {
  color: var(--text-soft);
}

.nb-footer-copy {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 0.62rem;
}

.nb-footer-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 35px;
  padding: 0 13px;
  border-top: 1px solid var(--line);
  background: rgba(var(--accent-rgb), 0.055);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.6rem;
}

.nb-footer-status > span,
.nb-status-left,
.nb-status-right {
  display: inline-flex;
  align-items: center;
  gap: 11px;
}

.nb-status-live {
  color: var(--accent-strong);
}

.nb-float {
  position: fixed;
  z-index: 250;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  display: grid;
  gap: 8px;
}

.nb-float-btn {
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--glass-strong);
  box-shadow: var(--shadow-panel), var(--shadow-inner);
  color: var(--text-soft);
  cursor: pointer;
  place-items: center;
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
}

.nb-float-btn:hover {
  border-color: var(--line-accent);
  color: var(--accent-strong);
  transform: translateY(-2px);
}

/* ---------- Code copy ---------- */
.nb-markdown pre,
.markdown pre {
  position: relative;
}

.nb-copy-code {
  position: absolute;
  z-index: 2;
  top: 9px;
  right: 9px;
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid rgba(225, 255, 233, 0.12);
  border-radius: 7px;
  background: rgba(3, 9, 6, 0.7);
  color: #83978b;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  cursor: pointer;
  opacity: 0;
  transition:
    opacity 160ms var(--ease-ui),
    color 160ms var(--ease-ui),
    border-color 160ms var(--ease-ui);
}

pre:hover > .nb-copy-code,
.nb-copy-code:focus-visible {
  opacity: 1;
}

.nb-copy-code.is-copied {
  border-color: rgba(var(--accent-rgb), 0.4);
  color: var(--accent);
}

/* ---------- Reveal ---------- */
.reveal {
  opacity: 1;
  transform: none;
}

html.js .reveal:not(.is-inview) {
  opacity: 0;
  transform: translateY(14px);
}

html.js .reveal.is-inview {
  animation: nb-reveal 480ms var(--ease) both;
  animation-delay: calc(var(--entry-order, 0) * 32ms);
}

@keyframes nb-reveal {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- Interaction-capable hover ---------- */
@media (hover: hover) and (pointer: fine) {
  .nb-card:hover {
    z-index: 1;
    background: rgba(var(--accent-rgb), 0.038);
  }

  .nb-card:hover .nb-card-cover img {
    filter: saturate(1) contrast(1.02);
    transform: scale(1.035);
  }

  .nb-card:hover .nb-ln {
    color: var(--accent-strong);
  }

  .side-cover-image:hover img,
  .nb-side-cover:hover img {
    transform: scale(1.04);
  }
}

/* ---------- Responsive ---------- */
@media (max-width: 1160px) {
  :root {
    --sidebar-w: 280px;
  }

  .nb-hero-grid {
    grid-template-columns: minmax(0, 1fr) minmax(285px, 0.78fr);
  }

  .nb-hero-copy {
    padding-inline: 42px 32px;
  }

  .nb-editor {
    margin-right: 22px;
  }

  .nb-card-signals {
    display: none;
  }
}

@media (max-width: 1020px) {
  .nb-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .nb-sidebar {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: none;
    padding: 7px 18px;
    gap: 0 28px;
    overflow: visible;
  }

  .nb-widget:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .nb-article-layout {
    grid-template-columns: minmax(0, 820px);
  }

  .nb-toc-wrap {
    position: static;
    grid-row: 1;
  }

  .nb-toc {
    max-height: 260px;
  }
}

@media (max-width: 880px) {
  .nb-logo-text small {
    display: none;
  }

  .nb-search-trigger {
    min-width: 42px;
    width: 42px;
    padding: 0;
    justify-content: center;
  }

  .nb-search-trigger > span,
  .nb-search-trigger kbd {
    display: none;
  }

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

  .nb-hero-copy {
    padding: 44px;
  }

  .nb-editor {
    margin: 0 44px 44px;
    transform: none;
  }

  .nb-hero-title {
    max-width: 700px;
  }
}

@media (max-width: 820px) {
  .nb-menu-btn {
    display: inline-grid;
  }

  .nb-nav {
    position: fixed;
    z-index: 320;
    top: 0;
    right: 0;
    display: block;
    width: min(350px, 88vw);
    height: 100vh;
    height: 100dvh;
    padding: calc(86px + env(safe-area-inset-top)) 16px calc(20px + env(safe-area-inset-bottom));
    overflow: auto;
    overscroll-behavior: contain;
    visibility: hidden;
    border-left: 1px solid var(--line-strong);
    background: var(--glass-strong);
    box-shadow: var(--shadow-float);
    transform: translateX(102%);
    -webkit-backdrop-filter: var(--blur);
    backdrop-filter: var(--blur);
    transition:
      transform 240ms var(--ease),
      visibility 240ms var(--ease);
  }

  .nb-nav.is-open {
    visibility: visible;
    transform: none;
  }

  .nb-nav-list {
    display: grid;
    align-items: stretch;
    gap: 4px;
  }

  .nb-nav-list > .nb-nav-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
  }

  .nb-nav-link {
    min-height: 48px;
    padding-inline: 13px;
    font-size: 0.9rem;
  }

  .nb-nav-list > .nb-nav-item > .nb-nav-link:only-child {
    grid-column: 1 / -1;
  }

  .nb-submenu-toggle {
    width: 44px;
    height: 48px;
    margin: 0;
  }

  .nb-dropdown {
    position: static;
    grid-column: 1 / -1;
    display: none;
    min-width: 0;
    max-width: none;
    padding: 3px 0 7px 12px;
    visibility: visible;
    border: 0;
    border-left: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    opacity: 1;
    transform: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .nb-nav-item:hover > .nb-dropdown,
  .nb-nav-item:focus-within > .nb-dropdown {
    display: none;
  }

  .nb-nav-item.is-open > .nb-dropdown {
    display: grid;
  }

  .nb-dropdown .nb-nav-link {
    min-height: 42px;
    color: var(--text-dim);
  }
}

@media (max-width: 720px) {
  .nb-container {
    width: min(var(--max), calc(100% - 26px));
  }

  .nb-main {
    padding-top: 15px;
  }

  .nb-workbench,
  .nb-posts,
  .nb-article-header,
  .nb-markdown,
  .nb-context {
    border-radius: 18px;
  }

  .nb-workbench-bar {
    grid-template-columns: minmax(140px, auto) 1fr;
  }

  .nb-branch {
    display: none;
  }

  .nb-hero-copy {
    padding: 34px 26px;
  }

  .nb-hero-title {
    font-size: clamp(2.2rem, 11vw, 3.5rem);
  }

  .nb-editor {
    margin: 0 20px 24px;
  }

  .nb-hero-stats span:nth-child(2) {
    display: none;
  }

  .nb-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .nb-filter-wrap {
    width: 100%;
    justify-content: space-between;
  }

  .nb-filter button {
    min-height: 40px;
  }

  .nb-card,
  .nb-card.has-cover,
  .nb-card.is-featured.has-cover {
    grid-template-columns: minmax(0, 1fr);
  }

  .nb-card {
    min-height: 0;
  }

  .nb-card-cover {
    min-height: 0;
    aspect-ratio: 16 / 8.5;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nb-card-gutter {
    display: none;
  }

  .nb-card-body {
    padding: 21px 19px 18px;
  }

  .nb-card-signals {
    display: none;
  }

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

  .nb-widget:nth-last-child(2) {
    border-bottom: 1px solid var(--line);
  }

  .nb-article-header {
    padding: 36px 24px;
  }

  .nb-article-header::before {
    right: 12px;
    opacity: 0.55;
  }

  .nb-article-cover {
    margin: 27px 0 0;
  }

  .nb-article-title {
    font-size: clamp(1.9rem, 9vw, 3rem);
  }

  .nb-article-info {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .next-log {
    text-align: left;
  }

  .nb-comment {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 9px;
  }

  .nb-comment > .avatar img {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }

  .comment-children {
    grid-column: 1 / -1;
    margin-left: 22px;
  }

  .comment-children::before {
    display: none;
  }

  .nb-footer-main {
    flex-direction: column;
  }

  .nb-footer-meta {
    text-align: left;
  }
}

@media (max-width: 520px) {
  :root {
    --header-h: 70px;
  }

  .nb-header {
    padding-top: 7px;
  }

  .nb-header-inner {
    min-height: 51px;
    padding-left: 9px;
    gap: 8px;
  }

  .nb-logo-mark {
    width: 34px;
    height: 34px;
  }

  .nb-logo-text {
    max-width: 112px;
  }

  .nb-actions {
    gap: 4px;
  }

  .nb-icon-btn,
  .nb-search-trigger {
    width: 40px;
    min-width: 40px;
    height: 40px;
  }

  .nb-search-head {
    padding: 17px 16px 12px;
  }

  .nb-search-form {
    margin-inline: 10px;
  }

  .nb-search-form button span {
    display: none;
  }

  .nb-search-tip {
    padding-inline: 16px;
  }

  .nb-workbench-tab {
    padding-inline: 13px;
  }

  .nb-workbench-path {
    padding-inline: 11px;
    text-align: right;
  }

  .nb-hero-copy {
    padding: 31px 20px;
  }

  .nb-hero-description {
    font-size: 0.92rem;
  }

  .nb-hero-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .nb-btn {
    padding-inline: 12px;
  }

  .nb-editor {
    margin-inline: 12px;
  }

  .nb-code-row {
    grid-template-columns: 39px minmax(0, 1fr);
  }

  .nb-context {
    padding: 27px 22px;
  }

  .nb-filter-label {
    display: none;
  }

  .nb-filter {
    width: 100%;
  }

  .nb-filter button {
    flex: 1;
  }

  .nb-card-foot {
    align-items: flex-end;
  }

  .nb-card-more span {
    display: none;
  }

  .nb-markdown,
  .markdown.nb-markdown {
    padding: 26px 19px;
  }

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

  .nb-comment-post {
    padding: 14px;
  }

  .nb-footer-main {
    padding: 22px 19px;
  }

  .nb-footer-status {
    overflow: hidden;
  }

  .nb-status-right {
    display: none;
  }

  .nb-float {
    right: max(11px, env(safe-area-inset-right));
    bottom: max(11px, env(safe-area-inset-bottom));
  }
}

@media (hover: none) {
  .nb-copy-code {
    opacity: 1;
  }
}

/* ---------- Graceful degradation / user preferences ---------- */
@supports not ((-webkit-backdrop-filter: blur(2px)) or (backdrop-filter: blur(2px))) {
  .nb-header-shell,
  .nb-search-panel,
  .nb-workbench,
  .nb-posts,
  .nb-sidebar,
  .nb-article-header,
  .nb-toc,
  .nb-footer-inner,
  .nb-footer-shell,
  .nb-float-btn {
    background: var(--surface);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html.js .reveal:not(.is-inview) {
    opacity: 1;
    transform: none;
  }
}

@media (forced-colors: active) {
  .nb-header-shell,
  .nb-workbench,
  .nb-posts,
  .nb-sidebar,
  .nb-article-header,
  .nb-markdown,
  .nb-toc,
  .nb-widget {
    border: 1px solid CanvasText;
  }

  .nb-bg,
  .nb-progress {
    display: none;
  }
}
