/* sparkling · 真实便签墙（方向 A）
   零依赖：纸张质感用 CSS 渐变 + 一小段内联 SVG 噪点，没有图片文件。 */

:root {
  --wall: #efe7d8;
  --wall-deep: #e3d9c6;
  --ink: #3b352c;
  --ink-soft: #6f665a;
  --ink-faint: #9a9083;
  --accent: #2f6f5e;
  --card-shadow: 0 1px 1px rgba(74, 60, 40, 0.1), 0 6px 14px -6px rgba(74, 60, 40, 0.28);
  --card-shadow-hover: 0 2px 2px rgba(74, 60, 40, 0.12), 0 22px 34px -14px rgba(74, 60, 40, 0.4);
  --radius: 3px;
  --serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  /* 便签五色 */
  --paper-1: #e9ecd8;
  --paper-2: #f7e9c8;
  --paper-3: #f6dcd6;
  --paper-4: #dde7f2;
  --paper-5: #ece0f0;
}

@media (prefers-color-scheme: dark) {
  :root {
    --wall: #1c1a17;
    --wall-deep: #14120f;
    --ink: #e6e0d5;
    --ink-soft: #b3aa9b;
    --ink-faint: #857c6f;
    --accent: #86c9b2;
    --card-shadow: 0 1px 1px rgba(0, 0, 0, 0.4), 0 8px 18px -8px rgba(0, 0, 0, 0.6);
    --card-shadow-hover: 0 2px 3px rgba(0, 0, 0, 0.5), 0 26px 40px -16px rgba(0, 0, 0, 0.8);
    --paper-1: #2f3328;
    --paper-2: #3a3222;
    --paper-3: #3b2c28;
    --paper-4: #26313c;
    --paper-5: #332a39;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  background-color: var(--wall);
  background-image:
    radial-gradient(120% 80% at 50% -10%, rgba(255, 255, 255, 0.5), transparent 60%),
    linear-gradient(180deg, var(--wall) 0%, var(--wall-deep) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.16'/%3E%3C/svg%3E");
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 22px 88px; }

/* ---------- 顶栏 ---------- */
header.top {
  padding: 46px 0 22px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 18px 26px;
  border-bottom: 1px dashed rgba(120, 105, 80, 0.34);
}
.brand { margin-right: auto; }
.brand h1 {
  font-family: var(--serif);
  font-size: clamp(30px, 5vw, 44px);
  line-height: 1.1;
  margin: 0;
  letter-spacing: 0.01em;
  cursor: default;
  user-select: none;
}
.brand p { margin: 10px 0 0; color: var(--ink-soft); font-size: 14.5px; max-width: 46ch; line-height: 1.7; }
.brand .count { color: var(--ink-faint); font-size: 12.5px; margin-top: 6px; }

.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.seg {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(120, 105, 80, 0.26);
  border-radius: 999px;
  padding: 3px;
}
@media (prefers-color-scheme: dark) { .seg { background: rgba(255, 255, 255, 0.06); } }
.seg button {
  appearance: none; border: 0; background: transparent; color: var(--ink-soft);
  font: 500 13.5px/1 var(--sans); padding: 8px 15px; border-radius: 999px; cursor: pointer;
  transition: background 0.18s, color 0.18s;
}
.seg button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.search {
  display: flex; align-items: center; gap: 6px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(120, 105, 80, 0.26);
  border-radius: 999px; padding: 0 14px; height: 38px;
}
@media (prefers-color-scheme: dark) { .search { background: rgba(255, 255, 255, 0.06); } }
.search input {
  border: 0; background: transparent; font: 14px var(--sans); color: var(--ink);
  width: min(190px, 40vw); min-width: 0; outline: none; padding: 0; height: 100%;
}
.search input[type="text"] { border: 0; background: transparent; width: min(190px, 40vw); padding: 0; }
.search input::placeholder { color: var(--ink-faint); }

.btn {
  appearance: none; cursor: pointer; font: 500 13.5px/1 var(--sans);
  border-radius: 999px; padding: 10px 16px; border: 1px solid rgba(120, 105, 80, 0.3);
  background: rgba(255, 255, 255, 0.5); color: var(--ink);
  transition: transform 0.14s, box-shadow 0.14s, background 0.14s;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--card-shadow); }
.btn:active { transform: translateY(0); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ghost { background: transparent; }
.btn.danger { color: #b3402f; border-color: rgba(179, 64, 47, 0.4); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn[hidden] { display: none; }

/* ---------- 分类条 ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 18px 0 4px; }
.chip {
  appearance: none; cursor: pointer; border: 1px solid rgba(120, 105, 80, 0.26);
  background: transparent; color: var(--ink-soft); border-radius: 999px;
  padding: 6px 13px; font: 13px var(--sans); transition: all 0.16s;
}
.chip:hover { color: var(--ink); border-color: var(--ink-faint); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--wall); }
.chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- 墙 ---------- */
.wall { margin-top: 22px; columns: 4; column-gap: 20px; }
@media (max-width: 1080px) { .wall { columns: 3; } }
@media (max-width: 760px) { .wall { columns: 2; column-gap: 14px; } }
@media (max-width: 470px) { .wall { columns: 1; } }

.note {
  position: relative; display: block; width: 100%; break-inside: avoid;
  margin: 0 0 20px; padding: 20px 18px 16px; border: 0; text-align: left;
  border-radius: var(--radius); cursor: pointer; appearance: none;
  font: inherit; color: var(--ink); background: var(--paper-1);
  box-shadow: var(--card-shadow);
  transform: rotate(var(--rot, 0deg));
  transform-origin: 50% 0%;
  transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.25, 1), box-shadow 0.24s;
}
.note.paper-1 { background: var(--paper-1); }
.note.paper-2 { background: var(--paper-2); }
.note.paper-3 { background: var(--paper-3); }
.note.paper-4 { background: var(--paper-4); }
.note.paper-5 { background: var(--paper-5); }
/* 纸面上的胶带 */
.note::before {
  content: ""; position: absolute; top: -9px; left: 50%; width: 54px; height: 18px;
  transform: translateX(-50%) rotate(var(--tape, -3deg));
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.34);
  box-shadow: 0 1px 2px rgba(74, 60, 40, 0.14);
}
@media (prefers-color-scheme: dark) { .note::before { background: rgba(255, 255, 255, 0.09); } }
/* 纸边卷起的一点阴影 */
.note::after {
  content: ""; position: absolute; inset: auto 8px 3px 8px; height: 12px; z-index: -1;
  background: radial-gradient(60% 100% at 50% 100%, rgba(74, 60, 40, 0.22), transparent 70%);
}
.note:hover, .note:focus-visible {
  transform: rotate(0deg) translateY(-6px) scale(1.015);
  box-shadow: var(--card-shadow-hover);
  z-index: 2;
}
.note:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.note .text {
  font-family: var(--serif); font-size: 17px; line-height: 1.85; margin: 0;
  white-space: pre-wrap; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 7; line-clamp: 7; -webkit-box-orient: vertical; overflow: hidden;
}
.note .foot {
  margin-top: 14px; padding-top: 10px; border-top: 1px dashed rgba(120, 105, 80, 0.24);
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px;
  font-size: 12.5px; color: var(--ink-soft);
}
.note .who { font-weight: 600; }
.note .src { color: var(--ink-faint); }
.cat {
  font-size: 11.5px; color: var(--accent); border: 1px solid currentColor;
  border-radius: 999px; padding: 1px 8px; white-space: nowrap;
}
.note .cat { font-size: 11.5px; }
.note .when { margin-left: auto; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.note .pin-flag { position: absolute; top: 8px; right: 10px; font-size: 12px; color: var(--ink-faint); }

.empty { padding: 70px 0; text-align: center; color: var(--ink-soft); font-family: var(--serif); font-size: 19px; }

/* ---------- 漫游模式 ---------- */
.wander { display: none; margin-top: 34px; }
body[data-mode="wander"] .wander { display: block; }
body[data-mode="wander"] .wall, body[data-mode="wander"] .chips { display: none; }

.wander-stage { display: grid; place-items: center; padding: 40px 0 10px; }
.wander-card {
  max-width: 620px; width: 100%; padding: 44px 38px 30px; border-radius: var(--radius);
  background: var(--paper-2); box-shadow: var(--card-shadow-hover);
  transform: rotate(-0.6deg); transition: transform 0.3s, opacity 0.3s;
}
.wander-card .text { font-family: var(--serif); font-size: clamp(20px, 3.2vw, 27px); line-height: 1.9; margin: 0; white-space: pre-wrap; }
.wander-card .foot { margin-top: 26px; padding-top: 14px; border-top: 1px dashed rgba(120, 105, 80, 0.26); font-size: 13.5px; color: var(--ink-soft); display: flex; flex-wrap: wrap; gap: 6px 12px; }
.wander-nav { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 26px; color: var(--ink-faint); font-size: 12.5px; }
.wander-card.leaving { opacity: 0; transform: rotate(2deg) translateY(10px); }

/* ---------- 详情弹层 ---------- */
.scrim {
  position: fixed; inset: 0; z-index: 50; display: none; place-items: center; padding: 24px;
  background: rgba(40, 32, 20, 0.42); backdrop-filter: blur(3px);
}
.scrim[data-open="true"] { display: grid; }
.sheet {
  position: relative; width: min(660px, 100%); max-height: 86vh; overflow: auto;
  padding: 40px 38px 30px; border-radius: var(--radius); background: var(--paper-2);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.5);
  animation: pop 0.22s cubic-bezier(0.2, 0.8, 0.25, 1);
}
@keyframes pop { from { transform: translateY(14px) scale(0.985); opacity: 0; } }
.sheet .text { font-family: var(--serif); font-size: 21px; line-height: 1.95; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.sheet .meta-line { margin-top: 24px; padding-top: 16px; border-top: 1px dashed rgba(120, 105, 80, 0.26); font-size: 14px; color: var(--ink-soft); line-height: 1.9; }
.sheet .meta-line b { color: var(--ink); font-weight: 600; }
.sheet .my-note { margin-top: 14px; font-size: 14.5px; color: var(--ink-soft); font-style: italic; }
.sheet .bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 26px; }
.sheet .bar .spacer { margin-left: auto; }
.sheet .close {
  position: absolute; top: 12px; right: 14px; appearance: none; border: 0; background: transparent;
  font: 400 22px/1 var(--sans); color: var(--ink-faint); cursor: pointer; padding: 6px;
}
.sheet .close:hover { color: var(--ink); }
.sheet .nav-hint { font-size: 12px; color: var(--ink-faint); }
@media (max-width: 600px) {
  .scrim { padding: 0; align-items: flex-end; }
  .sheet { max-height: 92vh; border-radius: 10px 10px 0 0; padding: 34px 22px 26px; }
}

/* ---------- 收录面板 ---------- */
.studio {
  position: fixed; inset: 0; z-index: 60; display: none; overflow: auto; padding: 28px 20px 60px;
  background: var(--wall);
}
.studio[data-open="true"] { display: block; }
.studio-inner { max-width: 900px; margin: 0 auto; }
.studio h2 { font-family: var(--serif); font-size: 26px; margin: 0 0 6px; }
.studio .lede { color: var(--ink-soft); font-size: 13.5px; line-height: 1.8; margin: 0 0 22px; max-width: 60ch; }
.panel {
  border: 1px solid rgba(120, 105, 80, 0.26); border-radius: 8px; padding: 20px;
  background: rgba(255, 255, 255, 0.4); margin-bottom: 22px;
}
@media (prefers-color-scheme: dark) { .panel { background: rgba(255, 255, 255, 0.04); } }
.panel h3 { font-size: 14px; margin: 0 0 16px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-soft); }
form .row { display: grid; gap: 14px; margin-bottom: 14px; }
form .row.two { grid-template-columns: 1fr 1fr; }
@media (max-width: 640px) { form .row.two { grid-template-columns: 1fr; } }
label { display: block; font-size: 12.5px; color: var(--ink-soft); margin-bottom: 5px; }
/* 这些只给收录面板的表单用；限定在 .studio 里，否则会串到顶栏搜索框上 */
.studio input[type="text"], .studio input[type="date"], .studio textarea, .studio select {
  width: 100%; font: 15px/1.7 var(--sans); color: var(--ink);
  background: rgba(255, 255, 255, 0.72); border: 1px solid rgba(120, 105, 80, 0.3);
  border-radius: 5px; padding: 10px 12px; outline: none;
}
@media (prefers-color-scheme: dark) {
  .studio input[type="text"], .studio input[type="date"], .studio textarea, .studio select { background: rgba(0, 0, 0, 0.25); }
}
.studio textarea { min-height: 92px; resize: vertical; font-family: var(--serif); font-size: 16px; line-height: 1.8; }
.studio input:focus-visible, .studio textarea:focus-visible, .studio select:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47, 111, 94, 0.16); }
.swatches { display: flex; gap: 8px; }
.swatch { appearance: none; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; border: 2px solid rgba(120, 105, 80, 0.25); }
.swatch[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 0 0 2px var(--wall) inset; }

.list { display: grid; gap: 10px; }
.list-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border: 1px solid rgba(120, 105, 80, 0.22); border-radius: 6px; background: rgba(255, 255, 255, 0.5);
}
@media (prefers-color-scheme: dark) { .list-item { background: rgba(255, 255, 255, 0.05); } }
.list-item .dot { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.list-item .body { min-width: 0; flex: 1; }
.list-item .t { font-family: var(--serif); font-size: 15px; line-height: 1.6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .s { font-size: 12px; color: var(--ink-faint); margin-top: 3px; }
.list-item .acts { display: flex; gap: 6px; flex: none; }
.list-item .acts .btn { padding: 7px 11px; font-size: 12.5px; }
.tag-seed { font-size: 11px; color: var(--ink-faint); border: 1px solid currentColor; border-radius: 999px; padding: 1px 7px; }

.studio-top { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.studio-top .spacer { margin-left: auto; }
.hint { font-size: 12.5px; color: var(--ink-soft); line-height: 1.8; }
.hint kbd {
  font: 11px ui-monospace, SFMono-Regular, Menlo, monospace; border: 1px solid rgba(120, 105, 80, 0.35);
  border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px; background: rgba(255, 255, 255, 0.6);
}

/* ---------- 提示条 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px); z-index: 80;
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s;
  background: var(--ink); color: var(--wall); font-size: 13.5px; padding: 11px 18px; border-radius: 999px;
  box-shadow: 0 12px 24px -10px rgba(0, 0, 0, 0.5);
}
.toast[data-show="true"] { opacity: 1; transform: translate(-50%, 0); }

footer.foot {
  margin-top: 60px; padding-top: 20px; border-top: 1px dashed rgba(120, 105, 80, 0.3);
  color: var(--ink-faint); font-size: 12.5px; line-height: 1.9;
}
footer.foot a { color: var(--ink-soft); }

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

@media print {
  header.top, .tools, .chips, .wander-nav, footer.foot, .toast { display: none !important; }
  body { background: #fff; }
  .note { break-inside: avoid; box-shadow: none; border: 1px solid #ddd; transform: none; }
}
