/* ============================================================
   简易笔记 · 现代卡片风格
   ============================================================ */
:root {
  color-scheme: light dark;
  --bg: #f3f3f8;
  --mesh-1: rgba(139, 92, 246, .20);
  --mesh-2: rgba(56, 189, 248, .17);
  --mesh-3: rgba(244, 114, 182, .13);
  --glass: rgba(255, 255, 255, .64);
  --glass-strong: rgba(255, 255, 255, .86);
  --glass-border: rgba(255, 255, 255, .8);
  --card: #ffffff;
  --card-2: #f5f5fa;
  --line: rgba(20, 20, 50, .07);
  --line-2: rgba(20, 20, 50, .12);
  --text: #1c1c22;
  --muted: #6b6b78;
  --faint: #9d9daa;
  --accent: #6457f9;
  --accent-soft: rgba(100, 87, 249, .10);
  --grad: linear-gradient(135deg, #a855f7 0%, #6366f1 50%, #3b82f6 100%);
  --grad-glow: 0 8px 20px -8px rgba(99, 102, 241, .65);
  --danger: #e5484d;
  --danger-soft: rgba(229, 72, 77, .10);
  --ok: #1f9d6a;
  --mark: rgba(250, 204, 21, .42);
  --shadow-sm: 0 1px 2px rgba(20, 20, 60, .05);
  --shadow: 0 1px 2px rgba(20, 20, 60, .04), 0 12px 32px -16px rgba(40, 40, 110, .22);
  --shadow-lg: 0 2px 4px rgba(20, 20, 60, .04), 0 24px 56px -20px rgba(40, 40, 110, .32);
  --r: 14px;
  --r-lg: 20px;
  --r-xl: 26px;
  --blur: saturate(180%) blur(22px);
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0b11;
    --mesh-1: rgba(124, 58, 237, .24);
    --mesh-2: rgba(37, 99, 235, .18);
    --mesh-3: rgba(219, 39, 119, .12);
    --glass: rgba(26, 26, 36, .62);
    --glass-strong: rgba(30, 30, 42, .9);
    --glass-border: rgba(255, 255, 255, .08);
    --card: #15151d;
    --card-2: #1d1d28;
    --line: rgba(255, 255, 255, .07);
    --line-2: rgba(255, 255, 255, .12);
    --text: #f1f1f6;
    --muted: #a3a3b2;
    --faint: #6e6e7e;
    --accent: #9b8cff;
    --accent-soft: rgba(155, 140, 255, .14);
    --danger: #ff6b6f;
    --danger-soft: rgba(255, 107, 111, .12);
    --ok: #4ade80;
    --mark: rgba(202, 138, 4, .45);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: inset 0 1px 0 rgba(255, 255, 255, .03), 0 14px 32px -18px rgba(0, 0, 0, .8);
    --shadow-lg: inset 0 1px 0 rgba(255, 255, 255, .04), 0 26px 56px -20px rgba(0, 0, 0, .9);
  }
}

/* ---------- 基础 ---------- */
* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
/* 柔和的彩色渐变背景，透过毛玻璃显出来 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(55vw 45vh at 0% 0%, var(--mesh-1), transparent 70%),
    radial-gradient(45vw 40vh at 100% 5%, var(--mesh-2), transparent 70%),
    radial-gradient(60vw 45vh at 70% 105%, var(--mesh-3), transparent 70%);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a, button, summary, select, label { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
input, select, textarea, button { font: inherit; color: inherit; }
code, pre { font-family: var(--mono); }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.narrow-only { display: none !important; }
::selection { background: rgba(99, 102, 241, .25); }

svg.i { flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg.i[fill] { fill: currentColor; stroke: none; }

.logo {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 32px; height: 32px; border-radius: 10px;
  background: var(--grad); color: #fff; box-shadow: var(--grad-glow);
}
.logo.sm { width: 28px; height: 28px; border-radius: 9px; }
.logo.big { width: 64px; height: 64px; border-radius: 20px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 16px;
  border: 1px solid var(--line-2); border-radius: 12px;
  background: var(--card); color: var(--text);
  font-size: 14px; font-weight: 550; white-space: nowrap;
  cursor: pointer; text-decoration: none !important;
  box-shadow: var(--shadow-sm);
  transition: transform .15s var(--ease), box-shadow .2s, background .2s, filter .2s;
}
.btn:hover { background: var(--card-2); }
.btn:active { transform: scale(.97); }
.btn-grad, .btn-grad:hover { border-color: transparent; background: var(--grad); color: #fff; box-shadow: var(--grad-glow); }
.btn-grad:hover { filter: brightness(1.07) saturate(1.1); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn.block { width: 100%; height: 46px; font-size: 15px; border-radius: 14px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 38px; height: 38px; padding: 0;
  border: 0; border-radius: 12px; background: transparent; color: var(--muted);
  cursor: pointer; text-decoration: none !important;
  transition: background .2s, color .2s;
}
.icon-btn:hover { background: var(--accent-soft); color: var(--accent); }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }

/* ---------- 表单 ---------- */
input[type=text], input[type=search], input[type=password], input:not([type]), select {
  height: 40px; padding: 0 12px;
  border: 1px solid var(--line-2); border-radius: 12px;
  background: var(--card); color: var(--text); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus-visible, select:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.form label { display: block; margin-bottom: 14px; color: var(--muted); font-size: 13.5px; font-weight: 500; }
.form label input { display: block; width: 100%; margin-top: 6px; }

/* ---------- 提示 ---------- */
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  margin: 0 0 18px; padding: 12px 16px;
  border-radius: var(--r); border: 1px solid var(--glass-border);
  background: var(--glass); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--shadow-sm); font-size: 14px;
}
.alert .i { margin-top: 2px; }
.alert.ok { color: var(--ok); }
.alert.err { color: var(--danger); }

/* ---------- 毛玻璃条（阅读页 / 编辑器顶栏） ---------- */
.bar {
  display: flex; align-items: center; gap: 8px;
  padding: 6px; border-radius: 18px;
  background: var(--glass); border: 1px solid var(--glass-border);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--shadow-sm);
}

/* ---------- 下拉菜单 ---------- */
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu[open] > summary { background: var(--accent-soft); color: var(--accent); }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30;
  min-width: 170px; padding: 6px;
  border-radius: 16px; border: 1px solid var(--glass-border);
  background: var(--glass-strong); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--shadow-lg);
  animation: pop .16s var(--ease);
}
.menu-list form { margin: 0; }
.menu-list a, .menu-list button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 12px; border: 0; border-radius: 10px;
  background: none; color: var(--text); font-size: 14px; text-align: left;
  cursor: pointer; text-decoration: none !important;
}
.menu-list .i { color: var(--muted); }
.menu-list a:hover, .menu-list button:hover { background: var(--accent-soft); }
.menu-list .danger, .menu-list .danger .i { color: var(--danger); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }

/* ---------- 整体布局 ---------- */
.shell { display: grid; grid-template-columns: 272px minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }

.nav {
  position: sticky; top: 12px;
  display: flex; flex-direction: column; gap: 2px;
  height: calc(100vh - 24px); height: calc(100dvh - 24px);
  margin: 12px 0 12px 12px; padding: 16px 12px 12px;
  border-radius: var(--r-xl); border: 1px solid var(--glass-border);
  background: var(--glass); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--shadow);
}
.brand {
  display: flex; align-items: center; gap: 10px; min-width: 0;
  padding: 2px 6px 14px;
  color: var(--text); font-size: 17px; font-weight: 700; letter-spacing: -.01em;
  text-decoration: none !important;
}
.brand span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.search { position: relative; margin: 0 0 12px; }
.search .i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search input { width: 100%; height: 40px; padding-left: 36px; background: var(--glass-strong); border-color: var(--line); }

.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-tags { flex: 1; min-height: 0; overflow-y: auto; margin: 0 -4px; padding: 0 4px; scrollbar-width: thin; }
.nav-label { padding: 16px 10px 6px; color: var(--faint); font-size: 12px; font-weight: 600; letter-spacing: .06em; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 38px; padding: 0 10px;
  border: 0; border-radius: 11px; background: none;
  color: var(--text); font-size: 14px; text-align: left; cursor: pointer;
  text-decoration: none !important; transition: background .15s;
}
.nav-item span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item em { font-style: normal; font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.nav-item .i { color: var(--muted); }
.nav-item .hash { flex: none; width: 18px; color: var(--faint); font-weight: 700; text-align: center; }
.nav-item:hover { background: var(--accent-soft); }
.nav-item.active { background: var(--card); box-shadow: var(--shadow-sm); font-weight: 600; }
.nav-item.active .i, .nav-item.active .hash { color: var(--accent); }
.nav-foot { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); }
.nav-foot form { margin: 0; }

.main { min-width: 0; padding: 26px 36px 80px; }

/* ---------- 列表页 ---------- */
.list-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 8px 2px 24px; }
.list-head h1 { margin: 0; font-size: 30px; line-height: 1.2; font-weight: 750; letter-spacing: -.025em; word-break: break-word; }
.list-head p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.list-head form { margin: 0; }
.head-with-back { display: flex; align-items: center; gap: 8px; min-width: 0; }

.section-label { display: flex; align-items: center; gap: 6px; margin: 4px 2px 12px; color: var(--muted); font-size: 13px; font-weight: 600; letter-spacing: .02em; }
.section-label .i { color: var(--accent); }

.cards { columns: 250px; column-gap: 16px; margin-bottom: 18px; }
.card-note {
  display: block; break-inside: avoid; -webkit-column-break-inside: avoid; margin: 0 0 16px;
  border-radius: var(--r-lg); border: 1px solid var(--line);
  background: var(--card); color: var(--text); box-shadow: var(--shadow);
  overflow: hidden; text-decoration: none !important;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.card-note:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.card-note:active { transform: scale(.985); }
.cn-cover { aspect-ratio: 16 / 10; background: var(--card-2); overflow: hidden; }
.cn-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cn-body { padding: 16px 18px 14px; }
.cn-title { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 6px; font-size: 16px; font-weight: 650; line-height: 1.4; letter-spacing: -.01em; }
.cn-title span { flex: 1; min-width: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.cn-pin { display: inline-flex; color: var(--accent); margin-top: 3px; }
.cn-excerpt {
  margin: 0 0 14px; color: var(--muted); font-size: 14px; line-height: 1.65; word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden;
}
.has-cover .cn-excerpt { -webkit-line-clamp: 3; }
.cn-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--faint); font-size: 12px; }
.cn-time { margin-right: auto; }

.chip {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 9px;
  border-radius: 999px; background: var(--accent-soft); color: var(--accent);
  font-size: 12px; font-weight: 550; white-space: nowrap; text-decoration: none !important;
}
.chip.gray { background: var(--card-2); color: var(--muted); }
a.chip:hover { filter: brightness(.96); }

.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 72px 20px; color: var(--muted); }
.empty-state .logo { margin-bottom: 18px; }
.empty-state h2 { margin: 0 0 6px; color: var(--text); font-size: 19px; font-weight: 650; }
.empty-state p { margin: 0 0 20px; }

.fab, .m-head { display: none; }

/* ---------- 阅读页 ---------- */
.reader { max-width: 860px; margin: 0 auto; }
.reader .bar { position: sticky; top: 12px; z-index: 10; margin-bottom: 18px; }
.crumb { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; color: var(--faint); font-size: 14px; white-space: nowrap; overflow: hidden; }
.crumb a { color: var(--muted); }
.crumb span:last-child { color: var(--text); font-weight: 550; overflow: hidden; text-overflow: ellipsis; }
.actions { display: flex; align-items: center; gap: 6px; }
.actions form { margin: 0; }
.paper {
  padding: 48px 60px 40px;
  border-radius: var(--r-xl); border: 1px solid var(--line);
  background: var(--card); box-shadow: var(--shadow);
}
.note-title { margin: 0 0 14px; font-size: 34px; line-height: 1.25; font-weight: 760; letter-spacing: -.025em; word-break: break-word; }
.note-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-bottom: 30px; padding-bottom: 22px; border-bottom: 1px solid var(--line);
  color: var(--faint); font-size: 13px;
}
.meta-item { display: inline-flex; align-items: center; gap: 5px; margin-right: 4px; }
.paper-foot { margin: 40px 0 0; padding-top: 16px; border-top: 1px solid var(--line); color: var(--faint); font-size: 12.5px; }

/* ---------- 正文排版 ---------- */
.content { font-size: 16px; line-height: 1.8; word-wrap: break-word; overflow-wrap: anywhere; }
.content > :first-child { margin-top: 0; }
.content h1, .content h2, .content h3, .content h4, .content h5, .content h6 { margin: 1.6em 0 .6em; line-height: 1.35; font-weight: 700; letter-spacing: -.015em; }
.content h1 { font-size: 1.75em; }
.content h2 { font-size: 1.4em; }
.content h3 { font-size: 1.18em; }
.content p { margin: 0 0 1.05em; }
.content a { text-decoration: underline; text-decoration-color: rgba(100, 87, 249, .35); text-underline-offset: 3px; }
.content img { max-width: 100%; height: auto; border-radius: 14px; box-shadow: var(--shadow-sm); }
.content blockquote {
  margin: 0 0 1.1em; padding: 12px 18px;
  border-left: 3px solid var(--accent); border-radius: 4px 14px 14px 4px;
  background: var(--card-2); color: var(--muted);
}
.content blockquote > :last-child { margin-bottom: 0; }
.content blockquote cite { display: block; margin-bottom: 4px; color: var(--text); font-size: 13px; font-style: normal; font-weight: 600; }
.content code { padding: .15em .4em; border-radius: 6px; background: var(--card-2); color: var(--accent); font-size: .88em; }
.content pre { margin: 0 0 1.1em; padding: 16px 18px; border-radius: 14px; border: 1px solid var(--line); background: var(--card-2); overflow-x: auto; line-height: 1.6; }
.content pre code { padding: 0; background: none; color: var(--text); font-size: 13.5px; }
.content ul, .content ol { margin: 0 0 1.05em; padding-left: 1.6em; }
.content li { margin: .2em 0; }
.content li > ul, .content li > ol { margin-bottom: 0; }
.content li::marker { color: var(--accent); }
.content ul.task-list { list-style: none; padding-left: .2em; }
.content .task-item { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 0 10px; }
.content .task-item > input { flex: none; width: 18px; height: 18px; margin: .3em 0 0; accent-color: var(--accent); }
.content .task-item > ul, .content .task-item > ol { flex-basis: 100%; }
.content .task-item:has(> input:checked) { color: var(--faint); text-decoration: line-through; text-decoration-color: var(--line-2); }
.content input.task:not([disabled]) { cursor: pointer; }
.content hr { height: 1px; margin: 2em 0; border: 0; background: var(--line-2); }
.content mark { padding: 0 3px; border-radius: 4px; background: var(--mark); color: inherit; }
.content .table-wrap { margin: 0 0 1.1em; overflow-x: auto; border-radius: 14px; border: 1px solid var(--line); }
.content table { width: 100%; border-collapse: collapse; font-size: 15px; }
.content th, .content td { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; }
.content tr:last-child td { border-bottom: 0; }
.content th { background: var(--card-2); font-weight: 600; }
.content .al-left, .content .align-left { text-align: left; }
.content .al-center, .content .align-center { text-align: center; }
.content .al-right, .content .align-right { text-align: right; }
.content .align-justify { text-align: justify; }
.content .indent { padding-left: 2em; }
.content details { margin: 0 0 1.1em; padding: 12px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--card-2); }
.content summary { color: var(--muted); font-weight: 550; cursor: pointer; }
.content details[open] summary { margin-bottom: 8px; }
.content pre.code-note { font-size: 13.5px; }

/* ---------- 回收站 / 设置 ---------- */
.panel {
  padding: 22px 24px; border-radius: var(--r-xl); border: 1px solid var(--line);
  background: var(--card); box-shadow: var(--shadow);
}
.panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.panel h2 { margin: 0; font-size: 17px; font-weight: 650; }
.panel p { margin: 0 0 16px; font-size: 14px; }
.panel code { padding: 1px 6px; border-radius: 6px; background: var(--card-2); font-size: 12.5px; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; max-width: 980px; }
.span-2 { grid-column: span 2; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 4px 0 18px; }
.stats div { padding: 14px 16px; border-radius: 16px; background: var(--card-2); }
.stats dt { color: var(--muted); font-size: 12.5px; }
.stats dd { margin: 4px 0 0; font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.stats small { font-size: 13px; font-weight: 500; color: var(--muted); }
table.info { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.info th { width: 90px; padding: 7px 0; color: var(--muted); font-weight: 500; text-align: left; vertical-align: top; }
table.info td { padding: 7px 0; word-break: break-all; }

.list-panel { max-width: 860px; padding: 6px; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 16px; }
.row + .row { border-top: 1px solid var(--line); }
.row-main { flex: 1; min-width: 0; color: var(--text); text-decoration: none !important; }
.row-main strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.row-main span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--faint); font-size: 13px; }
.row-actions { display: flex; align-items: center; gap: 4px; }
.row-actions form { margin: 0; }

/* ---------- 登录 / 提示页 ---------- */
.center-page { display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  width: 100%; max-width: 380px; padding: 36px 30px 30px;
  border-radius: 28px; border: 1px solid var(--glass-border);
  background: var(--glass); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--shadow-lg); text-align: center;
}
.auth-card .logo { margin-bottom: 4px; }
.auth-card h1 { margin: 0; font-size: 24px; font-weight: 750; letter-spacing: -.02em; }
.auth-card p.muted { margin: -4px 0 8px; font-size: 14px; }
.auth-card .alert { width: 100%; margin: 0; }
.auth-input { width: 100%; height: 46px !important; border-radius: 14px !important; font-size: 15px; background: var(--glass-strong) !important; }
.auth-card .btn { margin-top: 4px; }

/* ---------- 编辑器 ---------- */
.editor-page { overflow: hidden; }
.editor { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.ed-bar { flex: none; margin: 12px 12px 0; }
.ed-crumb { color: var(--muted); font-size: 14px; font-weight: 550; }
.ed-status { margin-left: auto; color: var(--faint); font-size: 13px; white-space: nowrap; }
.ed-status.ok { color: var(--ok); }
.ed-status.err { color: var(--danger); }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--card-2); border: 1px solid var(--line); }
.seg button { height: 30px; padding: 0 13px; border: 0; border-radius: 9px; background: none; color: var(--muted); font-size: 13px; font-weight: 550; cursor: pointer; transition: background .15s, color .15s; }
.seg button.active { background: var(--card); color: var(--text); box-shadow: var(--shadow-sm); }

.ed-head { flex: none; padding: 22px max(28px, calc((100% - 860px) / 2)) 4px; }
.ed-title-row { display: flex; align-items: center; gap: 8px; }
.ed-title {
  flex: 1; min-width: 0; height: auto !important; padding: 0 !important;
  border: 0 !important; background: transparent !important; box-shadow: none !important;
  font-size: 30px; font-weight: 760; letter-spacing: -.025em; color: var(--text);
}
.ed-title::placeholder { color: var(--faint); }
.ed-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.pill-field {
  position: relative; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--glass-strong);
  color: var(--muted); font-size: 13px; cursor: pointer;
}
.pill-field select, .pill-field input:not([type=checkbox]) {
  height: 100%; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none !important;
  color: var(--text); font-size: 13px; outline: none;
}
.pill-field select { padding-right: 2px; cursor: pointer; }
.pill-field.tags { flex: 1; min-width: 200px; max-width: 420px; cursor: text; }
.pill-field.tags input { flex: 1; min-width: 0; }
.pill-field.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.pill-field.toggle:has(input:checked) { border-color: transparent; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.pill-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

.ed-toolbar {
  flex: none; align-self: center; display: flex; flex-wrap: wrap; justify-content: center; gap: 2px;
  max-width: calc(100% - 24px); margin: 12px auto 8px; padding: 4px;
  border-radius: 14px; border: 1px solid var(--glass-border);
  background: var(--glass); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--shadow-sm);
}
.ed-toolbar:empty, .editor.is-preview .ed-toolbar { display: none; }
.ed-toolbar button {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  min-width: 34px; height: 32px; padding: 0 8px;
  border: 0; border-radius: 9px; background: none; color: var(--muted);
  font-size: 13.5px; font-weight: 600; cursor: pointer; transition: background .15s, color .15s;
}
.ed-toolbar button:hover { background: var(--accent-soft); color: var(--accent); }
.ed-toolbar .tb-B { font-weight: 800; }
.ed-toolbar .tb-I { font-style: italic; font-family: Georgia, serif; }
.ed-toolbar .tb-U { text-decoration: underline; }
.ed-toolbar .tb-S { text-decoration: line-through; }
.ed-toolbar .tb-A { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 800; }
.ed-toolbar .sep { flex: none; width: 1px; margin: 7px 4px; background: var(--line-2); }

.ed-body {
  flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr;
  margin: 0 12px 12px; border-radius: var(--r-xl); border: 1px solid var(--line);
  background: var(--card); box-shadow: var(--shadow); overflow: hidden;
}
.ed-body textarea {
  width: 100%; height: 100%; padding: 28px 34px 80px; resize: none;
  border: 0; outline: none; background: transparent; color: var(--text);
  font: 16px/1.85 var(--sans); tab-size: 4;
}
.editor[data-format=code] .ed-body textarea, .editor[data-format=markdown] .ed-body textarea { font-family: var(--mono); font-size: 14.5px; }
.ed-body textarea::placeholder { color: var(--faint); }
.ed-preview { min-width: 0; padding: 28px 38px 80px; overflow-y: auto; border-left: 1px solid var(--line); }
.ed-body.mode-edit, .ed-body.mode-preview { grid-template-columns: 1fr; }
.ed-body.mode-edit .ed-preview, .ed-body.mode-preview textarea { display: none; }
.ed-body.mode-edit textarea { padding-inline: max(34px, calc((100% - 780px) / 2)); }
.ed-body.mode-preview .ed-preview { border-left: 0; padding-inline: max(38px, calc((100% - 780px) / 2)); }
.ed-body.dragover { outline: 2px dashed var(--accent); outline-offset: -10px; }

/* ============================================================
   平板：侧栏收窄
   ============================================================ */
@media (max-width: 1100px) and (min-width: 761px) {
  .shell { grid-template-columns: 232px minmax(0, 1fr); }
  .main { padding: 22px 24px 60px; }
  .paper { padding: 36px 36px 32px; }
  .settings-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
}

/* ============================================================
   手机
   ============================================================ */
@media (max-width: 760px) {
  .wide-only { display: none !important; }
  .narrow-only { display: inline-flex !important; }
  /* iOS 输入框字号小于 16px 时会自动放大页面 */
  input[type=text], input[type=search], input[type=password], input:not([type]), select, textarea { font-size: 16px !important; }

  .shell { display: block; }
  .nav { display: none; }
  .main { padding: 0 calc(14px + env(safe-area-inset-right)) calc(110px + env(safe-area-inset-bottom)) calc(14px + env(safe-area-inset-left)); }

  /* 列表页顶部 */
  .m-head {
    display: block; position: sticky; top: 0; z-index: 10;
    margin: 0 -14px 6px; padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
    background: var(--glass); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
    border-bottom: 1px solid var(--line);
  }
  .m-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
  .m-head .brand { padding: 0; font-size: 20px; }
  .m-head .search { margin: 0 0 10px; }
  .m-head .search input { height: 42px; border-radius: 14px; }
  .chips { display: flex; gap: 8px; margin: 0 -14px; padding: 0 14px; overflow-x: auto; scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chip-tab {
    flex: none; display: inline-flex; align-items: center; height: 32px; padding: 0 14px;
    border-radius: 999px; border: 1px solid var(--line); background: var(--glass-strong);
    color: var(--muted); font-size: 14px; font-weight: 550; text-decoration: none !important;
  }
  .chip-tab.active { border-color: transparent; background: var(--grad); color: #fff; box-shadow: var(--grad-glow); }

  .list-head { margin: 16px 2px 14px; }
  .list-head h1 { font-size: 24px; }
  .list-head p { font-size: 13px; }
  .main > .alert { margin-top: 12px; }

  .cards { columns: 2; column-gap: 10px; }
  .card-note { margin-bottom: 10px; border-radius: 18px; }
  .cn-body { padding: 13px 14px 12px; }
  .cn-title { font-size: 15px; }
  .cn-excerpt { font-size: 13px; -webkit-line-clamp: 7; margin-bottom: 10px; }
  .has-cover .cn-excerpt { -webkit-line-clamp: 3; }
  .cn-foot .chip { height: 20px; padding: 0 7px; font-size: 11px; }
  .cn-foot .chip:nth-of-type(n+2) { display: none; }

  .fab {
    display: flex; align-items: center; justify-content: center;
    position: fixed; right: calc(20px + env(safe-area-inset-right)); bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 20;
    width: 58px; height: 58px; border-radius: 20px;
    background: var(--grad); color: #fff; box-shadow: 0 12px 28px -8px rgba(99, 102, 241, .7);
    text-decoration: none !important; transition: transform .15s var(--ease);
  }
  .fab:active { transform: scale(.93); }

  /* 阅读页 */
  .reader .bar { top: calc(8px + env(safe-area-inset-top)); margin: calc(8px + env(safe-area-inset-top)) 0 12px; }
  .crumb { visibility: hidden; }
  .paper { margin: 0 -4px; padding: 26px 20px 24px; border-radius: 24px; }
  .note-title { font-size: 25px; }
  .note-meta { margin-bottom: 22px; padding-bottom: 16px; }
  .content { font-size: 16.5px; }
  .content pre code { font-size: 13px; }
  .paper-foot { margin-top: 28px; }

  /* 设置 / 回收站 */
  .list-head .icon-btn { margin-left: -8px; }
  .main > .list-head:first-child { margin-top: calc(14px + env(safe-area-inset-top)); }
  .settings-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel { padding: 20px 18px; border-radius: 22px; }
  .row { padding-left: 12px; }

  /* 编辑器 */
  .editor { padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); }
  .ed-bar { margin: 8px 8px 0; gap: 6px; }
  .ed-status { max-width: 70px; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
  .seg button { padding: 0 12px; }
  .ed-head { padding: 16px 18px 2px; }
  .ed-title { font-size: 23px !important; font-weight: 750; }
  .ed-opts { display: none; }
  .editor.opts-open .ed-opts { display: flex; }
  .editor.opts-open #ed-opts-toggle { background: var(--accent-soft); color: var(--accent); }
  .pill-field { height: 38px; }
  .pill-field.tags { min-width: 0; max-width: none; flex-basis: 100%; order: 3; }
  .ed-toolbar { flex-wrap: nowrap; justify-content: flex-start; align-self: stretch; max-width: none; margin: 10px 8px 8px; overflow-x: auto; scrollbar-width: none; }
  .ed-toolbar::-webkit-scrollbar { display: none; }
  .ed-toolbar button { flex: none; height: 36px; min-width: 38px; }
  .ed-body { margin: 0 8px calc(8px + env(safe-area-inset-bottom)); border-radius: 22px; }
  .ed-body.mode-split { grid-template-columns: 1fr; }
  .ed-body.mode-split .ed-preview { display: none; }
  .ed-body textarea, .ed-body.mode-edit textarea { padding: 18px 18px 60px; }
  .ed-preview, .ed-body.mode-preview .ed-preview { padding: 20px 18px 60px; }

  .auth-card { padding: 32px 22px 24px; }
}

/* 触屏设备不保留悬停效果 */
@media (hover: none) {
  .card-note:hover { transform: none; box-shadow: var(--shadow); }
  .nav-item:not(.active):hover, .menu-list a:hover, .menu-list button:hover { background: transparent; }
  .icon-btn:hover { background: transparent; color: var(--muted); }
  .menu[open] > summary { background: var(--accent-soft); color: var(--accent); }
  .menu-list a:active, .menu-list button:active, .icon-btn:active { background: var(--accent-soft); }
  .btn:not(.btn-grad):hover { background: var(--card); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
