/* ============================================================
   识海 mindsea · 黑金主题（与 portfolio / mem / classkeeper / lifetodo 一致）
   ============================================================ */
:root {
  --bg: #0f1115;
  --surface: #181b22;
  --surface-2: #1d212a;
  --surface-3: #252a34;
  --line: #2b2f38;
  --text: #f0ede4;
  --muted: #9aa0ab;
  --faint: #6f7684;
  --accent: #d4af37;
  --accent-hover: #e0bd4a;
  --accent-dim: rgba(212, 175, 55, 0.14);
  --accent-line: rgba(212, 175, 55, 0.4);
  --accent-contrast: #171204;
  --danger: #f87171;
  --danger-dim: rgba(248, 113, 113, 0.12);
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
[v-cloak] { display: none !important; }
html, body { min-height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; font-size: 15px; color: var(--text); }
a { color: var(--accent); }
img { display: block; max-width: 100%; }

/* ---------------- 通用 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 44px; padding: 0 18px; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 500; transition: opacity 120ms, background 120ms;
}
.btn:disabled { opacity: 0.45; }
.btn-primary { background: var(--accent); color: var(--accent-contrast); }
.btn-primary:active { background: var(--accent-hover); }
.btn-ghost { background: var(--surface-3); color: var(--text); }
.btn-danger-ghost { background: var(--danger-dim); color: var(--danger); }
.btn-block { width: 100%; }
.mini { font-size: 13px; color: var(--accent); padding: 6px 10px; }
.err { color: var(--danger); font-size: 13px; margin-top: 8px; }
.hint { color: var(--faint); font-size: 12px; margin-top: 10px; }

.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:active { background: var(--surface-3); color: var(--accent); }

.toast {
  position: fixed; left: 50%; top: calc(16px + var(--safe-top)); transform: translateX(-50%);
  z-index: 200; padding: 10px 16px; border-radius: 10px; font-size: 13.5px;
  background: var(--surface-3); border: 1px solid var(--line); box-shadow: var(--shadow);
  max-width: 86vw; text-align: center;
}
.toast-error { border-color: rgba(248, 113, 113, 0.5); color: #ffc9c9; }
.toast-ok { border-color: var(--accent-line); color: #f3e3b0; }

/* ---------------- 登录 / 改密 ---------------- */
.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px calc(20px + var(--safe-bottom)) calc(24px + var(--safe-bottom));
}
.auth-box { width: 400px; max-width: 100%; }
.auth-logo { text-align: center; margin-bottom: 26px; }
.auth-logo svg { margin: 0 auto 12px; display: block; }
.auth-title { font-size: 23px; font-weight: 600; letter-spacing: 3px; }
.auth-sub { font-size: 13px; color: var(--muted); margin-top: 6px; }
.auth-hint { text-align: center; font-size: 12px; color: var(--faint); margin-top: 18px; line-height: 1.7; }
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px 18px;
}
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%; height: 46px; padding: 0 13px; background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--radius-sm); outline: none;
}
.field input:focus { border-color: var(--accent-line); }

/* ---------------- 主布局 ---------------- */
.shell { min-height: 100vh; padding-top: calc(50px + var(--safe-top)); }

.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60;
  height: calc(50px + var(--safe-top)); padding: var(--safe-top) 12px 0 16px;
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(15, 17, 21, 0.93);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 600; letter-spacing: 2px; color: var(--accent); }
.brand-mark {
  width: 22px; height: 22px; border-radius: 7px; flex: 0 0 22px;
  background: linear-gradient(135deg, #3a2f10, #d4af37);
  display: flex; align-items: center; justify-content: center;
}
.brand-mark svg { display: block; }
.topbar-actions { display: flex; gap: 2px; }
.menu {
  position: absolute; right: 12px; top: calc(46px + var(--safe-top));
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); overflow: hidden; min-width: 132px; z-index: 70;
}
.menu button { display: block; width: 100%; text-align: left; padding: 12px 16px; font-size: 14px; color: var(--text); }
.menu button:active { background: var(--surface-3); }

.feed { max-width: 720px; margin: 0 auto; }

/* ---------------- 捕获区 ---------------- */
.capture {
  position: sticky; top: calc(50px + var(--safe-top)); z-index: 50;
  background: var(--bg); border-bottom: 1px solid var(--line);
  padding: 12px 14px 10px;
  transition: box-shadow 160ms;
}
.capture-focus { box-shadow: 0 10px 22px rgba(0, 0, 0, 0.5); }
.capture-input {
  width: 100%; resize: none; border: none; outline: none; background: transparent;
  font-size: 16px; line-height: 1.6; color: var(--text); padding: 4px 2px 8px;
  max-height: 40vh; overflow-y: auto;
}
.capture-input::placeholder { color: var(--faint); }

.draft-list { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 0 8px; }
.draft-item {
  display: flex; align-items: center; gap: 7px; max-width: 100%;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 4px 6px 4px 4px; font-size: 12.5px;
}
.draft-item img { width: 34px; height: 34px; object-fit: cover; border-radius: 7px; }
.file-ico {
  font-size: 10.5px; color: var(--muted); background: var(--surface-3);
  border-radius: 7px; padding: 9px 7px; letter-spacing: 0.5px;
}
.draft-name { max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.draft-size { color: var(--faint); font-size: 11px; }
.draft-x { color: var(--faint); font-size: 17px; line-height: 1; padding: 0 3px; }

.capture-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tools { display: flex; gap: 2px; }
.tool {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 8px 9px; border-radius: 9px; color: var(--muted); font-size: 12.5px;
}
.tool:active { background: var(--surface-2); color: var(--accent); }
.send {
  height: 38px; padding: 0 20px; border-radius: 19px;
  background: var(--accent); color: var(--accent-contrast); font-size: 14.5px; font-weight: 600;
  transition: opacity 120ms, background 120ms;
}
.send:disabled { background: var(--surface-3); color: var(--faint); }

.url-input { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.url-input input {
  flex: 1; height: 38px; padding: 0 12px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 9px; outline: none; font-size: 14px;
}
.url-input input:focus { border-color: var(--accent-line); }

.orig-toggle {
  display: flex; align-items: center; gap: 8px; margin-top: 8px;
  font-size: 12.5px; color: var(--muted);
}
.orig-toggle input { width: 15px; height: 15px; accent-color: var(--accent); }

/* ---------------- 筛选 ---------------- */
.tabs {
  display: flex; gap: 6px; padding: 12px 14px 4px; overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  flex: 0 0 auto; padding: 6px 13px; border-radius: 16px; font-size: 13px;
  color: var(--muted); background: var(--surface); border: 1px solid var(--line);
}
.tabs button.active { color: var(--accent); background: var(--accent-dim); border-color: var(--accent-line); }
.tabs .count { margin-left: 5px; font-size: 11.5px; opacity: 0.7; }

/* ---------------- 火花卡片 ---------------- */
.list { padding: 8px 14px 0; }
.spark {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 13px 14px; margin-bottom: 10px;
  transition: border-color 140ms;
}
.spark:active { border-color: var(--accent-line); }
.spark-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.spark-time { font-size: 12px; color: var(--faint); letter-spacing: 0.3px; }
.badge {
  font-size: 10.5px; padding: 1px 7px; border-radius: 6px;
  background: var(--accent-dim); color: var(--accent); border: 1px solid var(--accent-line);
}
.badge-muted { background: rgba(154, 160, 171, 0.12); color: var(--muted); border-color: rgba(154, 160, 171, 0.28); }
.spark-text {
  font-size: 15px; line-height: 1.65; white-space: pre-wrap; word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 8; -webkit-box-orient: vertical; overflow: hidden;
}
.spark-thumbs { display: flex; gap: 6px; margin-top: 9px; flex-wrap: wrap; align-items: center; }
.spark-thumbs img {
  width: 74px; height: 74px; object-fit: cover; border-radius: 9px;
  border: 1px solid var(--line); background: var(--surface-2);
}
.spark-thumbs .more { font-size: 12px; color: var(--faint); }
.spark-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  font-size: 12.5px; color: var(--muted); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 8px; padding: 4px 9px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chip em { font-style: normal; color: var(--faint); font-size: 11px; }
.chip-link { color: var(--accent); text-decoration: none; }
.spark-link {
  display: block; margin-top: 8px; font-size: 13px; color: #b99a3f;
  text-decoration: none; word-break: break-all;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.empty { text-align: center; color: var(--faint); font-size: 13.5px; padding: 44px 20px; line-height: 1.9; }
.load-more {
  display: block; width: 100%; padding: 13px; margin-top: 4px;
  font-size: 13px; color: var(--muted); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.bottom-pad { height: calc(30px + var(--safe-bottom)); }

/* ---------------- 详情弹层 ---------------- */
.sheet-mask {
  position: fixed; inset: 0; z-index: 120; background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: 100%; max-width: 720px; max-height: 88vh; overflow-y: auto;
  background: var(--surface); border-radius: 18px 18px 0 0;
  border-top: 1px solid var(--line); padding: 8px 16px calc(18px + var(--safe-bottom));
  animation: rise 180ms ease-out;
}
@keyframes rise { from { transform: translateY(24px); opacity: 0.6; } to { transform: none; opacity: 1; } }
.sheet-grab { width: 38px; height: 4px; border-radius: 2px; background: var(--surface-3); margin: 4px auto 10px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.sheet-text {
  width: 100%; resize: vertical; background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 12px; outline: none; line-height: 1.65; min-height: 96px;
}
.sheet-text:focus, .sheet-url:focus { border-color: var(--accent-line); }
.sheet-url {
  width: 100%; height: 40px; margin-top: 8px; padding: 0 12px; background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--radius-sm); outline: none; font-size: 14px;
}
.sheet-thumbs { margin-top: 12px; }
.sheet-thumbs img { width: 92px; height: 92px; }
.sheet-actions { display: flex; gap: 8px; margin-top: 16px; }
.sheet-actions .btn { flex: 1; }
.sheet-actions .btn-primary { flex: 1.2; }

/* ---------------- 搜索 ---------------- */
.search-mask {
  position: fixed; inset: 0; z-index: 110; background: rgba(10, 11, 14, 0.94);
  backdrop-filter: blur(6px); padding-top: calc(10px + var(--safe-top));
  display: flex; flex-direction: column;
}
.search-panel { max-width: 720px; width: 100%; margin: 0 auto; flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.search-bar { display: flex; gap: 8px; align-items: center; padding: 6px 14px 12px; }
.search-bar input {
  flex: 1; height: 44px; padding: 0 14px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; outline: none; font-size: 15px;
}
.search-bar input:focus { border-color: var(--accent-line); }
.search-panel .list { overflow-y: auto; padding-bottom: calc(30px + var(--safe-bottom)); }

/* ---------------- 看大图 ---------------- */
.viewer {
  position: fixed; inset: 0; z-index: 150; background: rgba(0, 0, 0, 0.95);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  padding: calc(20px + var(--safe-top)) 12px calc(20px + var(--safe-bottom));
}
.viewer img { max-width: 100%; max-height: 82vh; object-fit: contain; border-radius: 8px; }
.viewer-dl {
  font-size: 13px; color: var(--accent); padding: 8px 16px;
  border: 1px solid var(--accent-line); border-radius: 9px; text-decoration: none;
}

/* ---------------- 桌面 ---------------- */
@media (min-width: 760px) {
  .feed { max-width: 780px; }
  .capture { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
  .spark:hover { border-color: #3a3f4b; }
  .spark-thumbs img { width: 84px; height: 84px; }
  .sheet { border-radius: 18px; margin-bottom: 26px; max-height: 84vh; }
  .sheet-mask { align-items: center; }
}
