/* =========================================================
   Hadal Privacy Vault — 前端展示样式
   暗色安全主题 · 手机优先 · 纯 CSS（零构建）
   v0.4.0 · ?v=4
   ========================================================= */
:root {
  --bg: #0b0f14;
  --bg-grad: radial-gradient(120% 60% at 50% 0%, #101823 0%, #0b0f14 55%);
  --surface: #131a23;
  --surface-2: #1b2430;
  --border: #223041;
  --text: #e7edf3;
  --muted: #8b98a8;
  --muted-2: #64748b;
  --accent: #34d399;
  --accent-soft: rgba(52, 211, 153, 0.14);
  --accent-2: #2dd4bf;
  --danger: #f87171;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --radius: 16px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  max-width: 460px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  padding-bottom: 92px; /* 给底部导航留空间 */
}

/* --------- 视图切换 --------- */
.view { animation: fade-in 0.25s ease; }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* --------- 通用按钮 --------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 14px;
  padding: 13px 18px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, background 0.2s, opacity 0.2s;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: #04120c; }
.btn-ghost { background: transparent; color: var(--accent); }
.btn-outline { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.link-btn { background: none; border: none; color: var(--accent); font-size: 13px; cursor: pointer; padding: 6px 4px; }
.icon-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  width: 40px;
  height: 40px;
  font-size: 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* --------- 演示控制浮条 --------- */
.demo-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  justify-content: center;
  gap: 10px;
  align-items: center;
  background: rgba(11, 15, 20, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 8px 14px;
  font-size: 12px;
}
.demo-tag { color: var(--muted); }
.demo-version {
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(52, 211, 153, 0.3);
  border-radius: 999px;
  padding: 2px 9px;
  font-weight: 600;
}

/* =========================================================
   视图 0 — 伪装入口（便签 App）
   ========================================================= */
.view-disguise { padding: 44px 18px 20px; }
.disguise-app {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.disguise-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.disguise-app-title { font-size: 17px; font-weight: 700; }
.disguise-search {
  margin: 14px 16px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--muted-2);
  font-size: 14px;
}
.disguise-list { padding: 0 8px 8px; }
.disguise-note {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 10px;
  border-bottom: 1px solid rgba(34, 48, 65, 0.5);
}
.disguise-note:last-child { border-bottom: none; }
.note-emoji { font-size: 22px; }
.note-body { flex: 1; min-width: 0; }
.note-title { font-size: 15px; font-weight: 600; }
.note-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.note-time { font-size: 12px; color: var(--muted-2); }
.disguise-hint { text-align: center; color: var(--muted-2); font-size: 12px; padding: 10px; }
.disguise-fab {
  position: absolute;
  right: 26px;
  bottom: 120px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent);
  color: #04120c;
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
}
.demo-goto-unlock { margin: 18px auto 0; display: flex; }

/* =========================================================
   视图 1 — 解锁
   ========================================================= */
.view-unlock {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}
.unlock-box { width: 100%; text-align: center; }
.unlock-lock-wrap { display: flex; justify-content: center; margin-bottom: 18px; }
.unlock-lock {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 1px solid rgba(52, 211, 153, 0.3);
  font-size: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: breathe 2.4s ease-in-out infinite;
}
@keyframes breathe { 0%,100% { box-shadow: 0 0 0 0 rgba(52,211,153,0.2); } 50% { box-shadow: 0 0 0 14px rgba(52,211,153,0.03); } }
.unlock-title { font-size: 22px; font-weight: 700; }
.unlock-sub { color: var(--muted); font-size: 14px; margin-top: 6px; }

.biometric-btn {
  margin: 28px auto 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 15px;
  border-radius: 14px;
  background: var(--accent);
  color: #04120c;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  border: none;
}
.bio-icon { font-size: 20px; }
.biometric-btn:active { transform: scale(0.98); }
.bio-status {
  margin-top: 14px;
  font-size: 13px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(52, 211, 153, 0.28);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}
.bio-status.error {
  color: var(--danger);
  background: rgba(248, 113, 113, 0.1);
  border-color: rgba(248, 113, 113, 0.3);
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted-2);
  font-size: 13px;
  margin: 26px 0 18px;
}
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.pin-field { display: flex; justify-content: center; gap: 14px; margin: 8px 0 26px; }
.pin-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border);
  transition: all 0.12s;
}
.pin-dot.filled { background: var(--accent); border-color: var(--accent); }
.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 300px;
  margin: 0 auto;
}
.pin-key {
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 22px;
  font-weight: 600;
  cursor: pointer;
}
.pin-key:active { background: var(--accent-soft); }
.pin-key-blank { visibility: hidden; }
.pin-key-del { font-size: 22px; }

/* =========================================================
   通用 Header / 内容
   ========================================================= */
.view-home, .view-category, .view-detail, .view-trust { padding: 64px 18px 20px; }
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.header-left { display: flex; align-items: center; gap: 10px; }
.header-center { flex: 1; }
.header-title { font-size: 20px; font-weight: 700; }
.header-badge {
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(52, 211, 153, 0.28);
  border-radius: 999px;
  padding: 4px 10px;
}

/* --------- 隐私仪表盘 --------- */
.dashboard { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.dashboard-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}
.dash-stat { font-size: 26px; }
.dash-label { font-size: 15px; font-weight: 600; margin-top: 8px; }
.dash-label b { color: var(--accent); }
.dash-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

.privacy-strip {
  background: var(--accent-soft);
  border: 1px solid rgba(52, 211, 153, 0.28);
  color: var(--accent);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 20px;
}

.section-title { font-size: 15px; font-weight: 700; color: var(--text); margin: 18px 0 12px; }
.section-title-row { display: flex; align-items: center; justify-content: space-between; }

/* --------- 分类网格 --------- */
.category-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.category-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.2s;
  text-align: left;
}
.category-card:active { transform: scale(0.98); }
.category-card:hover { border-color: rgba(52, 211, 153, 0.4); }
.cat-icon { font-size: 30px; }
.cat-name { font-size: 15px; font-weight: 700; margin-top: 10px; }
.cat-count { font-size: 12px; color: var(--muted); margin-top: 4px; }
.cat-accent { height: 4px; border-radius: 2px; background: var(--accent); margin-top: 12px; opacity: 0.7; }

/* --------- 最近项目 --------- */
.recent-list { display: flex; flex-direction: column; gap: 10px; }
.recent-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  cursor: pointer;
}
.thumb {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.recent-body { flex: 1; min-width: 0; }
.recent-name { font-size: 14px; font-weight: 600; }
.recent-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.recent-chev { color: var(--muted-2); }

/* --------- 项目网格（分类视图） --------- */
.item-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.item-card {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  overflow: hidden;
  position: relative;
}
.item-card:active { transform: scale(0.97); }
.item-card .item-emoji { font-size: 30px; }
.item-card .item-name { font-size: 11px; color: var(--muted); text-align: center; padding: 0 4px; }

/* --------- 项目详情 --------- */
.detail-body { margin-top: 8px; }
.detail-hero {
  aspect-ratio: 3/4;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 72px;
  margin-bottom: 16px;
}
.detail-name { font-size: 18px; font-weight: 700; }
.detail-meta { color: var(--muted); font-size: 13px; margin-top: 6px; }
.detail-badge-list { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.detail-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13px;
  color: var(--muted);
}
.detail-actions { display: flex; gap: 12px; margin-top: 20px; }
.detail-actions .btn { flex: 1; }

/* --------- 信任 / 隐私 --------- */
.trust-hero {
  text-align: center;
  padding: 26px 0 22px;
}
.trust-hero-lock {
  width: 72px;
  height: 72px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 1px solid rgba(52, 211, 153, 0.3);
  font-size: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.trust-hero-title { font-size: 20px; font-weight: 700; }
.trust-hero-sub { color: var(--muted); font-size: 13px; margin-top: 6px; }

.trust-list { display: flex; flex-direction: column; gap: 12px; }
.trust-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
}
.trust-icon { font-size: 22px; }
.trust-body { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.trust-body b { font-size: 14px; }
.trust-body span { font-size: 12px; color: var(--muted); }
.trust-check { color: var(--accent); font-weight: 700; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.note-card { padding: 16px; margin-top: 18px; font-size: 13px; }
.note-card b { color: var(--danger); }
.note-card p { color: var(--muted); margin: 8px 0 0; }

/* --------- 底部导航 --------- */
.tabbar {
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  width: min(400px, calc(100% - 24px));
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: rgba(19, 26, 35, 0.92);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px;
  z-index: 40;
}
.tab {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 20px;
  width: 48px;
  height: 44px;
  border-radius: 999px;
  cursor: pointer;
}
.tab.active { background: var(--accent-soft); color: var(--accent); }

/* --------- 工具类 --------- */
.hidden { display: none !important; }
/* 确保 hidden 属性始终生效（覆盖 .view-* 的 display 规则，如 .view-unlock 的 flex） */
[hidden] { display: none !important; }

/* =========================================================
   v0.4.0 — 流程完善：引导 / 导入 / 设置 / 空态 / Toast
   ========================================================= */
.app-header .header-actions { display: flex; gap: 8px; }
.btn-block { width: 100%; }
.label-sub { font-size: 12px; color: var(--muted); font-weight: 400; }
.empty-state { color: var(--muted-2); text-align: center; font-size: 14px; padding: 28px 12px; }
.text-input {
  width: 100%;
  margin: 10px 0;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 15px;
}
.text-input:focus { outline: none; border-color: var(--accent); }

/* ---- Toast ---- */
#toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%) translateY(12px);
  background: rgba(19, 26, 35, 0.95);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 60;
  box-shadow: var(--shadow);
  max-width: calc(100% - 32px);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- 首启引导 ---- */
.view-onboarding { padding: 74px 24px 24px; min-height: 100vh; min-height: 100dvh; }
.onb-progress { display: flex; justify-content: center; gap: 8px; margin-bottom: 30px; }
.onb-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border); transition: all 0.2s; }
.onb-dot.active { background: var(--accent); width: 22px; border-radius: 999px; }
.onb-slide { text-align: center; }
.onb-hero { font-size: 56px; margin: 10px auto 18px; }
.onb-step-icon { font-size: 44px; margin: 8px auto 16px; }
.onb-title { font-size: 24px; font-weight: 700; }
.onb-sub { color: var(--muted); font-size: 14px; margin: 8px 0 22px; }
.onb-points { list-style: none; margin: 0 auto 26px; padding: 0; display: flex; flex-direction: column; gap: 12px; max-width: 320px; text-align: left; }
.onb-points li { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.onb-points li span { font-size: 20px; }
.onb-err { color: var(--danger); font-size: 13px; margin: 4px 0; }
.recovery-box {
  background: var(--surface-2);
  border: 1px dashed var(--accent);
  color: var(--accent);
  border-radius: 12px;
  padding: 16px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 16px;
  word-break: break-all;
}
.view-onboarding .btn { margin-top: 12px; }

/* ---- 导入 ---- */
.import-sources { display: flex; gap: 12px; margin-bottom: 20px; }
.import-source {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.import-source:active { transform: scale(0.98); }
.import-source span { font-size: 28px; }
.import-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.import-item { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; }
.import-ok { font-size: 12px; color: var(--accent); }

/* ---- 设置 ---- */
.settings-list { display: flex; flex-direction: column; gap: 12px; }
.settings-item { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; cursor: pointer; }
.settings-item:active { background: var(--surface-2); }
.set-icon { font-size: 22px; }
.set-body { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.set-body b { font-size: 14px; }
.set-body span { font-size: 12px; color: var(--muted); }
.set-chev { color: var(--muted-2); }
