/* ============================================================
   灵感 · 创作记录 —— 样式表
   设计原则：深色优先、大圆角、低对比描边、移动端优先
   ============================================================ */

:root {
  --bg: #0b0d12;
  --bg-elev: #12151c;
  --bg-elev-2: #171b24;
  --bg-input: #10131a;
  --border: #232833;
  --border-soft: #1b2029;
  --text: #e9ebf2;
  --text-dim: #9aa3b5;
  --text-faint: #69728a;
  --accent: #7c6cff;
  --accent-2: #a78bfa;
  --accent-soft: rgba(124, 108, 255, 0.14);
  --accent-line: rgba(124, 108, 255, 0.45);
  --danger: #ff6b6b;
  --danger-soft: rgba(255, 107, 107, 0.12);
  --ok: #3ddc97;
  --star: #ffc857;
  --radius: 16px;
  --radius-sm: 11px;
  --radius-pill: 999px;
  --shadow: 0 10px 34px rgba(0, 0, 0, 0.38);
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.22);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --tabbar-h: 58px;
  --topbar-h: 54px;
  --maxw: 780px;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f7fb;
    --bg-elev: #ffffff;
    --bg-elev-2: #f1f3f9;
    --bg-input: #ffffff;
    --border: #e2e5ee;
    --border-soft: #eceef5;
    --text: #14161d;
    --text-dim: #5c657a;
    --text-faint: #8b93a7;
    --accent: #5b4bdb;
    --accent-2: #7c6cff;
    --accent-soft: rgba(91, 75, 219, 0.09);
    --accent-line: rgba(91, 75, 219, 0.4);
    --danger: #d63c3c;
    --danger-soft: rgba(214, 60, 60, 0.08);
    --ok: #12a06a;
    --star: #d99b1c;
    --shadow: 0 10px 30px rgba(20, 22, 29, 0.1);
    --shadow-sm: 0 2px 10px rgba(20, 22, 29, 0.06);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }

/* hidden 属性必须赢过组件自己的 display:flex/grid，否则遮罩层会永远盖住页面 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

body { min-height: 100vh; min-height: 100dvh; }

button, input, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}
button { cursor: pointer; border: none; background: none; }
input, textarea { outline: none; }
.hidden { display: none !important; }
.muted { color: var(--text-dim); }
.small { font-size: 12.5px; }
.spacer { flex: 1; }

/* ---------- 布局骨架 ---------- */
.app {
  display: grid;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-columns: 1fr;
  min-height: 100vh;
  min-height: 100dvh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(6px + var(--safe-t)) 14px 6px;
  height: calc(var(--topbar-h) + var(--safe-t));
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--border-soft);
}

.brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 32px; height: 32px;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(140deg, var(--accent) 0%, var(--accent-2) 55%, #f0a7ff 100%);
  box-shadow: 0 4px 14px rgba(124, 108, 255, 0.35);
  flex: none;
}
.brand-text { font-weight: 650; letter-spacing: 0.02em; white-space: nowrap; flex: none; }
.brand-sub {
  font-size: 11.5px;
  color: var(--text-faint);
  padding-left: 8px;
  margin-left: 2px;
  border-left: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.top-actions { display: flex; align-items: center; gap: 4px; flex: none; }
@media (max-width: 560px) {
  .brand-sub { display: none; }
}

.net-badge {
  font-size: 11px;
  color: var(--star);
  border: 1px solid color-mix(in srgb, var(--star) 40%, transparent);
  background: color-mix(in srgb, var(--star) 12%, transparent);
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  margin-right: 4px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: 11px;
  color: var(--text-dim);
  transition: background 0.15s, color 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.icon-btn:hover { background: var(--bg-elev-2); color: var(--text); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn.tiny { width: 28px; height: 28px; border-radius: 8px; }
.icon-btn.primary-ghost { color: var(--accent-2); }

/* 桌面左侧栏（移动端隐藏） */
.rail { display: none; }

.main {
  padding: 14px 14px calc(var(--tabbar-h) + var(--safe-b) + 22px);
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
}

.view { display: none; animation: fade 0.18s ease; }
.view.is-active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-top: 1px solid var(--border-soft);
}
.tab-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-faint);
  font-size: 10.5px;
  letter-spacing: 0.02em;
  transition: color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.tab-btn.is-active { color: var(--accent-2); }
.tab-btn:active { transform: scale(0.96); }

/* ---------- 输入区（Composer） ---------- */
.composer {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 12px 8px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.18s, box-shadow 0.18s;
}
.composer:focus-within {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-sm);
}
.composer.drag-over {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent-soft) 60%, var(--bg-elev));
}

#composer-text {
  width: 100%;
  min-height: 46px;
  max-height: 46vh;
  resize: none;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 16px; /* iOS 不缩放 */
  line-height: 1.62;
  padding: 4px 4px 6px;
}
#composer-text::placeholder { color: var(--text-faint); }

.composer-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border-soft);
}
.composer-bar .icon-btn { width: 34px; height: 34px; }

.tag-input {
  width: 92px;
  min-width: 68px;
  height: 34px;
  padding: 0 10px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text);
  font-size: 13px;
  transition: border-color 0.15s, width 0.2s;
}
.tag-input::placeholder { color: var(--text-faint); }
.tag-input:focus { border-color: var(--accent-line); border-style: solid; width: 140px; }

kbd.hint {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10.5px;
  color: var(--text-faint);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 5px;
  white-space: nowrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 15px;
  border-radius: 10px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  transition: transform 0.1s, background 0.15s, opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.btn:hover { background: color-mix(in srgb, var(--bg-elev-2) 70%, var(--border)); }
.btn:active { transform: scale(0.97); }
.btn.primary {
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 16px rgba(124, 108, 255, 0.3);
}
.btn.primary:disabled {
  opacity: 0.38;
  box-shadow: none;
  cursor: not-allowed;
}
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); background: var(--danger-soft); }
.btn.block { width: 100%; }
.btn.sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }

/* 缩略图预览条 */
.composer-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 2px 10px;
  scrollbar-width: none;
}
.composer-thumbs::-webkit-scrollbar { display: none; }
.thumb-item {
  position: relative;
  flex: none;
  width: 66px; height: 66px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-elev-2);
  animation: pop 0.16s ease;
}
@keyframes pop { from { transform: scale(0.9); opacity: 0; } to { transform: none; opacity: 1; } }
.thumb-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-item .thumb-x {
  position: absolute;
  top: 2px; right: 2px;
  width: 20px; height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-size: 12px;
  line-height: 1;
}
.thumb-item .thumb-loading {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 10px;
  color: var(--text-dim);
  background: var(--bg-elev-2);
}

/* 标签 chips */
.composer-chips, .card-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.composer-chips:not(:empty) { padding: 2px 2px 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 26%, transparent);
  color: var(--accent-2);
  font-size: 12.5px;
  white-space: nowrap;
}
.chip button { color: inherit; opacity: 0.7; display: grid; place-items: center; }
.chip button:hover { opacity: 1; }
.chip.static { cursor: pointer; transition: background 0.15s; }
.chip.static:hover { background: color-mix(in srgb, var(--accent) 20%, transparent); }

/* ---------- 时间线 ---------- */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 20px 4px 10px;
}
.section-head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  text-transform: uppercase;
}
.link-btn {
  font-size: 12.5px;
  color: var(--accent-2);
  padding: 2px 4px;
}
.link-btn:hover { text-decoration: underline; }

.card-list { display: flex; flex-direction: column; gap: 9px; }

.day-sep {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 4px 4px;
  font-size: 12px;
  color: var(--text-faint);
  letter-spacing: 0.04em;
}
.day-sep::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border-soft), transparent);
}

.card {
  position: relative;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 15px 12px;
  transition: border-color 0.16s, transform 0.12s;
  animation: rise 0.18s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.card:hover { border-color: color-mix(in srgb, var(--border) 55%, var(--accent)); }
.card.is-starred { border-color: color-mix(in srgb, var(--star) 26%, var(--border)); }

.card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}
.card-time {
  font-size: 11.5px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.card-star {
  color: var(--star);
  display: inline-flex;
  opacity: 0;
  transition: opacity 0.15s;
}
.card.is-starred .card-star { opacity: 1; }
.card-menu-btn {
  margin-left: auto;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 8px;
  color: var(--text-faint);
  opacity: 0.7;
}
.card-menu-btn:hover, .card-menu-btn[aria-expanded="true"] { background: var(--bg-elev-2); color: var(--text); opacity: 1; }

.card-body {
  font-size: 15px;
  line-height: 1.68;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.card-body.clamped {
  display: -webkit-box;
  -webkit-line-clamp: 9;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-body mark { background: color-mix(in srgb, var(--star) 30%, transparent); color: var(--text); border-radius: 3px; padding: 0 1px; }
.expand-btn { font-size: 12.5px; color: var(--accent-2); margin-top: 4px; }

.card-imgs { margin-top: 9px; display: grid; gap: 6px; }
.card-imgs[data-count="1"] { grid-template-columns: 1fr; }
.card-imgs[data-count="2"] { grid-template-columns: 1fr 1fr; }
.card-imgs[data-count="3"], .card-imgs[data-count="4"], .card-imgs[data-count="5"],
.card-imgs[data-count="6"] { grid-template-columns: 1fr 1fr 1fr; }

.card-img {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border-soft);
  animation: fade 0.2s ease;
}
.card-imgs[data-count="1"] .card-img { max-height: 330px; }
.card-imgs[data-count="2"] .card-img, .card-imgs[data-count="3"] .card-img { aspect-ratio: 1; }
.card-imgs[data-count="4"] .card-img,
.card-imgs[data-count="5"] .card-img,
.card-imgs[data-count="6"] .card-img { aspect-ratio: 1; }
.card-img img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
}
.card-imgs[data-count="1"] .card-img img { object-fit: contain; max-height: 330px; }
.card-img .more-badge {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 18px;
  font-weight: 600;
}

.card-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.card-imgs + .card-foot { margin-top: 11px; }

.card-menu {
  position: absolute;
  z-index: 20;
  min-width: 148px;
  padding: 5px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  animation: pop 0.13s ease;
}
.card-menu button {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text);
  font-size: 13.5px;
  text-align: left;
}
.card-menu button:hover { background: var(--bg-elev); }
.card-menu button.danger { color: var(--danger); }
.card-menu hr { border: none; border-top: 1px solid var(--border); margin: 4px 6px; }

/* 空状态 */
.empty {
  text-align: center;
  padding: 48px 20px 30px;
  color: var(--text-dim);
}
.empty-art {
  font-size: 34px;
  color: var(--accent-2);
  opacity: 0.75;
  margin-bottom: 10px;
}
.empty-title { margin: 0 0 4px; font-weight: 600; color: var(--text); }
.empty-desc { margin: 0; font-size: 13px; }

.more-btn { width: 100%; margin: 14px 0 6px; }

/* ---------- 搜索 ---------- */
.search-head { padding-top: 6px; }
.search-box {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 44px;
  padding: 0 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-dim);
  transition: border-color 0.16s, box-shadow 0.16s;
}
.search-box:focus-within {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search-box input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: none;
  background: transparent;
  font-size: 16px;
  color: var(--text);
}
.search-box input::placeholder { color: var(--text-faint); }
.search-box input::-webkit-search-cancel-button { display: none; }

.filter-row {
  display: flex;
  flex-wrap: wrap;        /* 换行显示，不再把超出的筛选条件藏到屏幕外 */
  gap: 7px;
  overflow: visible;
  padding: 10px 0 2px;
}
.tags-row:empty { display: none; }
.pill {
  flex: 0 1 auto;
  max-width: 100%;
  height: 30px;
  padding: 0 13px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  transition: all 0.15s;
}
.pill:hover { border-color: var(--accent-line); color: var(--text); }
.pill.is-active {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent-2);
  font-weight: 500;
}

.search-meta {
  padding: 12px 4px 6px;
  font-size: 12px;
  color: var(--text-faint);
  min-height: 12px;
}

/* ---------- 标签页 ---------- */
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px; }
.tag-card {
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 9px 14px;
  border-radius: 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  transition: all 0.15s;
}
.tag-card:hover { border-color: var(--accent-line); transform: translateY(-1px); }
.tag-card b { font-weight: 550; font-size: 14px; }
.tag-card span { font-size: 11.5px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.tag-card.hot { border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); }

/* ---------- 设置 ---------- */
.panel {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px 16px;
  margin-bottom: 12px;
}
.panel-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.07em;
  color: var(--text-faint);
  text-transform: uppercase;
  margin-bottom: 12px;
}
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 6px;
  border-radius: 11px;
  background: var(--bg-elev-2);
  text-align: center;
}
.stat b { font-size: 16px; font-weight: 620; font-variant-numeric: tabular-nums; }
.stat span { font-size: 11px; color: var(--text-faint); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.btn-row:last-child { margin-bottom: 0; }
.row { padding: 7px 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.note {
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-faint);
}
.footnote {
  font-size: 11.5px;
  color: var(--text-faint);
  line-height: 1.65;
  padding: 4px 6px 10px;
}
.badge-ok { color: var(--ok); }
.badge-warn { color: var(--star); }

/* ---------- 弹层 ---------- */
.modal-root:empty { display: none; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
  animation: fade 0.16s ease;
}
.sheet {
  position: fixed;
  z-index: 61;
  left: 0; right: 0; bottom: 0;
  max-height: 92vh;
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-radius: 20px 20px 0 0;
  border-top: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding-bottom: var(--safe-b);
  animation: slideUp 0.22s cubic-bezier(0.2, 0.9, 0.3, 1);
  overflow: hidden;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: none; } }
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border-soft);
}
.sheet-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.sheet-body {
  padding: 14px 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.sheet-foot {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px 16px;
  border-top: 1px solid var(--border-soft);
  background: var(--bg);
}
.sheet textarea {
  width: 100%;
  min-height: 130px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  font-size: 16px;
  line-height: 1.65;
  resize: vertical;
}
.sheet textarea:focus { border-color: var(--accent-line); }

.dialog {
  position: fixed;
  z-index: 61;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: min(420px, calc(100vw - 32px));
  padding: 20px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: pop 0.16s ease;
}
.dialog h4 { margin: 0 0 8px; font-size: 15.5px; }
.dialog p { margin: 0 0 16px; font-size: 13.5px; color: var(--text-dim); line-height: 1.65; }
.dialog .dialog-actions { display: flex; gap: 8px; justify-content: flex-end; }
.dialog input.text {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  margin-bottom: 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
}

/* ---------- Toast ---------- */
.toast-root {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px);
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 32px);
}
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow);
  font-size: 13.5px;
  pointer-events: auto;
  animation: toastIn 0.24s cubic-bezier(0.2, 0.9, 0.3, 1);
}
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(0.97); } to { opacity: 1; transform: none; } }
.toast.out { animation: toastOut 0.2s ease forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px) scale(0.97); } }
.toast-action {
  color: var(--accent-2);
  font-weight: 600;
  font-size: 13px;
  padding: 2px 4px;
}
.toast-action:hover { text-decoration: underline; }

/* ---------- 图片查看器 ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.92);
  animation: fade 0.16s ease;
}
.lightbox img {
  max-width: 96vw;
  max-height: 92vh;
  object-fit: contain;
  border-radius: 6px;
}
.lightbox-close {
  position: absolute;
  top: calc(14px + var(--safe-t));
  right: 14px;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 16px;
}

/* ---------- 桌面适配 ---------- */
@media (min-width: 860px) {
  .app {
    grid-template-columns: 208px 1fr;
    grid-template-rows: var(--topbar-h) 1fr;
  }
  .topbar { grid-column: 1 / -1; padding-left: 20px; padding-right: 20px; }
  .rail {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 12px;
    border-right: 1px solid var(--border-soft);
    position: sticky;
    top: var(--topbar-h);
    height: calc(100vh - var(--topbar-h));
  }
  .rail-btn {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border-radius: 11px;
    color: var(--text-dim);
    font-size: 14px;
    transition: all 0.15s;
    text-align: left;
  }
  .rail-btn:hover { background: var(--bg-elev); color: var(--text); }
  .rail-btn.is-active { background: var(--accent-soft); color: var(--accent-2); font-weight: 550; }
  .tabbar { display: none; }
  .main {
    grid-column: 2;
    padding: 20px 26px 60px;
    max-width: 860px;
    margin: 0;
  }
  .sheet {
    left: 50%;
    bottom: auto;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(620px, calc(100vw - 48px));
    border-radius: var(--radius);
    animation: pop 0.18s ease;
    padding-bottom: 0;
  }
  .toast-root { bottom: 28px; }
  kbd.hint { display: inline-block; }
  .card-body { font-size: 15.5px; }
}

@media (max-width: 380px) {
  .brand-sub { display: none; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  kbd.hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001s !important; transition-duration: 0.001s !important; }
}

/* 打印/导出兜底 */
@media print {
  .topbar, .tabbar, .rail, .composer, .card-menu-btn, .toast-root { display: none !important; }
  body { background: #fff; color: #000; }
}

/* ============================================================
   v0.2 — 主题系统 & 科技感 UI 语言
   四条轴线：色彩令牌 → 几何装饰（切角/括号/刻度）→ 等宽排版 → 图标族
   ============================================================ */

:root {
  --mono: ui-monospace, "Cascadia Mono", "JetBrains Mono", "SF Mono", Consolas, "Liberation Mono", monospace;
}

.svg-ico { display: block; flex: none; }
.search-lead { display: grid; place-items: center; color: var(--text-dim); flex: none; }

/* ---------------- 主题选择器 ---------------- */
.theme-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.theme-card {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  background: var(--bg-elev-2);
  border-radius: var(--radius-sm);
  text-align: left;
  transition: border-color .15s, transform .12s, background .15s;
  -webkit-tap-highlight-color: transparent;
}
.theme-card:hover { border-color: var(--accent-line); }
.theme-card:active { transform: scale(.985); }
.theme-card .sw {
  width: 22px; height: 22px; flex: none; border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14);
}
.theme-card .meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.theme-card b { font-size: 13px; font-weight: 550; }
.theme-card i {
  font-style: normal; font-family: var(--mono);
  font-size: 9px; letter-spacing: .16em; color: var(--text-faint);
}
.theme-card.is-on { border-color: var(--accent); background: var(--accent-soft); }
.theme-card.is-on b { color: var(--accent-2); }

/* ---------------- 今日刻度环（仅科技主题显示） ---------------- */
.gauge { display: none; position: relative; width: 40px; height: 40px; flex: none; margin-right: 6px; text-align: center; }
html[data-tech="on"] .gauge { display: grid; place-items: center; }
.gauge-ring {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from -90deg,
    var(--accent) calc(var(--p, 0) * 360deg),
    color-mix(in srgb, var(--accent) 15%, transparent) 0);
  -webkit-mask: radial-gradient(circle, transparent 57%, #000 58%);
  mask: radial-gradient(circle, transparent 57%, #000 58%);
}
.gauge b { font: 600 13px/1 var(--mono); color: var(--accent); position: relative; }
.gauge i {
  font-style: normal; font: 500 6px/1 var(--mono); letter-spacing: .16em;
  color: var(--text-faint); margin-top: 3px; position: relative;
}

/* ============================================================
   主题 1：TERMINAL —— 近黑 + 暖琥珀（参考终端面板语言）
   ============================================================ */
html[data-theme="terminal"] {
  --bg: #0a0b0d;
  --bg-elev: #101215;
  --bg-elev-2: #171a1d;
  --bg-input: #0c0e11;
  --border: #2b2c2c;
  --border-soft: #1b1d1f;
  --text: #ece5d9;
  --text-dim: #9f9787;
  --text-faint: #6d675b;
  --accent: #e8a33d;
  --accent-2: #f6c97d;
  --accent-soft: rgba(232, 163, 61, .12);
  --accent-line: rgba(232, 163, 61, .55);
  --input-label: "INPUT // TERMINAL";
  --star: #f6c97d;
  --ok: #59b98d;
  --danger: #e0553a;
  --danger-soft: rgba(224, 85, 58, .12);
  --shadow: 0 12px 34px rgba(0, 0, 0, .55);
  --shadow-sm: 0 3px 12px rgba(0, 0, 0, .35);
  --radius: 2px;
  --radius-sm: 2px;
  --radius-pill: 2px;
  color-scheme: dark;
}

/* ============================================================
   主题 2：AZURE —— 冷光青（数据链路感）
   ============================================================ */
html[data-theme="azure"] {
  --bg: #050a0d;
  --bg-elev: #0b1216;
  --bg-elev-2: #122029;
  --bg-input: #070e12;
  --border: #1e3038;
  --border-soft: #131f26;
  --text: #dbe8ee;
  --text-dim: #85a3ad;
  --text-faint: #5a7681;
  --accent: #4fd1e0;
  --accent-2: #9be9f2;
  --accent-soft: rgba(79, 209, 224, .12);
  --accent-line: rgba(79, 209, 224, .5);
  --input-label: "INPUT // DATA LINK";
  --star: #8fe8f2;
  --ok: #4fd1a0;
  --danger: #ff6b6b;
  --danger-soft: rgba(255, 107, 107, .1);
  --shadow: 0 12px 34px rgba(0, 0, 0, .55);
  --shadow-sm: 0 3px 12px rgba(0, 0, 0, .35);
  --radius: 2px;
  --radius-sm: 2px;
  --radius-pill: 2px;
  color-scheme: dark;
}

/* ============================================================
   主题 3：CRIMSON —— 警戒红（更硬的斜切）
   ============================================================ */
html[data-theme="crimson"] {
  --bg: #0b0708;
  --bg-elev: #130d0f;
  --bg-elev-2: #1d1316;
  --bg-input: #0e090a;
  --border: #342326;
  --border-soft: #23161a;
  --text: #f2e4e1;
  --text-dim: #b08f8a;
  --text-faint: #7a5f5a;
  --accent: #e0503c;
  --accent-2: #ff8a72;
  --accent-soft: rgba(224, 80, 60, .13);
  --accent-line: rgba(224, 80, 60, .5);
  --input-label: "INPUT // ALERT";
  --star: #ffb38a;
  --ok: #59c08d;
  --danger: #ff5d43;
  --danger-soft: rgba(255, 93, 67, .12);
  --shadow: 0 12px 34px rgba(0, 0, 0, .55);
  --shadow-sm: 0 3px 12px rgba(0, 0, 0, .35);
  --radius: 2px;
  --radius-sm: 2px;
  --radius-pill: 2px;
  color-scheme: dark;
}

/* ============================================================
   科技感装饰（三个 tech 主题共用）
   ============================================================ */

/* 底纹：角落辉光 + 斜纹 + 点阵 */
html[data-tech="on"] body {
  background-color: var(--bg);
  background-image:
    radial-gradient(120% 70% at 12% -12%, color-mix(in srgb, var(--accent) 9%, transparent) 0%, transparent 62%),
    repeating-linear-gradient(135deg, color-mix(in srgb, var(--text) 2.4%, transparent) 0 1px, transparent 1px 7px),
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--text) 7%, transparent) 1px, transparent 0);
  background-size: auto, auto, 22px 22px;
  background-attachment: fixed, fixed, fixed;
}

/* 顶栏：发丝线 + 刻度尺 */
html[data-tech="on"] .topbar { border-bottom: 1px solid var(--border); }
html[data-tech="on"] .topbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: repeating-linear-gradient(90deg, var(--accent) 0 1px, transparent 1px 14px);
  opacity: .3; pointer-events: none;
}
html[data-tech="on"] .brand-mark {
  background: var(--accent); color: #0a0b0d;
  border-radius: 0; box-shadow: none;
  clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 0 100%);
}
html[data-tech="on"] .brand-text { letter-spacing: .06em; }
html[data-tech="on"] .brand-sub {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .18em;
  color: var(--accent); opacity: .75;
}

/* 卡片：直角 + 对角括号 + 顶边强调段 */
html[data-tech="on"] .card {
  border-radius: 2px;
  background: linear-gradient(180deg, var(--bg-elev) 0%, color-mix(in srgb, var(--bg-elev) 88%, #000) 100%);
  padding-top: 15px;
}
html[data-tech="on"] .card::before,
html[data-tech="on"] .card::after {
  content: ""; position: absolute; width: 11px; height: 11px; pointer-events: none; opacity: .85;
}
html[data-tech="on"] .card::before {
  left: -1px; top: -1px;
  border-left: 1px solid var(--accent-line);
  border-top: 1px solid var(--accent-line);
}
html[data-tech="on"] .card::after {
  right: -1px; bottom: -1px;
  border-right: 1px solid var(--accent-line);
  border-bottom: 1px solid var(--accent-line);
  opacity: .45;
}
html[data-tech="on"] .card.is-starred::before,
html[data-tech="on"] .card.is-starred::after { border-color: var(--star); }
html[data-tech="on"] .card-head::after {
  content: ""; position: absolute; left: 15px; right: 15px; top: 30px; height: 1px;
  background: linear-gradient(90deg, var(--border), transparent 65%);
  pointer-events: none;
}
html[data-tech="on"] .card-time { font-family: var(--mono); letter-spacing: .1em; color: var(--text-dim); }
html[data-tech="on"] .card-star { color: var(--star); }

/* 标签：直角 + 左侧强调竖条 */
html[data-tech="on"] .chip {
  border-radius: 2px;
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  color: var(--text);
  position: relative; padding-left: 13px; height: 24px;
  font-family: var(--mono); font-size: 11.5px; letter-spacing: .03em;
}
html[data-tech="on"] .chip::before {
  content: ""; position: absolute; left: 5px; top: 5px; bottom: 5px; width: 2px;
  background: var(--accent); opacity: .9;
}
html[data-tech="on"] .chip.static:hover { background: color-mix(in srgb, var(--accent) 15%, transparent); }

/* 按钮：切角主按钮 + 直角次按钮 */
html[data-tech="on"] .btn {
  border-radius: 0;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-elev-2) 80%, transparent);
  font-family: var(--mono); font-size: 12.5px; letter-spacing: .04em;
}
html[data-tech="on"] .btn:hover { border-color: var(--accent-line); background: color-mix(in srgb, var(--accent) 8%, var(--bg-elev-2)); }
html[data-tech="on"] .btn.primary {
  background: var(--accent);
  color: #0a0b0d;
  border-color: transparent;
  font-weight: 700;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%);
  box-shadow: none;
}
html[data-tech="on"] .btn.primary:disabled { opacity: .3; }
html[data-tech="on"] .btn.danger { background: transparent; border-color: color-mix(in srgb, var(--danger) 45%, transparent); }

/* 输入区：左上角小标题（终端标签） */
html[data-tech="on"] .composer { border-radius: 2px; position: relative; }
html[data-tech="on"] .composer::before {
  content: var(--input-label, "INPUT // TERMINAL");
  position: absolute; top: -7px; left: 13px; padding: 0 6px;
  background: var(--bg);
  color: var(--accent);
  font-family: var(--mono); font-size: 8.5px; font-weight: 600; letter-spacing: .22em;
  pointer-events: none;
}
html[data-tech="on"] .composer:focus-within { box-shadow: 0 0 0 1px var(--accent-line); }
html[data-tech="on"] #composer-text { caret-color: var(--accent); }
html[data-tech="on"] .tag-input { border-radius: 2px; font-family: var(--mono); letter-spacing: .04em; }
html[data-tech="on"] kbd.hint { font-family: var(--mono); border-radius: 0; border-color: var(--border); }

/* 区块标题：等宽 + 斜杠前缀 */
html[data-tech="on"] .section-head h2 {
  color: var(--accent);
  font-family: var(--mono); font-size: 11px; letter-spacing: .22em;
}
html[data-tech="on"] .section-head h2::before { content: "// "; opacity: .55; }
html[data-tech="on"] .link-btn { font-family: var(--mono); font-size: 11.5px; letter-spacing: .06em; }
html[data-tech="on"] .day-sep { font-family: var(--mono); letter-spacing: .12em; color: var(--text-faint); }
html[data-tech="on"] .day-sep::after { background: linear-gradient(90deg, var(--border), transparent); }

/* 搜索框：聚焦时底部扫光 */
html[data-tech="on"] .search-box { border-radius: 2px; position: relative; overflow: hidden; }
html[data-tech="on"] .search-box::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 1px; width: 0;
  background: var(--accent); transition: width .25s ease;
}
html[data-tech="on"] .search-box:focus-within::after { width: 42%; }
html[data-tech="on"] .search-box input { font-family: var(--mono); letter-spacing: .03em; }
html[data-tech="on"] .search-meta { font-family: var(--mono); letter-spacing: .08em; }

/* 筛选 pill */
html[data-tech="on"] .pill {
  border-radius: 2px; font-family: var(--mono); font-size: 11.5px; letter-spacing: .05em;
}
html[data-tech="on"] .pill.is-active {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  border-color: var(--accent); color: var(--accent); font-weight: 600;
}

/* 标签卡片 */
html[data-tech="on"] .tag-card { border-radius: 2px; }
html[data-tech="on"] .tag-card b { font-family: var(--mono); font-size: 13px; letter-spacing: .04em; }

/* 面板 / 统计 / 弹层 */
html[data-tech="on"] .panel { border-radius: 2px; position: relative; }
html[data-tech="on"] .panel::before {
  content: ""; position: absolute; left: -1px; top: -1px; width: 10px; height: 10px;
  border-left: 1px solid var(--accent-line); border-top: 1px solid var(--accent-line);
  opacity: .8; pointer-events: none;
}
html[data-tech="on"] .panel-title { font-family: var(--mono); letter-spacing: .2em; color: var(--accent); }
html[data-tech="on"] .stat { border-radius: 2px; background: transparent; border: 1px solid var(--border-soft); }
html[data-tech="on"] .stat b { font-family: var(--mono); color: var(--text); font-size: 17px; }
html[data-tech="on"] .sheet { border-radius: 0; border-top: 2px solid var(--accent); }
html[data-tech="on"] .dialog { border-radius: 2px; border-top: 2px solid var(--accent); }
html[data-tech="on"] .sheet-head { border-bottom-color: var(--border); }
html[data-tech="on"] .sheet-head h3 { font-family: var(--mono); letter-spacing: .1em; font-size: 13px; }
html[data-tech="on"] .dialog h4 { font-family: var(--mono); letter-spacing: .06em; }
html[data-tech="on"] .card-menu { border-radius: 2px; border-color: var(--border); }
html[data-tech="on"] .card-menu button { border-radius: 0; font-family: var(--mono); font-size: 12px; letter-spacing: .04em; }
html[data-tech="on"] .card-menu .menu-ico { color: var(--accent); opacity: .8; display: grid; place-items: center; }
html[data-tech="on"] .toast { border-radius: 2px; font-family: var(--mono); font-size: 12px; letter-spacing: .04em; }
html[data-tech="on"] .empty-art { font-family: var(--mono); color: var(--accent); }

/* 底部导航：选中项顶部光条 + 等宽标签 */
html[data-tech="on"] .tabbar { border-top: 1px solid var(--border); }
html[data-tech="on"] .tab-btn {
  position: relative;
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .12em;
}
html[data-tech="on"] .tab-btn.is-active { color: var(--accent); }
html[data-tech="on"] .tab-btn.is-active::before {
  content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 26px; height: 2px; background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}
html[data-tech="on"] .tab-btn.is-active svg { filter: drop-shadow(0 0 6px color-mix(in srgb, var(--accent) 55%, transparent)); }

/* 桌面导航 */
html[data-tech="on"] .rail { border-right: 1px solid var(--border); }
html[data-tech="on"] .rail-btn { border-radius: 0; font-family: var(--mono); font-size: 12.5px; letter-spacing: .08em; }
html[data-tech="on"] .rail-btn.is-active {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  box-shadow: inset 2px 0 0 var(--accent);
}

/* 图片框：直角 + 细边 */
html[data-tech="on"] .card-img { border-radius: 0; }
html[data-tech="on"] .thumb-item { border-radius: 0; }

/* 细微扫描线（很轻，避免影响阅读） */
html[data-tech="on"] .app::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 100;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .3) 0 1px, transparent 1px 4px);
  opacity: .16;
}

/* ============================================================
   v0.5 — 合集/相册、归档、标签建议、图片比例、更新提示
   ============================================================ */

/* ---------- 标签输入：手机友好 ---------- */
.tag-field { display: flex; align-items: center; gap: 4px; position: relative; }
.tag-input { width: 88px; min-width: 64px; }
.tag-input:focus { width: 118px; }
.tag-add {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 9px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 18px; line-height: 1;
  background: var(--bg-elev-2);
  -webkit-tap-highlight-color: transparent;
}
.tag-add:active { transform: scale(0.94); }
.tag-add:hover { border-color: var(--accent-line); color: var(--accent-2); }

.tag-suggest {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 10px 2px 2px;
  border-top: 1px dashed var(--border-soft);
  margin-top: 8px;
}
.tag-suggest-item {
  padding: 6px 11px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg-elev-2);
  color: var(--text-dim);
  font-size: 13px;
  -webkit-tap-highlight-color: transparent;
  transition: all .12s;
}
.tag-suggest-item:active { transform: scale(0.96); }
.tag-suggest-item:hover { border-color: var(--accent-line); color: var(--accent-2); }

/* ---------- 合集：文件夹网格 ---------- */
.collection-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.collection-card {
  display: flex; flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
  overflow: hidden;
  text-align: left;
  transition: border-color .15s, transform .12s;
  -webkit-tap-highlight-color: transparent;
}
.collection-card:active { transform: scale(0.985); }
.collection-card:hover { border-color: var(--accent-line); }
.collection-cover {
  position: relative;
  aspect-ratio: 16 / 10;
  background: linear-gradient(150deg, var(--bg-elev-2), var(--bg-elev));
  display: grid; place-items: center;
  overflow: hidden;
}
.collection-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.collection-glyph {
  font-family: var(--mono);
  font-size: 26px;
  color: var(--accent);
  opacity: .65;
}
.collection-meta {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  padding: 9px 12px 11px;
}
.collection-meta b {
  font-size: 14px; font-weight: 560;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.collection-meta span { font-size: 11.5px; color: var(--text-faint); font-variant-numeric: tabular-nums; flex: none; }
.collection-wide { grid-column: 1 / -1; flex-direction: row; align-items: center; }
.collection-wide .collection-cover { width: 86px; aspect-ratio: 1; flex: none; }
.collection-wide .collection-meta { flex: 1; }

/* ---------- 相册：文件夹内部 ---------- */
.folder-head {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 4px 14px;
}
.folder-back {
  width: 36px; height: 36px; flex: none;
  display: grid; place-items: center;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-dim);
}
.folder-back:active { transform: scale(0.94); }
.folder-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.folder-title b { font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-title span { font-size: 11.5px; color: var(--text-faint); }

.album-grid {
  display: grid;
  /* 统一正方形网格：每格同宽同高，不做瀑布流、不做跨列合并 */
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: 5px;
}
.album-tile {
  position: relative;
  aspect-ratio: 1 / 1;
  min-width: 0;
  border-radius: 7px;
  overflow: hidden;
  background: var(--bg-elev-2);
  border: 1px solid var(--border-soft);
  display: grid; place-items: center;
  -webkit-tap-highlight-color: transparent;
}
.album-tile:active { transform: scale(0.97); }
.album-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.album-text {
  padding: 9px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-dim);
  display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical;
  overflow: hidden;
  text-align: left;
  width: 100%;
  max-height: 100%;
}
/* 纯文字格子也保持同样大小，只换底色区分 */
.album-tile.has-text { background: var(--bg-elev); grid-column: auto; aspect-ratio: 1 / 1; min-height: 0; }
.album-badge {
  position: absolute; right: 5px; bottom: 5px;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: rgba(0,0,0,.6);
  color: #fff;
  font-size: 10px;
  font-family: var(--mono);
}
.album-empty { padding: 40px 10px; text-align: center; color: var(--text-faint); font-size: 13px; }

/* ---------- 条目详情 ---------- */
.note-detail { display: flex; flex-direction: column; gap: 14px; }
.note-detail-meta { display: flex; flex-wrap: wrap; gap: 10px; font-size: 11.5px; color: var(--text-faint); font-family: var(--mono); }
.note-detail-body { white-space: pre-wrap; word-break: break-word; line-height: 1.72; }
.note-detail-imgs { display: flex; flex-direction: column; gap: 8px; }
.note-detail-imgs img {
  width: 100%; height: auto; border-radius: 10px;
  border: 1px solid var(--border-soft);
  display: block;
}
.note-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- 归档标记 ---------- */
.card.is-archived { opacity: .8; }
.card-badge {
  font-size: 10.5px;
  color: var(--text-faint);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: var(--mono);
}

/* ---------- 更新提示条 ---------- */
.update-bar {
  position: fixed;
  left: 50%; transform: translateX(-50%);
  top: calc(var(--safe-t) + 8px);
  z-index: 95;
  display: flex; align-items: center; gap: 12px;
  padding: 8px 10px 8px 16px;
  border-radius: var(--radius-pill);
  background: var(--bg-elev-2);
  border: 1px solid var(--accent-line);
  box-shadow: var(--shadow);
  font-size: 13px;
  animation: toastIn .24s ease;
}
html[data-tech="on"] .update-bar { border-radius: 2px; font-family: var(--mono); font-size: 12px; }

/* 图片按原始比例显示（单图） */
.card-imgs[data-count="1"] .card-img { max-height: 68vh; }
.card-imgs[data-count="1"] .card-img img { object-fit: cover; max-height: none; }

@media (min-width: 640px) {
  .album-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .collection-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ============================================================
   v0.5.4 — 手机端输入框：禁止自动缩放
   iOS/Android 在聚焦 font-size < 16px 的输入框时会放大页面；
   移动端统一提到 16px，并禁用双击缩放（保留双指缩放）。
   ============================================================ */
html { -webkit-text-size-adjust: 100%; }
input, textarea, select { touch-action: manipulation; }

@media (max-width: 859px) {
  .tag-input { font-size: 16px; width: 96px; min-width: 72px; }
  .tag-input:focus { width: 132px; }
  .dialog input.text { font-size: 16px; }
  .search-box input { font-size: 16px; }
}

/* v0.5.9 — 窄屏筛选胶囊更紧凑，尽量一行放下两三个而不是勉强塞满 */
@media (max-width: 420px) {
  .filter-row { gap: 6px; }
  .pill { padding: 0 10px; height: 28px; font-size: 12.5px; }
}
