/* ==========================================================================
   小婷的专属档案 —— 样式
   暖纸色 + 玫瑰红，中文衬线标题，手机优先
   ========================================================================== */

:root {
  --bg: #faf6f2;
  --bg-2: #f3ece5;
  --card: #ffffff;
  --ink: #40362f;
  --ink-2: #7d7068;
  --ink-3: #a89c93;
  --line: #ecdfd5;
  --line-2: #f3e9e1;
  --accent: #c4607c;
  --accent-2: #a94a66;
  --accent-soft: #faecf0;
  --ok: #558f74;
  --warn: #b8783c;
  --danger: #c04f4f;
  --shadow: 0 1px 2px rgba(80, 60, 50, .05), 0 8px 24px rgba(80, 60, 50, .06);
  --shadow-up: 0 2px 6px rgba(80, 60, 50, .08), 0 18px 40px rgba(80, 60, 50, .12);
  --r-s: 8px;
  --r: 14px;
  --r-l: 20px;
  --serif: "Songti SC", "STSong", "SimSun", "Source Han Serif SC", "Noto Serif CJK SC", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  --maxw: 1080px;
}

:root[data-theme="dark"] {
  --bg: #16120f;
  --bg-2: #1d1815;
  --card: #221c18;
  --ink: #f0e6de;
  --ink-2: #b5a69b;
  --ink-3: #877a70;
  --line: #362c26;
  --line-2: #2c2420;
  --accent: #e08aa1;
  --accent-2: #f0a5b8;
  --accent-soft: #2e2026;
  --ok: #7ab896;
  --warn: #d9a06a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  --shadow-up: 0 2px 6px rgba(0, 0, 0, .35), 0 18px 40px rgba(0, 0, 0, .4);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16120f;
    --bg-2: #1d1815;
    --card: #221c18;
    --ink: #f0e6de;
    --ink-2: #b5a69b;
    --ink-3: #877a70;
    --line: #362c26;
    --line-2: #2c2420;
    --accent: #e08aa1;
    --accent-2: #f0a5b8;
    --accent-soft: #2e2026;
    --ok: #7ab896;
    --warn: #d9a06a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    --shadow-up: 0 2px 6px rgba(0, 0, 0, .35), 0 18px 40px rgba(0, 0, 0, .4);
  }
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent-2); }
code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .9em; background: var(--bg-2); padding: 1px 5px; border-radius: 5px; }
button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }

/* ============================ 通用控件 ============================ */

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
  transition: .16s transform, .16s box-shadow, .16s background, .16s border-color;
  white-space: nowrap;
  box-shadow: var(--shadow);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-ghost { background: transparent; border-color: var(--line); box-shadow: none; color: var(--ink-2); }
.btn-ghost:hover { color: var(--ink); border-color: var(--accent); }
.btn-danger-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--danger); }
.btn-danger-ghost:hover { background: rgba(192, 79, 79, .08); border-color: currentColor; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 8px; }
.btn-row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }

.icon-btn {
  appearance: none;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-2);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  display: grid; place-items: center;
  transition: .16s;
  flex: none;
}
.icon-btn:hover { background: var(--bg-2); color: var(--ink); }

input[type=text], input[type=password], input[type=date], input[type=search], input[type=number], textarea, select {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  padding: 9px 12px;
  outline: none;
  transition: .16s border-color, .16s box-shadow;
}
textarea { resize: vertical; min-height: 66px; line-height: 1.7; }
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
::placeholder { color: var(--ink-3); }

.mini-select { width: auto; padding: 6px 10px; font-size: 13px; border-radius: var(--r-s); }

.switch-line { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.switch-line input { width: 16px; height: 16px; accent-color: var(--accent); }

/* ============================ 口令门 ============================ */

.gate {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center;
  background: var(--bg);
  padding: 24px;
}
.gate-card { width: 100%; max-width: 372px; text-align: center; }
.gate-emoji { font-size: 40px; margin-bottom: 6px; }
.gate-card h1 { font-family: var(--serif); font-size: 25px; letter-spacing: .5px; }
.gate-sub { color: var(--ink-2); font-size: 13.5px; margin: 8px 0 22px; }
#gateForm { display: grid; gap: 10px; }
.gate-tip { color: var(--ink-3); font-size: 12px; margin-top: 16px; line-height: 1.6; }
.gate-err { color: var(--danger); font-size: 13px; margin-top: 10px; }

/* ============================ 布局 ============================ */

.app { min-height: 100%; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line-2);
}
.topbar-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 14px 18px 8px;
  display: flex; align-items: center; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-avatar {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  background: var(--accent-soft); display: grid; place-items: center; font-size: 20px;
  border: 1px solid var(--line-2);
}
.brand-text { min-width: 0; }
.brand-text h1 { font-family: var(--serif); font-size: 19px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text p { color: var(--ink-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }

.stat-strip { display: none; font-size: 12px; color: var(--ink-3); margin-right: 4px; }
@media (min-width: 760px) { .stat-strip { display: inline-block; } }

.tabs {
  max-width: var(--maxw); margin: 0 auto; padding: 0 12px;
  display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  appearance: none; background: none; border: 0; cursor: pointer;
  padding: 10px 14px 12px; font-size: 14.5px; color: var(--ink-2);
  border-bottom: 2px solid transparent; white-space: nowrap; transition: .16s;
}
.tab:hover { color: var(--ink); }
.tab.on { color: var(--accent-2); border-bottom-color: var(--accent); font-weight: 600; }

.main { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 22px 18px 110px; flex: 1; }

.view-head { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 4px; }
.view-head h2 { font-family: var(--serif); font-size: 22px; }
.view-desc { color: var(--ink-2); font-size: 13px; margin-top: 3px; max-width: 620px; }
.view-head .btn { margin-left: auto; }

.toolbar { display: flex; flex-direction: column; gap: 10px; margin: 16px 0 8px; }
.search-wrap { position: relative; display: flex; align-items: center; }
.search-ico { position: absolute; left: 11px; font-size: 13px; opacity: .55; pointer-events: none; }
.search-wrap input { padding-left: 33px; }
.search-clear { position: absolute; right: 6px; border: 0; background: none; font-size: 20px; color: var(--ink-3); cursor: pointer; line-height: 1; padding: 0 8px; }
.filter-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tag-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
  border: 1px solid var(--line); background: var(--card); color: var(--ink-2);
  border-radius: 999px; padding: 3px 11px; font-size: 12.5px; cursor: pointer; transition: .16s;
}
.pill:hover { border-color: var(--accent); color: var(--ink); }
.pill.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.count-line { color: var(--ink-3); font-size: 12.5px; margin: 4px 2px 10px; }

/* ============================ 概览 ============================ */

.hero-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-l);
  box-shadow: var(--shadow); padding: 22px; display: flex; gap: 22px; flex-wrap: wrap; align-items: center;
}
.hero-left { flex: 1 1 260px; min-width: 0; }
.hero-left h2 { font-family: var(--serif); font-size: 30px; letter-spacing: 1px; }
.hero-about { color: var(--ink-2); font-size: 14px; margin-top: 6px; white-space: pre-wrap; }
.hero-about:empty { display: none; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.chip { background: var(--accent-soft); color: var(--accent-2); border-radius: 999px; padding: 3px 11px; font-size: 12.5px; }
.hero-right { flex: 0 0 auto; display: grid; gap: 8px; min-width: 190px; }

.mini-count {
  display: flex; align-items: baseline; gap: 8px;
  border: 1px solid var(--line-2); border-radius: var(--r); padding: 9px 13px; background: var(--bg);
  cursor: pointer; transition: .16s;
}
.mini-count:hover { border-color: var(--accent); transform: translateY(-1px); }
.mini-count b { font-family: var(--serif); font-size: 24px; color: var(--accent-2); font-weight: 600; }
.mini-count span { font-size: 12.5px; color: var(--ink-2); }

.ov-grid { display: grid; gap: 16px; margin-top: 16px; grid-template-columns: 1fr; }
@media (min-width: 860px) { .ov-grid { grid-template-columns: 1fr 1fr; } }

.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-l);
  box-shadow: var(--shadow); padding: 16px 18px 18px; align-self: start;
}
.panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.panel-head h3 { font-size: 15px; letter-spacing: .5px; }
.panel-head .btn { margin-left: auto; }

.field-groups { display: grid; gap: 14px; }
.fgroup-title { font-size: 12px; color: var(--ink-3); letter-spacing: 1px; margin-bottom: 6px; }
.fgrid { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 520px) { .fgrid { grid-template-columns: 1fr 1fr; } }
.fitem {
  border: 1px dashed transparent; border-radius: var(--r-s); padding: 7px 9px;
  display: flex; gap: 8px; align-items: baseline; transition: .16s;
}
.fitem:hover { border-color: var(--line); background: var(--bg); }
.fitem .fl { color: var(--ink-3); font-size: 12.5px; flex: none; min-width: 62px; }
.fitem .fv { font-size: 14px; flex: 1; min-width: 0; word-break: break-word; white-space: pre-wrap; }
.fitem .fops { opacity: 0; display: flex; gap: 2px; transition: .16s; }
.fitem:hover .fops { opacity: 1; }
.fitem .fops .icon-btn { width: 24px; height: 24px; font-size: 13px; }

.ov-list { display: grid; gap: 10px; }
.ov-row { border-top: 1px solid var(--line-2); padding-top: 9px; cursor: pointer; }
.ov-row:first-child { border-top: 0; padding-top: 0; }
.ov-row .t { font-size: 14px; }
.ov-row .d { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.ov-row:hover .t { color: var(--accent-2); }

.ov-photos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.ov-photos img { aspect-ratio: 1; object-fit: cover; border-radius: var(--r-s); cursor: pointer; transition: .18s; background: var(--bg-2); }
.ov-photos img:hover { transform: scale(1.04); }
.ov-photos .more { grid-column: 1 / -1; font-size: 12px; color: var(--ink-3); }

/* ============================ 提问存档 ============================ */

.q-list { display: grid; gap: 14px; }
.q-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-l);
  box-shadow: var(--shadow); padding: 18px 20px; position: relative; overflow: hidden;
  transition: .18s box-shadow, .18s transform;
}
.q-card:hover { box-shadow: var(--shadow-up); transform: translateY(-1px); }
.q-card.star::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.q-card.sample { border-style: dashed; background: repeating-linear-gradient(135deg, transparent, transparent 14px, color-mix(in srgb, var(--line) 40%, transparent) 14px, color-mix(in srgb, var(--line) 40%, transparent) 15px); }
.q-date { font-size: 12px; color: var(--ink-3); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.q-text {
  font-family: var(--serif); font-size: 17.5px; line-height: 1.65; margin: 7px 0 0;
  padding-left: 0; font-weight: 600;
}
.q-a {
  margin-top: 12px; padding: 12px 14px; background: var(--bg); border-radius: var(--r);
  font-size: 15px; line-height: 1.85; white-space: pre-wrap; word-break: break-word;
  border-left: 3px solid var(--line);
}
.q-a.ans-empty { color: var(--ink-3); font-style: normal; border-left-color: var(--accent-soft); background: transparent; border: 1px dashed var(--line); }
.q-a .who { display: block; font-size: 11.5px; color: var(--ink-3); letter-spacing: 1px; margin-bottom: 4px; }
.q-extra { display: grid; gap: 5px; margin-top: 10px; }
.q-extra div { font-size: 13px; color: var(--ink-2); display: flex; gap: 8px; }
.q-extra b { color: var(--ink-3); font-weight: 400; flex: none; }
.q-note { margin-top: 10px; font-size: 13.5px; color: var(--ink-2); white-space: pre-wrap; }
.q-note::before { content: "我的想法："; color: var(--ink-3); }
.q-foot { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.tag { font-size: 11.5px; color: var(--accent-2); background: var(--accent-soft); border-radius: 999px; padding: 2px 9px; }
.tag.grey { background: var(--bg-2); color: var(--ink-2); }
.q-ops { margin-left: auto; display: flex; gap: 2px; opacity: .2; transition: .16s; }
.q-card:hover .q-ops { opacity: 1; }

/* ============================ 照片墙 ============================ */

.photo-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
}
@media (min-width: 620px) { .photo-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 980px) { .photo-grid { grid-template-columns: repeat(4, 1fr); } }
.pcell {
  margin: 0; position: relative;
  border-radius: var(--r); overflow: hidden; background: var(--bg-2);
  border: 1px solid var(--line-2); cursor: zoom-in;
  aspect-ratio: 3 / 4;
}
.pcell img { width: 100%; height: 100%; object-fit: cover; display: block; transition: .28s transform; }
.pcell:hover img { transform: scale(1.03); }
.pcell .video-poster-none {
  width: 100%; height: 100%; display: grid; place-items: center; background: var(--bg-2); color: var(--ink-3);
}
.pcell-cap {
  position: absolute; inset: auto 0 0 0; padding: 22px 10px 8px;
  background: linear-gradient(to top, rgba(24, 16, 12, .72), transparent);
  color: #fff; font-size: 12px; line-height: 1.45;
  opacity: 0; transition: .18s; pointer-events: none;
}
.pcell:hover .pcell-cap { opacity: 1; }
.pcell .star-badge { position: absolute; top: 7px; left: 9px; font-size: 13px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.5)); }
.upload-progress {
  margin: 8px 0 14px; padding: 10px 14px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); font-size: 13px; color: var(--ink-2);
}
.upload-progress .bar { height: 4px; background: var(--bg-2); border-radius: 999px; margin-top: 8px; overflow: hidden; }
.upload-progress .bar i { display: block; height: 100%; background: var(--accent); width: 0; transition: .2s; }

/* ============================ 时间轴 ============================ */

.timeline { position: relative; margin-top: 10px; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 2px; background: var(--line); }
.tl-item { position: relative; margin-bottom: 18px; }
.tl-item::before {
  content: ""; position: absolute; left: -25px; top: 7px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--card); border: 2px solid var(--accent);
}
.tl-date { font-size: 12.5px; color: var(--ink-3); display: flex; gap: 8px; align-items: center; }
.tl-body {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 13px 15px; margin-top: 4px; box-shadow: var(--shadow); position: relative;
}
.tl-body h4 { font-size: 15px; margin-bottom: 3px; }
.tl-body .txt { font-size: 14.5px; white-space: pre-wrap; word-break: break-word; color: var(--ink); }
.tl-thumbs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.tl-thumbs img { width: 62px; height: 62px; object-fit: cover; border-radius: var(--r-s); cursor: zoom-in; }
.tl-ops { position: absolute; top: 8px; right: 8px; display: flex; gap: 2px; opacity: 0; transition: .16s; }
.tl-item:hover .tl-ops { opacity: 1; }
.kind { font-size: 11.5px; border-radius: 6px; padding: 1px 7px; background: var(--accent-soft); color: var(--accent-2); }
.kind.k-心情 { background: #eaf1ff; color: #4a6fa8; }
.kind.k-约定 { background: #eaf7ee; color: #40764f; }
.kind.k-重要事 { background: #fdeeee; color: #a84a4a; }
:root[data-theme="dark"] .kind.k-心情 { background: #1e2734; }
:root[data-theme="dark"] .kind.k-约定 { background: #1c2a21; }
:root[data-theme="dark"] .kind.k-重要事 { background: #331f1f; }

/* ============================ 纪念日 ============================ */

.anni-grid { display: grid; gap: 12px; grid-template-columns: 1fr; margin-top: 14px; }
@media (min-width: 640px) { .anni-grid { grid-template-columns: 1fr 1fr; } }
.anni-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-l);
  padding: 16px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.anni-card.soon { border-color: var(--accent); }
.anni-name { font-family: var(--serif); font-size: 17px; }
.anni-day { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.anni-num { display: flex; align-items: baseline; gap: 7px; margin-top: 10px; }
.anni-num b { font-family: var(--serif); font-size: 34px; line-height: 1; color: var(--accent-2); font-weight: 600; }
.anni-num span { font-size: 12.5px; color: var(--ink-2); }
.anni-note { font-size: 13px; color: var(--ink-2); margin-top: 8px; white-space: pre-wrap; }
.anni-sec { font-size: 12px; color: var(--ink-3); margin-top: 6px; }
.anni-ops { position: absolute; top: 8px; right: 8px; display: flex; gap: 2px; opacity: 0; transition: .16s; }
.anni-card:hover .anni-ops { opacity: 1; }

/* ============================ 空状态 ============================ */

.empty { text-align: center; padding: 44px 20px; color: var(--ink-2); }
.empty-ico { font-size: 34px; opacity: .8; }
.empty p { margin: 8px 0 14px; font-size: 14px; }

/* ============================ FAB / 快速菜单 ============================ */

.fab {
  position: fixed; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom));
  width: 54px; height: 54px; border-radius: 50%; z-index: 35;
  border: 0; background: var(--accent); color: #fff; font-size: 26px; line-height: 1;
  box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 45%, transparent);
  cursor: pointer; transition: .18s;
  display: grid; place-items: center;
}
.fab:hover { transform: scale(1.06) rotate(90deg); }
.fab.on { transform: rotate(45deg); background: var(--accent-2); }

.quickmenu {
  position: fixed; right: 20px; bottom: calc(86px + env(safe-area-inset-bottom)); z-index: 35;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-l);
  box-shadow: var(--shadow-up); padding: 6px; display: grid; gap: 2px; min-width: 190px;
  animation: pop .16s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.97); } }
.quickmenu button {
  appearance: none; border: 0; background: none; cursor: pointer; text-align: left;
  padding: 9px 12px; border-radius: var(--r-s); display: flex; gap: 10px; align-items: center; font-size: 14px;
}
.quickmenu button:hover { background: var(--accent-soft); color: var(--accent-2); }
.quickmenu b { font-size: 16px; }

/* ============================ 弹窗 ============================ */

.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal-mask { position: absolute; inset: 0; background: rgba(40, 26, 20, .42); backdrop-filter: blur(3px); }
.modal-panel {
  position: relative; width: 100%; max-width: 560px; max-height: 88vh;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-l);
  box-shadow: var(--shadow-up); display: flex; flex-direction: column;
  animation: slideup .2s ease-out;
}
@keyframes slideup { from { opacity: 0; transform: translateY(14px); } }
.modal-head { display: flex; align-items: center; padding: 15px 18px; border-bottom: 1px solid var(--line-2); }
.modal-head h3 { font-size: 16px; font-family: var(--serif); letter-spacing: .5px; }
.modal-head .icon-btn { margin-left: auto; }
.modal-body { padding: 16px 18px; overflow-y: auto; display: grid; gap: 13px; }
.modal-foot { display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line-2); }

.fld { display: grid; gap: 5px; }
.fld > span { font-size: 12.5px; color: var(--ink-2); letter-spacing: .3px; }
.fld .hint { font-size: 11.5px; color: var(--ink-3); }
.fld.two { grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; }
.grow textarea { min-height: 130px; }

.pairs { display: grid; gap: 7px; }
.pair-row { display: flex; gap: 7px; align-items: center; }
.pair-row input:first-child { flex: 0 0 32%; }
.pair-row input:last-child { flex: 1; }
.pair-del { flex: none; }

.sect-hint { font-size: 12px; color: var(--ink-3); margin-top: -6px; }

/* 设置抽屉 */
.settings-panel { max-width: 520px; }
.settings-body { display: grid; gap: 11px; }
.sec-title { font-size: 12.5px; letter-spacing: 1.2px; color: var(--ink-3); margin-top: 10px; border-bottom: 1px solid var(--line-2); padding-bottom: 5px; }
.sec-title:first-child { margin-top: 0; }
.hint { font-size: 12px; color: var(--ink-3); line-height: 1.65; }
.ver { font-size: 11.5px; color: var(--ink-3); margin-top: 8px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; transition: .14s; }
.swatch:hover { transform: scale(1.12); }
.swatch.on { border-color: var(--ink); }

/* ============================ 大图 ============================ */

.lightbox {
  position: fixed; inset: 0; z-index: 70; background: rgba(18, 12, 9, .92);
  display: grid; place-items: center; padding: 20px;
}
.lightbox img { max-width: 92vw; max-height: 78vh; border-radius: var(--r-s); box-shadow: 0 20px 60px rgba(0,0,0,.5); object-fit: contain; }
.lb-close { position: absolute; top: 14px; right: 16px; color: #fff; font-size: 24px; }
.lb-close:hover { background: rgba(255,255,255,.14); }
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 60px; border: 0; background: rgba(255,255,255,.08); color: #fff;
  font-size: 28px; cursor: pointer; border-radius: var(--r-s);
}
.lb-nav:hover { background: rgba(255,255,255,.18); }
.lb-prev { left: 10px; } .lb-next { right: 10px; }
.lb-meta { position: absolute; bottom: 20px; left: 0; right: 0; text-align: center; color: #e8ddd6; font-size: 13px; padding: 0 60px; }
.lb-meta .ops { margin-top: 8px; display: flex; gap: 8px; justify-content: center; }
.lb-meta .btn { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.2); color: #fff; box-shadow: none; }

/* ============================ Toast ============================ */

.toast-wrap { position: fixed; left: 50%; transform: translateX(-50%); bottom: 26px; z-index: 90; display: grid; gap: 8px; width: min(92vw, 420px); }
.toast {
  background: var(--ink); color: var(--bg); border-radius: 999px; padding: 9px 16px;
  font-size: 13.5px; box-shadow: var(--shadow-up); animation: toastin .2s ease-out; text-align: center;
}
.toast.err { background: var(--danger); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }
.toast.warn { background: var(--warn); color: #fff; }
@keyframes toastin { from { opacity: 0; transform: translateY(10px); } }

/* ============================ 杂项 ============================ */

[hidden] { display: none !important; }
.sk { color: var(--ink-3); font-size: 13px; padding: 12px 2px; }
mark { background: color-mix(in srgb, var(--accent) 26%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }

@media (max-width: 600px) {
  .main { padding: 16px 13px 100px; }
  .topbar-inner { padding: 10px 12px 6px; }
  .brand-avatar { width: 34px; height: 34px; font-size: 17px; }
  .brand-text h1 { font-size: 17px; }
  .brand-text p { display: none; }
  .tab { padding: 9px 11px 11px; font-size: 14px; }
  .hero-card { padding: 17px; }
  .hero-left h2 { font-size: 25px; }
  .q-card { padding: 15px 16px; border-radius: var(--r); }
  .q-text { font-size: 16.5px; }
  .view-head .btn { margin-left: 0; }
  .q-ops { opacity: .55; }
  .tl-ops, .anni-ops { opacity: .6; }
}

@media print {
  .topbar, .fab, .quickmenu, .toolbar, .q-ops, .tl-ops, .anni-ops { display: none !important; }
  body { background: #fff; }
  .q-card, .panel { box-shadow: none; break-inside: avoid; }
}

/* ============================ 图标系统（界面不使用 emoji） ============================ */

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic {
  width: 17px; height: 17px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -3px;
}
.ic-lg { width: 21px; height: 21px; }
.ic-xl { width: 34px; height: 34px; stroke-width: 1.3; }
.ic-sm { width: 14px; height: 14px; }
.ic-spin { animation: spin 1.1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.btn { display: inline-flex; align-items: center; gap: 6px; }
.btn-ai {
  background: var(--card); border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  color: var(--accent-2);
}
.btn-ai .ic { color: var(--accent); }
.btn-ai:hover { border-color: var(--accent); color: var(--accent-2); }
.grow-gap { flex: 1 1 auto; }

.tab { display: inline-flex; align-items: center; gap: 6px; }
.tab .ic { width: 15px; height: 15px; opacity: .8; }
.tab.on .ic { opacity: 1; }
@media (max-width: 520px) { .tab .ic { display: none; } }

.icon-btn .ic { stroke-width: 1.7; }
.brand-avatar .ic { width: 21px; height: 21px; color: var(--accent); }
.gate-mark { display: grid; place-items: center; margin-bottom: 4px; }
.gate-mark .ic { width: 34px; height: 34px; color: var(--accent); stroke-width: 1.3; }
.empty-ico .ic { width: 36px; height: 36px; color: var(--ink-3); stroke-width: 1.2; }
.search-ico { display: grid; place-items: center; }
.search-ico .ic { width: 15px; height: 15px; color: var(--ink-3); }
.search-clear { display: grid; place-items: center; }
.search-clear .ic { width: 16px; height: 16px; }
.q-ops .ic, .tl-ops .ic, .anni-ops .ic, .fops .ic { width: 15px; height: 15px; }
.star-badge .ic { width: 15px; height: 15px; color: #ffcf5c; }
.q-star .ic { width: 15px; height: 15px; color: var(--accent); }

/* ---- 分段筛选 ---- */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--card); }
.seg-b {
  appearance: none; border: 0; background: none; cursor: pointer;
  padding: 4px 13px; font-size: 12.5px; color: var(--ink-2);
}
.seg-b:hover { color: var(--ink); }
.seg-b.on { background: var(--accent); color: #fff; }

/* ============================ 视频 ============================ */

.pcell .play-badge {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 46px; height: 46px; border-radius: 50%;
  background: rgba(20, 12, 9, .58); color: #fff;
  display: grid; place-items: center; pointer-events: none;
  backdrop-filter: blur(2px);
}
.pcell .play-badge .ic { width: 22px; height: 22px; margin-left: 2px; stroke: none; }
.pcell .dur {
  position: absolute; right: 7px; top: 7px;
  background: rgba(20, 12, 9, .6); color: #fff;
  font-size: 11px; border-radius: 6px; padding: 1px 6px; letter-spacing: .3px;
}
.pcell .kind-corner {
  position: absolute; left: 7px; top: 7px; color: #fff; opacity: .85;
}
.pcell .kind-corner .ic { width: 15px; height: 15px; }

.video-poster-none {
  aspect-ratio: 4 / 3; display: grid; place-items: center; background: var(--bg-2); color: var(--ink-3);
}
.video-poster-none .ic { width: 30px; height: 30px; }

.lb-stage { display: grid; place-items: center; }
.lb-stage video { max-width: 92vw; max-height: 78vh; border-radius: var(--r-s); background: #000; box-shadow: 0 20px 60px rgba(0,0,0,.5); }

/* ============================ AI 分析页 ============================ */

.ai-layout { display: grid; gap: 14px; margin-top: 14px; grid-template-columns: 1fr; }
@media (min-width: 800px) { .ai-layout { grid-template-columns: 1fr 1fr; } }

.birth-view { display: grid; gap: 6px; }
.birth-big { font-family: var(--serif); font-size: 26px; letter-spacing: 1px; }
.birth-meta { font-size: 13px; color: var(--ink-2); }
.birth-lunar { margin-top: 6px; font-size: 14px; color: var(--accent-2); font-family: var(--serif); }
.lunar-pick { display: flex; align-items: center; gap: 8px; }
.lunar-pick select { width: auto; }
.lunar-pick > span { color: var(--ink-3); font-size: 13px; }
.birth-form { display: grid; gap: 11px; }
.fld-row { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 460px) { .fld-row { grid-template-columns: 1fr 1fr; } }

.astro-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.astro-cell { border: 1px solid var(--line-2); border-radius: var(--r); padding: 10px 12px; background: var(--bg); }
.astro-cell b { display: block; font-family: var(--serif); font-size: 19px; color: var(--accent-2); font-weight: 600; }
.astro-cell span { font-size: 12px; color: var(--ink-3); }

.ai-warn {
  margin-top: 12px; padding: 11px 14px; border-radius: var(--r);
  border: 1px solid color-mix(in srgb, var(--warn) 40%, var(--line));
  background: color-mix(in srgb, var(--warn) 8%, var(--card));
  color: var(--ink); font-size: 13px; display: flex; gap: 9px; align-items: flex-start;
}
.ai-warn .ic { color: var(--warn); margin-top: 2px; }
.ai-warn .btn { margin-left: auto; }

.fortune-out { display: grid; gap: 14px; margin-top: 16px; }
.f-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-l);
  box-shadow: var(--shadow); padding: 17px 19px; position: relative;
}
.f-card.is-new { border-color: var(--accent); }
.f-card-head { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; flex-wrap: wrap; }
.f-card-head h3 { font-family: var(--serif); font-size: 17px; }
.f-card-head .ic { color: var(--accent); }
.f-tag { font-size: 11.5px; color: var(--ink-2); background: var(--bg-2); border-radius: 999px; padding: 2px 9px; }
.f-overview { font-size: 15.5px; line-height: 1.9; }
.f-list { display: grid; gap: 9px; margin-top: 4px; }
.f-li { display: flex; gap: 10px; font-size: 14.5px; line-height: 1.75; }
.f-li .dot { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-top: 9px; }
.f-sub { font-size: 12.5px; color: var(--ink-3); letter-spacing: 1px; margin: 14px 0 7px; }
.f-grid2 { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 620px) { .f-grid2 { grid-template-columns: 1fr 1fr; } }
.f-item { border: 1px solid var(--line-2); border-radius: var(--r); padding: 10px 13px; background: var(--bg); }
.f-item .area { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; }
.f-item .lvl { font-size: 11px; border-radius: 6px; padding: 1px 7px; background: var(--accent-soft); color: var(--accent-2); margin-left: auto; }
.f-item .lvl.lvl-需留意 { background: color-mix(in srgb, var(--warn) 16%, var(--card)); color: var(--warn); }
.f-item .lvl.lvl-顺 { background: color-mix(in srgb, var(--ok) 14%, var(--card)); color: var(--ok); }
.f-item p { font-size: 14px; line-height: 1.75; margin-top: 5px; }
.f-caution { margin-top: 12px; font-size: 12.5px; color: var(--ink-3); display: flex; gap: 7px; }
.f-ops { display: flex; align-items: center; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.f-loading { display: grid; gap: 10px; }
.f-loading .bar { height: 4px; border-radius: 999px; background: var(--line-2); overflow: hidden; }
.f-loading .bar i { display: block; height: 100%; width: 34%; background: var(--accent); animation: slide 1.25s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(320%); } }
.f-loading p { font-size: 13.5px; color: var(--ink-2); display: flex; align-items: center; gap: 8px; }

.ai-history { display: grid; gap: 9px; }
.his-row {
  border-top: 1px solid var(--line-2); padding: 10px 2px; cursor: pointer;
  display: flex; align-items: center; gap: 10px;
}
.his-row:first-child { border-top: 0; }
.his-row .t { font-size: 14px; flex: 1; min-width: 0; }
.his-row .d { font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.his-row:hover .t { color: var(--accent-2); }
.his-row .ic { color: var(--ink-3); width: 14px; height: 14px; transition: .16s; }
.his-row.open .ic { transform: rotate(180deg); }
.his-detail { padding: 4px 2px 10px; }
.ai-privacy { display: flex; gap: 9px; margin-top: 16px; font-size: 12.5px; color: var(--ink-3); line-height: 1.7; }
.ai-privacy .ic { margin-top: 2px; color: var(--ink-3); }
.hero-birth { font-size: 13px; color: var(--ink-2); margin-top: 4px; }
.hero-birth:empty { display: none; }

/* ---- AI 设置区 ---- */
.ai-conf { display: grid; gap: 11px; }
.conf-state {
  font-size: 12.5px; color: var(--ink-2); background: var(--bg); border: 1px solid var(--line-2);
  border-radius: var(--r); padding: 8px 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.conf-state .led { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); flex: none; }
.conf-state .led.on { background: var(--ok); }
.conf-state .led.off { background: var(--warn); }
.conf-state code { font-size: 11.5px; }
.key-row { display: flex; gap: 7px; align-items: center; }
.key-row select { flex: 1; }
.key-row .icon-btn, .key-row .btn { flex: none; }
.switch-line.big { font-size: 14px; color: var(--ink); gap: 8px; }
.btn-row.center { justify-content: center; }
.fld > .hint { color: var(--ink-3); font-size: 11.5px; line-height: 1.6; }

/* ---- 草稿确认清单 ---- */
.modal-panel.wide { max-width: 660px; }
.draft-step { font-size: 12.5px; color: var(--ink-3); letter-spacing: .6px; }
.draft-src { display: grid; gap: 7px; max-height: 46vh; overflow: auto; border: 1px solid var(--line-2); border-radius: var(--r); padding: 10px 12px; }
.draft-src label { display: flex; gap: 9px; align-items: flex-start; font-size: 13.5px; cursor: pointer; }
.draft-src input { margin-top: 4px; width: 15px; height: 15px; accent-color: var(--accent); flex: none; }
.draft-src .ans { color: var(--ink-2); font-size: 12.5px; }
.draft-list { display: grid; gap: 10px; }
.draft-item { border: 1px solid var(--line); border-radius: var(--r); padding: 11px 13px; background: var(--card); }
.draft-item.off { opacity: .5; }
.draft-top { display: flex; align-items: center; gap: 9px; }
.draft-top .g { font-size: 11.5px; color: var(--accent-2); background: var(--accent-soft); border-radius: 999px; padding: 2px 9px; }
.draft-top .lb { font-size: 14px; font-weight: 600; }
.draft-top .act { font-size: 11.5px; border-radius: 6px; padding: 1px 7px; margin-left: auto; }
.draft-top .act.new { background: color-mix(in srgb, var(--ok) 14%, var(--card)); color: var(--ok); }
.draft-top .act.replace { background: color-mix(in srgb, var(--warn) 16%, var(--card)); color: var(--warn); }
.draft-val { margin-top: 8px; }
.draft-val textarea { min-height: 48px; font-size: 14px; }
.draft-old { font-size: 12.5px; color: var(--ink-3); margin-top: 6px; }
.draft-old s { color: var(--ink-3); }
.draft-ev { font-size: 12px; color: var(--ink-3); margin-top: 6px; padding-left: 8px; border-left: 2px solid var(--line); }
.draft-foot-tip { font-size: 12px; color: var(--ink-3); line-height: 1.7; }
.draft-grouped-head { display: flex; align-items: center; gap: 8px; margin-top: 4px; }

/* 窄屏微调 */
@media (max-width: 600px) {
  .view-head .btn-row { width: 100%; flex-wrap: wrap; }
  .astro-grid { grid-template-columns: 1fr 1fr; }
  .f-grid2 { grid-template-columns: 1fr; }
  .lb-nav { width: 36px; height: 50px; font-size: 22px; }
  .lb-stage video, .lb-stage img { max-height: 66vh; }
}

/* ---------------------------- 头像 ---------------------------- */

.brand-avatar { overflow: hidden; }
.brand-avatar.has-photo { background: transparent; border-color: var(--line); padding: 0; }
.brand-avatar img { width: 100%; height: 100%; object-fit: cover; object-position: center 22%; display: block; }
.hero-avatar { width: 84px; height: 84px; border-radius: 26px; overflow: hidden; margin-bottom: 10px; border: 1px solid var(--line); box-shadow: var(--shadow); }
.hero-avatar img { width: 100%; height: 100%; object-fit: cover; object-position: center 20%; display: block; }
.avatar-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.avatar-preview {
  width: 56px; height: 56px; border-radius: 18px; overflow: hidden; flex: none;
  background: var(--bg-2); border: 1px solid var(--line); display: grid; place-items: center; color: var(--ink-3);
}
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; object-position: center 20%; display: block; }
.avatar-ph { display: grid; place-items: center; }
.avatar-ph .ic { width: 24px; height: 24px; }

/* ---------------------------- 媒体小格 / 选图器 ---------------------------- */

.ov-cell { position: relative; aspect-ratio: 1; border-radius: var(--r-s); overflow: hidden; cursor: zoom-in; background: var(--bg-2); }
.ov-cell img { width: 100%; height: 100%; object-fit: cover; transition: .24s transform; }
.ov-cell:hover img { transform: scale(1.06); }
.ov-play {
  position: absolute; right: 4px; bottom: 4px;
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(20, 12, 9, .6); color: #fff; display: grid; place-items: center;
}
.ov-play .ic { width: 11px; height: 11px; stroke: none; margin-left: 1px; }
.ov-ph { display: grid; place-items: center; width: 100%; height: 100%; color: var(--ink-3); background: var(--bg-2); }
.ov-ph .ic { width: 20px; height: 20px; }
.ov-film { min-height: 56px; }

.tl-thumbs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.tl-thumb { position: relative; width: 62px; height: 62px; border-radius: var(--r-s); overflow: hidden; cursor: zoom-in; background: var(--bg-2); }
.tl-thumb img { width: 100%; height: 100%; object-fit: cover; }
.tl-thumb .pick-play { width: 18px; height: 18px; }

.pick-wrap { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 6px; max-height: 208px; overflow: auto; padding: 2px; }
.pick-cell { position: relative; aspect-ratio: 1; border-radius: var(--r-s); overflow: hidden; cursor: pointer; background: var(--bg-2); }
.pick-cell img { width: 100%; height: 100%; object-fit: cover; }
.pick-play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(20, 12, 9, .6); color: #fff; display: grid; place-items: center; pointer-events: none;
}
.pick-play .ic { width: 12px; height: 12px; stroke: none; margin-left: 1px; }

.lb-input {
  flex: 1 1 120px; min-width: 0;
  background: transparent; border: 0; border-bottom: 1px dashed var(--line);
  border-radius: 0; padding: 2px 4px; font-size: 14px; font-weight: 600;
}
.lb-input:focus { box-shadow: none; border-bottom-color: var(--accent); }

.up-t { font-weight: 500; }
.q-star { display: inline-flex; align-items: center; gap: 3px; color: var(--accent); }
.q-star .ic { width: 13px; height: 13px; color: var(--accent); }
.kind-corner { position: absolute; left: 8px; top: 8px; color: #ffcf5c; filter: drop-shadow(0 1px 2px rgba(0,0,0,.45)); }
.kind-corner .ic { width: 15px; height: 15px; }
.his-row .q-star { margin-right: 2px; }
.his-row > .ic:first-child { color: var(--accent); }
.f-ops .ic, .his-row .ic { flex: none; }
.seg-b { font: inherit; }
